summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak S <deepak.s@linux.intel.com>2017-08-12 15:13:21 -0700
committerDeepak S <deepak.s@linux.intel.com>2017-08-16 04:34:33 -0700
commit46383867760fa485fa20dbee69ca5ba72f50f467 (patch)
treecd9e48479d64c696bfc870c00075b25619ef4020
parent95d9798e15d54270f73692b22b138b44f9defd7a (diff)
Verify the route list before parsing the data key
Exception: line 502, in get_route_data return next((route[data_key] for route in route_list if route['if'] == port), None) TypeError: 'NoneType' object is not iterable Change-Id: Ia45d90a4e9a61cb917b23efd03b86eafb249b747 Signed-off-by: Deepak S <deepak.s@linux.intel.com>
-rw-r--r--yardstick/network_services/helpers/samplevnf_helper.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yardstick/network_services/helpers/samplevnf_helper.py b/yardstick/network_services/helpers/samplevnf_helper.py
index 1eefc5ffa..543d814df 100644
--- a/yardstick/network_services/helpers/samplevnf_helper.py
+++ b/yardstick/network_services/helpers/samplevnf_helper.py
@@ -499,7 +499,10 @@ class MultiPortConfig(object):
def get_route_data(self, src_key, data_key, port):
route_list = self.vnfd['vdu'][0].get(src_key, [])
- return next((route[data_key] for route in route_list if route['if'] == port), None)
+ try:
+ return next((route[data_key] for route in route_list if route['if'] == port), None)
+ except (TypeError, StopIteration, KeyError):
+ return None
def get_ports_gateway(self, port):
return self.get_route_data('routing_table', 'gateway', port)