diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-08-17 01:56:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-17 01:56:47 +0000 |
commit | 9c6eba101c7b656d077b95cf5d028551b0460aa1 (patch) | |
tree | 17d9bc11d3fb6098d13fb47f990876c277434119 | |
parent | 641b52820afd1c61261cda954803cc335b818ccc (diff) | |
parent | 46383867760fa485fa20dbee69ca5ba72f50f467 (diff) |
Merge "Verify the route list before parsing the data key"
-rw-r--r-- | yardstick/network_services/helpers/samplevnf_helper.py | 5 |
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) |