Add Warning for key issue ixload 79/66479/10
authorJohn O Loughlin <john.oloughlin@intel.com>
Fri, 18 Jan 2019 09:16:31 +0000 (09:16 +0000)
committerJohn O'Loughlin <john.oloughlin@intel.com>
Thu, 7 Feb 2019 09:19:20 +0000 (09:19 +0000)
Currently there is a section of code that assigns a gateway
links[name]["ip"]["gateway"] = gateway
If the ip field has not already been defined a key error is
thrown and not handled. This error is then suppressed so
the program fails silently and thus causes the test case to hang.

JIRA: YARDSTICK-1586

Change-Id: I94a1081a2038fb58989b3033444ea5f3a6e178f0
Signed-off-by: John O Loughlin <john.oloughlin@intel.com>
yardstick/network_services/vnf_generic/vnf/tg_ixload.py

index d254027..495b14d 100644 (file)
@@ -143,7 +143,12 @@ class IxLoadTrafficGen(sample_vnf.SampleVNFTrafficGen):
                                    "external-interface"] if
                                intf["virtual-interface"]["vld_id"] == name)
 
-                links[name]["ip"]["gateway"] = gateway
+                try:
+                    links[name]["ip"]["gateway"] = gateway
+                except KeyError:
+                    LOG.error("Invalid traffic profile: No IP section defined for %s", name)
+                    raise
+
             except StopIteration:
                 LOG.debug("Cant find gateway for link %s", name)
                 links[name]["ip"]["gateway"] = "0.0.0.0"