From 5e0efe50e974e1271d423abf575fe1b9b9a97b49 Mon Sep 17 00:00:00 2001 From: peusterm Date: Tue, 2 Jul 2019 13:01:36 +0200 Subject: [PATCH] Fix: Make vim-emu ready for the upcoming Containernet release Change-Id: Ia501fbf723d8ea508be05c0adeaf6d2b0dbc8c9e Signed-off-by: peusterm --- src/emuvim/dcemulator/net.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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): """ -- 2.25.1