2 # -*- coding: utf-8 -*-
6 from constants import TESTBED_ID, TESTBED_VERSION
7 from nepi.core import metadata
8 from nepi.core.metadata import Parallel
9 from nepi.core.attributes import Attribute
10 from nepi.util import tags, validation
11 from nepi.util.constants import ApplicationStatus as AS, \
12 FactoryCategories as FC, \
13 ATTR_NEPI_TESTBED_ENVIRONMENT_SETUP, \
14 DeploymentConfiguration as DC
22 NODEIFACE = "NodeInterface"
23 TUNIFACE = "TunInterface"
24 TAPIFACE = "TapInterface"
25 APPLICATION = "Application"
26 DEPENDENCY = "Dependency"
27 NEPIDEPENDENCY = "NepiDependency"
28 NS3DEPENDENCY = "NS3Dependency"
31 TUNFILTER = "TunFilter"
32 CLASSQUEUEFILTER = "ClassQueueFilter"
33 TOSQUEUEFILTER = "TosQueueFilter"
35 TUNFILTERS = (TUNFILTER, CLASSQUEUEFILTER, TOSQUEUEFILTER)
36 TAPFILTERS = (TUNFILTER, )
37 ALLFILTERS = (TUNFILTER, CLASSQUEUEFILTER, TOSQUEUEFILTER)
39 PL_TESTBED_ID = "planetlab"
42 ### Custom validation functions ###
43 def is_addrlist(attribute, value):
44 if not validation.is_string(attribute, value):
51 components = value.split(',')
53 for component in components:
55 addr, mask = component.split('/',1)
57 addr, mask = component, '32'
59 if mask is not None and not (mask and mask.isdigit()):
60 # No empty or nonnumeric masks
63 if not validation.is_ip4_address(attribute, addr):
64 # Address part must be ipv4
69 def is_portlist(attribute, value):
70 if not validation.is_string(attribute, value):
77 components = value.split(',')
79 for component in components:
81 pfrom, pto = component.split('-',1)
83 pfrom = pto = component
85 if not pfrom or not pto or not pfrom.isdigit() or not pto.isdigit():
86 # No empty or nonnumeric ports
92 ### Connection functions ####
94 def connect_node_iface_node(testbed_instance, node_guid, iface_guid):
95 node = testbed_instance._elements[node_guid]
96 iface = testbed_instance._elements[iface_guid]
99 def connect_node_iface_inet(testbed_instance, iface_guid, inet_guid):
100 iface = testbed_instance._elements[iface_guid]
101 iface.has_internet = True
103 def connect_tun_iface_node(testbed_instance, node_guid, iface_guid):
104 node = testbed_instance._elements[node_guid]
105 iface = testbed_instance._elements[iface_guid]
107 node.required_vsys.update(('fd_tuntap', 'vif_up', 'vif_down'))
108 node.required_packages.update(('python', 'python-crypto', 'python-setuptools', 'gcc'))
110 def connect_tun_iface_peer(proto, testbed_instance, iface_guid, peer_iface_guid):
111 iface = testbed_instance._elements[iface_guid]
112 peer_iface = testbed_instance._elements[peer_iface_guid]
113 iface.peer_iface = peer_iface
114 peer_iface.peer_iface = iface
117 peer_iface.peer_proto = \
118 peer_iface.tun_proto = proto
119 iface.tun_key = peer_iface.tun_key
121 def connect_tun_iface_filter(testbed_instance, iface_guid, filter_guid):
122 iface = testbed_instance._elements[iface_guid]
123 filt = testbed_instance._elements[filter_guid]
124 traces = testbed_instance._get_traces(filter_guid)
125 if 'dropped_stats' in traces:
126 args = filt.args if filt.args else ""
127 filt.args = ','.join(filt.args.split(',') + ["logdropped=true",])
128 iface.filter_module = filt
129 filt.iface_guid = iface_guid
130 filt.iface = weakref.ref(iface)
133 connect_tun_iface_peer(filt.peer_proto, testbed_instance, filt.iface_guid, filt.peer_guid)
135 def connect_filter_peer(proto, testbed_instance, filter_guid, peer_guid):
136 peer = testbed_instance._elements[peer_guid]
137 filt = testbed_instance._elements[filter_guid]
138 filt.peer_proto = proto
139 filt.peer_guid = peer_guid
141 connect_tun_iface_peer(filt.peer_proto, testbed_instance, filt.iface_guid, filt.peer_guid)
143 def connect_filter_filter(proto, testbed_instance, filter_guid, peer_guid):
144 peer = testbed_instance._elements[peer_guid]
145 filt = testbed_instance._elements[filter_guid]
146 filt.peer_proto = proto
147 peer.peer_proto = proto
149 peer.peer_guid = filt.iface_guid
151 filt.peer_guid = peer.iface_guid
152 if filt.iface_guid and filt.peer_guid:
153 connect_tun_iface_peer(filt.peer_proto, testbed_instance, filt.iface_guid, filt.peer_guid)
155 def crossconnect_tun_iface_peer_init(proto, testbed_instance, iface_guid, peer_iface_data):
156 iface = testbed_instance._elements[iface_guid]
157 iface.peer_iface = None
158 iface.peer_addr = peer_iface_data.get("tun_addr")
159 iface.peer_proto = peer_iface_data.get("tun_proto") or proto
160 iface.peer_port = peer_iface_data.get("tun_port")
161 iface.peer_cipher = peer_iface_data.get("tun_cipher")
162 iface.tun_key = min(iface.tun_key, peer_iface_data.get("tun_key"))
163 iface.tun_proto = proto
165 preconfigure_tuniface(testbed_instance, iface_guid)
167 def crossconnect_tun_iface_peer_compl(proto, testbed_instance, iface_guid, peer_iface_data):
168 # refresh (refreshable) attributes for second-phase
169 iface = testbed_instance._elements[iface_guid]
170 iface.peer_addr = peer_iface_data.get("tun_addr")
171 iface.peer_proto = peer_iface_data.get("tun_proto") or proto
172 iface.peer_port = peer_iface_data.get("tun_port")
173 iface.peer_cipher = peer_iface_data.get("tun_cipher")
175 postconfigure_tuniface(testbed_instance, iface_guid)
177 def crossconnect_tun_iface_peer_both(proto, testbed_instance, iface_guid, peer_iface_data):
178 crossconnect_tun_iface_peer_init(proto, testbed_instance, iface_guid, peer_iface_data)
179 crossconnect_tun_iface_peer_compl(proto, testbed_instance, iface_guid, peer_iface_data)
181 def crossconnect_filter_peer_init(proto, testbed_instance, filter_guid, peer_data):
182 filt = testbed_instance._elements[filter_guid]
183 filt.peer_proto = proto
184 crossconnect_tun_iface_peer_init(filt.peer_proto, testbed_instance, filt.iface_guid, peer_data)
186 def crossconnect_filter_peer_compl(proto, testbed_instance, filter_guid, peer_data):
187 filt = testbed_instance._elements[filter_guid]
188 filt.peer_proto = proto
189 crossconnect_tun_iface_peer_compl(filt.peer_proto, testbed_instance, filt.iface_guid, peer_data)
191 def crossconnect_filter_peer_both(proto, testbed_instance, filter_guid, peer_data):
192 crossconnect_filter_peer_init(proto, testbed_instance, iface_guid, peer_iface_data)
193 crossconnect_filter_peer_compl(proto, testbed_instance, iface_guid, peer_iface_data)
195 def connect_dep(testbed_instance, node_guid, app_guid):
196 node = testbed_instance._elements[node_guid]
197 app = testbed_instance._elements[app_guid]
201 node.required_packages.update(set(
202 app.depends.split() ))
205 if app.home_path and app.home_path not in node.pythonpath:
206 node.pythonpath.append(app.home_path)
209 for envkey, envval in app.env.iteritems():
210 envval = app._replace_paths(envval)
211 node.env[envkey].append(envval)
214 node.rpmFusion = True
216 def connect_node_netpipe(testbed_instance, node_guid, netpipe_guid):
217 node = testbed_instance._elements[node_guid]
218 netpipe = testbed_instance._elements[netpipe_guid]
220 node.required_vsys.add('ipfw-be')
221 node.required_packages.add('ipfwslice')
224 ### Creation functions ###
226 def create_node(testbed_instance, guid):
227 parameters = testbed_instance._get_parameters(guid)
229 # create element with basic attributes
230 element = testbed_instance._make_node(parameters)
232 # add constraint on number of (real) interfaces
233 # by counting connected devices
234 dev_guids = testbed_instance.get_connected(guid, "devs", "node")
235 num_open_ifaces = sum( # count True values
236 NODEIFACE == testbed_instance._get_factory_id(guid)
237 for guid in dev_guids )
238 element.min_num_external_ifaces = num_open_ifaces
240 # require vroute vsys if we have routes to set up
241 routes = testbed_instance._add_route.get(guid)
243 vsys = element.routing_method(routes,
244 testbed_instance.vsys_vnet)
245 element.required_vsys.add(vsys)
247 testbed_instance.elements[guid] = element
249 def create_nodeiface(testbed_instance, guid):
250 parameters = testbed_instance._get_parameters(guid)
251 element = testbed_instance._make_node_iface(parameters)
252 testbed_instance.elements[guid] = element
254 def create_tuniface(testbed_instance, guid):
255 parameters = testbed_instance._get_parameters(guid)
256 element = testbed_instance._make_tun_iface(parameters)
258 # Set custom addresses, if there are any already
259 # Setting this early helps set up P2P links
260 if guid in testbed_instance._add_address and not (element.address or element.netmask or element.netprefix):
261 addresses = testbed_instance._add_address[guid]
262 for address in addresses:
263 (address, netprefix, broadcast) = address
264 element.add_address(address, netprefix, broadcast)
266 testbed_instance.elements[guid] = element
268 def create_tapiface(testbed_instance, guid):
269 parameters = testbed_instance._get_parameters(guid)
270 element = testbed_instance._make_tap_iface(parameters)
272 # Set custom addresses, if there are any already
273 # Setting this early helps set up P2P links
274 if guid in testbed_instance._add_address and not (element.address or element.netmask or element.netprefix):
275 addresses = testbed_instance._add_address[guid]
276 for address in addresses:
277 (address, netprefix, broadcast) = address
278 element.add_address(address, netprefix, broadcast)
280 testbed_instance.elements[guid] = element
282 def create_tunfilter(testbed_instance, guid):
283 parameters = testbed_instance._get_parameters(guid)
284 element = testbed_instance._make_tun_filter(parameters)
285 testbed_instance.elements[guid] = element
287 def create_classqueuefilter(testbed_instance, guid):
288 parameters = testbed_instance._get_parameters(guid)
289 element = testbed_instance._make_class_queue_filter(parameters)
290 testbed_instance.elements[guid] = element
292 def create_tosqueuefilter(testbed_instance, guid):
293 parameters = testbed_instance._get_parameters(guid)
294 element = testbed_instance._make_tos_queue_filter(parameters)
295 testbed_instance.elements[guid] = element
297 def create_application(testbed_instance, guid):
298 parameters = testbed_instance._get_parameters(guid)
299 element = testbed_instance._make_application(parameters)
301 # Just inject configuration stuff
302 element.home_path = "nepi-app-%s" % (guid,)
304 testbed_instance.elements[guid] = element
306 def create_dependency(testbed_instance, guid):
307 parameters = testbed_instance._get_parameters(guid)
308 element = testbed_instance._make_dependency(parameters)
310 # Just inject configuration stuff
311 element.home_path = "nepi-dep-%s" % (guid,)
313 testbed_instance.elements[guid] = element
315 def create_nepi_dependency(testbed_instance, guid):
316 parameters = testbed_instance._get_parameters(guid)
317 element = testbed_instance._make_nepi_dependency(parameters)
319 # Just inject configuration stuff
320 element.home_path = "nepi-nepi-%s" % (guid,)
322 testbed_instance.elements[guid] = element
324 def create_ns3_dependency(testbed_instance, guid):
325 parameters = testbed_instance._get_parameters(guid)
326 element = testbed_instance._make_ns3_dependency(parameters)
328 # Just inject configuration stuff
329 element.home_path = "nepi-ns3-%s" % (guid,)
331 testbed_instance.elements[guid] = element
333 def create_internet(testbed_instance, guid):
334 parameters = testbed_instance._get_parameters(guid)
335 element = testbed_instance._make_internet(parameters)
336 testbed_instance.elements[guid] = element
338 def create_netpipe(testbed_instance, guid):
339 parameters = testbed_instance._get_parameters(guid)
340 element = testbed_instance._make_netpipe(parameters)
341 testbed_instance.elements[guid] = element
343 ### Start/Stop functions ###
345 def start_application(testbed_instance, guid):
346 parameters = testbed_instance._get_parameters(guid)
347 traces = testbed_instance._get_traces(guid)
348 app = testbed_instance.elements[guid]
350 app.stdout = "stdout" in traces
351 app.stderr = "stderr" in traces
352 app.buildlog = "buildlog" in traces
353 app.outout = "output" in traces
357 def stop_application(testbed_instance, guid):
358 app = testbed_instance.elements[guid]
361 ### Status functions ###
363 def status_application(testbed_instance, guid):
364 if guid not in testbed_instance.elements.keys():
365 return AS.STATUS_NOT_STARTED
367 app = testbed_instance.elements[guid]
370 ### Configure functions ###
372 def configure_nodeiface(testbed_instance, guid):
373 element = testbed_instance._elements[guid]
375 # Cannot explicitly configure addresses
376 if guid in testbed_instance._add_address:
377 raise ValueError, "Cannot explicitly set address of public PlanetLab interface"
380 node_guid = testbed_instance.get_connected(guid, "node", "devs")[0]
381 dev_guids = testbed_instance.get_connected(node_guid, "node", "devs")
382 siblings = [ self._element[dev_guid]
383 for dev_guid in dev_guids
384 if dev_guid != guid ]
386 # Fetch address from PLC api
387 element.pick_iface(siblings)
389 # Do some validations
392 def preconfigure_tuniface(testbed_instance, guid):
393 element = testbed_instance._elements[guid]
395 # Set custom addresses if any, and if not set already
396 if guid in testbed_instance._add_address and not (element.address or element.netmask or element.netprefix):
397 addresses = testbed_instance._add_address[guid]
398 for address in addresses:
399 (address, netprefix, broadcast) = address
400 element.add_address(address, netprefix, broadcast)
402 # Link to external interface, if any
403 for iface in testbed_instance._elements.itervalues():
404 if isinstance(iface, testbed_instance._interfaces.NodeIface) and iface.node is element.node and iface.has_internet:
405 element.external_iface = iface
408 # Set standard TUN attributes
409 if (not element.tun_addr or not element.tun_port) and element.external_iface:
410 element.tun_addr = element.external_iface.address
411 element.tun_port = testbed_instance.tapPortBase + int(guid)
414 traces = testbed_instance._get_traces(guid)
415 for capmode in ('pcap', 'packets'):
416 if capmode in traces:
417 element.capture = capmode
420 element.capture = False
422 # Do some validations
426 element.prepare('tun-%s' % (guid,))
428 def postconfigure_tuniface(testbed_instance, guid):
429 element = testbed_instance._elements[guid]
434 def prestart_tuniface(testbed_instance, guid):
435 element = testbed_instance._elements[guid]
440 def configure_node(testbed_instance, guid):
441 node = testbed_instance._elements[guid]
443 # Just inject configuration stuff
444 node.home_path = "nepi-node-%s" % (guid,)
445 node.ident_path = testbed_instance.sliceSSHKey
446 node.slicename = testbed_instance.slicename
448 # Do some validations
451 # this will be done in parallel in all nodes
452 # this call only spawns the process
453 node.install_dependencies()
455 def configure_node_routes(testbed_instance, guid):
456 node = testbed_instance._elements[guid]
457 routes = testbed_instance._add_route.get(guid)
461 for dev_guid in testbed_instance.get_connected(guid, "devs", "node")
462 for dev in ( testbed_instance._elements.get(dev_guid) ,)
463 if dev and isinstance(dev, testbed_instance._interfaces.TunIface) ]
465 vsys = testbed_instance.vsys_vnet
467 node.configure_routes(routes, devs, vsys)
469 def configure_application(testbed_instance, guid):
470 app = testbed_instance._elements[guid]
472 # Do some validations
475 # Wait for dependencies
476 app.node.wait_dependencies()
481 def configure_dependency(testbed_instance, guid):
482 dep = testbed_instance._elements[guid]
484 # Do some validations
487 # Wait for dependencies
488 dep.node.wait_dependencies()
493 def configure_netpipe(testbed_instance, guid):
494 netpipe = testbed_instance._elements[guid]
496 # Do some validations
499 # Wait for dependencies
500 netpipe.node.wait_dependencies()
505 ### Factory information ###
507 connector_types = dict({
509 "help": "Connector from node to applications",
515 "help": "Connector from node to network interfaces",
521 "help": "Connector from node to application dependencies "
522 "(packages and applications that need to be installed)",
528 "help": "Connector from network interfaces to the internet",
534 "help": "Connector to a Node",
540 "help": "Connector to a NetPipe",
547 "help": "ip-ip tunneling over TCP link",
553 "help": "ip-ip tunneling over UDP datagrams",
559 "help": "IP or Ethernet tunneling using the GRE protocol",
565 "help": "TUN device file descriptor provider",
571 "help": "TUN device file descriptor slot",
580 "from": (TESTBED_ID, NODE, "devs"),
581 "to": (TESTBED_ID, NODEIFACE, "node"),
582 "init_code": connect_node_iface_node,
586 "from": (TESTBED_ID, NODE, "devs"),
587 "to": (TESTBED_ID, TUNIFACE, "node"),
588 "init_code": connect_tun_iface_node,
592 "from": (TESTBED_ID, NODE, "devs"),
593 "to": (TESTBED_ID, TAPIFACE, "node"),
594 "init_code": connect_tun_iface_node,
598 "from": (TESTBED_ID, NODEIFACE, "inet"),
599 "to": (TESTBED_ID, INTERNET, "devs"),
600 "init_code": connect_node_iface_inet,
604 "from": (TESTBED_ID, NODE, "apps"),
605 "to": (TESTBED_ID, APPLICATION, "node"),
606 "init_code": connect_dep,
610 "from": (TESTBED_ID, NODE, "deps"),
611 "to": (TESTBED_ID, DEPENDENCY, "node"),
612 "init_code": connect_dep,
616 "from": (TESTBED_ID, NODE, "deps"),
617 "to": (TESTBED_ID, NEPIDEPENDENCY, "node"),
618 "init_code": connect_dep,
622 "from": (TESTBED_ID, NODE, "deps"),
623 "to": (TESTBED_ID, NS3DEPENDENCY, "node"),
624 "init_code": connect_dep,
628 "from": (TESTBED_ID, NODE, "pipes"),
629 "to": (TESTBED_ID, NETPIPE, "node"),
630 "init_code": connect_node_netpipe,
634 "from": (TESTBED_ID, TUNIFACE, "tcp"),
635 "to": (TESTBED_ID, TUNIFACE, "tcp"),
636 "init_code": functools.partial(connect_tun_iface_peer,"tcp"),
640 "from": (TESTBED_ID, TUNIFACE, "udp"),
641 "to": (TESTBED_ID, TUNIFACE, "udp"),
642 "init_code": functools.partial(connect_tun_iface_peer,"udp"),
646 "from": (TESTBED_ID, TUNIFACE, "gre"),
647 "to": (TESTBED_ID, TUNIFACE, "gre"),
648 "init_code": functools.partial(connect_tun_iface_peer,"gre"),
652 "from": (TESTBED_ID, TUNIFACE, "fd->"),
653 "to": (TESTBED_ID, TUNFILTERS, "->fd"),
654 "init_code": connect_tun_iface_filter,
658 "from": (TESTBED_ID, TUNFILTERS, "tcp"),
659 "to": (TESTBED_ID, TUNIFACE, "tcp"),
660 "init_code": functools.partial(connect_filter_peer,"tcp"),
664 "from": (TESTBED_ID, TUNFILTERS, "udp"),
665 "to": (TESTBED_ID, TUNIFACE, "udp"),
666 "init_code": functools.partial(connect_filter_peer,"udp"),
670 "from": (TESTBED_ID, TAPIFACE, "tcp"),
671 "to": (TESTBED_ID, TAPIFACE, "tcp"),
672 "init_code": functools.partial(connect_tun_iface_peer,"tcp"),
676 "from": (TESTBED_ID, TAPIFACE, "udp"),
677 "to": (TESTBED_ID, TAPIFACE, "udp"),
678 "init_code": functools.partial(connect_tun_iface_peer,"udp"),
682 "from": (TESTBED_ID, TAPIFACE, "gre"),
683 "to": (TESTBED_ID, TAPIFACE, "gre"),
684 "init_code": functools.partial(connect_tun_iface_peer,"gre"),
688 "from": (TESTBED_ID, TAPIFACE, "fd->"),
689 "to": (TESTBED_ID, TAPFILTERS, "->fd"),
690 "init_code": connect_tun_iface_filter,
694 "from": (TESTBED_ID, TAPFILTERS, "tcp"),
695 "to": (TESTBED_ID, TAPIFACE, "tcp"),
696 "init_code": functools.partial(connect_filter_peer,"tcp"),
700 "from": (TESTBED_ID, TAPFILTERS, "udp"),
701 "to": (TESTBED_ID, TAPIFACE, "udp"),
702 "init_code": functools.partial(connect_filter_peer,"udp"),
706 "from": (TESTBED_ID, TUNFILTERS, "tcp"),
707 "to": (TESTBED_ID, TUNFILTERS, "tcp"),
708 "init_code": functools.partial(connect_filter_filter,"tcp"),
712 "from": (TESTBED_ID, TUNFILTERS, "udp"),
713 "to": (TESTBED_ID, TUNFILTERS, "udp"),
714 "init_code": functools.partial(connect_filter_filter,"udp"),
718 "from": (TESTBED_ID, TAPFILTERS, "tcp"),
719 "to": (TESTBED_ID, TAPFILTERS, "tcp"),
720 "init_code": functools.partial(connect_filter_filter,"tcp"),
724 "from": (TESTBED_ID, TAPFILTERS, "udp"),
725 "to": (TESTBED_ID, TAPFILTERS, "udp"),
726 "init_code": functools.partial(connect_filter_filter,"udp"),
730 "from": (TESTBED_ID, TUNIFACE, "tcp"),
731 "to": (None, None, "tcp"),
732 "init_code": functools.partial(crossconnect_tun_iface_peer_init,"tcp"),
733 "compl_code": functools.partial(crossconnect_tun_iface_peer_compl,"tcp"),
737 "from": (TESTBED_ID, TUNIFACE, "udp"),
738 "to": (None, None, "udp"),
739 "init_code": functools.partial(crossconnect_tun_iface_peer_init,"udp"),
740 "compl_code": functools.partial(crossconnect_tun_iface_peer_compl,"udp"),
744 "from": (TESTBED_ID, TUNIFACE, "fd->"),
745 "to": (None, None, "->fd"),
746 "compl_code": functools.partial(crossconnect_tun_iface_peer_both,"fd"),
750 "from": (TESTBED_ID, TUNIFACE, "gre"),
751 "to": (None, None, "gre"),
752 "compl_code": functools.partial(crossconnect_tun_iface_peer_both,"gre"),
756 "from": (TESTBED_ID, TAPIFACE, "tcp"),
757 "to": (None, None, "tcp"),
758 "init_code": functools.partial(crossconnect_tun_iface_peer_init,"tcp"),
759 "compl_code": functools.partial(crossconnect_tun_iface_peer_compl,"tcp"),
763 "from": (TESTBED_ID, TAPIFACE, "udp"),
764 "to": (None, None, "udp"),
765 "init_code": functools.partial(crossconnect_tun_iface_peer_init,"udp"),
766 "compl_code": functools.partial(crossconnect_tun_iface_peer_compl,"udp"),
770 "from": (TESTBED_ID, TAPIFACE, "fd->"),
771 "to": (None, None, "->fd"),
772 "compl_code": functools.partial(crossconnect_tun_iface_peer_both,"fd"),
775 # EGRE is an extension of PlanetLab, so we can't connect externally
776 # if the other testbed isn't another PlanetLab
778 "from": (TESTBED_ID, TAPIFACE, "gre"),
779 "to": (TESTBED_ID, None, "gre"),
780 "compl_code": functools.partial(crossconnect_tun_iface_peer_both,"gre"),
784 "from": (TESTBED_ID, ALLFILTERS, "tcp"),
785 "to": (None, None, "tcp"),
786 "init_code": functools.partial(crossconnect_filter_peer_init,"tcp"),
787 "compl_code": functools.partial(crossconnect_filter_peer_compl,"tcp"),
791 "from": (TESTBED_ID, ALLFILTERS, "udp"),
792 "to": (None, None, "udp"),
793 "init_code": functools.partial(crossconnect_filter_peer_init,"udp"),
794 "compl_code": functools.partial(crossconnect_filter_peer_compl,"udp"),
800 "forward_X11": dict({
801 "name": "forward_X11",
802 "help": "Forward x11 from main namespace to the node",
803 "type": Attribute.BOOL,
805 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
806 "validation_function": validation.is_bool,
810 "help": "Constrain hostname during resource discovery. May use wildcards.",
811 "type": Attribute.STRING,
812 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
813 "validation_function": validation.is_string,
817 "help": "Constrain location (city) during resource discovery. May use wildcards.",
818 "type": Attribute.STRING,
819 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
820 "validation_function": validation.is_string,
824 "help": "Constrain location (country) during resource discovery. May use wildcards.",
825 "type": Attribute.STRING,
826 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
827 "validation_function": validation.is_string,
831 "help": "Constrain location (region) during resource discovery. May use wildcards.",
832 "type": Attribute.STRING,
833 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
834 "validation_function": validation.is_string,
836 "architecture": dict({
837 "name": "architecture",
838 "help": "Constrain architexture during resource discovery.",
839 "type": Attribute.ENUM,
840 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
841 "allowed": ["x86_64",
843 "validation_function": validation.is_enum,
845 "operating_system": dict({
846 "name": "operatingSystem",
847 "help": "Constrain operating system during resource discovery.",
848 "type": Attribute.ENUM,
849 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
855 "validation_function": validation.is_enum,
859 "help": "Constrain the PlanetLab site this node should reside on.",
860 "type": Attribute.ENUM,
861 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
865 "validation_function": validation.is_enum,
867 "min_reliability": dict({
868 "name": "minReliability",
869 "help": "Constrain reliability while picking PlanetLab nodes. Specifies a lower acceptable bound.",
870 "type": Attribute.DOUBLE,
872 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
873 "validation_function": validation.is_number,
875 "max_reliability": dict({
876 "name": "maxReliability",
877 "help": "Constrain reliability while picking PlanetLab nodes. Specifies an upper acceptable bound.",
878 "type": Attribute.DOUBLE,
880 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
881 "validation_function": validation.is_number,
883 "min_bandwidth": dict({
884 "name": "minBandwidth",
885 "help": "Constrain available bandwidth while picking PlanetLab nodes. Specifies a lower acceptable bound.",
886 "type": Attribute.DOUBLE,
888 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
889 "validation_function": validation.is_number,
891 "max_bandwidth": dict({
892 "name": "maxBandwidth",
893 "help": "Constrain available bandwidth while picking PlanetLab nodes. Specifies an upper acceptable bound.",
894 "type": Attribute.DOUBLE,
896 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
897 "validation_function": validation.is_number,
901 "help": "Constrain node load average while picking PlanetLab nodes. Specifies a lower acceptable bound.",
902 "type": Attribute.DOUBLE,
904 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
905 "validation_function": validation.is_number,
909 "help": "Constrain node load average while picking PlanetLab nodes. Specifies an upper acceptable bound.",
910 "type": Attribute.DOUBLE,
912 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
913 "validation_function": validation.is_number,
917 "help": "Constrain available cpu time while picking PlanetLab nodes. Specifies a lower acceptable bound.",
918 "type": Attribute.DOUBLE,
920 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
921 "validation_function": validation.is_number,
925 "help": "Constrain available cpu time while picking PlanetLab nodes. Specifies an upper acceptable bound.",
926 "type": Attribute.DOUBLE,
928 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
929 "validation_function": validation.is_number,
935 "type": Attribute.BOOL,
937 "validation_function": validation.is_bool
941 "help": "This is the primary interface for the attached node",
942 "type": Attribute.BOOL,
944 "validation_function": validation.is_bool
948 "help": "Device name",
949 "type": Attribute.STRING,
950 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
951 "validation_function": validation.is_string
955 "help": "Maximum transmition unit for device",
956 "type": Attribute.INTEGER,
958 "validation_function": validation.is_integer_range(0,1500)
962 "help": "Network mask for the device (eg: 24 for /24 network)",
963 "type": Attribute.INTEGER,
964 "validation_function": validation.is_integer_range(8,24)
968 "help": "Enable SNAT (source NAT to the internet) no this device",
969 "type": Attribute.BOOL,
971 "validation_function": validation.is_bool
975 "help": "Enable multicast forwarding on this device. "
976 "Note that you still need a multicast routing daemon "
978 "type": Attribute.BOOL,
980 "validation_function": validation.is_bool
982 "pointopoint": dict({
983 "name": "pointopoint",
984 "help": "If the interface is a P2P link, the remote endpoint's IP "
985 "should be set on this attribute.",
986 "type": Attribute.STRING,
987 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
988 "validation_function": validation.is_string
992 "help": "Emulated transmission speed (in kbytes per second)",
993 "type": Attribute.INTEGER,
994 "range" : (1,10*2**20),
995 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
996 "validation_function": validation.is_integer
999 "name": "txqueuelen",
1000 "help": "Transmission queue length (in packets)",
1001 "type": Attribute.INTEGER,
1003 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1004 "range" : (1,10000),
1005 "validation_function": validation.is_integer
1010 "help": "Command line string",
1011 "type": Attribute.STRING,
1012 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1013 "validation_function": validation.is_string
1017 "help": "Run with root privileges",
1018 "type": Attribute.BOOL,
1019 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1021 "validation_function": validation.is_bool
1025 "help": "Standard input",
1026 "type": Attribute.STRING,
1027 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1028 "validation_function": validation.is_string
1033 "help": "Space-separated list of packages required to run the application",
1034 "type": Attribute.STRING,
1035 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1036 "validation_function": validation.is_string
1038 "build-depends": dict({
1039 "name": "buildDepends",
1040 "help": "Space-separated list of packages required to build the application",
1041 "type": Attribute.STRING,
1042 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1043 "validation_function": validation.is_string
1045 "rpm-fusion": dict({
1046 "name": "rpmFusion",
1047 "help": "True if required packages can be found in the RpmFusion repository",
1048 "type": Attribute.BOOL,
1049 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1051 "validation_function": validation.is_bool
1055 "help": "Space-separated list of regular files to be deployed in the working path prior to building. "
1056 "Archives won't be expanded automatically.",
1057 "type": Attribute.STRING,
1058 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1059 "validation_function": validation.is_string
1063 "help": "Build commands to execute after deploying the sources. "
1064 "Sources will be in the ${SOURCES} folder. "
1065 "Example: tar xzf ${SOURCES}/my-app.tgz && cd my-app && ./configure && make && make clean.\n"
1066 "Try to make the commands return with a nonzero exit code on error.\n"
1067 "Also, do not install any programs here, use the 'install' attribute. This will "
1068 "help keep the built files constrained to the build folder (which may "
1069 "not be the home folder), and will result in faster deployment. Also, "
1070 "make sure to clean up temporary files, to reduce bandwidth usage between "
1071 "nodes when transferring built packages.",
1072 "type": Attribute.STRING,
1073 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1074 "validation_function": validation.is_string
1078 "help": "Commands to transfer built files to their final destinations. "
1079 "Sources will be in the initial working folder, and a special "
1080 "tag ${SOURCES} can be used to reference the experiment's "
1081 "home folder (where the application commands will run).\n"
1082 "ALL sources and targets needed for execution must be copied there, "
1083 "if building has been enabled.\n"
1084 "That is, 'slave' nodes will not automatically get any source files. "
1085 "'slave' nodes don't get build dependencies either, so if you need "
1086 "make and other tools to install, be sure to provide them as "
1087 "actual dependencies instead.",
1088 "type": Attribute.STRING,
1089 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1090 "validation_function": validation.is_string
1093 "netpipe_mode": dict({
1095 "help": "Link mode:\n"
1096 " * SERVER: applies to incoming connections\n"
1097 " * CLIENT: applies to outgoing connections\n"
1098 " * SERVICE: applies to both",
1099 "type": Attribute.ENUM,
1100 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1101 "allowed": ["SERVER",
1104 "validation_function": validation.is_enum,
1108 "help": "Port list or range. Eg: '22', '22,23,27', '20-2000'",
1109 "type": Attribute.STRING,
1110 "validation_function": is_portlist,
1114 "help": "Address list or range. Eg: '127.0.0.1', '127.0.0.1,127.0.1.1', '127.0.0.1/8'",
1115 "type": Attribute.STRING,
1116 "validation_function": is_addrlist,
1120 "help": "Inbound bandwidth limit (in Mbit/s)",
1121 "type": Attribute.DOUBLE,
1122 "validation_function": validation.is_number,
1126 "help": "Outbound bandwidth limit (in Mbit/s)",
1127 "type": Attribute.DOUBLE,
1128 "validation_function": validation.is_number,
1132 "help": "Inbound packet loss rate (0 = no loss, 1 = 100% loss)",
1133 "type": Attribute.DOUBLE,
1134 "validation_function": validation.is_number,
1138 "help": "Outbound packet loss rate (0 = no loss, 1 = 100% loss)",
1139 "type": Attribute.DOUBLE,
1140 "validation_function": validation.is_number,
1144 "help": "Inbound packet delay (in milliseconds)",
1145 "type": Attribute.INTEGER,
1147 "validation_function": validation.is_integer,
1151 "help": "Outbound packet delay (in milliseconds)",
1152 "type": Attribute.INTEGER,
1154 "validation_function": validation.is_integer,
1158 "help": "Path to a .c or .py source for a filter module, or a binary .so",
1159 "type": Attribute.STRING,
1160 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1161 "validation_function": validation.is_string
1165 "help": "Module arguments - comma-separated list of name=value pairs",
1166 "type": Attribute.STRING,
1167 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1168 "validation_function": validation.is_string
1175 "help": "Standard output stream"
1179 "help": "Application standard error",
1183 "help": "Output of the build process",
1186 "netpipe_stats": dict({
1187 "name": "netpipeStats",
1188 "help": "Information about rule match counters, packets dropped, etc.",
1193 "help": "Detailled log of all packets going through the interface",
1197 "help": "PCAP trace of all packets going through the interface",
1201 "help": "Extra output trace for applications. When activated this trace can be referenced with wildcard a reference from an Application command line. Ex: command: 'tcpdump -w {#[elemet-label].trace[trace-id].[name|path]#}' ",
1203 "dropped_stats": dict({
1204 "name": "dropped_stats",
1205 "help": "Information on dropped packets on a filer or queue associated to a network interface",
1209 create_order = [ INTERNET, NODE, NODEIFACE, CLASSQUEUEFILTER, TOSQUEUEFILTER, TUNFILTER, TAPIFACE, TUNIFACE, NETPIPE, NEPIDEPENDENCY, NS3DEPENDENCY, DEPENDENCY, APPLICATION ]
1211 configure_order = [ INTERNET, Parallel(NODE), NODEIFACE, Parallel(TAPIFACE), Parallel(TUNIFACE), NETPIPE, Parallel(NEPIDEPENDENCY), Parallel(NS3DEPENDENCY), Parallel(DEPENDENCY), Parallel(APPLICATION) ]
1213 # Start (and prestart) node after ifaces, because the node needs the ifaces in order to set up routes
1214 start_order = [ INTERNET, NODEIFACE, Parallel(TAPIFACE), Parallel(TUNIFACE), Parallel(NODE), NETPIPE, Parallel(NEPIDEPENDENCY), Parallel(NS3DEPENDENCY), Parallel(DEPENDENCY), Parallel(APPLICATION) ]
1217 shutdown_order = [ Parallel(APPLICATION), Parallel(TAPIFACE), Parallel(TUNIFACE), Parallel(NETPIPE), Parallel(NEPIDEPENDENCY), Parallel(NS3DEPENDENCY), Parallel(DEPENDENCY), NODEIFACE, Parallel(NODE) ]
1219 factories_info = dict({
1221 "help": "Virtualized Node (V-Server style)",
1222 "category": FC.CATEGORY_NODES,
1223 "create_function": create_node,
1224 "preconfigure_function": configure_node,
1225 "prestart_function": configure_node_routes,
1237 # NEPI-in-NEPI attributes
1238 ATTR_NEPI_TESTBED_ENVIRONMENT_SETUP,
1240 "connector_types": ["devs", "apps", "pipes", "deps"],
1241 "tags": [tags.NODE, tags.ALLOW_ROUTES],
1244 "help": "External network interface - they cannot be brought up or down, and they MUST be connected to the internet.",
1245 "category": FC.CATEGORY_DEVICES,
1246 "create_function": create_nodeiface,
1247 "preconfigure_function": configure_nodeiface,
1248 "box_attributes": [ ],
1249 "connector_types": ["node", "inet"],
1250 "tags": [tags.INTERFACE, tags.HAS_ADDRESSES],
1253 "help": "Virtual TUN network interface (layer 3)",
1254 "category": FC.CATEGORY_DEVICES,
1255 "create_function": create_tuniface,
1256 "preconfigure_function": preconfigure_tuniface,
1257 "configure_function": postconfigure_tuniface,
1258 "prestart_function": prestart_tuniface,
1260 "up", "if_name", "mtu", "snat", "pointopoint", "multicast", "bwlimit",
1262 "tun_proto", "tun_addr", "tun_port", "tun_key", "tun_cipher",
1264 "traces": ["packets", "pcap"],
1265 "connector_types": ["node","udp","tcp","fd->","gre"],
1266 "tags": [tags.INTERFACE, tags.ALLOW_ADDRESSES],
1269 "help": "Virtual TAP network interface (layer 2)",
1270 "category": FC.CATEGORY_DEVICES,
1271 "create_function": create_tapiface,
1272 "preconfigure_function": preconfigure_tuniface,
1273 "configure_function": postconfigure_tuniface,
1274 "prestart_function": prestart_tuniface,
1276 "up", "if_name", "mtu", "snat", "pointopoint", "multicast", "bwlimit",
1278 "tun_proto", "tun_addr", "tun_port", "tun_key", "tun_cipher",
1280 "traces": ["packets", "pcap"],
1281 "connector_types": ["node","udp","tcp","fd->","gre"],
1282 "tags": [tags.INTERFACE, tags.ALLOW_ADDRESSES],
1285 "help": "TUN/TAP stream filter\n\n"
1286 "If specified, it should be either a .py or .so module. "
1287 "It will be loaded, and all incoming and outgoing packets "
1288 "will be routed through it. The filter will not be responsible "
1289 "for buffering, packet queueing is performed in tun_connect "
1290 "already, so it should not concern itself with it. It should "
1291 "not, however, block in one direction if the other is congested.\n"
1293 "Modules are expected to have the following methods:\n"
1295 "\t\tIf arguments are given, this method will be called with the\n"
1296 "\t\tgiven arguments (as keyword args in python modules, or a single\n"
1297 "\taccept_packet(packet, direction):\n"
1298 "\t\tDecide whether to drop the packet. Direction is 0 for packets "
1299 "coming from the local side to the remote, and 1 is for packets "
1300 "coming from the remote side to the local. Return a boolean, "
1301 "true if the packet is not to be dropped.\n"
1302 "\tfilter_init():\n"
1303 "\t\tInitializes a filtering pipe (filter_run). It should "
1304 "return two file descriptors to use as a bidirectional "
1305 "pipe: local and remote. 'local' is where packets from the "
1306 "local side will be written to. After filtering, those packets "
1307 "should be written to 'remote', where tun_connect will read "
1308 "from, and it will forward them to the remote peer. "
1309 "Packets from the remote peer will be written to 'remote', "
1310 "where the filter is expected to read from, and eventually "
1311 "forward them to the local side. If the file descriptors are "
1312 "not nonblocking, they will be set to nonblocking. So it's "
1313 "better to set them from the start like that.\n"
1314 "\tfilter_run(local, remote):\n"
1315 "\t\tIf filter_init is provided, it will be called repeatedly, "
1316 "in a separate thread until the process is killed. It should "
1317 "sleep at most for a second.\n"
1318 "\tfilter_close(local, remote):\n"
1319 "\t\tCalled then the process is killed, if filter_init was provided. "
1320 "It should, among other things, close the file descriptors.\n"
1322 "Python modules are expected to return a tuple in filter_init, "
1323 "either of file descriptors or file objects, while native ones "
1324 "will receive two int*.\n"
1326 "Python modules can additionally contain a custom queue class "
1327 "that will replace the FIFO used by default. The class should "
1328 "be named 'queueclass' and contain an interface compatible with "
1329 "collections.deque. That is, indexing (especiall for q[0]), "
1330 "bool(q), popleft, appendleft, pop (right), append (right), "
1331 "len(q) and clear.",
1332 "category": FC.CATEGORY_CHANNELS,
1333 "create_function": create_tunfilter,
1336 "tun_proto", "tun_addr", "tun_port", "tun_key", "tun_cipher",
1338 "connector_types": ["->fd","udp","tcp"],
1340 CLASSQUEUEFILTER : dict({
1341 "help": "TUN classfull queue, uses a separate queue for each user-definable class.\n\n"
1342 "It takes two arguments, both of which have sensible defaults:\n"
1343 "\tsize: the base size of each class' queue\n"
1344 "\tclasses: the class definitions, which follow the following syntax:\n"
1345 '\t <CLASSLIST> ::= <CLASS> ":" CLASSLIST\n'
1347 '\t <CLASS> ::= <PROTOLIST> "*" <PRIORITYSPEC>\n'
1348 '\t | <DFLTCLASS>\n'
1349 '\t <DFLTCLASS> ::= "*" <PRIORITYSPEC>\n'
1350 '\t <PROTOLIST> ::= <PROTO> "." <PROTOLIST>\n'
1352 '\t <PROTO> ::= <NAME> | <NUMBER>\n'
1353 '\t <NAME> ::= --see http://en.wikipedia.org/wiki/List_of_IP_protocol_numbers --\n'
1354 '\t --only in lowercase, with special characters removed--\n'
1355 '\t --or see below--\n'
1356 '\t <NUMBER> ::= [0-9]+\n'
1357 '\t <PRIORITYSPEC> ::= <THOUGHPUT> [ "#" <SIZE> ] [ "p" <PRIORITY> ]\n'
1358 '\t <THOUGHPUT> ::= NUMBER -- default 1\n'
1359 '\t <PRIORITY> ::= NUMBER -- default 0\n'
1360 '\t <SIZE> ::= NUMBER -- default 1\n'
1362 "Size, thoughput and priority are all relative terms. "
1363 "Sizes are multipliers for the size argument, thoughput "
1364 "is applied relative to other classes and the same with "
1366 "category": FC.CATEGORY_CHANNELS,
1367 "create_function": create_classqueuefilter,
1370 "tun_proto", "tun_addr", "tun_port", "tun_key", "tun_cipher",
1372 "connector_types": ["->fd","udp","tcp"],
1373 "traces": ["dropped_stats"],
1375 TOSQUEUEFILTER : dict({
1376 "help": "TUN classfull queue that classifies according to the TOS (RFC 791) IP field.\n\n"
1377 "It takes a size argument that specifies the size of each class. As TOS is a "
1378 "subset of DiffServ, this queue half-implements DiffServ.",
1379 "category": FC.CATEGORY_CHANNELS,
1380 "create_function": create_tosqueuefilter,
1383 "tun_proto", "tun_addr", "tun_port", "tun_key", "tun_cipher",
1385 "connector_types": ["->fd","udp","tcp"],
1389 "help": "Generic executable command line application",
1390 "category": FC.CATEGORY_APPLICATIONS,
1391 "create_function": create_application,
1392 "start_function": start_application,
1393 "status_function": status_application,
1394 "stop_function": stop_application,
1395 "configure_function": configure_application,
1396 "box_attributes": ["command", "sudo", "stdin",
1397 "depends", "build-depends", "build", "install",
1398 "sources", "rpm-fusion" ],
1399 "connector_types": ["node"],
1400 "traces": ["stdout", "stderr", "buildlog", "output"],
1401 "tags": [tags.APPLICATION],
1404 "help": "Requirement for package or application to be installed on some node",
1405 "category": FC.CATEGORY_APPLICATIONS,
1406 "create_function": create_dependency,
1407 "preconfigure_function": configure_dependency,
1408 "box_attributes": ["depends", "build-depends", "build", "install",
1409 "sources", "rpm-fusion" ],
1410 "connector_types": ["node"],
1411 "traces": ["buildlog"],
1413 NEPIDEPENDENCY: dict({
1414 "help": "Requirement for NEPI inside NEPI - required to run testbed instances inside a node",
1415 "category": FC.CATEGORY_APPLICATIONS,
1416 "create_function": create_nepi_dependency,
1417 "preconfigure_function": configure_dependency,
1418 "box_attributes": [],
1419 "connector_types": ["node"],
1420 "traces": ["buildlog"],
1422 NS3DEPENDENCY: dict({
1423 "help": "Requirement for NS3 inside NEPI - required to run NS3 testbed instances inside a node. It also needs NepiDependency.",
1424 "category": FC.CATEGORY_APPLICATIONS,
1425 "create_function": create_ns3_dependency,
1426 "preconfigure_function": configure_dependency,
1427 "box_attributes": [ ],
1428 "connector_types": ["node"],
1429 "traces": ["buildlog"],
1432 "help": "Internet routing",
1433 "category": FC.CATEGORY_CHANNELS,
1434 "create_function": create_internet,
1435 "connector_types": ["devs"],
1436 "tags": [tags.INTERNET],
1439 "help": "Link emulation",
1440 "category": FC.CATEGORY_CHANNELS,
1441 "create_function": create_netpipe,
1442 "configure_function": configure_netpipe,
1443 "box_attributes": ["netpipe_mode",
1444 "addr_list", "port_list",
1445 "bw_in","plr_in","delay_in",
1446 "bw_out","plr_out","delay_out"],
1447 "connector_types": ["node"],
1448 "traces": ["netpipe_stats"],
1452 testbed_attributes = dict({
1455 "help": "The name of the PlanetLab slice to use",
1456 "type": Attribute.STRING,
1457 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable | Attribute.NoDefaultValue,
1458 "validation_function": validation.is_string
1462 "help": "The name of the PlanetLab user to use for API calls - it must have at least a User role.",
1463 "type": Attribute.STRING,
1464 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable | Attribute.NoDefaultValue,
1465 "validation_function": validation.is_string
1469 "help": "The PlanetLab user's password.",
1470 "type": Attribute.STRING,
1471 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable | Attribute.NoDefaultValue,
1472 "validation_function": validation.is_string
1476 "help": "The PlanetLab PLC API host",
1477 "type": Attribute.STRING,
1478 "value": "www.planet-lab.eu",
1479 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1480 "validation_function": validation.is_string
1484 "help": "The PlanetLab PLC API url pattern - %(hostname)s is replaced by plcHost.",
1485 "type": Attribute.STRING,
1486 "value": "https://%(hostname)s:443/PLCAPI/",
1487 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1488 "validation_function": validation.is_string
1490 "p2p_deployment": dict({
1491 "name": "p2pDeployment",
1492 "help": "Enable peer-to-peer deployment of applications and dependencies. "
1493 "When enabled, dependency packages and applications are "
1494 "deployed in a P2P fashion, picking a single node to do "
1495 "the building or repo download, while all the others "
1496 "cooperatively exchange resulting binaries or rpms. "
1497 "When deploying to many nodes, this is a far more efficient "
1498 "use of resources. It does require re-encrypting and distributing "
1499 "the slice's private key. Though it is implemented in a secure "
1500 "fashion, if they key's sole purpose is not PlanetLab, then this "
1501 "feature should be disabled.",
1502 "type": Attribute.BOOL,
1504 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1505 "validation_function": validation.is_bool
1507 "slice_ssh_key": dict({
1508 "name": "sliceSSHKey",
1509 "help": "The controller-local path to the slice user's ssh private key. "
1510 "It is the user's responsability to deploy this file where the controller "
1511 "will run, it won't be done automatically because it's sensitive information. "
1512 "It is recommended that a NEPI-specific user be created for this purpose and "
1513 "this purpose alone.",
1514 "type": Attribute.STRING,
1515 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable | Attribute.NoDefaultValue,
1516 "validation_function": validation.is_string
1518 "pl_log_level": dict({
1519 "name": "plLogLevel",
1520 "help": "Verbosity of logging of planetlab events.",
1522 "type": Attribute.ENUM,
1523 "allowed": ["DEBUG",
1528 "validation_function": validation.is_enum,
1530 "tap_port_base": dict({
1531 "name": "tapPortBase",
1532 "help": "Base port to use when connecting TUN/TAPs. Effective port will be BASE + GUID.",
1533 "type": Attribute.INTEGER,
1535 "range": (2000,30000),
1536 "validation_function": validation.is_integer_range(2000,30000)
1538 "dedicated_slice": dict({
1539 "name": "dedicatedSlice",
1540 "help": "Set to True if the slice will be dedicated to this experiment. "
1541 "NEPI will perform node and slice cleanup, making sure slices are "
1542 "in a clean, repeatable state before running the experiment.",
1543 "type": Attribute.BOOL,
1545 "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable,
1546 "validation_function": validation.is_bool
1550 supported_recovery_policies = [
1556 class MetadataInfo(metadata.MetadataInfo):
1558 def connector_types(self):
1559 return connector_types
1562 def connections(self):
1566 def attributes(self):
1574 def create_order(self):
1578 def configure_order(self):
1579 return configure_order
1582 def prestart_order(self):
1586 def start_order(self):
1590 def factories_info(self):
1591 return factories_info
1594 def testbed_attributes(self):
1595 return testbed_attributes
1598 def testbed_id(self):
1602 def testbed_version(self):
1603 return TESTBED_VERSION
1606 def supported_recovery_policies(self):
1607 return supported_recovery_policies