From: peusterm Date: Wed, 17 May 2017 07:51:05 +0000 (+0200) Subject: Fix: Nova, Heat APIs now rely on latest son-emu master code to handle links X-Git-Tag: v3.1~27^2~8 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=92a37cd072a82cc8bfc32f04d7b4eedb39a57192;p=osm%2Fvim-emu.git Fix: Nova, Heat APIs now rely on latest son-emu master code to handle links --- diff --git a/src/emuvim/api/openstack/compute.py b/src/emuvim/api/openstack/compute.py index 9918c6d..45cef59 100644 --- a/src/emuvim/api/openstack/compute.py +++ b/src/emuvim/api/openstack/compute.py @@ -677,8 +677,6 @@ class OpenstackCompute(object): del self.dc.switch.ports[link.intf2] del self.dc.switch.nameToIntf[link.intf2.name] self.dc.net.removeLink(link=link) - self.dc.net.DCNetwork_graph.remove_edge(server_name, self.dc.switch.name) - self.dc.net.DCNetwork_graph.remove_edge(self.dc.switch.name, server_name) for intf_key in self.dc.net[server_name].intfs.keys(): if self.dc.net[server_name].intfs[intf_key].link == link: self.dc.net[server_name].intfs[intf_key].delete() diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index 9dfef36..5dfcbcd 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -233,8 +233,21 @@ class DCNetwork(Containernet): """ Remove the link from the Containernet and the networkx graph """ + if link is not None: + node1 = link.intf1.node + node2 = link.intf2.node + assert node1 is not None + assert node2 is not None Containernet.removeLink(self, link=link, node1=node1, node2=node2) - self.DCNetwork_graph.remove_edge(node2.name, node1.name) + # TODO we might decrease the loglevel to debug: + try: + self.DCNetwork_graph.remove_edge(node2.name, node1.name) + except: + LOG.warning("%s not found in DCNetwork_graph." % ((node2.name, node1.name))) + try: + self.DCNetwork_graph.remove_edge(node1.name, node2.name) + except: + LOG.warning("%s not found in DCNetwork_graph." % ((node1.name, node2.name))) def addDocker( self, label, **params ): """