From 8406eaebdf6e0c953640ebd4d59894a46af82aaa Mon Sep 17 00:00:00 2001 From: Alina Quereilhac Date: Thu, 31 Mar 2011 22:11:37 +0200 Subject: [PATCH] search ns3 library and ns3 bindings in the environment variables --- src/nepi/testbeds/ns3/execute.py | 7 ++- src/nepi/testbeds/ns3/metadata_v3_9_RC3.py | 62 +++++++++------------- 2 files changed, 29 insertions(+), 40 deletions(-) diff --git a/src/nepi/testbeds/ns3/execute.py b/src/nepi/testbeds/ns3/execute.py index 2a8cc0a8..470f638e 100644 --- a/src/nepi/testbeds/ns3/execute.py +++ b/src/nepi/testbeds/ns3/execute.py @@ -150,12 +150,15 @@ class TestbedInstance(testbed_impl.TestbedInstance): import ctypes import imp - bindings = self._attributes.get_attribute_value("ns3Bindings") - libfile = self._attributes.get_attribute_value("ns3Library") simu_impl_type = self._attributes.get_attribute_value( "SimulatorImplementationType") checksum = self._attributes.get_attribute_value("ChecksumEnabled") + bindings = os.environ["NEPI_NS3BINDINGS"] \ + if "NEPI_NS3BINDINGS" in os.environ else None + libfile = os.environ["NEPI_NS3LIBRARY"] \ + if "NEPI_NS3LIBRARY" in os.environ else None + if libfile: ctypes.CDLL(libfile, ctypes.RTLD_GLOBAL) diff --git a/src/nepi/testbeds/ns3/metadata_v3_9_RC3.py b/src/nepi/testbeds/ns3/metadata_v3_9_RC3.py index bb514954..8371b0b2 100644 --- a/src/nepi/testbeds/ns3/metadata_v3_9_RC3.py +++ b/src/nepi/testbeds/ns3/metadata_v3_9_RC3.py @@ -632,44 +632,30 @@ factories_order = ["ns3::BasicEnergySource", ] testbed_attributes = dict({ - "ns3_bindings": dict({ - "name": "ns3Bindings", - "help": "Location of the ns-3 python binding", - "type": Attribute.STRING, - "flags": Attribute.DesignOnly, - "validation_function": validation.is_string # TODO: validation.is_path - }), - "ns3_library": dict({ - "name": "ns3Library", - "help": "Location of the ns-3 library .so file", - "type": Attribute.STRING, - "flags": Attribute.DesignOnly, - "validation_function": validation.is_string # TODO: validation.is_path - }), - "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 - }), - "home_directory": dict({ - "name": "homeDirectory", - "help": "Path to the directory where traces and other files \ - will be stored", - "type": Attribute.STRING, - "value": "", - "flags": Attribute.DesignOnly, - "validation_function": validation.is_string - }) + "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 + }), + "home_directory": dict({ + "name": "homeDirectory", + "help": "Path to the directory where traces and other files \ + will be stored", + "type": Attribute.STRING, + "value": "", + "flags": Attribute.DesignOnly, + "validation_function": validation.is_string + }) }) class VersionedMetadataInfo(metadata.VersionedMetadataInfo): -- 2.47.0