Added support for ns-3 Wimax module. wimax_ns3.py example not working: SS never regis...
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Sun, 22 May 2011 09:49:02 +0000 (11:49 +0200)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Sun, 22 May 2011 09:49:02 +0000 (11:49 +0200)
examples/wimax_ns3.py [new file with mode: 0644]
src/nepi/testbeds/ns3/attributes_metadata_v3_9_RC3.py
src/nepi/testbeds/ns3/connection_metadata_v3_9_RC3.py [new file with mode: 0644]
src/nepi/testbeds/ns3/factories_metadata_v3_9_RC3.py
src/nepi/testbeds/ns3/metadata_v3_9_RC3.py
src/nepi/testbeds/ns3/traces_metadata_v3_9_RC3.py [new file with mode: 0644]

diff --git a/examples/wimax_ns3.py b/examples/wimax_ns3.py
new file mode 100644 (file)
index 0000000..ddd8b76
--- /dev/null
@@ -0,0 +1,141 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from nepi.core.design import ExperimentDescription, FactoriesProvider
+from nepi.core.execute import ExperimentController
+from optparse import OptionParser, SUPPRESS_HELP
+from nepi.util import proxy
+import os
+import shutil
+import tempfile
+import test_util
+import time
+
+class Roads09Example(object):
+    def __init__(self):
+        self.root_dir = tempfile.mkdtemp()
+        print self.root_dir
+
+    def add_ns3_node(self, ns3_desc):
+        node = ns3_desc.create("ns3::Node")
+        ipv4 = ns3_desc.create("ns3::Ipv4L3Protocol")
+        arp  = ns3_desc.create("ns3::ArpL3Protocol")
+        icmp = ns3_desc.create("ns3::Icmpv4L4Protocol")
+        udp = ns3_desc.create("ns3::UdpL4Protocol")
+        node.connector("protos").connect(ipv4.connector("node"))
+        node.connector("protos").connect(arp.connector("node"))
+        node.connector("protos").connect(icmp.connector("node"))
+        node.connector("protos").connect(udp.connector("node"))
+        return node
+
+    def add_ns3_wimax_bs(self, ns3_desc, node, channel):
+        bs = ns3_desc.create("ns3::BaseStationNetDevice")
+        node.connector("devs").connect(bs.connector("node"))
+        bs.connector("chan").connect(channel.connector("devs"))
+        phy = ns3_desc.create("ns3::SimpleOfdmWimaxPhy")
+        bs.connector("phy").connect(phy.connector("dev"))
+        uplink = ns3_desc.create("ns3::UplinkSchedulerSimple")
+        bs.connector("uplnk").connect(uplink.connector("dev"))
+        bssched = ns3_desc.create("ns3::BSSchedulerSimple")
+        bs.connector("dwnlnk").connect(bssched.connector("dev"))
+        bs.enable_trace("WimaxPcapTrace")
+        bs.enable_trace("WimaxAsciiTrace")
+        return bs
+
+    def add_ns3_wimax_ss(self, ns3_desc, node, channel):
+        ss = ns3_desc.create("ns3::SubscriberStationNetDevice")
+        node.connector("devs").connect(ss.connector("node"))
+        ss.connector("chan").connect(channel.connector("devs"))
+        phy = ns3_desc.create("ns3::SimpleOfdmWimaxPhy")
+        ss.connector("phy").connect(phy.connector("dev"))
+        ss.enable_trace("WimaxPcapTrace")
+        ss.enable_trace("WimaxAsciiTrace")
+        return ss
+
+    def add_ns3_service_flow(self, ns3_desc, ss, src_address, src_mask,
+            dst_address, dst_mask, src_portlow, src_porthigh, dst_portlow,
+            dst_porthigh, protocol, priority, direction, scheduling_type):
+        classifier = ns3_desc.create("ns3::IpcsClassifierRecord")
+        classifier.set_attribute_value("SrcAddress", src_address)
+        classifier.set_attribute_value("SrcMask", src_mask)
+        classifier.set_attribute_value("DstAddress", dst_address)
+        classifier.set_attribute_value("DstMask", dst_mask)
+        classifier.set_attribute_value("SrcPortLow", src_portlow)
+        classifier.set_attribute_value("SrcPortHigh",src_porthigh)
+        classifier.set_attribute_value("DstPortLow", dst_portlow)
+        classifier.set_attribute_value("DstPortHigh", dst_porthigh)
+        classifier.set_attribute_value("Protocol", protocol)
+        classifier.set_attribute_value("Priority", priority)
+        sflow = ns3_desc.create("ns3::ServiceFlow")
+        sflow.set_attribute_value("Direction", direction)
+        sflow.set_attribute_value("SchedulingType", scheduling_type)
+        sflow.connector("classif").connect(classifier.connector("sflow"))
+        ss.connector("sflows").connect(sflow.connector("dev"))
+
+    def add_ip_address(self, iface, address):
+        ip = iface.add_address()
+        ip.set_attribute_value("Address", address)
+
+    def run(self):
+        exp_desc = ExperimentDescription()
+
+        testbed_version = "3_9_RC3"
+        testbed_id = "ns3"
+        ns3_provider = FactoriesProvider(testbed_id, testbed_version)
+        ns3_desc = exp_desc.add_testbed_description(ns3_provider)
+        ns3_desc.set_attribute_value("homeDirectory", self.root_dir)
+
+        node1 = self.add_ns3_node(ns3_desc)
+        node2 = self.add_ns3_node(ns3_desc)
+        node3 = self.add_ns3_node(ns3_desc)
+
+        channel = ns3_desc.create("ns3::SimpleOfdmWimaxChannel")
+
+        ss1 = self.add_ns3_wimax_ss(ns3_desc, node1, channel)
+        ss2 = self.add_ns3_wimax_ss(ns3_desc, node2, channel)
+        bs = self.add_ns3_wimax_bs(ns3_desc, node3, channel)
+
+        self.add_ns3_service_flow(ns3_desc, ss1, "0.0.0.0", "0.0.0.0",
+                "10.1.1.1", "255.255.255.255", 0, 65000, 100, 100, 
+                "UdpL4Protocol", 1, "SF_DIRECTION_DOWN", "SF_TYPE_RTPS")
+        self.add_ns3_service_flow(ns3_desc, ss2, "10.1.1.2", "255.255.255.255",
+                "0.0.0.0", "0.0.0.0", 0, 65000, 100, 100, "UdpL4Protocol",
+                1, "SF_DIRECTION_UP", "SF_TYPE_RTPS")
+
+        self.add_ip_address(ss1, "10.1.1.1")
+        self.add_ip_address(ss2, "10.1.1.2")
+        self.add_ip_address(bs, "10.1.1.3")
+
+        udp_server = ns3_desc.create("ns3::UdpServer")
+        udp_server.set_attribute_value("Port", 100)
+        udp_server.set_attribute_value("StartTime", "1s")
+        udp_server.set_attribute_value("StopTime", "8s")
+        udp_server.connector("node").connect(node1.connector("apps"))
+
+        udp_client = ns3_desc.create("ns3::UdpClient")
+        udp_client.set_attribute_value("RemotePort", 100)
+        udp_client.set_attribute_value("RemoteAddress", "10.1.1.1")
+        udp_client.set_attribute_value("MaxPackets", 1200)
+        udp_client.set_attribute_value("Interval", "0.5s")
+        udp_client.set_attribute_value("PacketSize", 1024)
+        udp_client.set_attribute_value("StartTime", "1s")
+        udp_client.set_attribute_value("StopTime", "8s")
+        udp_client.connector("node").connect(node2.connector("apps"))
+
+        xml = exp_desc.to_xml()
+        controller = ExperimentController(xml, self.root_dir)
+        controller.start()
+        while not (controller.is_finished(udp_server.guid) and controller.is_finished(udp_client.guid)):
+            time.sleep(0.5)
+        time.sleep(0.1)
+        controller.stop()
+        controller.shutdown()
+
+    def clean(self):
+        shutil.rmtree(self.root_dir)
+
+if __name__ == '__main__':
+    example = Roads09Example()
+    example.run()
+    example.clean()
+
index 0447261..9a09f4f 100644 (file)
@@ -1,11 +1,30 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-from factories_metadata_v3_9_RC3 import wifi_standards
+from factories_metadata_v3_9_RC3 import wifi_standards, l4_protocols, \
+    service_flow_direction, service_flow_scheduling_type
 import validation as ns3_validation
 from nepi.core.attributes import Attribute
 from nepi.util import validation
 
+testbed_attributes = dict({
+     "simu_impl_type": dict({
+            "name": "SimulatorImplementationType",
+            "help": "The object class to use as the simulator implementation",
+            "type": Attribute.STRING,
+            "flags": Attribute.DesignOnly,
+            "validation_function": validation.is_string
+        }),
+      "checksum": dict({
+            "name": "ChecksumEnabled",
+            "help": "A global switch to enable all checksums for all protocols",
+            "type": Attribute.BOOL,
+            "value": False,
+            "flags": Attribute.DesignOnly,
+            "validation_function": validation.is_bool
+        }),
+})
+
 attributes = dict({
     "SleepCurrentA": dict({
         "name": "SleepCurrentA",
@@ -2402,4 +2421,103 @@ attributes = dict({
         "type": Attribute.STRING,
         "help": "Socket address assigned to the Linux socket created to recive file descriptor"
     }),
+    "ClassifierSrcAddress": dict({
+        "name": "SrcAddress",
+        "validation_function": validation.is_string, # TODO:! Address + Netref
+        "value": "",
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.STRING,
+        "help": "The source ip address for the IpcsClassifierRecord"
+    }),
+    "ClassifierSrcMask": dict({
+        "name": "SrcMask",
+        "validation_function": validation.is_string, # TODO:! NetworkMask
+        "value": "",
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.STRING,
+        "help": "The mask to apply on the source ip address for the IpcsClassifierRecord"
+    }),
+    "ClassifierDstAddress": dict({
+        "name": "DstAddress",
+        "validation_function": validation.is_string, # TODO:! Address + Netref
+        "value": "",
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.STRING,
+        "help": "The destination ip address for the IpcsClassifierRecord"
+    }),
+    "ClassifierDstMask": dict({
+        "name": "DstMask",
+        "validation_function": validation.is_string, # TODO:! NetworkMask
+        "value": "",
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.STRING,
+        "help": "The mask to apply on the destination ip address for the IpcsClassifierRecord"
+    }),
+    "ClassifierSrcPortLow": dict({
+        "name": "SrcPortLow",
+        "validation_function": validation.is_integer,
+        "value": 0,
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.INTEGER,
+        "help": "The lower boundary of the source port range for the IpcsClassifierRecord"
+    }),
+    "ClassifierSrcPortHigh": dict({
+        "name": "SrcPortHigh",
+        "validation_function": validation.is_integer,
+        "value": 65000,
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.INTEGER,
+        "help": "The higher boundary of the source port range for the IpcsClassifierRecord"
+    }),
+    "ClassifierDstPortLow": dict({
+        "name": "DstPortLow",
+        "validation_function": validation.is_integer,
+        "value": 0,
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.INTEGER,
+        "help": "The lower boundary of the destination port range for the IpcsClassifierRecord"
+    }),
+    "ClassifierDstPortHigh": dict({
+        "name": "DstPortHigh",
+        "validation_function": validation.is_integer,
+        "value": 65000,
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.INTEGER,
+        "help": "The higher boundary of the destination port range for the IpcsClassifierRecord"
+    }),
+    "ClassifierProtocol": dict({
+        "name": "Protocol",
+        "validation_function": validation.is_string,
+        "value": "UdpL4Protocol",
+        "allowed": l4_protocols.keys(),
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.ENUM,
+        "help": "The L4 protocol for the IpcsClassifierRecord"
+    }),
+    "ClassifierPriority": dict({
+        "name": "Priority",
+        "validation_function": validation.is_integer,
+        "value": 1,
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.INTEGER,
+        "help": "The priority of the IpcsClassifierRecord"
+    }),
+    "ServiceFlowDirection": dict({
+        "name": "Direction",
+        "validation_function": validation.is_string,
+        "value": "SF_DIRECTION_UP",
+        "allowed": service_flow_direction.keys(),
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.ENUM,
+        "help": "Service flow direction as described by the IEEE-802.16 standard"
+    }),
+    "ServiceFlowSchedulingType": dict({
+        "name": "SchedulingType",
+        "validation_function": validation.is_string,
+        "value": "SF_TYPE_RTPS",
+        "allowed": service_flow_scheduling_type.keys(),
+        "flags": Attribute.DesignOnly,
+        "type": Attribute.ENUM,
+        "help": "Service flow scheduling type",
+    }),
 })
diff --git a/src/nepi/testbeds/ns3/connection_metadata_v3_9_RC3.py b/src/nepi/testbeds/ns3/connection_metadata_v3_9_RC3.py
new file mode 100644 (file)
index 0000000..64fcbeb
--- /dev/null
@@ -0,0 +1,729 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from constants import TESTBED_ID
+import functools
+from nepi.util.tunchannel_impl import \
+    crossconnect_tunchannel_peer_init, \
+    crossconnect_tunchannel_peer_compl
+
+### Connection functions ####
+
+def connect_dummy(testbed_instance, guid1, guid2):
+    pass
+
+def connect_node_device(testbed_instance, node_guid, device_guid):
+    node = testbed_instance._elements[node_guid]
+    device = testbed_instance._elements[device_guid]
+    node.AddDevice(device)
+
+def connect_queue_device(testbed_instance, queue_guid, device_guid):
+    queue = testbed_instance._elements[queue_guid]
+    device = testbed_instance._elements[device_guid]
+    device.SetQueue(queue)
+
+def connect_manager_device(testbed_instance, manager_guid, device_guid):
+    manager = testbed_instance._elements[manager_guid]
+    device = testbed_instance._elements[device_guid]
+    device.SetRemoteStationManager(manager)
+
+def connect_phy_device(testbed_instance, phy_guid, device_guid):
+    phy = testbed_instance._elements[phy_guid]
+    device = testbed_instance._elements[device_guid]
+    device.SetPhy(phy)
+    phy.SetDevice(device)
+    # search for the node asociated with the device
+    node_guid = testbed_instance.get_connected(device_guid, "node", "devs")
+    if len(node_guid) == 0:
+        raise RuntimeError("Can't instantiate interface %d outside netns \
+                node" % device_guid)
+    node = testbed_instance.elements[node_guid[0]]
+    phy.SetMobility(node)
+
+def connect_mac_device(testbed_instance, mac_guid, device_guid):
+    mac = testbed_instance._elements[mac_guid]
+    device = testbed_instance._elements[device_guid]
+    device.SetMac(mac)
+
+def connect_errormodel_device(testbed_instance, model_guid, device_guid):
+    model = testbed_instance._elements[model_guid]
+    device = testbed_instance._elements[device_guid]
+    device.SetReceiveErrorModel(model)
+
+def connect_errormodel_phy(testbed_instance, err_guid, phy_guid):
+    err = testbed_instance._elements[err_guid]
+    phy = testbed_instance._elements[phy_guid]
+    phy.SetErrorRateModel(err)
+
+def connect_channel_device(testbed_instance, channel_guid, device_guid):
+    channel = testbed_instance._elements[channel_guid]
+    device = testbed_instance._elements[device_guid]
+    device.Attach(channel)
+
+def connect_simple_channel_device(testbed_instance, channel_guid, device_guid):
+    channel = testbed_instance._elements[channel_guid]
+    device = testbed_instance._elements[device_guid]
+    device.SetChannel(channel)
+
+def connect_loss_channel(testbed_instance, loss_guid, channel_guid):
+    loss = testbed_instance._elements[loss_guid]
+    channel = testbed_instance._elements[channel_guid]
+    channel.SetPropagationLossModel(loss)
+
+def connect_next_loss(testbed_instance, prev_guid, next_guid):
+    prev = testbed_instance._elements[prev_guid]
+    next = testbed_instance._elements[next_guid]
+    prev.SetNext(next)
+
+def connect_delay_channel(testbed_instance, delay_guid, channel_guid):
+    delay = testbed_instance._elements[delay_guid]
+    channel = testbed_instance._elements[channel_guid]
+    channel.SetPropagationDelayModel(delay)
+
+def connect_node_application(testbed_instance, node_guid, application_guid):
+    node = testbed_instance._elements[node_guid]
+    application = testbed_instance._elements[application_guid]
+    node.AddApplication(application)
+# works for ArpL3Protocol, Ipv4L3Protocol, UdpL4Protocol, TcpL4Protocol,
+# NscTcpL4Protocol, MobilityModel (every subclass), 
+# RoutingProtocol (every subclass)
+
+def connect_node_other(testbed_instance, node_guid, other_guid):
+    node = testbed_instance._elements[node_guid]
+    other = testbed_instance._elements[other_guid]
+    node.AggregateObject(other)
+
+def connect_station_sflow(testbed_instance, station_guid, sflow_guid):
+    station = testbed_instance._elements[station_guid]
+    sflow = testbed_instance._elements[sflow_guid]
+    station.AddServiceFlow(sflow)
+
+def connect_bstation_linksched(testbed_instance, bstation_guid, linksched_guid):
+    bstation = testbed_instance._elements[bstation_guid]
+    linksched = testbed_instance._elements[linksched_guid]
+    linksched.SetBs(bstation)
+
+def connect_classifier_sflow(testbed_instance, classifier_guid, sflow_guid):
+    classifier = testbed_instance._elements[classifier_guid]
+    sflow = testbed_instance._elements[sflow_guid]
+    csparam = testbed_instance.ns3.CsParameters(testbed_instance.ns3.CsParameters.ADD, classifier)
+    sflow.SetConvergenceSublayerParam (csparam); 
+
+def connect_fd(testbed_instance, fdnd_guid, cross_data):
+    fdnd = testbed_instance._elements[fdnd_guid]
+    endpoint = fdnd.GetEndpoint()
+    # XXX: check the method StringToBuffer of ns3::FileDescriptorNetDevice
+    # to see how the address should be decoded
+    address = endpoint.replace(":", "").decode('hex')[2:]
+    testbed_instance.set(fdnd_guid, "LinuxSocketAddress", address)
+    
+    # If it's a non-abstract socket, add the path
+    if not address.startswith('\x00'):
+        address = os.path.join( testbed_instance.root_directory, address )
+    
+    # Set tun standard contract attributes
+    testbed_instance.set(fdnd_guid, "tun_addr", address )
+    testbed_instance.set(fdnd_guid, "tun_proto", "fd")
+    testbed_instance.set(fdnd_guid, "tun_port", 0)
+    testbed_instance.set(fdnd_guid, "tun_key", "\xfa"*32) # unimportant, fds aren't encrypted
+
+def connect_tunchannel_fd(testbed_instance, tun_guid, fdnd_guid):
+    fdnd = testbed_instance._elements[fdnd_guid]
+    tun = testbed_instance._elements[tun_guid]
+
+    # XXX: check the method StringToBuffer of ns3::FileDescriptorNetDevice
+    # to see how the address should be decoded
+    endpoint = fdnd.GetEndpoint()
+    address = endpoint.replace(":", "").decode('hex')[2:]
+    testbed_instance.set(fdnd_guid, "LinuxSocketAddress", address)
+    
+    # Create socket pair to connect the FDND and the TunChannel with it
+    import socket
+    sock1, sock2 = socket.socketpair(
+        socket.AF_UNIX, socket.SOCK_SEQPACKET)
+
+    # Send one endpoint to the FDND
+    import passfd
+    import socket
+    sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
+    sock.connect(address)
+    passfd.sendfd(sock, sock1.fileno(), '0')
+    
+    # Store a reference to the endpoint to keep the socket alive
+    fdnd._endpoint_socket = sock1
+    
+    # Send the other endpoint to the TUN channel
+    tun.tun_socket = sock2
+    
+    # With this kind of tun_socket, NS3 will expect a PI header
+    # (sockets don't support the TUNGETIFF ioctl, so it will assume
+    # the default presence of PI headers)
+    tun.with_pi = True
+
+
+### Connector information ###
+
+connector_types = dict({
+    "node": dict({
+                "help": "Connector to a ns3::Node object (mandatory)",
+                "name": "node",
+                "max": 1,
+                "min": 1
+            }),
+    "devs": dict({
+                "help": "Connector to network interfaces",
+                "name": "devs",
+                "max": -1,
+                "min": 0
+            }),
+    "dev2": dict({
+                "help": "Connector to exactly two network interfaces (mandatory)",
+                "name": "dev2",
+                "max": 2,
+                "min": 2
+            }),
+    "dev": dict({
+                "help": "Connector to exactly one network interface (mandatory)",
+                "name": "dev",
+                "max": 1,
+                "min": 1
+            }),
+    "apps": dict({
+                "help": "Connector to applications", 
+                "name": "apps",
+                "max": -1,
+                "min": 0
+            }),
+    "protos": dict({
+                "help": "Connector to network stacks and protocols", 
+                "name": "protos",
+                "max": -1,
+                "min": 0
+            }),
+    "chan": dict({
+                "help": "Connector to a channel for the device (mandatory)", 
+                "name": "chan",
+                "max": 1,
+                "min": 1
+            }),
+    "queue": dict({
+                "help": "Connector to a queueing discipline (mandatory)", 
+                "name": "queue",
+                "max": 1,
+                "min": 1
+            }),
+    "err": dict({
+                "help": "Connector to an error model for the device", 
+                "name": "err",
+                "max": 1,
+                "min": 0
+            }),
+    "->fd": dict({
+                "help": "Connector for file descriptor reception for devices with file descriptors",
+                "name": "->fd",
+                "max": 1,
+                "min": 0
+            }),
+    "fd->": dict({
+                "help": "Connector for file descriptor providing for devices with file descriptors",
+                "name": "fd->",
+                "max": 1,
+                "min": 0
+            }),
+    "phy": dict({
+                "help": "Connector to a PHY wifi model", 
+                "name": "phy",
+                "max": 1,
+                "min": 0
+            }),
+    "phys": dict({
+                "help": "Connector to a wifi channel with PHY wifi models", 
+                "name": "phys",
+                "max": -1,
+                "min": 0
+            }),
+    "mac": dict({
+                "help": "Connector to a MAC wifi model", 
+                "name": "mac",
+                "max": 1,
+                "min": 0
+            }),
+    "manager": dict({
+                "help": "Connector to a wifi manager", 
+                "name": "manager",
+                "max": 1,
+                "min": 0
+            }),
+    "delay": dict({
+                "help": "Connector to a delay model", 
+                "name": "delay",
+                "max": 1,
+                "min": 0
+            }),
+    "loss": dict({
+                "help": "Connector to a loss model", 
+                "name": "loss",
+                "max": 1,
+                "min": 0
+            }),
+    "prev": dict({
+                "help": "Connector to the previous loss model", 
+                "name": "prev",
+                "max": 1,
+                "min": 0
+            }),
+    "next": dict({
+                "help": "Connector to the next loss model", 
+                "name": "next",
+                "max": 1,
+                "min": 0
+            }),
+    "mobility": dict({
+                "help": "Connector to a mobility model", 
+                "name": "mobility",
+                "max": 1,
+                "min": 0
+            }),
+    "tcp": dict({
+                "help": "Connector for ip-ip tunneling over TCP link", 
+                "name": "tcp",
+                "max": 1, 
+                "min": 0
+            }),
+    "udp": dict({
+                "help": "Connector for ip-ip tunneling over UDP datagrams", 
+                "name": "udp",
+                "max": 1, 
+                "min": 0
+            }),
+    "sflows": dict({
+                "help": "Connector to service flows",
+                "name": "sflows",
+                "max": -1, 
+                "min": 0
+            }),
+    "uplnk": dict({
+                "help": "Connector to a uplink scheduler",
+                "name": "uplnk",
+                "max": 1, 
+                "min": 0
+            }),
+    "dwnlnk": dict({
+                "help": "Connector to a dowlink scheduler",
+                "name": "dwnlnk",
+                "max": 1, 
+                "min": 0
+            }),
+    "classif": dict({
+                "help": "Connector to a classifier recod",
+                "name": "classif",
+                "max": 1, 
+                "min": 0
+            }),
+    "sflow": dict({
+                "help": "Connector to a service flow",
+                "name": "sflow",
+                "max": 1, 
+                "min": 0
+            }),
+    })
+
+connections = [
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::BridgeNetDevice", "node" ),
+            "init_code": connect_node_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::CsmaNetDevice", "node" ),
+            "init_code": connect_node_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::EmuNetDevice", "node" ),
+            "init_code": connect_node_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::PointToPointNetDevice", "node" ),
+            "init_code": connect_node_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::SimpleNetDevice", "node" ),
+            "init_code": connect_node_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::FileDescriptorNetDevice", "node" ),
+            "init_code": connect_node_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::WifiNetDevice", "node" ),
+            "init_code": connect_node_device,   
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::SubscriberStationNetDevice", "node" ),
+            "init_code": connect_dummy,   
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::Node", "devs" ),
+            "to":   ( "ns3", "ns3::BaseStationNetDevice", "node" ),
+            "init_code": connect_dummy,   
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::DropTailQueue", "dev" ),
+            "to":   ( "ns3", "ns3::CsmaNetDevice", "queue" ),
+            "init_code": connect_queue_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::DropTailQueue", "dev" ),
+            "to":   ( "ns3", "ns3::EmuNetDevice", "queue" ),
+            "init_code": connect_queue_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::DropTailQueue", "dev" ),
+            "to":   ( "ns3", "ns3::PointToPointNetDevice", "queue" ),
+            "init_code": connect_queue_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::ArfWifiManager", "dev" ),
+            "to":   ( "ns3", "ns3::WifiNetDevice", "manager" ),  
+            "init_code": connect_manager_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::ConstantRateWifiManager", "dev" ),
+            "to":   ( "ns3", "ns3::WifiNetDevice", "manager" ),  
+            "init_code": connect_manager_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::YansWifiPhy", "dev" ),
+            "to":   ( "ns3", "ns3::WifiNetDevice", "phy" ),  
+            "init_code": connect_phy_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::SimpleOfdmWimaxPhy", "dev" ),
+            "to":   ( "ns3", "ns3::SubscriberStationNetDevice", "phy" ),  
+            "init_code": connect_phy_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::SimpleOfdmWimaxPhy", "dev" ),
+            "to":   ( "ns3", "ns3::BaseStationNetDevice", "phy" ),  
+            "init_code": connect_phy_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::QapWifiMac", "dev" ),
+            "to":   ( "ns3", "ns3::WifiNetDevice", "mac" ),
+            "init_code": connect_mac_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::QstaWifiMac", "dev" ),
+            "to":   ( "ns3", "ns3::WifiNetDevice", "mac" ),
+            "init_code": connect_mac_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::RateErrorModel", "dev" ),
+            "to":   ( "ns3", "ns3::CsmaNetDevice", "err" ),
+            "init_code": connect_errormodel_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::RateErrorModel", "dev" ),
+            "to":   ( "ns3", "ns3::PointToPointNetDevice", "err" ),
+            "init_code": connect_errormodel_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::ListErrorModel", "dev" ),
+            "to":   ( "ns3", "ns3::CsmaNetDevice", "err" ),
+            "init_code": connect_errormodel_device,
+            "can_cross": False
+    }),
+    dict({
+            "from": ( "ns3", "ns3::ListErrorModel", "dev" ),
+            "to":   ( "ns3", "ns3::PointToPointNetDevice", "err" ),
+            "init_code": connect_errormodel_device,
+            "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::NistErrorRateModel", "phy" ),        
+        "to":   ( "ns3", "ns3::YansWifiPhy", "err" ),
+        "init_code": connect_errormodel_phy,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::CsmaChannel", "devs" ),
+        "to":   ( "ns3", "ns3::CsmaNetDevice", "chan" ),
+        "init_code": connect_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::PointToPointChannel", "dev2" ),
+        "to":   ( "ns3", "ns3::PointToPointNetDevice", "chan" ),
+        "init_code": connect_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::SimpleChannel", "devs" ),
+        "to":   ( "ns3", "ns3::SimpleNetDevice", "chan" ),
+        "init_code": connect_simple_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::SimpleOfdmWimaxChannel", "devs" ),
+        "to":   ( "ns3", "ns3::SubscriberStationNetDevice", "chan" ),
+        "init_code": connect_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::SimpleOfdmWimaxChannel", "devs" ),
+        "to":   ( "ns3", "ns3::BaseStationNetDevice", "chan" ),
+        "init_code": connect_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::YansWifiChannel", "phys" ),
+        "to":   ( "ns3", "ns3::YansWifiPhy", "chan" ),  
+        "init_code": connect_simple_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::YansWifiChannel", "phys" ),
+        "to":   ( "ns3", "ns3::YansWifiPhy", "chan" ),  
+        "init_code": connect_simple_channel_device,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::LogDistancePropagationLossModel", "prev" ),
+        "to":   ( "ns3", "ns3::YansWifiChannel", "loss" ),  
+        "init_code": connect_loss_channel,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::LogDistancePropagationLossModel", "prev" ),
+        "to":   ( "ns3", "ns3::LogDistancePropagationLossModel", "next" ),  
+        "init_code": connect_next_loss,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::ConstantSpeedPropagationDelayModel", "chan" ),
+        "to":   ( "ns3", "ns3::YansWifiChannel", "delay" ),  
+        "init_code": connect_delay_channel,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::OnOffApplication", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::PacketSink", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::UdpEchoClient", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::UdpEchoServer", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::UdpClient", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::UdpServer", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),    dict({
+        "from": ( "ns3", "ns3::Node", "apps" ),
+        "to":   ( "ns3", "ns3::V4Ping", "node" ),
+        "init_code": connect_node_application,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::ArpL3Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::Icmpv4L4Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::Icmpv6L4Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::Ipv4L3Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::Ipv6L3Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::UdpL4Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "protos" ),
+        "to":   ( "ns3", "ns3::TcpL4Protocol", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::ConstantAccelerationMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::ConstantPositionMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::ConstantVelocityMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::HierarchicalMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::RandomDirection2dMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::RandomWalk2dMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Node", "mobility" ),
+        "to":   ( "ns3", "ns3::RandomWaypointMobilityModel", "node" ),
+        "init_code": connect_node_other,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::SubscriberStationNetDevice", "sflows" ),
+        "to":   ( "ns3", "ns3::ServiceFlow", "dev" ),
+        "init_code": connect_station_sflow,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::BaseStationNetDevice", "sflows" ),
+        "to":   ( "ns3", "ns3::ServiceFlow", "dev" ),
+        "init_code": connect_station_sflow,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::BaseStationNetDevice", "uplnk" ),
+        "to":   ( "ns3", "ns3::UplinkSchedulerSimple", "dev" ),
+        "init_code": connect_bstation_linksched,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::BaseStationNetDevice", "uplnk" ),
+        "to":   ( "ns3", "ns3::UplinkSchedulerRtps", "dev" ),
+        "init_code": connect_bstation_linksched,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::BaseStationNetDevice", "dwnlnk" ),
+        "to":   ( "ns3", "ns3::BSSchedulerSimple", "dev" ),
+        "init_code": connect_bstation_linksched,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::BaseStationNetDevice", "dwnlnk" ),
+        "to":   ( "ns3", "ns3::BSSchedulerRtps", "dev" ),
+        "init_code": connect_bstation_linksched,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::IpcsClassifierRecord", "sflow" ),
+        "to":   ( "ns3", "ns3::ServiceFlow", "classif" ),
+        "init_code": connect_classifier_sflow,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::FileDescriptorNetDevice", "->fd" ),
+        "to":   ( None, None, "fd->" ),
+        "init_code": connect_fd,
+        "can_cross": True
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Nepi::TunChannel", "fd->" ),
+        "to":   ( "ns3", "ns3::FileDescriptorNetDevice", "->fd" ),
+        "init_code": connect_tunchannel_fd,
+        "can_cross": False
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Nepi::TunChannel", "tcp"),
+        "to":   (None, None, "tcp"),
+        "init_code": functools.partial(crossconnect_tunchannel_peer_init,"tcp"),
+        "compl_code": functools.partial(crossconnect_tunchannel_peer_compl,"tcp"),
+        "can_cross": True
+    }),
+    dict({
+        "from": ( "ns3", "ns3::Nepi::TunChannel", "udp"),
+        "to":   (None, None, "udp"),
+        "init_code": functools.partial(crossconnect_tunchannel_peer_init,"udp"),
+        "compl_code": functools.partial(crossconnect_tunchannel_peer_compl,"udp"),
+        "can_cross": True
+    }),
+]
index 2889a1b..250bac6 100644 (file)
@@ -3,11 +3,42 @@
 
 from nepi.util.constants import AF_INET, STATUS_NOT_STARTED, STATUS_RUNNING, \
         STATUS_FINISHED, STATUS_UNDETERMINED
-
 from nepi.util.tunchannel_impl import \
     preconfigure_tunchannel, postconfigure_tunchannel, \
     wait_tunchannel, create_tunchannel
 
+wifi_standards = dict({
+    "WIFI_PHY_STANDARD_holland": 5,
+    "WIFI_PHY_STANDARD_80211p_SCH": 7,
+    "WIFI_PHY_STANDARD_80211_5Mhz": 4,
+    "WIFI_PHY_UNKNOWN": 8,
+    "WIFI_PHY_STANDARD_80211_10Mhz": 3,
+    "WIFI_PHY_STANDARD_80211g": 2,
+    "WIFI_PHY_STANDARD_80211p_CCH": 6,
+    "WIFI_PHY_STANDARD_80211a": 0,
+    "WIFI_PHY_STANDARD_80211b": 1
+})
+
+l4_protocols = dict({
+    "Icmpv4L4Protocol": 1,
+    "UdpL4Protocol": 17,
+    "TcpL4Protocol": 6,
+})
+
+service_flow_direction = dict({
+    "SF_DIRECTION_UP": 1,
+    "SF_DIRECTION_DOWN": 0,
+})
+
+service_flow_scheduling_type = dict ({
+    "SF_TYPE_NONE": 0,
+    "SF_TYPE_UNDEF": 1, 
+    "SF_TYPE_BE": 2,
+    "SF_TYPE_NRTPS": 3,
+    "SF_TYPE_RTPS": 4,
+    "SF_TYPE_UGS": 6, 
+    "SF_TYPE_ALL": 255
+})
 
 def _get_ipv4_protocol_guid(testbed_instance, node_guid):
     # search for the Ipv4L3Protocol asociated with the device
@@ -108,29 +139,41 @@ def yanswifipcap_trace(testbed_instance, guid, trace_id):
     helper = testbed_instance.ns3.YansWifiPhyHelper()
     helper.EnablePcap(filepath, element, explicitFilename = True)
 
+def wimaxascii_trace(testbed_instance, guid, trace_id):
+    node_guid = _get_node_guid(testbed_instance, guid)
+    interface_number = _get_dev_number(testbed_instance, guid)
+    element = testbed_instance._elements[guid]
+    filename = "trace-wimax-node-%d-dev-%d.tr" % (node_guid, interface_number)
+    testbed_instance.follow_trace(guid, trace_id, filename)
+    filepath = testbed_instance.trace_filename(guid, trace_id)
+    helper = testbed_instance.ns3.WimaxHelper()
+    asciiHelper = testbed_instance.ns3.AsciiTraceHelper()
+    stream = asciiHelper.CreateFileStream (filepath)
+    helper.EnableAscii(stream, element)
+
+def wimaxpcap_trace(testbed_instance, guid, trace_id):
+    node_guid = _get_node_guid(testbed_instance, guid)
+    interface_number = _get_dev_number(testbed_instance, guid)
+    element = testbed_instance._elements[guid]
+    filename = "trace-wimax-node-%d-dev-%d.pcap" % (node_guid, interface_number)
+    testbed_instance.follow_trace(guid, trace_id, filename)
+    filepath = testbed_instance.trace_filename(guid, trace_id)
+    helper = testbed_instance.ns3.WimaxHelper()
+    helper.EnablePcap(filepath, element, explicitFilename = True)
+
 trace_functions = dict({
     "P2PPcapTrace": p2ppcap_trace,
     "P2PAsciiTrace": p2pascii_trace,
     "CsmaPcapTrace": csmapcap_trace,
     "CsmaPcapPromiscTrace": csmapcap_promisc_trace,
     "FileDescriptorPcapTrace": fdpcap_trace,
-    "YansWifiPhyPcapTrace": yanswifipcap_trace
+    "YansWifiPhyPcapTrace": yanswifipcap_trace,
+    "WimaxPcapTrace": wimaxpcap_trace,
+    "WimaxAsciiTrace": wimaxascii_trace,
     })
 
 ### Creation functions ###
 
-wifi_standards = dict({
-    "WIFI_PHY_STANDARD_holland": 5,
-    "WIFI_PHY_STANDARD_80211p_SCH": 7,
-    "WIFI_PHY_STANDARD_80211_5Mhz": 4,
-    "WIFI_PHY_UNKNOWN": 8,
-    "WIFI_PHY_STANDARD_80211_10Mhz": 3,
-    "WIFI_PHY_STANDARD_80211g": 2,
-    "WIFI_PHY_STANDARD_80211p_CCH": 6,
-    "WIFI_PHY_STANDARD_80211a": 0,
-    "WIFI_PHY_STANDARD_80211b": 1
-})
-
 def create_element(testbed_instance, guid):
     element_factory = testbed_instance.ns3.ObjectFactory()
     factory_id = testbed_instance._create[guid]
@@ -164,6 +207,143 @@ def create_ipv4protocol(testbed_instance, guid):
     static_routing = testbed_instance.ns3.Ipv4StaticRouting()
     list_routing.AddRoutingProtocol(static_routing, 1)
 
+def create_element_no_constructor(testbed_instance, guid):
+    """ Create function for ns3 classes for which 
+        TypeId.HasConstructor == False"""
+    factory_id = testbed_instance._create[guid]
+    factory_name = factory_id.replace("ns3::", "")
+    constructor = getattr(testbed_instance.ns3, factory_name)
+    element = constructor()
+    testbed_instance._elements[guid] = element
+
+def create_base_station(testbed_instance, guid):
+    node_guid = _get_node_guid(testbed_instance, guid)
+    node = testbed_instance._elements[node_guid]
+    phy_guids = testbed_instance.get_connected(guid, "phy", "dev")
+    if len(phy_guids) == 0:
+        raise RuntimeError("No PHY was found for station %d" % guid)
+    phy = testbed_instance._elements[phy_guids[0]]
+    uplnk_guids = testbed_instance.get_connected(guid, "uplnk", "dev")
+    if len(uplnk_guids) == 0:
+        raise RuntimeError("No uplink scheduler was found for station %d" % guid)
+    uplnk = testbed_instance._elements[uplnk_guids[0]]
+    dwnlnk_guids = testbed_instance.get_connected(guid, "dwnlnk", "dev")
+    if len(dwnlnk_guids) == 0:
+        raise RuntimeError("No downlink scheduler was found for station %d" % guid)
+    dwnlnk = testbed_instance._elements[dwnlnk_guids[0]]
+    element = testbed_instance.ns3.BaseStationNetDevice(node, phy, uplnk, dwnlnk)
+    testbed_instance._elements[guid] = element
+
+def create_subscriber_station(testbed_instance, guid):
+    node_guid = _get_node_guid(testbed_instance, guid)
+    node = testbed_instance._elements[node_guid]
+    phy_guids = testbed_instance.get_connected(guid, "phy", "dev")
+    if len(phy_guids) == 0:
+        raise RuntimeError("No PHY was found for station %d" % guid)
+    phy = testbed_instance._elements[phy_guids[0]]
+    element = testbed_instance.ns3.SubscriberStationNetDevice(node, phy)
+    element.SetModulationType(testbed_instance.ns3.WimaxPhy.MODULATION_TYPE_QAM16_12)
+    testbed_instance._elements[guid] = element
+
+def create_wimax_channel(testbed_instance, guid):
+    element = testbed_instance.ns3.SimpleOfdmWimaxChannel(testbed_instance.ns3.SimpleOfdmWimaxChannel.COST231_PROPAGATION)
+    testbed_instance._elements[guid] = element
+
+def create_wimax_phy(testbed_instance, guid):
+    element = testbed_instance.ns3.SimpleOfdmWimaxPhy()
+    testbed_instance._elements[guid] = element
+
+def create_service_flow(testbed_instance, guid):
+    parameters = testbed_instance._get_parameters(guid)
+    direction = None
+    if "Direction" in parameters:
+        direction = parameters["Direction"]
+    if direction == None:
+        raise RuntimeError("No SchedulingType was found for service flow %d" % guid)
+    sched = None
+    if "SchedulingType" in parameters:
+        sched = parameters["SchedulingType"]
+    if sched == None:
+        raise RuntimeError("No SchedulingType was found for service flow %d" % guid)
+    ServiceFlow = testbed_instance.ns3.ServiceFlow
+    direction = service_flow_direction[direction]
+    sched = service_flow_scheduling_type[sched]
+    element = ServiceFlow(direction)
+    element.SetCsSpecification(ServiceFlow.IPV4)
+    element.SetServiceSchedulingType(sched) 
+    element.SetMaxSustainedTrafficRate(100)
+    element.SetMinReservedTrafficRate(1000000)
+    element.SetMinTolerableTrafficRate(1000000)
+    element.SetMaximumLatency(100)
+    element.SetMaxTrafficBurst(2000)
+    element.SetTrafficPriority(1)
+    element.SetUnsolicitedGrantInterval(1)
+    element.SetMaxSustainedTrafficRate(70)
+    element.SetToleratedJitter(10)
+    element.SetSduSize(49)
+    element.SetRequestTransmissionPolicy(0)
+    testbed_instance._elements[guid] = element
+
+def create_ipcs_classifier_record(testbed_instance, guid):
+    parameters = testbed_instance._get_parameters(guid)
+    src_address = None
+    if "SrcAddress" in parameters:
+        src_address = parameters["SrcAddress"]
+    if src_address == None:
+        raise RuntimeError("No SrcAddress was found for classifier %d" % guid)
+    src_address = testbed_instance.ns3.Ipv4Address(src_address)
+    src_mask= None
+    if "SrcMask" in parameters:
+        src_mask = parameters["SrcMask"]
+    if src_mask == None:
+        raise RuntimeError("No SrcMask was found for classifier %d" % guid)
+    src_mask = testbed_instance.ns3.Ipv4Mask(src_mask)
+    dst_address = None
+    if "DstAddress" in parameters:
+        dst_address = parameters["DstAddress"]
+    if dst_address == None:
+        raise RuntimeError("No Dstddress was found for classifier %d" % guid)
+    dst_address = testbed_instance.ns3.Ipv4Address(dst_address)
+    dst_mask= None
+    if "DstMask" in parameters:
+        dst_mask = parameters["DstMask"]
+    if dst_mask == None:
+        raise RuntimeError("No DstMask was found for classifier %d" % guid)
+    dst_mask = testbed_instance.ns3.Ipv4Mask(dst_mask)
+    src_port_low = None
+    if "SrcPortLow" in parameters:
+        src_port_low = parameters["SrcPortLow"]
+    if src_port_low == None:
+        raise RuntimeError("No SrcPortLow was found for classifier %d" % guid)
+    src_port_high= None
+    if "SrcPortHigh" in parameters:
+        src_port_high = parameters["SrcPortHigh"]
+    if src_port_high == None:
+        raise RuntimeError("No SrcPortHigh was found for classifier %d" % guid)
+    dst_port_low = None
+    if "DstPortLow" in parameters:
+        dst_port_low = parameters["DstPortLow"]
+    if dst_port_low == None:
+        raise RuntimeError("No DstPortLow was found for classifier %d" % guid)
+    dst_port_high = None
+    if "DstPortHigh" in parameters:
+        dst_port_high = parameters["DstPortHigh"]
+    if dst_port_high == None:
+        raise RuntimeError("No DstPortHigh was found for classifier %d" % guid)
+    protocol = None
+    if "Protocol" in parameters:
+        protocol = parameters["Protocol"]
+    if protocol == None or protocol not in l4_protocols:
+        raise RuntimeError("No Protocol was found for classifier %d" % guid)
+    priority = None
+    if "Priority" in parameters:
+        priority = parameters["Priority"]
+    if priority == None:
+        raise RuntimeError("No Priority was found for classifier %d" % guid)
+    element = testbed_instance.ns3.IpcsClassifierRecord(src_address, src_mask,
+        dst_address, dst_mask, src_port_low, src_port_high, dst_port_low, 
+        dst_port_high, l4_protocols[protocol], priority)
+    testbed_instance._elements[guid] = element
 
 ### Start/Stop functions ###
 
@@ -178,7 +358,6 @@ def stop_application(testbed_instance, guid):
     now = testbed_instance.ns3.Simulator.Now()
     element.SetStopTime(now)
 
-
 ### Status functions ###
 
 def status_application(testbed_instance, guid):
@@ -247,7 +426,7 @@ def configure_device(testbed_instance, guid):
         ipv4.AddAddress(ifindex, inaddr)
         ipv4.SetMetric(ifindex, 1)
         ipv4.SetUp(ifindex)
-    
+
 def _add_static_route(ns3, static_routing, 
         address, netprefix, nexthop_address, ifindex):
     if netprefix == 0:
@@ -312,6 +491,174 @@ def configure_node(testbed_instance, guid):
             _add_static_route_if(ns3, static_routing, 
                 address, netprefix, nexthop_address, ifindex)
 
+def configure_station(testbed_instance, guid):
+    configure_device(testbed_instance, guid)
+    element = testbed_instance._elements[guid]
+    element.Start()
+
+###  Factories  ###
+
+factories_order = ["ns3::BasicEnergySource",
+    "ns3::WifiRadioEnergyModel",
+    "ns3::BSSchedulerRtps",
+    "ns3::BSSchedulerSimple",
+    "ns3::UdpTraceClient",
+    "ns3::UdpServer",
+    "ns3::UdpClient",
+    "ns3::FlowMonitor",
+    "ns3::Radvd",
+    "ns3::Ping6",
+    "ns3::flame::FlameProtocol",
+    "ns3::flame::FlameRtable",
+    "ns3::dot11s::AirtimeLinkMetricCalculator",
+    "ns3::dot11s::HwmpProtocol",
+    "ns3::dot11s::HwmpRtable",
+    "ns3::dot11s::PeerManagementProtocol",
+    "ns3::dot11s::PeerLink",
+    "ns3::MeshWifiInterfaceMac",
+    "ns3::MeshPointDevice",
+    "ns3::UanMacRcGw",
+    "ns3::UanMacRc",
+    "ns3::UanPhyCalcSinrDual",
+    "ns3::UanPhyPerGenDefault",
+    "ns3::UanPhyDual",
+    "ns3::UanPropModelThorp",
+    "ns3::UanMacCw",
+    "ns3::UanNoiseModelDefault",
+    "ns3::UanMacAloha",
+    "ns3::UanPropModelIdeal",
+    "ns3::UanTransducerHd",
+    "ns3::UanPhyCalcSinrDefault",
+    "ns3::UanPhyGen",
+    "ns3::UanPhyCalcSinrFhFsk",
+    "ns3::UanPhyPerUmodem",
+    "ns3::UanChannel",
+    "ns3::V4Ping",
+    "ns3::AthstatsWifiTraceSink",
+    "ns3::FlameStack",
+    "ns3::Dot11sStack",
+    "ns3::NonCommunicatingNetDevice",
+    "ns3::HalfDuplexIdealPhy",
+    "ns3::AlohaNoackNetDevice",
+    "ns3::SpectrumAnalyzer",
+    "ns3::WaveformGenerator",
+    "ns3::MultiModelSpectrumChannel",
+    "ns3::SingleModelSpectrumChannel",
+    "ns3::MsduStandardAggregator",
+    "ns3::EdcaTxopN",
+    "ns3::QstaWifiMac",
+    "ns3::QapWifiMac",
+    "ns3::QadhocWifiMac",
+    "ns3::MinstrelWifiManager",
+    "ns3::CaraWifiManager",
+    "ns3::AarfcdWifiManager",
+    "ns3::OnoeWifiManager",
+    "ns3::AmrrWifiManager",
+    "ns3::ConstantRateWifiManager",
+    "ns3::IdealWifiManager",
+    "ns3::AarfWifiManager",
+    "ns3::ArfWifiManager",
+    "ns3::WifiNetDevice",
+    "ns3::NqstaWifiMac",
+    "ns3::NqapWifiMac",
+    "ns3::AdhocWifiMac",
+    "ns3::DcaTxop",
+    "ns3::WifiMacQueue",
+    "ns3::YansWifiChannel",
+    "ns3::YansWifiPhy",
+    "ns3::NistErrorRateModel",
+    "ns3::YansErrorRateModel",
+    "ns3::WaypointMobilityModel",
+    "ns3::ConstantAccelerationMobilityModel",
+    "ns3::RandomDirection2dMobilityModel",
+    "ns3::RandomWalk2dMobilityModel",
+    "ns3::SteadyStateRandomWaypointMobilityModel",
+    "ns3::RandomWaypointMobilityModel",
+    "ns3::GaussMarkovMobilityModel",
+    "ns3::ConstantVelocityMobilityModel",
+    "ns3::ConstantPositionMobilityModel",
+    "ns3::ListPositionAllocator",
+    "ns3::GridPositionAllocator",
+    "ns3::RandomRectanglePositionAllocator",
+    "ns3::RandomBoxPositionAllocator",
+    "ns3::RandomDiscPositionAllocator",
+    "ns3::UniformDiscPositionAllocator",
+    "ns3::HierarchicalMobilityModel",
+    "ns3::aodv::RoutingProtocol",
+    "ns3::UdpEchoServer",
+    "ns3::UdpEchoClient",
+    "ns3::PacketSink",
+    "ns3::OnOffApplication",
+    "ns3::VirtualNetDevice",
+    "ns3::FileDescriptorNetDevice",
+    "ns3::Nepi::TunChannel",
+    "ns3::TapBridge",
+    "ns3::BridgeChannel",
+    "ns3::BridgeNetDevice",
+    "ns3::EmuNetDevice",
+    "ns3::CsmaChannel",
+    "ns3::CsmaNetDevice",
+    "ns3::PointToPointRemoteChannel",
+    "ns3::PointToPointChannel",
+    "ns3::PointToPointNetDevice",
+    "ns3::NscTcpL4Protocol",
+    "ns3::Icmpv6L4Protocol",
+    "ns3::Ipv6OptionPad1",
+    "ns3::Ipv6OptionPadn",
+    "ns3::Ipv6OptionJumbogram",
+    "ns3::Ipv6OptionRouterAlert",
+    "ns3::Ipv6ExtensionHopByHop",
+    "ns3::Ipv6ExtensionDestination",
+    "ns3::Ipv6ExtensionFragment",
+    "ns3::Ipv6ExtensionRouting",
+    "ns3::Ipv6ExtensionLooseRouting",
+    "ns3::Ipv6ExtensionESP",
+    "ns3::Ipv6ExtensionAH",
+    "ns3::Ipv6L3Protocol",
+    "ns3::LoopbackNetDevice",
+    "ns3::Icmpv4L4Protocol",
+    "ns3::RttMeanDeviation",
+    "ns3::ArpL3Protocol",
+    "ns3::TcpL4Protocol",
+    "ns3::UdpL4Protocol",
+    "ns3::Ipv4L3Protocol",
+    "ns3::SimpleNetDevice",
+    "ns3::SimpleChannel",
+    "ns3::PacketSocket",
+    "ns3::DropTailQueue",
+    "ns3::Node",
+    "ns3::FriisSpectrumPropagationLossModel",
+    "ns3::Cost231PropagationLossModel",
+    "ns3::JakesPropagationLossModel",
+    "ns3::RandomPropagationLossModel",
+    "ns3::FriisPropagationLossModel",
+    "ns3::TwoRayGroundPropagationLossModel",
+    "ns3::LogDistancePropagationLossModel",
+    "ns3::ThreeLogDistancePropagationLossModel",
+    "ns3::NakagamiPropagationLossModel",
+    "ns3::FixedRssLossModel",
+    "ns3::MatrixPropagationLossModel",
+    "ns3::RangePropagationLossModel",
+    "ns3::RandomPropagationDelayModel",
+    "ns3::ConstantSpeedPropagationDelayModel",
+    "ns3::RateErrorModel",
+    "ns3::ListErrorModel",
+    "ns3::ReceiveListErrorModel",
+    "ns3::PacketBurst",
+    "ns3::EnergySourceContainer",
+    "ns3::BSSchedulerRtps",
+    "ns3::BSSchedulerSimple",
+    "ns3::SimpleOfdmWimaxChannel",
+    "ns3::SimpleOfdmWimaxPhy",
+    "ns3::UplinkSchedulerMBQoS",
+    "ns3::UplinkSchedulerRtps",
+    "ns3::UplinkSchedulerSimple",
+    "ns3::IpcsClassifierRecord",
+    "ns3::ServiceFlow",
+    "ns3::BaseStationNetDevice",
+    "ns3::SubscriberStationNetDevice",
+ ]
+
 factories_info = dict({
     "ns3::Ping6": dict({
         "category": "Application",
@@ -957,7 +1304,7 @@ factories_info = dict({
            "Y"],
     }),
      "ns3::NqapWifiMac": dict({
-        "category": "",
+        "category": "Mac",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1058,10 +1405,10 @@ factories_info = dict({
     }),
      "ns3::BaseStationNetDevice": dict({
         "category": "Device",
-        "create_function": create_element,
-        "configure_function": configure_device,
-        "help": "",
-        "connector_types": [],
+        "create_function": create_base_station,
+        "configure_function": configure_station,
+        "help": "Base station for wireless mobile network",
+        "connector_types": ["node", "chan", "phy", "uplnk", "dwnlnk"],
         "allow_addresses": True,
         "box_attributes": ["InitialRangInterval",
             "DcdInterval",
@@ -1073,13 +1420,14 @@ factories_info = dict({
             "Mtu",
             "RTG",
             "TTG"],
+        "traces": ["wimaxpcap", "wimaxascii"],
     }),
      "ns3::UdpServer": dict({
         "category": "Application",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
-        "connector_types": [],
+        "connector_types": ["node"],
         "stop_function": stop_application,
         "start_function": start_application,
         "status_function": status_application,
@@ -1142,7 +1490,7 @@ factories_info = dict({
             "RxQueueSize"],
     }),
      "ns3::Ipv6ExtensionLooseRouting": dict({
-        "category": "",
+        "category": "Routing",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1161,7 +1509,7 @@ factories_info = dict({
             "Velocity"],
     }),
      "ns3::RangePropagationLossModel": dict({
-        "category": "",
+        "category": "Loss",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1186,7 +1534,7 @@ factories_info = dict({
         "box_attributes": ["DefaultLoss"],
     }),
      "ns3::WifiNetDevice": dict({
-        "category": "Device",
+        "category": "Wifi",
         "create_function": create_element,
         "configure_function": configure_device,
         "help": "",
@@ -1195,7 +1543,7 @@ factories_info = dict({
         "box_attributes": ["Mtu"],
     }),
      "ns3::CsmaChannel": dict({
-        "category": "Channel",
+        "category": "Topology",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1215,7 +1563,7 @@ factories_info = dict({
            "ExpirationTime"],
     }),
      "ns3::Ipv6ExtensionRouting": dict({
-        "category": "",
+        "category": "Routing",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1265,7 +1613,7 @@ factories_info = dict({
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
-        "connector_types": [],
+        "connector_types": ["node"],
         "stop_function": stop_application,
         "start_function": start_application,
         "status_function": status_application,
@@ -1286,7 +1634,7 @@ factories_info = dict({
         "box_attributes": ["Delay"],
     }),
      "ns3::Ipv6StaticRouting": dict({
-        "category": "",
+        "category": "Routing",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1294,7 +1642,7 @@ factories_info = dict({
         "box_attributes": [],
     }),
      "ns3::DropTailQueue": dict({
-        "category": "Device",
+        "category": "Queue",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1320,7 +1668,7 @@ factories_info = dict({
         "box_attributes": ["Rss"],
     }),
      "ns3::EnergySourceContainer": dict({
-        "category": "",
+        "category": "Energy",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1361,7 +1709,7 @@ factories_info = dict({
             "EnableBeaconCollisionAvoidance"],
     }),
      "ns3::MeshPointDevice": dict({
-        "category": "Device",
+        "category": "Topology",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1370,7 +1718,7 @@ factories_info = dict({
         "box_attributes": ["Mtu"],
     }),
      "ns3::BasicEnergySource": dict({
-        "category": "",
+        "category": "Energy",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1416,7 +1764,7 @@ factories_info = dict({
         "box_attributes": [],
     }),
      "ns3::WifiMacQueue": dict({
-        "category": "",
+        "category": "Queue",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1445,7 +1793,7 @@ factories_info = dict({
             "IsEnabled"],
     }),
      "ns3::MeshWifiInterfaceMac": dict({
-        "category": "",
+        "category": "Mac",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -1508,7 +1856,7 @@ factories_info = dict({
         "traces": ["yanswifipcap"]
     }),
      "ns3::WifiRadioEnergyModel": dict({
-        "category": "",
+        "category": "Energy",
         "create_function": create_element,
         "configure_function": configure_element,
         "help": "",
@@ -2013,10 +2361,10 @@ factories_info = dict({
     }),
      "ns3::SubscriberStationNetDevice": dict({
         "category": "Device",
-        "create_function": create_element,
-        "configure_function": configure_element,
-        "help": "",
-        "connector_types": [],
+        "create_function": create_subscriber_station,
+        "configure_function": configure_station,
+        "help": "Subscriber station for mobile wireless network",
+        "connector_types": ["node", "chan", "phy", "sflows"],
         "allow_addresses": True,
         "box_attributes": ["LostDlMapInterval",
             "LostUlMapInterval",
@@ -2033,8 +2381,9 @@ factories_info = dict({
             "Mtu",
             "RTG",
             "TTG"],
+        "traces": ["wimaxpcap", "wimaxascii"],
     }),
-     "ns3::flame::FlameRtable": dict({
+    "ns3::flame::FlameRtable": dict({
         "category": "",
         "create_function": create_element,
         "configure_function": configure_element,
@@ -2042,4 +2391,79 @@ factories_info = dict({
         "connector_types": [],
         "box_attributes": ["Lifetime"],
     }),
+    "ns3::BSSchedulerRtps": dict({
+        "category": "Service Flow",
+        "create_function": create_element,
+        "configure_function": configure_element,
+        "help": "Simple downlink scheduler for rtPS flows",
+        "connector_types": ["dev"],
+        "box_attributes": [],
+    }),
+    "ns3::BSSchedulerSimple": dict({
+        "category": "Service Flow",
+        "create_function": create_element,
+        "configure_function": configure_element,
+        "help": "simple downlink scheduler for service flows",
+        "connector_types": ["dev"],
+        "box_attributes": [],
+    }),
+    "ns3::SimpleOfdmWimaxChannel": dict({
+        "category": "Channel",
+        "create_function": create_wimax_channel,
+        "configure_function": configure_element,
+        "help": "Wimax channel",
+        "connector_types": ["devs"],
+        "box_attributes": [],
+    }),
+    "ns3::SimpleOfdmWimaxPhy": dict({
+        "category": "Phy",
+        "create_function": create_wimax_phy,
+        "configure_function": configure_element,
+        "help": "Wimax Phy",
+        "connector_types": ["dev"],
+        "box_attributes": [],
+    }),
+    "ns3::UplinkSchedulerSimple": dict({
+        "category": "Service Flow",
+        "create_function": create_element_no_constructor,
+        "configure_function": configure_element,
+        "help": "Simple uplink scheduler for service flows",
+        "connector_types": ["dev"],
+        "box_attributes": [],
+    }),
+    "ns3::UplinkSchedulerRtps": dict({
+        "category": "Service Flow",
+        "create_function": create_element_no_constructor,
+        "configure_function": configure_element,
+        "help": "Simple uplink scheduler for rtPS flows",
+        "connector_types": ["dev"],
+        "box_attributes": [],
+    }),
+    "ns3::IpcsClassifierRecord": dict({
+        "category": "Service Flow",
+        "create_function": create_ipcs_classifier_record,
+        "configure_function": configure_element,
+        "help": "Classifier record for service flow",
+        "connector_types": ["sflow"],
+        "box_attributes": ["ClassifierSrcAddress", 
+            "ClassifierSrcMask", 
+            "ClassifierDstAddress",
+            "ClassifierDstMask",
+            "ClassifierSrcPortLow",
+            "ClassifierSrcPortHigh",
+            "ClassifierDstPortLow",
+            "ClassifierDstPortHigh",
+            "ClassifierProtocol",
+            "ClassifierPriority"],
+    }),   
+    "ns3::ServiceFlow": dict({
+        "category": "Service Flow",
+        "create_function": create_service_flow,
+        "configure_function": configure_element,
+        "help": "Service flow for QoS",
+        "connector_types": ["classif", "dev"],
+        "box_attributes": ["ServiceFlowDirection", 
+            "ServiceFlowSchedulingType"],
+    }),   
 })
+        
index 0b280dd..1058aae 100644 (file)
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-from constants import TESTBED_ID
 from nepi.core import metadata
-from nepi.core.attributes import Attribute
-from nepi.util import validation
-import os.path
-import functools
-
-from nepi.util.tunchannel_impl import \
-    crossconnect_tunchannel_peer_init, \
-    crossconnect_tunchannel_peer_compl
-
-
-### Connection functions ####
-
-def connect_node_device(testbed_instance, node_guid, device_guid):
-    node = testbed_instance._elements[node_guid]
-    device = testbed_instance._elements[device_guid]
-    node.AddDevice(device)
-
-def connect_queue_device(testbed_instance, queue_guid, device_guid):
-    queue = testbed_instance._elements[queue_guid]
-    device = testbed_instance._elements[device_guid]
-    device.SetQueue(queue)
-
-def connect_manager_device(testbed_instance, manager_guid, device_guid):
-    manager = testbed_instance._elements[manager_guid]
-    device = testbed_instance._elements[device_guid]
-    device.SetRemoteStationManager(manager)
-
-def connect_phy_device(testbed_instance, phy_guid, device_guid):
-    phy = testbed_instance._elements[phy_guid]
-    device = testbed_instance._elements[device_guid]
-    device.SetPhy(phy)
-    phy.SetDevice(device)
-    # search for the node asociated with the device
-    node_guid = testbed_instance.get_connected(device_guid, "node", "devs")
-    if len(node_guid) == 0:
-        raise RuntimeError("Can't instantiate interface %d outside netns \
-                node" % device_guid)
-    node = testbed_instance.elements[node_guid[0]]
-    phy.SetMobility(node)
-
-def connect_mac_device(testbed_instance, mac_guid, device_guid):
-    mac = testbed_instance._elements[mac_guid]
-    device = testbed_instance._elements[device_guid]
-    device.SetMac(mac)
-
-def connect_errormodel_device(testbed_instance, model_guid, device_guid):
-    model = testbed_instance._elements[model_guid]
-    device = testbed_instance._elements[device_guid]
-    device.SetReceiveErrorModel(model)
-
-def connect_errormodel_phy(testbed_instance, err_guid, phy_guid):
-    err = testbed_instance._elements[err_guid]
-    phy = testbed_instance._elements[phy_guid]
-    phy.SetErrorRateModel(err)
-
-def connect_channel_device(testbed_instance, channel_guid, device_guid):
-    channel = testbed_instance._elements[channel_guid]
-    device = testbed_instance._elements[device_guid]
-    device.Attach(channel)
-
-def connect_simple_channel_device(testbed_instance, channel_guid, device_guid):
-    channel = testbed_instance._elements[channel_guid]
-    device = testbed_instance._elements[device_guid]
-    device.SetChannel(channel)
-
-def connect_loss_channel(testbed_instance, loss_guid, channel_guid):
-    loss = testbed_instance._elements[loss_guid]
-    channel = testbed_instance._elements[channel_guid]
-    channel.SetPropagationLossModel(loss)
-
-def connect_next_loss(testbed_instance, prev_guid, next_guid):
-    prev = testbed_instance._elements[prev_guid]
-    next = testbed_instance._elements[next_guid]
-    prev.SetNext(next)
-
-def connect_delay_channel(testbed_instance, delay_guid, channel_guid):
-    delay = testbed_instance._elements[delay_guid]
-    channel = testbed_instance._elements[channel_guid]
-    channel.SetPropagationDelayModel(delay)
-
-def connect_node_application(testbed_instance, node_guid, application_guid):
-    node = testbed_instance._elements[node_guid]
-    application = testbed_instance._elements[application_guid]
-    node.AddApplication(application)
-# works for ArpL3Protocol, Ipv4L3Protocol, UdpL4Protocol, TcpL4Protocol,
-# NscTcpL4Protocol, MobilityModel (every subclass), 
-# RoutingProtocol (every subclass)
-
-def connect_node_other(testbed_instance, node_guid, other_guid):
-    node = testbed_instance._elements[node_guid]
-    other = testbed_instance._elements[other_guid]
-    node.AggregateObject(other)
-
-def connect_fd(testbed_instance, fdnd_guid, cross_data):
-    fdnd = testbed_instance._elements[fdnd_guid]
-    endpoint = fdnd.GetEndpoint()
-    # XXX: check the method StringToBuffer of ns3::FileDescriptorNetDevice
-    # to see how the address should be decoded
-    address = endpoint.replace(":", "").decode('hex')[2:]
-    testbed_instance.set(fdnd_guid, "LinuxSocketAddress", address)
-    
-    # If it's a non-abstract socket, add the path
-    if not address.startswith('\x00'):
-        address = os.path.join( testbed_instance.root_directory, address )
-    
-    # Set tun standard contract attributes
-    testbed_instance.set(fdnd_guid, "tun_addr", address )
-    testbed_instance.set(fdnd_guid, "tun_proto", "fd")
-    testbed_instance.set(fdnd_guid, "tun_port", 0)
-    testbed_instance.set(fdnd_guid, "tun_key", "\xfa"*32) # unimportant, fds aren't encrypted
-
-def connect_tunchannel_fd(testbed_instance, tun_guid, fdnd_guid):
-    fdnd = testbed_instance._elements[fdnd_guid]
-    tun = testbed_instance._elements[tun_guid]
-
-    # XXX: check the method StringToBuffer of ns3::FileDescriptorNetDevice
-    # to see how the address should be decoded
-    endpoint = fdnd.GetEndpoint()
-    address = endpoint.replace(":", "").decode('hex')[2:]
-    testbed_instance.set(fdnd_guid, "LinuxSocketAddress", address)
-    
-    # Create socket pair to connect the FDND and the TunChannel with it
-    import socket
-    sock1, sock2 = socket.socketpair(
-        socket.AF_UNIX, socket.SOCK_SEQPACKET)
-
-    # Send one endpoint to the FDND
-    import passfd
-    import socket
-    sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
-    sock.connect(address)
-    passfd.sendfd(sock, sock1.fileno(), '0')
-    
-    # Store a reference to the endpoint to keep the socket alive
-    fdnd._endpoint_socket = sock1
-    
-    # Send the other endpoint to the TUN channel
-    tun.tun_socket = sock2
-    
-    # With this kind of tun_socket, NS3 will expect a PI header
-    # (sockets don't support the TUNGETIFF ioctl, so it will assume
-    # the default presence of PI headers)
-    tun.with_pi = True
-
-
-### Connector information ###
-
-connector_types = dict({
-    "node": dict({
-                "help": "Connector to a ns3::Node object (mandatory)",
-                "name": "node",
-                "max": 1,
-                "min": 1
-            }),
-    "devs": dict({
-                "help": "Connector to network interfaces",
-                "name": "devs",
-                "max": -1,
-                "min": 0
-            }),
-    "dev2": dict({
-                "help": "Connector to exactly two network interfaces (mandatory)",
-                "name": "dev2",
-                "max": 2,
-                "min": 2
-            }),
-    "dev": dict({
-                "help": "Connector to exactly one network interface (mandatory)",
-                "name": "dev",
-                "max": 1,
-                "min": 1
-            }),
-    "apps": dict({
-                "help": "Connector to applications", 
-                "name": "apps",
-                "max": -1,
-                "min": 0
-            }),
-    "protos": dict({
-                "help": "Connector to network stacks and protocols", 
-                "name": "protos",
-                "max": -1,
-                "min": 0
-            }),
-    "chan": dict({
-                "help": "Connector to a channel for the device (mandatory)", 
-                "name": "chan",
-                "max": 1,
-                "min": 1
-            }),
-    "queue": dict({
-                "help": "Connector to a queueing discipline (mandatory)", 
-                "name": "queue",
-                "max": 1,
-                "min": 1
-            }),
-    "err": dict({
-                "help": "Connector to an error model for the device", 
-                "name": "err",
-                "max": 1,
-                "min": 0
-            }),
-    "->fd": dict({
-                "help": "File descriptor receptor for devices with file descriptors",
-                "name": "->fd",
-                "max": 1,
-                "min": 0
-            }),
-    "fd->": dict({
-                "help": "File descriptor provider for devices with file descriptors",
-                "name": "fd->",
-                "max": 1,
-                "min": 0
-            }),
-    "phy": dict({
-                "help": "Connector to interconnect elements with a PHY wifi model", 
-                "name": "phy",
-                "max": 1,
-                "min": 0
-            }),
-    "phys": dict({
-                "help": "Connector to interconnect a wifi channel with PHY wifi models", 
-                "name": "phys",
-                "max": -1,
-                "min": 0
-            }),
-    "mac": dict({
-                "help": "Connector to interconnect a device with a MAC wifi model", 
-                "name": "mac",
-                "max": 1,
-                "min": 0
-            }),
-    "manager": dict({
-                "help": "Connector to interconnect a wifi device with a wifi manager", 
-                "name": "manager",
-                "max": 1,
-                "min": 0
-            }),
-    "delay": dict({
-                "help": "Connector to a delay model", 
-                "name": "delay",
-                "max": 1,
-                "min": 0
-            }),
-    "loss": dict({
-                "help": "Connector to a loss model", 
-                "name": "loss",
-                "max": 1,
-                "min": 0
-            }),
-    "prev": dict({
-                "help": "Connector to the previous loss model", 
-                "name": "prev",
-                "max": 1,
-                "min": 0
-            }),
-    "next": dict({
-                "help": "Connector to the next loss model", 
-                "name": "next",
-                "max": 1,
-                "min": 0
-            }),
-    "mobility": dict({
-                "help": "Connector to a mobility model for the node", 
-                "name": "mobility",
-                "max": 1,
-                "min": 0
-            }),
-    "tcp": dict({
-                "help": "ip-ip tunneling over TCP link", 
-                "name": "tcp",
-                "max": 1, 
-                "min": 0
-            }),
-    "udp": dict({
-                "help": "ip-ip tunneling over UDP datagrams", 
-                "name": "udp",
-                "max": 1, 
-                "min": 0
-            }),
-    })
-
-connections = [
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::BridgeNetDevice", "node" ),
-            "init_code": connect_node_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::CsmaNetDevice", "node" ),
-            "init_code": connect_node_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::EmuNetDevice", "node" ),
-            "init_code": connect_node_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::PointToPointNetDevice", "node" ),
-            "init_code": connect_node_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::SimpleNetDevice", "node" ),
-            "init_code": connect_node_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::FileDescriptorNetDevice", "node" ),
-            "init_code": connect_node_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::Node", "devs" ),
-            "to":   ( "ns3", "ns3::WifiNetDevice", "node" ),
-            "init_code": connect_node_device,   
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::DropTailQueue", "dev" ),
-            "to":   ( "ns3", "ns3::CsmaNetDevice", "queue" ),
-            "init_code": connect_queue_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::DropTailQueue", "dev" ),
-            "to":   ( "ns3", "ns3::EmuNetDevice", "queue" ),
-            "init_code": connect_queue_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::DropTailQueue", "dev" ),
-            "to":   ( "ns3", "ns3::PointToPointNetDevice", "queue" ),
-            "init_code": connect_queue_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::ArfWifiManager", "dev" ),
-            "to":   ( "ns3", "ns3::WifiNetDevice", "manager" ),  
-            "init_code": connect_manager_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::ConstantRateWifiManager", "dev" ),
-            "to":   ( "ns3", "ns3::WifiNetDevice", "manager" ),  
-            "init_code": connect_manager_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::YansWifiPhy", "dev" ),
-            "to":   ( "ns3", "ns3::WifiNetDevice", "phy" ),  
-            "init_code": connect_phy_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::QapWifiMac", "dev" ),
-            "to":   ( "ns3", "ns3::WifiNetDevice", "mac" ),
-            "init_code": connect_mac_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::QstaWifiMac", "dev" ),
-            "to":   ( "ns3", "ns3::WifiNetDevice", "mac" ),
-            "init_code": connect_mac_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::RateErrorModel", "dev" ),
-            "to":   ( "ns3", "ns3::CsmaNetDevice", "err" ),
-            "init_code": connect_errormodel_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::RateErrorModel", "dev" ),
-            "to":   ( "ns3", "ns3::PointToPointNetDevice", "err" ),
-            "init_code": connect_errormodel_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::ListErrorModel", "dev" ),
-            "to":   ( "ns3", "ns3::CsmaNetDevice", "err" ),
-            "init_code": connect_errormodel_device,
-            "can_cross": False
-    }),
-    dict({
-            "from": ( "ns3", "ns3::ListErrorModel", "dev" ),
-            "to":   ( "ns3", "ns3::PointToPointNetDevice", "err" ),
-            "init_code": connect_errormodel_device,
-            "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::NistErrorRateModel", "phy" ),        
-        "to":   ( "ns3", "ns3::YansWifiPhy", "err" ),
-        "init_code": connect_errormodel_phy,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::CsmaChannel", "devs" ),
-        "to":   ( "ns3", "ns3::CsmaNetDevice", "chan" ),
-        "init_code": connect_channel_device,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::PointToPointChannel", "dev2" ),
-        "to":   ( "ns3", "ns3::PointToPointNetDevice", "chan" ),
-        "init_code": connect_channel_device,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::SimpleChannel", "devs" ),
-        "to":   ( "ns3", "ns3::SimpleNetDevice", "chan" ),
-        "init_code": connect_simple_channel_device,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::YansWifiChannel", "phys" ),
-        "to":   ( "ns3", "ns3::YansWifiPhy", "chan" ),  
-        "init_code": connect_simple_channel_device,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::LogDistancePropagationLossModel", "prev" ),
-        "to":   ( "ns3", "ns3::YansWifiChannel", "loss" ),  
-        "init_code": connect_loss_channel,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::LogDistancePropagationLossModel", "prev" ),
-        "to":   ( "ns3", "ns3::LogDistancePropagationLossModel", "next" ),  
-        "init_code": connect_next_loss,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::ConstantSpeedPropagationDelayModel", "chan" ),
-        "to":   ( "ns3", "ns3::YansWifiChannel", "delay" ),  
-        "init_code": connect_delay_channel,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "apps" ),
-        "to":   ( "ns3", "ns3::OnOffApplication", "node" ),
-        "init_code": connect_node_application,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "apps" ),
-        "to":   ( "ns3", "ns3::PacketSink", "node" ),
-        "init_code": connect_node_application,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "apps" ),
-        "to":   ( "ns3", "ns3::UdpEchoClient", "node" ),
-        "init_code": connect_node_application,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "apps" ),
-        "to":   ( "ns3", "ns3::UdpEchoServer", "node" ),
-        "init_code": connect_node_application,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "apps" ),
-        "to":   ( "ns3", "ns3::V4Ping", "node" ),
-        "init_code": connect_node_application,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::ArpL3Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::Icmpv4L4Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::Icmpv6L4Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::Ipv4L3Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::Ipv6L3Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::UdpL4Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "protos" ),
-        "to":   ( "ns3", "ns3::TcpL4Protocol", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::ConstantAccelerationMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::ConstantPositionMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::ConstantVelocityMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::HierarchicalMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::RandomDirection2dMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::RandomWalk2dMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Node", "mobility" ),
-        "to":   ( "ns3", "ns3::RandomWaypointMobilityModel", "node" ),
-        "init_code": connect_node_other,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::FileDescriptorNetDevice", "->fd" ),
-        "to":   ( None, None, "fd->" ),
-        "init_code": connect_fd,
-        "can_cross": True
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Nepi::TunChannel", "fd->" ),
-        "to":   ( "ns3", "ns3::FileDescriptorNetDevice", "->fd" ),
-        "init_code": connect_tunchannel_fd,
-        "can_cross": False
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Nepi::TunChannel", "tcp"),
-        "to":   (None, None, "tcp"),
-        "init_code": functools.partial(crossconnect_tunchannel_peer_init,"tcp"),
-        "compl_code": functools.partial(crossconnect_tunchannel_peer_compl,"tcp"),
-        "can_cross": True
-    }),
-    dict({
-        "from": ( "ns3", "ns3::Nepi::TunChannel", "udp"),
-        "to":   (None, None, "udp"),
-        "init_code": functools.partial(crossconnect_tunchannel_peer_init,"udp"),
-        "compl_code": functools.partial(crossconnect_tunchannel_peer_compl,"udp"),
-        "can_cross": True
-    }),
-]
-
-traces = dict({
-    "p2ppcap": dict({
-                "name": "P2PPcapTrace",
-                "help": "Trace to sniff packets from a P2P network device"
-              }),
-    "p2pascii": dict({
-                "name": "P2PAsciiTrace",
-                "help": "Ascii trace from a P2P network device"
-              }),
-    "csmapcap_promisc": dict({
-                "name": "CsmaPromiscPcapTrace",
-                "help": "Trace to sniff packets from a Csma network device in promiscuous mode"
-              }),
-    "csmapcap": dict({
-                "name": "CsmaPcapTrace",
-                "help": "Trace to sniff packets from a Csma network device"
-              }),
-    "fdpcap": dict({
-                "name": "FileDescriptorPcapTrace",
-                "help": "Trace to sniff packets from a FileDescriptor network device"
-              }),
-    "yanswifipcap": dict({
-                "name": "YansWifiPhyPcapTrace",
-                "help": "Trace to sniff packets from a Wifi network device"
-              }),
-})
-
-factories_order = ["ns3::BasicEnergySource",
-    "ns3::WifiRadioEnergyModel",
-    "ns3::BSSchedulerRtps",
-    "ns3::BSSchedulerSimple",
-    "ns3::SubscriberStationNetDevice",
-    "ns3::BaseStationNetDevice",
-    "ns3::UdpTraceClient",
-    "ns3::UdpServer",
-    "ns3::UdpClient",
-    "ns3::FlowMonitor",
-    "ns3::Radvd",
-    "ns3::Ping6",
-    "ns3::flame::FlameProtocol",
-    "ns3::flame::FlameRtable",
-    "ns3::dot11s::AirtimeLinkMetricCalculator",
-    "ns3::dot11s::HwmpProtocol",
-    "ns3::dot11s::HwmpRtable",
-    "ns3::dot11s::PeerManagementProtocol",
-    "ns3::dot11s::PeerLink",
-    "ns3::MeshWifiInterfaceMac",
-    "ns3::MeshPointDevice",
-    "ns3::UanMacRcGw",
-    "ns3::UanMacRc",
-    "ns3::UanPhyCalcSinrDual",
-    "ns3::UanPhyPerGenDefault",
-    "ns3::UanPhyDual",
-    "ns3::UanPropModelThorp",
-    "ns3::UanMacCw",
-    "ns3::UanNoiseModelDefault",
-    "ns3::UanMacAloha",
-    "ns3::UanPropModelIdeal",
-    "ns3::UanTransducerHd",
-    "ns3::UanPhyCalcSinrDefault",
-    "ns3::UanPhyGen",
-    "ns3::UanPhyCalcSinrFhFsk",
-    "ns3::UanPhyPerUmodem",
-    "ns3::UanChannel",
-    "ns3::V4Ping",
-    "ns3::AthstatsWifiTraceSink",
-    "ns3::FlameStack",
-    "ns3::Dot11sStack",
-    "ns3::NonCommunicatingNetDevice",
-    "ns3::HalfDuplexIdealPhy",
-    "ns3::AlohaNoackNetDevice",
-    "ns3::SpectrumAnalyzer",
-    "ns3::WaveformGenerator",
-    "ns3::MultiModelSpectrumChannel",
-    "ns3::SingleModelSpectrumChannel",
-    "ns3::MsduStandardAggregator",
-    "ns3::EdcaTxopN",
-    "ns3::QstaWifiMac",
-    "ns3::QapWifiMac",
-    "ns3::QadhocWifiMac",
-    "ns3::MinstrelWifiManager",
-    "ns3::CaraWifiManager",
-    "ns3::AarfcdWifiManager",
-    "ns3::OnoeWifiManager",
-    "ns3::AmrrWifiManager",
-    "ns3::ConstantRateWifiManager",
-    "ns3::IdealWifiManager",
-    "ns3::AarfWifiManager",
-    "ns3::ArfWifiManager",
-    "ns3::WifiNetDevice",
-    "ns3::NqstaWifiMac",
-    "ns3::NqapWifiMac",
-    "ns3::AdhocWifiMac",
-    "ns3::DcaTxop",
-    "ns3::WifiMacQueue",
-    "ns3::YansWifiChannel",
-    "ns3::YansWifiPhy",
-    "ns3::NistErrorRateModel",
-    "ns3::YansErrorRateModel",
-    "ns3::WaypointMobilityModel",
-    "ns3::ConstantAccelerationMobilityModel",
-    "ns3::RandomDirection2dMobilityModel",
-    "ns3::RandomWalk2dMobilityModel",
-    "ns3::SteadyStateRandomWaypointMobilityModel",
-    "ns3::RandomWaypointMobilityModel",
-    "ns3::GaussMarkovMobilityModel",
-    "ns3::ConstantVelocityMobilityModel",
-    "ns3::ConstantPositionMobilityModel",
-    "ns3::ListPositionAllocator",
-    "ns3::GridPositionAllocator",
-    "ns3::RandomRectanglePositionAllocator",
-    "ns3::RandomBoxPositionAllocator",
-    "ns3::RandomDiscPositionAllocator",
-    "ns3::UniformDiscPositionAllocator",
-    "ns3::HierarchicalMobilityModel",
-    "ns3::aodv::RoutingProtocol",
-    "ns3::UdpEchoServer",
-    "ns3::UdpEchoClient",
-    "ns3::PacketSink",
-    "ns3::OnOffApplication",
-    "ns3::VirtualNetDevice",
-    "ns3::FileDescriptorNetDevice",
-    "ns3::Nepi::TunChannel",
-    "ns3::TapBridge",
-    "ns3::BridgeChannel",
-    "ns3::BridgeNetDevice",
-    "ns3::EmuNetDevice",
-    "ns3::CsmaChannel",
-    "ns3::CsmaNetDevice",
-    "ns3::PointToPointRemoteChannel",
-    "ns3::PointToPointChannel",
-    "ns3::PointToPointNetDevice",
-    "ns3::NscTcpL4Protocol",
-    "ns3::Icmpv6L4Protocol",
-    "ns3::Ipv6OptionPad1",
-    "ns3::Ipv6OptionPadn",
-    "ns3::Ipv6OptionJumbogram",
-    "ns3::Ipv6OptionRouterAlert",
-    "ns3::Ipv6ExtensionHopByHop",
-    "ns3::Ipv6ExtensionDestination",
-    "ns3::Ipv6ExtensionFragment",
-    "ns3::Ipv6ExtensionRouting",
-    "ns3::Ipv6ExtensionLooseRouting",
-    "ns3::Ipv6ExtensionESP",
-    "ns3::Ipv6ExtensionAH",
-    "ns3::Ipv6L3Protocol",
-    "ns3::LoopbackNetDevice",
-    "ns3::Icmpv4L4Protocol",
-    "ns3::RttMeanDeviation",
-    "ns3::ArpL3Protocol",
-    "ns3::TcpL4Protocol",
-    "ns3::UdpL4Protocol",
-    "ns3::Ipv4L3Protocol",
-    "ns3::SimpleNetDevice",
-    "ns3::SimpleChannel",
-    "ns3::PacketSocket",
-    "ns3::DropTailQueue",
-    "ns3::Node",
-    "ns3::FriisSpectrumPropagationLossModel",
-    "ns3::Cost231PropagationLossModel",
-    "ns3::JakesPropagationLossModel",
-    "ns3::RandomPropagationLossModel",
-    "ns3::FriisPropagationLossModel",
-    "ns3::TwoRayGroundPropagationLossModel",
-    "ns3::LogDistancePropagationLossModel",
-    "ns3::ThreeLogDistancePropagationLossModel",
-    "ns3::NakagamiPropagationLossModel",
-    "ns3::FixedRssLossModel",
-    "ns3::MatrixPropagationLossModel",
-    "ns3::RangePropagationLossModel",
-    "ns3::RandomPropagationDelayModel",
-    "ns3::ConstantSpeedPropagationDelayModel",
-    "ns3::RateErrorModel",
-    "ns3::ListErrorModel",
-    "ns3::ReceiveListErrorModel",
-    "ns3::PacketBurst",
-    "ns3::EnergySourceContainer"
- ]
-
-testbed_attributes = dict({
-     "simu_impl_type": dict({
-            "name": "SimulatorImplementationType",
-            "help": "The object class to use as the simulator implementation",
-            "type": Attribute.STRING,
-            "flags": Attribute.DesignOnly,
-            "validation_function": validation.is_string
-        }),
-      "checksum": dict({
-            "name": "ChecksumEnabled",
-            "help": "A global switch to enable all checksums for all protocols",
-            "type": Attribute.BOOL,
-            "value": False,
-            "flags": Attribute.DesignOnly,
-            "validation_function": validation.is_bool
-        }),
-})
 
 class VersionedMetadataInfo(metadata.VersionedMetadataInfo):
     @property
     def connector_types(self):
+        from connection_metadata_v3_9_RC3 import connector_types
         return connector_types
 
     @property
     def connections(self):
+        from connection_metadata_v3_9_RC3 import connections
         return connections
 
     @property
@@ -803,14 +21,17 @@ class VersionedMetadataInfo(metadata.VersionedMetadataInfo):
 
     @property
     def traces(self):
+        from traces_metadata_v3_9_RC3 import traces
         return traces
 
     @property
     def create_order(self):
+        from factories_metadata_v3_9_RC3 import factories_order
         return factories_order
 
     @property
     def configure_order(self):
+        from factories_metadata_v3_9_RC3 import factories_order
         return factories_order
 
     @property
@@ -820,5 +41,6 @@ class VersionedMetadataInfo(metadata.VersionedMetadataInfo):
 
     @property
     def testbed_attributes(self):
+        from attributes_metadata_v3_9_RC3 import testbed_attributes
         return testbed_attributes
 
diff --git a/src/nepi/testbeds/ns3/traces_metadata_v3_9_RC3.py b/src/nepi/testbeds/ns3/traces_metadata_v3_9_RC3.py
new file mode 100644 (file)
index 0000000..9fe457f
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+traces = dict({
+    "p2ppcap": dict({
+                "name": "P2PPcapTrace",
+                "help": "Trace to sniff packets from a P2P network device"
+              }),
+    "p2pascii": dict({
+                "name": "P2PAsciiTrace",
+                "help": "Ascii trace from a P2P network device"
+              }),
+    "csmapcap_promisc": dict({
+                "name": "CsmaPromiscPcapTrace",
+                "help": "Trace to sniff packets from a Csma network device in promiscuous mode"
+              }),
+    "csmapcap": dict({
+                "name": "CsmaPcapTrace",
+                "help": "Trace to sniff packets from a Csma network device"
+              }),
+    "fdpcap": dict({
+                "name": "FileDescriptorPcapTrace",
+                "help": "Trace to sniff packets from a FileDescriptor network device"
+              }),
+    "yanswifipcap": dict({
+                "name": "YansWifiPhyPcapTrace",
+                "help": "Trace to sniff packets from a Wifi network device"
+              }),
+    "wimaxpcap": dict({
+                "name": "WimaxPcapTrace",
+                "help": "Trace to sniff packets from a wimax network station"
+              }),
+    "wimaxascii": dict({
+                "name": "WimaxAsciiTrace",
+                "help": "Ascii trace from a wimax network station"
+              }),
+})