From: peusterm Date: Tue, 2 Jul 2019 11:01:36 +0000 (+0200) Subject: Fix: Make vim-emu ready for the upcoming Containernet release X-Git-Tag: v7.0.0rc1~22 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F7736%2F1;p=osm%2Fvim-emu.git Fix: Make vim-emu ready for the upcoming Containernet release Change-Id: Ia501fbf723d8ea508be05c0adeaf6d2b0dbc8c9e Signed-off-by: peusterm --- diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index 6258543..8b2c445 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -385,6 +385,18 @@ class DCNetwork(Containernet): switch_node = self.getNodeByName(src_sw) self._set_vlan_tag(switch_node, src_sw_inport_name, vlan) + def getNodeByName(self, name): + """ + Wraps Containernet's getNodeByName method to avoid + key not found exceptions. + """ + try: + return super(DCNetwork, self).getNodeByName(name) + except BaseException as ex: + LOG.warning("Node not found: {}".format(name)) + LOG.debug("Node not found: {}".format(ex)) + return None + def _addMonitorFlow(self, vnf_src_name, vnf_dst_name, vnf_src_interface=None, vnf_dst_interface=None, tag=None, **kwargs): """