git://git.onelab.eu
/
nepi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
a first very rough step towards python3
[nepi.git]
/
src
/
nepi
/
resources
/
ns3
/
ns3wrapper.py
diff --git
a/src/nepi/resources/ns3/ns3wrapper.py
b/src/nepi/resources/ns3/ns3wrapper.py
index
f6cc247
..
c275dcd
100644
(file)
--- a/
src/nepi/resources/ns3/ns3wrapper.py
+++ b/
src/nepi/resources/ns3/ns3wrapper.py
@@
-130,7
+130,7
@@
class NS3Wrapper(object):
self._allowed_types = None
# Object to dump instructions to reproduce and debug experiment
self._allowed_types = None
# Object to dump instructions to reproduce and debug experiment
- from ns3wrapper_debug import NS3WrapperDebuger
+ from
.
ns3wrapper_debug import NS3WrapperDebuger
self._debuger = NS3WrapperDebuger(enabled = enable_dump)
@property
self._debuger = NS3WrapperDebuger(enabled = enable_dump)
@property
@@
-154,7
+154,7
@@
class NS3Wrapper(object):
tid_count = type_id.GetRegisteredN()
base = type_id.LookupByName("ns3::Object")
tid_count = type_id.GetRegisteredN()
base = type_id.LookupByName("ns3::Object")
- for i in
x
range(tid_count):
+ for i in range(tid_count):
tid = type_id.GetRegistered(i)
if tid.MustHideFromDocumentation() or \
tid = type_id.GetRegistered(i)
if tid.MustHideFromDocumentation() or \
@@
-213,7
+213,7
@@
class NS3Wrapper(object):
factory = self.ns3.ObjectFactory()
factory.SetTypeId(type_name)
factory = self.ns3.ObjectFactory()
factory.SetTypeId(type_name)
- for name, value in kwargs.ite
rite
ms():
+ for name, value in kwargs.items():
ns3_value = self._attr_from_string_to_ns3_value(type_name, name, value)
factory.Set(name, ns3_value)
ns3_value = self._attr_from_string_to_ns3_value(type_name, name, value)
factory.Set(name, ns3_value)
@@
-327,7
+327,7
@@
class NS3Wrapper(object):
# then keep track of the object a return the object
# reference (newuuid)
if not (result is None or type(result) in [
# then keep track of the object a return the object
# reference (newuuid)
if not (result is None or type(result) in [
- bool, float,
long
, str, int]):
+ bool, float,
int
, str, int]):
self._objects[newuuid] = result
result = newuuid
self._objects[newuuid] = result
result = newuuid
@@
-482,7
+482,7
@@
class NS3Wrapper(object):
condition.release()
# contextId is defined as general context
condition.release()
# contextId is defined as general context
- contextId =
long
(0xffffffff)
+ contextId =
int
(0xffffffff)
# delay 0 means that the event is expected to execute inmediately
delay = self.ns3.Seconds(0)
# delay 0 means that the event is expected to execute inmediately
delay = self.ns3.Seconds(0)
@@
-575,11
+575,11
@@
class NS3Wrapper(object):
def replace_kwargs(self, kwargs):
realkwargs = dict([(k, self.get_object(v) \
if str(v).startswith("uuid") else v) \
def replace_kwargs(self, kwargs):
realkwargs = dict([(k, self.get_object(v) \
if str(v).startswith("uuid") else v) \
- for k,v in kwargs.ite
rite
ms()])
+ for k,v in kwargs.items()])
realkwargs = dict([(k, self._singleton(v) \
if str(v).startswith(SINGLETON) else v )\
realkwargs = dict([(k, self._singleton(v) \
if str(v).startswith(SINGLETON) else v )\
- for k, v in realkwargs.ite
rite
ms()])
+ for k, v in realkwargs.items()])
return realkwargs
return realkwargs
@@
-645,10
+645,10
@@
class NS3Wrapper(object):
# For all the interfaces registered with the ipv4 object, find
# the one that matches the network of the nexthop
nifaces = ipv4.GetNInterfaces()
# For all the interfaces registered with the ipv4 object, find
# the one that matches the network of the nexthop
nifaces = ipv4.GetNInterfaces()
- for ifidx in
x
range(nifaces):
+ for ifidx in range(nifaces):
iface = ipv4.GetInterface(ifidx)
naddress = iface.GetNAddresses()
iface = ipv4.GetInterface(ifidx)
naddress = iface.GetNAddresses()
- for addridx in
x
range(naddress):
+ for addridx in range(naddress):
ifaddr = iface.GetAddress(addridx)
ifmask = ifaddr.GetMask()
ifaddr = iface.GetAddress(addridx)
ifmask = ifaddr.GetMask()
@@
-668,7
+668,7
@@
class NS3Wrapper(object):
newuuid = None
if search:
# search object
newuuid = None
if search:
# search object
- for ouuid, oobj in self._objects.ite
rite
ms():
+ for ouuid, oobj in self._objects.items():
if nobj == oobj:
newuuid = ouuid
break
if nobj == oobj:
newuuid = ouuid
break