'family' attribute removed from address. also max_addresses is no longer an attribute...
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Tue, 22 Mar 2011 10:37:05 +0000 (11:37 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Tue, 22 Mar 2011 10:37:05 +0000 (11:37 +0100)
16 files changed:
src/nepi/core/attributes.py
src/nepi/core/design.py
src/nepi/core/execute.py
src/nepi/core/metadata.py
src/nepi/core/testbed_impl.py
src/nepi/testbeds/netns/execute.py
src/nepi/testbeds/netns/metadata_v01.py
src/nepi/testbeds/ns3/attributes_metadata_v3_9_RC3.py
src/nepi/testbeds/ns3/execute.py
src/nepi/util/parser/_xml.py
src/nepi/util/parser/base.py
src/nepi/util/proxy.py
src/nepi/util/validation.py
test/testbeds/netns/design.py
test/testbeds/netns/execute.py
test/testbeds/ns3/design.py

index f82fbae..0f0b6fc 100644 (file)
@@ -35,7 +35,7 @@ class Attribute(object):
         allowed = None, flags = NoFlags, validation_function = None):
         if not type in Attribute.types:
             raise AttributeError("invalid type %s " % type)
-        self.name = name
+        self._name = name
         self._type = type
         self._help = help
         self._value = value
@@ -47,6 +47,10 @@ class Attribute(object):
         self._validation_function = validation_function
         self._modified = False
 
+    @property
+    def name(self):
+        return self._name
+
     @property
     def type(self):
         return self._type
index 67ed62d..3ef4a0d 100644 (file)
@@ -8,7 +8,6 @@ Experiment design API
 from nepi.core.attributes import AttributesMap, Attribute
 from nepi.core.metadata import Metadata
 from nepi.util import validation
-from nepi.util.constants import AF_INET, AF_INET6
 from nepi.util.guid import GuidGenerator
 from nepi.util.graphical_info import GraphicalInfo
 from nepi.util.parser._xml import XmlExperimentParser
@@ -151,7 +150,7 @@ class Trace(AttributesMap):
         return self._help
 
 class Address(AttributesMap):
-    def __init__(self, family):
+    def __init__(self):
         super(Address, self).__init__()
         self.add_attribute(name = "AutoConfigure", 
                 help = "If set, this address will automatically be assigned", 
@@ -159,60 +158,42 @@ class Address(AttributesMap):
                 value = False,
                 flags = Attribute.DesignOnly,
                 validation_function = validation.is_bool)
-        self.add_attribute(name = "Family",
-                help = "Address family type: AF_INET, AFT_INET6", 
-                type = Attribute.INTEGER, 
-                value = family,
-                flags = Attribute.ReadOnly | Attribute.HasNoDefaultValue,
-                validation_function = validation.is_integer)
-        address_validation = validation.is_ip4_address if family == AF_INET \
-                        else validation.is_ip6_address
         self.add_attribute(name = "Address",
                 help = "Address number", 
                 type = Attribute.STRING,
                 flags = Attribute.HasNoDefaultValue,
-                validation_function = address_validation)
-        prefix_range = (0, 32) if family == AF_INET else (0, 128)
+                validation_function = validation.is_ip_address)
         self.add_attribute(name = "NetPrefix",
                 help = "Network prefix for the address", 
                 type = Attribute.INTEGER, 
-                range = prefix_range,
-                value = 24 if family == AF_INET else 64,
+                range = (0, 128),
+                value = 24,
                 flags = Attribute.HasNoDefaultValue,
                 validation_function = validation.is_integer)
-        if family == AF_INET:
-            self.add_attribute(name = "Broadcast",
-                    help = "Broadcast address", 
-                    type = Attribute.STRING,
-                    validation_function = validation.is_ip4_address)
+        self.add_attribute(name = "Broadcast",
+                help = "Broadcast address", 
+                type = Attribute.STRING,
+                validation_function = validation.is_ip4_address)
                 
 class Route(AttributesMap):
-    def __init__(self, family):
+    def __init__(self):
         super(Route, self).__init__()
-        self.add_attribute(name = "Family",
-                help = "Address family type: AF_INET, AFT_INET6", 
-                type = Attribute.INTEGER, 
-                value = family,
-                flags = Attribute.ReadOnly | Attribute.HasNoDefaultValue,
-                validation_function = validation.is_integer)
-        address_validation = validation.is_ip4_address if family == AF_INET \
-                        else validation.is_ip6_address
         self.add_attribute(name = "Destination", 
                 help = "Network destintation",
                 type = Attribute.STRING, 
-                validation_function = address_validation)
-        prefix_range = (0, 32) if family == AF_INET else (0, 128)
+                validation_function = validation.is_ip_address)
         self.add_attribute(name = "NetPrefix",
                 help = "Network destination prefix", 
                 type = Attribute.INTEGER, 
+                prefix_range = (0,128),
+                value = 24,
                 flags = Attribute.HasNoDefaultValue,
-                prefix_range = prefix_range,
                 validation_function = validation.is_integer)
         self.add_attribute(name = "NextHop",
                 help = "Address for the next hop", 
                 type = Attribute.STRING,
                 flags = Attribute.HasNoDefaultValue,
-                validation_function = address_validation)
+                validation_function = validation.is_ip_address)
 
 class Box(AttributesMap):
     def __init__(self, guid, factory, testbed_guid, container = None):
@@ -312,9 +293,7 @@ class AddressableBox(Box):
     def __init__(self, guid, factory, testbed_guid, container = None):
         super(AddressableBox, self).__init__(guid, factory, testbed_guid, 
                 container)
-        self._family = factory.get_attribute_value("Family")
-        # maximum number of addresses this box can have
-        self._max_addresses = factory.get_attribute_value("MaxAddresses")
+        self._max_addresses = 1 # TODO: How to make this configurable!
         self._addresses = list()
 
     @property
@@ -328,7 +307,7 @@ class AddressableBox(Box):
     def add_address(self):
         if len(self._addresses) == self.max_addresses:
             raise RuntimeError("Maximun number of addresses for this box reached.")
-        address = Address(family = self._family)
+        address = Address()
         self._addresses.append(address)
         return address
 
@@ -351,8 +330,8 @@ class RoutingTableBox(Box):
     def routes(self):
         return self._routes
 
-    def add_route(self, family):
-        route = Route(family = family)
+    def add_route(self):
+        route = Route()
         self._routes.append(route)
         return route
 
index 97402c9..a796bc4 100644 (file)
@@ -189,7 +189,7 @@ class TestbedInstance(object):
     def add_trace(self, guid, trace_id):
         raise NotImplementedError
 
-    def add_address(self, guid, family, address, netprefix, broadcast): 
+    def add_address(self, guid, address, netprefix, broadcast): 
         raise NotImplementedError
 
     def add_route(self, guid, destination, netprefix, nexthop):
@@ -328,12 +328,10 @@ class ExperimentController(object):
                         other_testbed_id, other_factory_id, other_connector_type_name)
             for trace_id in data.get_trace_data(guid):
                 testbed.add_trace(guid, trace_id)
-            for (autoconf, address, family, netprefix, broadcast) in \
+            for (autoconf, address, netprefix, broadcast) in \
                     data.get_address_data(guid):
                 if address != None:
-                    testbed.add_address(guid, family, address, netprefix,
-                        broadcast)
-            for (family, destination, netprefix, nexthop) in \
-                    data.get_route_data(guid):
+                    testbed.add_address(guid, address, netprefix, broadcast)
+            for (destination, netprefix, nexthop) in data.get_route_data(guid):
                 testbed.add_route(guid, destination, netprefix, nexthop)
 
index 953a3d8..16bb781 100644 (file)
@@ -190,8 +190,9 @@ class Metadata(object):
                 value = attribute_info["value"]
                 range = attribute_info["range"]
                 allowed = attribute_info["allowed"]
-                flags =  attribute_info["flags"] if "flags" in attribute_info \
-                    else Attribute.NoFlags
+                flags = attribute_info["flags"] if "flags" in attribute_info \
+                        and attribute_info["flags"] != None \
+                        else Attribute.NoFlags
                 validation_function = attribute_info["validation_function"]
                 if box_attributes:
                     factory.add_box_attribute(name, help, type, value, range, 
index 26b70ef..36e8b1f 100644 (file)
@@ -137,7 +137,7 @@ class TestbedInstance(execute.TestbedInstance):
             self._add_trace[guid] = list()
         self._add_trace[guid].append(trace_id)
 
-    def add_address(self, guid, family, address, netprefix, broadcast):
+    def add_address(self, guid, address, netprefix, broadcast):
         if not guid in self._create:
             raise RuntimeError("Element guid %d doesn't exist" % guid)
         factory_id = self._create[guid]
@@ -145,15 +145,15 @@ class TestbedInstance(execute.TestbedInstance):
         if not factory.allow_addresses:
             raise RuntimeError("Element type '%s' doesn't support addresses" %
                     factory_id)
-        max_addresses = factory.get_attribute_value("MaxAddresses")
+            max_addresses = 1 # TODO: MAKE THIS PARAMETRIZABLE
         if guid in self._add_address:
             count_addresses = len(self._add_address[guid])
             if max_addresses == count_addresses:
                 raise RuntimeError("Element guid %d of type '%s' can't accept \
-                        more addresses" % (guid, family_id))
+                        more addresses" % (guid, factory_id))
         else:
             self._add_address[guid] = list()
-        self._add_address[guid].append((family, address, netprefix, broadcast))
+        self._add_address[guid].append((address, netprefix, broadcast))
 
     def add_route(self, guid, destination, netprefix, nexthop):
         if not guid in self._create:
index e19f737..70a64b4 100644 (file)
@@ -3,7 +3,6 @@
 
 from constants import TESTBED_ID
 from nepi.core import testbed_impl
-from nepi.util.constants import AF_INET, AF_INET6
 import os
 
 class TestbedInstance(testbed_impl.TestbedInstance):
@@ -32,9 +31,9 @@ class TestbedInstance(testbed_impl.TestbedInstance):
         for guid, addresses in self._add_address.iteritems():
             element = self._elements[guid]
             for address in addresses:
-                (family, address, netprefix, broadcast) = address
-                if family == AF_INET:
-                    element.add_v4_address(address, netprefix)
+                (address, netprefix, broadcast) = address
+                # TODO: Decide if we should add a ipv4 or ipv6 address
+                element.add_v4_address(address, netprefix)
         # configure routes
         for guid, routes in self._add_route.iteritems():
             element = self._elements[guid]
index 0f39b9e..04b1847 100644 (file)
@@ -5,7 +5,7 @@ from constants import TESTBED_ID
 from nepi.core import metadata
 from nepi.core.attributes import Attribute
 from nepi.util import validation
-from nepi.util.constants import AF_INET, STATUS_NOT_STARTED, STATUS_RUNNING, \
+from nepi.util.constants import STATUS_NOT_STARTED, STATUS_RUNNING, \
         STATUS_FINISHED
 
 NODE = "Node"
@@ -325,26 +325,6 @@ attributes = dict({
                 "flags": Attribute.DesignOnly,
                 "validation_function": validation.is_string
             }),
-     "max_addresses": dict({
-                "name": "MaxAddresses",
-                "help": "Maximum number of addresses allowed by the device",
-                "type": Attribute.INTEGER,
-                "value": None,
-                "range": None,
-                "allowed": None,
-                "flags": Attribute.Invisible,
-                "validation_function": validation.is_integer
-            }),
-     "family": dict({
-                "name": "Family",
-                "help": "IP address family",
-                "type": Attribute.INTEGER,
-                "value": AF_INET,
-                "range": None,
-                "allowed": None,
-                "flags": Attribute.Invisible,
-                "validation_function": validation.is_integer
-            }),
     })
 
 traces = dict({
@@ -381,7 +361,7 @@ factories_info = dict({
             "start_function": None,
             "stop_function": None,
             "status_function": None,
-            "factory_attributes": ["family", "max_addresses"],
+            "factory_attributes": [],
             "box_attributes": ["lladdr", "up", "device_name", "mtu", 
                 "multicast", "broadcast", "arp"],
             "connector_types": ["node", "p2p"]
@@ -394,7 +374,7 @@ factories_info = dict({
             "start_function": None,
             "stop_function": None,
             "status_function": None,
-            "factory_attributes": ["family", "max_addresses"],
+            "factory_attributes": [],
             "box_attributes": ["lladdr", "up", "device_name", "mtu", 
                 "multicast", "broadcast", "arp"],
             "connector_types": ["node", "fd"]
@@ -407,7 +387,7 @@ factories_info = dict({
             "start_function": None,
             "stop_function": None,
             "status_function": None,
-            "factory_attributes": ["family", "max_addresses"],
+            "factory_attributes": [],
             "box_attributes": ["lladdr", "up", "device_name", "mtu", 
                 "multicast", "broadcast", "arp"],
             "connector_types": ["node", "switch"]
index 7748904..2964ca4 100644 (file)
@@ -3364,24 +3364,4 @@ attributes = dict({
         "type": Attribute.STRING,
         "help": "When this timeout expires, the RTS/CTS handshake has failed."
     }),
-    "max_addresses": dict({
-        "name": "MaxAddresses",
-        "help": "Maximum number of addresses allowed by the device",
-        "type": Attribute.INTEGER,
-        "value": None,
-        "range": None,
-        "allowed": None,
-        "flags": Attribute.Invisible,
-        "validation_function": validation.is_integer
-    }),
-    "family": dict({
-        "name": "Family",
-        "help": "IP address family",
-        "type": Attribute.INTEGER,
-        "value": AF_INET,
-        "range": None,
-        "allowed": None,
-        "flags": Attribute.Invisible,
-        "validation_function": validation.is_integer
-     }), 
 })
index 6bb58dc..036d391 100644 (file)
@@ -4,7 +4,6 @@
 from constants import TESTBED_ID
 from nepi.core import testbed_impl
 from nepi.core.attributes import Attribute
-from nepi.util.constants import AF_INET, AF_INET6
 import os
 
 class TestbedInstance(testbed_impl.TestbedInstance):
@@ -32,10 +31,8 @@ class TestbedInstance(testbed_impl.TestbedInstance):
         for guid, addresses in self._add_address.iteritems():
             element = self._elements[guid]
             for address in addresses:
-                (family, address, netprefix, broadcast) = address
-                if family == AF_INET:
-                    pass
-                    # TODO!!!
+                (address, netprefix, broadcast) = address
+                # TODO!!!
         # configure routes
         for guid, routes in self._add_route.iteritems():
             element = self._elements[guid]
index 4f47e93..b3241cd 100644 (file)
@@ -95,7 +95,7 @@ class XmlExperimentParser(ExperimentParser):
 
     def addresses_data_to_xml(self, doc, parent_tag, guid, data):
         addresses_tag = doc.createElement("addresses") 
-        for (autoconfigure, address, family, netprefix, broadcast) \
+        for (autoconfigure, address, netprefix, broadcast) \
                 in data.get_address_data(guid):
             address_tag = doc.createElement("address") 
             addresses_tag.appendChild(address_tag)
@@ -103,7 +103,6 @@ class XmlExperimentParser(ExperimentParser):
                 address_tag.setAttribute("AutoConfigure", str(autoconf))
             if address:
                 address_tag.setAttribute("Address", str(address))
-            address_tag.setAttribute("Family", str(family))
             address_tag.setAttribute("NetPrefix", str(netprefix))
             if broadcast:
                 address_tag.setAttribute("Broadcast", str(broadcast))
@@ -112,11 +111,10 @@ class XmlExperimentParser(ExperimentParser):
 
     def routes_data_to_xml(self, doc, parent_tag, guid, data):
         routes_tag = doc.createElement("routes") 
-        for (family, destination, netprefix, nexthop) \
+        for (destination, netprefix, nexthop) \
                 in data.get_route_data(guid):
             route_tag = doc.createElement("route") 
             routes_tag.appendChild(route_tag)
-            route_tag.setAttribute("Family", str(family))
             route_tag.setAttribute("Destination", str(destination))
             route_tag.setAttribute("NetPrefix", str(netprefix))
             route_tag.setAttribute("NextHop", str(nexthop))
@@ -248,14 +246,12 @@ class XmlExperimentParser(ExperimentParser):
                        if address_tag.hasAttribute("AutoConfigure") else None
                 address = str(address_tag.getAttribute("Address")) \
                        if address_tag.hasAttribute("Address") else None
-                family = int(address_tag.getAttribute("Family")) \
-                       if address_tag.hasAttribute("Family") else None
                 netprefix = int(address_tag.getAttribute("NetPrefix")) \
                        if address_tag.hasAttribute("NetPrefix") else None
                 broadcast = str(address_tag.getAttribute("Broadcast")) \
                        if address_tag.hasAttribute("Broadcast") else None
-                data.add_address_data(guid, autoconf, address, family
-                    netprefix, broadcast)
+                data.add_address_data(guid, autoconf, address, netprefix
+                        broadcast)
 
     def routes_data_from_xml(self, tag, guid, data):
         routes_tag_list = tag.getElementsByTagName("routes")
@@ -265,11 +261,10 @@ class XmlExperimentParser(ExperimentParser):
         route_tag_list = routes_tag_list[0].getElementsByTagName("route")
         for route_tag in route_tag_list:
             if route_tag.nodeType == tag.ELEMENT_NODE:
-                family = int(route_tag.getAttribute("Family"))
                 destination = str(route_tag.getAttribute("Destination"))
                 netprefix = int(route_tag.getAttribute("NetPrefix"))
                 nexthop = str(route_tag.getAttribute("NextHop"))
-                data.add_route_data(guid, family, destination, netprefix, 
+                data.add_route_data(guid, destination, netprefix, 
                         nexthop)
 
     def connections_data_from_xml(self, tag, guid, data):
index 4dff0e9..b695745 100644 (file)
@@ -66,7 +66,7 @@ class ExperimentData(object):
         connection_data = connections_data[connector_type_name]
         connection_data[other_guid] = other_connector_type_name
 
-    def add_address_data(self, guid, autoconf, address, family, netprefix, 
+    def add_address_data(self, guid, autoconf, address, netprefix, 
             broadcast):
         data = self.data[guid]
         if not "addresses" in data:
@@ -77,19 +77,17 @@ class ExperimentData(object):
             address_data["AutoConfigure"] = autoconf
         if address:
             address_data["Address"] = address
-        address_data["Family"] = family
         address_data["NetPrefix"] = netprefix
         if broadcast:
             address_data["Broadcast"] = broadcast
         addresses_data.append(address_data)
 
-    def add_route_data(self, guid, family, destination, netprefix, nexthop): 
+    def add_route_data(self, guid, destination, netprefix, nexthop): 
         data = self.data[guid]
         if not "routes" in data:
             data["routes"] = list()
         routes_data = data["routes"]
         route_data = dict({
-            "Family": family, 
             "Destination": destination,
             "NetPrefix": netprefix, 
             "NextHop": nexthop 
@@ -158,7 +156,6 @@ class ExperimentData(object):
         addresses_data = data["addresses"]
         return [(data["AutoConfigure"] if "AutoConfigure" in data else None,
                  data["Address"] if "Address" in data else None,
-                 data["Family"] if "Family" in data else None,
                  data["NetPrefix"] if "NetPrefix" in data else None,
                  data["Broadcast"] if "Broadcast" in data else None) \
                  for data in addresses_data]
@@ -168,8 +165,7 @@ class ExperimentData(object):
         if not "routes" in data:
             return []
         routes_data = data["routes"]
-        return [(data["Family"],
-                 data["Destination"],
+        return [(data["Destination"],
                  data["NetPrefix"],
                  data["NextHop"]) \
                          for data in routes_data]
@@ -229,20 +225,18 @@ class ExperimentParser(object):
              autoconf = addr.get_attribute_value("AutoConfigure")
              address = addr.get_attribute_value("Address")
              netprefix = addr.get_attribute_value("NetPrefix")
-             family = addr.get_attribute_value("Family")
              broadcast = addr.get_attribute_value("Broadcast") \
                     if addr.has_attribute("Broadcast") and \
                     addr.is_attribute_modified("Broadcast") else None
-             data.add_address_data(guid, autoconf, address, family, netprefix, 
+             data.add_address_data(guid, autoconf, address, netprefix, 
                     broadcast)
 
     def routes_to_data(self, data, guid, routes):
         for route in routes:
-             family = route.get_attribute_value("Family")
              destination = route.get_attribute_value("Destination")
              netprefix = route.get_attribute_value("NetPrefix")
              nexthop = route.get_attribute_value("NextHop")
-             data.add_route_data(guid, family, destination, netprefix, nexthop)
+             data.add_route_data(guid, destination, netprefix, nexthop)
 
     def from_data(self, experiment_description, data):
         box_guids = list()
@@ -299,24 +293,22 @@ class ExperimentParser(object):
             box.enable_trace(name)
 
     def addresses_from_data(self, box, data):
-        for (autoconf, address, family, netprefix, broadcast) \
+        for (autoconf, address, netprefix, broadcast) \
                 in data.get_address_data(box.guid):
             addr = box.add_address()
             if autoconf:
                 addr.set_attribute_value("AutoConfigure", autoconf)
             if address:
                 addr.set_attribute_value("Address", address)
-            if family != None:
-                addr.set_attribute_value("Family", family)
             if netprefix != None:
                 addr.set_attribute_value("NetPrefix", netprefix)
             if broadcast:
                 addr.set_attribute_value("Broadcast", broadcast)
 
     def routes_from_data(self, box, data):
-         for (family, destination, netprefix, nexthop) \
+         for (destination, netprefix, nexthop) \
                  in data.get_route_data(box.guid):
-            addr = box.add_route(family)
+            addr = box.add_route()
             addr.set_attribute_value("Destination", destination)
             addr.set_attribute_value("NetPrefix", netprefix)
             addr.set_attribute_value("NextHop", nexthop)
index c3b98b4..3f4e219 100644 (file)
@@ -71,7 +71,7 @@ testbed_messages = dict({
     CONNECT: "%d|%s" % (CONNECT, "%d|%s|%d|%s"),
     CROSS_CONNECT: "%d|%s" % (CROSS_CONNECT, "%d|%s|%d|%d|%s|%s"),
     ADD_TRACE: "%d|%s" % (ADD_TRACE, "%d|%s"),
-    ADD_ADDRESS: "%d|%s" % (ADD_ADDRESS, "%d|%d|%s|%d|%s"),
+    ADD_ADDRESS: "%d|%s" % (ADD_ADDRESS, "%d|%s|%d|%s"),
     ADD_ROUTE: "%d|%s" % (ADD_ROUTE, "%d|%s|%d|%s"),
     DO_SETUP:   "%d" % DO_SETUP,
     DO_CREATE:  "%d" % DO_CREATE,
@@ -439,11 +439,10 @@ class TestbedInstanceServer(server.Server):
 
     def add_address(self, params):
         guid = int(params[1])
-        family = int(params[2])
-        address = params[3]
-        netprefix = int(params[4])
-        broadcast = params[5]
-        self._testbed.add_address(guid, family, address, netprefix,
+        address = params[2]
+        netprefix = int(params[3])
+        broadcast = params[4]
+        self._testbed.add_address(guid, address, netprefix,
                 broadcast)
         return "%d|%s" % (OK, "")
 
@@ -731,9 +730,9 @@ class TestbedIntanceProxy(object):
         if code == ERROR:
             raise RuntimeError(text)
 
-    def add_address(self, guid, family, address, netprefix, broadcast): 
+    def add_address(self, guid, address, netprefix, broadcast): 
         msg = testbed_messages[ADD_ADDRESS]
-        msg = msg % (guid, family, address, netprefix, broadcast)
+        msg = msg % (guid, address, netprefix, broadcast)
         self._client.send_msg(msg)
         reply = self._client.read_reply()
         result = reply.split("|")
index 485d5da..13a067a 100644 (file)
@@ -22,7 +22,6 @@ def is_string(attribute, value):
 def is_time(attribute, value):
     return isinstance(value, str) # TODO: Missing validation!
 
-# TODO: Allow netrefs!
 def is_ip4_address(attribute, value):
     try:
         ipaddr.IPv4Address(value)
@@ -30,7 +29,6 @@ def is_ip4_address(attribute, value):
         return False
     return True
 
-# TODO: Allow netrefs!
 def is_ip6_address(attribute, value):
     try:
         ipaddr.IPv6Address(value)
@@ -38,6 +36,13 @@ def is_ip6_address(attribute, value):
         return False
     return True
 
+# TODO: Allow netrefs!
+def is_ip_address(attribute, value):
+    if not is_ip4_address(attribute, value) and \
+            not is_ip6_address(attribute, value):
+        return False
+    return True
+
 def is_mac_address(attribute, value):
     regex = r'^([0-9a-zA-Z]{0,2}:)*[0-9a-zA-Z]{0,2}'
     found = re.search(regex, value)
index b4e6c69..b68d0d5 100755 (executable)
@@ -2,7 +2,6 @@
 # -*- coding: utf-8 -*-
 
 from nepi.core.design import ExperimentDescription, FactoriesProvider
-from nepi.core.design import AF_INET
 import os
 import shutil
 import test_util
index cf3579e..148df22 100755 (executable)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 import getpass
-from nepi.util.constants import AF_INET, STATUS_FINISHED
+from nepi.util.constants import STATUS_FINISHED
 from nepi.testbeds import netns
 import os
 import shutil
@@ -26,11 +26,11 @@ class NetnsExecuteTestCase(unittest.TestCase):
         instance.create(4, "NodeInterface")
         instance.create_set(4, "up", True)
         instance.connect(2, "devs", 4, "node")
-        instance.add_address(4, AF_INET, "10.0.0.1", 24, None)
+        instance.add_address(4, "10.0.0.1", 24, None)
         instance.create(5, "NodeInterface")
         instance.create_set(5, "up", True)
         instance.connect(3, "devs", 5, "node")
-        instance.add_address(5, AF_INET, "10.0.0.2", 24, None)
+        instance.add_address(5, "10.0.0.2", 24, None)
         instance.create(6, "Switch")
         instance.create_set(6, "up", True)
         instance.connect(4, "switch", 6, "devs")
@@ -69,11 +69,11 @@ class NetnsExecuteTestCase(unittest.TestCase):
         instance.create(4, "P2PNodeInterface")
         instance.create_set(4, "up", True)
         instance.connect(2, "devs", 4, "node")
-        instance.add_address(4, AF_INET, "10.0.0.1", 24, None)
+        instance.add_address(4, "10.0.0.1", 24, None)
         instance.create(5, "P2PNodeInterface")
         instance.create_set(5, "up", True)
         instance.connect(3, "devs", 5, "node")
-        instance.add_address(5, AF_INET, "10.0.0.2", 24, None)
+        instance.add_address(5, "10.0.0.2", 24, None)
         instance.connect(4, "p2p", 5, "p2p")
         instance.create(6, "Application")
         instance.create_set(6, "command", "ping -qc1 10.0.0.2")
@@ -110,19 +110,19 @@ class NetnsExecuteTestCase(unittest.TestCase):
         instance.create(5, "NodeInterface")
         instance.create_set(5, "up", True)
         instance.connect(2, "devs", 5, "node")
-        instance.add_address(5, AF_INET, "10.0.0.1", 24, None)
+        instance.add_address(5, "10.0.0.1", 24, None)
         instance.create(6, "NodeInterface")
         instance.create_set(6, "up", True)
         instance.connect(3, "devs", 6, "node")
-        instance.add_address(6, AF_INET, "10.0.0.2", 24, None)
+        instance.add_address(6, "10.0.0.2", 24, None)
         instance.create(7, "NodeInterface")
         instance.create_set(7, "up", True)
         instance.connect(3, "devs", 7, "node")
-        instance.add_address(7, AF_INET, "10.0.1.1", 24, None)
+        instance.add_address(7, "10.0.1.1", 24, None)
         instance.create(8, "NodeInterface")
         instance.create_set(8, "up", True)
         instance.connect(4, "devs", 8, "node")
-        instance.add_address(8, AF_INET, "10.0.1.2", 24, None)
+        instance.add_address(8, "10.0.1.2", 24, None)
         instance.create(9, "Switch")
         instance.create_set(9, "up", True)
         instance.connect(5, "switch", 9, "devs")
index 6635c75..cf36c7c 100755 (executable)
@@ -2,7 +2,6 @@
 # -*- coding: utf-8 -*-
 
 from nepi.core.design import ExperimentDescription, FactoriesProvider
-from nepi.core.design import AF_INET
 import os
 import shutil
 import test_util
@@ -48,7 +47,7 @@ class Ns3DesignTestCase(unittest.TestCase):
         node2.connector("devs").connect(iface2.connector("node"))
         iface2.connector("queue").connect(queue2.connector("dev"))
         trace2 = iface2.enable_trace("P2PPcapTrace")
-        ip2 = iface1.add_address()
+        ip2 = iface2.add_address()
         ip2.set_attribute_value("Address", "10.0.0.2")
 
         chan = tstbd_desc.create("ns3::PointToPointChannel")