X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fns3%2Fns3node.py;h=ca63c3cd3a8f6ff93ea5c280c93a76570ae45c1c;hb=6285ca51026efb69642eea9dfc7c480e722d84a9;hp=a85ba0dc5b472242b84454c43a32a04e2bd83624;hpb=a55b5cf0818ced6ab8dc3e88fad7f6616675e826;p=nepi.git diff --git a/src/nepi/resources/ns3/ns3node.py b/src/nepi/resources/ns3/ns3node.py index a85ba0dc..ca63c3cd 100644 --- a/src/nepi/resources/ns3/ns3node.py +++ b/src/nepi/resources/ns3/ns3node.py @@ -3,9 +3,8 @@ # Copyright (C) 2014 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 @@ -28,6 +27,7 @@ class NS3BaseNode(NS3Base): def __init__(self, ec, guid): super(NS3BaseNode, self).__init__(ec, guid) self._simulation = None + self._node_id = None self._ipv4 = None self._arp = None self._mobility = None @@ -57,7 +57,7 @@ class NS3BaseNode(NS3Base): if not self._simulation: msg = "Node not connected to simulation" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) return self._simulation @@ -100,12 +100,16 @@ class NS3BaseNode(NS3Base): if not devices: msg = "Node not connected to devices" self.error(msg) - raise RuntimeError, msg + raise RuntimeError(msg) self._devices = devices return self._devices + @property + def node_id(self): + return self._node_id + @property def dceapplications(self): if not self._dceapplications: @@ -116,20 +120,16 @@ class NS3BaseNode(NS3Base): @property def _rms_to_wait(self): - rms = set() - rms.add(self.simulation) + rms = set([self.simulation]) - ipv4 = self.ipv4 - if ipv4: - rms.add(ipv4) + if self.ipv4: + rms.add(self.ipv4) - arp = self.arp - if arp: - rms.add(arp) + if self.arp: + rms.add(self.arp) - mobility = self.mobility - if mobility: - rms.add(mobility) + if self.mobility: + rms.add(self.mobility) return rms @@ -153,6 +153,8 @@ class NS3BaseNode(NS3Base): uuid_packet_socket_factory = self.simulation.create("PacketSocketFactory") self.simulation.invoke(self.uuid, "AggregateObject", uuid_packet_socket_factory) + self._node_id = self.simulation.invoke(self.uuid, "GetId") + dceapplications = self.dceapplications if dceapplications: self._add_dce(dceapplications) @@ -182,7 +184,11 @@ class NS3BaseNode(NS3Base): container_uuid = self.simulation.create("NodeContainer") self.simulation.invoke(container_uuid, "Add", self.uuid) - with dceapp.dce_manager_lock: - self.simulation.invoke(dceapp.dce_manager_helper_uuid, - "Install", container_uuid) + + dce_helper = self.simulation.dce_helper + + with dce_helper.dce_manager_lock: + dce_manager_uuid = dce_helper.dce_manager_uuid + + self.simulation.invoke(dce_manager_uuid, "Install", container_uuid)