X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fns3%2Fns3wrapper.py;h=9251006668f112b0121bb4c81d46fb50dbfa50c9;hb=58a2b493f8df1072a1faa653c8abb6a3f9ba21fa;hp=4c9b9db232cb6320091dcd5a62879d9177f0c503;hpb=42e05bfedb59dffb39b71faf2e781b86184e2017;p=nepi.git diff --git a/src/nepi/resources/ns3/ns3wrapper.py b/src/nepi/resources/ns3/ns3wrapper.py index 4c9b9db2..92510066 100644 --- a/src/nepi/resources/ns3/ns3wrapper.py +++ b/src/nepi/resources/ns3/ns3wrapper.py @@ -3,9 +3,8 @@ # Copyright (C) 2013 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -155,7 +154,7 @@ class NS3Wrapper(object): tid_count = type_id.GetRegisteredN() base = type_id.LookupByName("ns3::Object") - for i in xrange(tid_count): + for i in range(tid_count): tid = type_id.GetRegistered(i) if tid.MustHideFromDocumentation() or \ @@ -214,7 +213,7 @@ class NS3Wrapper(object): factory = self.ns3.ObjectFactory() factory.SetTypeId(type_name) - for name, value in kwargs.iteritems(): + for name, value in kwargs.items(): ns3_value = self._attr_from_string_to_ns3_value(type_name, name, value) factory.Set(name, ns3_value) @@ -576,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) \ - for k,v in kwargs.iteritems()]) + for k,v in kwargs.items()]) realkwargs = dict([(k, self._singleton(v) \ if str(v).startswith(SINGLETON) else v )\ - for k, v in realkwargs.iteritems()]) + for k, v in realkwargs.items()]) return realkwargs @@ -608,7 +607,7 @@ class NS3Wrapper(object): return False def _is_app_started(self, uuid): - return self._is_app_running(uuid) or self.is_finished() + return self._is_app_running(uuid) or self.is_finished def _add_static_route(self, ipv4_uuid, network, prefix, nexthop): ipv4 = self.get_object(ipv4_uuid) @@ -646,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 ifidx in xrange(nifaces): + for ifidx in range(nifaces): iface = ipv4.GetInterface(ifidx) naddress = iface.GetNAddresses() - for addridx in xrange(naddress): + for addridx in range(naddress): ifaddr = iface.GetAddress(addridx) ifmask = ifaddr.GetMask() @@ -669,7 +668,7 @@ class NS3Wrapper(object): newuuid = None if search: # search object - for ouuid, oobj in self._objects.iteritems(): + for ouuid, oobj in self._objects.items(): if nobj == oobj: newuuid = ouuid break