ns3_version = Attribute("ns3Version",
"Version of ns-3 to install from nsam repo",
- default = "ns-3.19",
- #default = "ns-3-dev",
- flags = Flags.Design)
-
- enable_dce = Attribute("enableDCE",
- "Install DCE source code",
- default = False,
- type = Types.Bool,
+ #default = "ns-3.19",
+ default = "ns-3-dev",
flags = Flags.Design)
pybindgen_version = Attribute("pybindgenVersion",
"Version of pybindgen to install from bazar repo",
- default = "864",
- #default = "868",
+ #default = "864",
+ default = "868",
flags = Flags.Design)
populate_routing_tables = Attribute("populateRoutingTables",
cls._register_attribute(ns3_version)
cls._register_attribute(pybindgen_version)
cls._register_attribute(populate_routing_tables)
- cls._register_attribute(enable_dce)
def __init__(self, ec, guid):
LinuxApplication.__init__(self, ec, guid)
self._socket_name = "ns3-%s.sock" % os.urandom(4).encode('hex')
self._dce_manager_helper_uuid = None
self._dce_application_helper_uuid = None
+ self._enable_dce = False
@property
def socket_name(self):
if self.get("populateRoutingTables") == True:
self.invoke(IPV4_GLOBAL_ROUTING_HELPER_UUID, "PopulateRoutingTables")
- self._client.start()
+ self._client.start()
+
+ # Wait until the Simulation is actually started...
+ is_running = False
+ for i in xrange(1000):
+ is_running = self.invoke(SIMULATOR_UUID, "isRunning")
+
+ if is_running:
+ break
+ else:
+ time.sleep(1)
+ else:
+ if not is_running:
+ msg = " Simulation did not start"
+ self.error(msg)
+ raise RuntimeError
self.set_started()
else:
super(LinuxApplication, self).do_release()
+ @property
+ def enable_dce(self):
+ if self._enable_dce is None:
+ from nepi.resources.ns3.ns3dceapplication import NS3BaseDceApplication
+ rclass = ResourceFactory.get_resource_type(NS3BaseDceApplication)
+
+ self._enable_dce = False
+ for guid in self.ec.resources:
+ rm = self.ec.get_resource(guid)
+ if isinstance(rm, rclass):
+ self._enable_dce = True
+ break
+
+ return self._enable_dce
+
@property
def _start_command(self):
command = []
}
clone_dce_cmd = " echo 'DCE will not be built' "
- if self.get("enableDCE"):
+ if self.enable_dce:
clone_dce_cmd = (
# DCE installation
# Test if dce is alredy installed
'dce_repo': self.dce_repo
}
-
return (
# NS3 installation
"( "
@property
def _install(self):
install_dce_cmd = " echo 'DCE will not be installed' "
- if self.get("enableDCE"):
+ if self.enable_dce:
install_dce_cmd = (
" ( "
" ((test -d %(ns3_build_home)s/bin_dce ) && "
" ( "
# If not, copy ns-3 build to bin
" cd ${SRC}/dce/ns-3-dce && "
+ " rm -rf ${SRC}/dce/ns-3-dce/build && "
" ./waf configure %(enable_opt)s --with-pybindgen=${SRC}/pybindgen/%(pybindgen_version)s "
" --prefix=%(ns3_build_home)s --with-ns3=%(ns3_build_home)s && "
" ./waf build && "
# If not, copy ns-3 build to bin
" mkdir -p %(ns3_build_home)s && "
" cd ${SRC}/ns-3/%(ns3_version)s && "
+ " rm -rf ${SRC}/ns-3/%(ns3_version)s/build && "
" ./waf configure -d %(build_mode)s --with-pybindgen=${SRC}/pybindgen/%(pybindgen_version)s "
" --prefix=%(ns3_build_home)s && "
" ./waf build && "