diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-09-28 20:29:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-09-28 20:29:43 +0000 |
commit | 578a9031d8d0c6f8631db13e89856abbdf8d23d9 (patch) | |
tree | 90d443f2756d046ccc1f115974339951bee85bd6 | |
parent | c832dd05f20936734faadcd1ffa1dd8d01d08819 (diff) | |
parent | 64e6d4d5eb38109b22a1fa095ace08b55a054642 (diff) |
Merge "vnf_generic: Fix str object has no attribute items"
-rw-r--r-- | tests/unit/benchmark/scenarios/networking/test_vnf_generic.py | 6 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/networking/vnf_generic.py | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py index fa9b8549d..5b15daca4 100644 --- a/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py +++ b/tests/unit/benchmark/scenarios/networking/test_vnf_generic.py @@ -361,6 +361,12 @@ class TestNetworkServiceTestCase(unittest.TestCase): def test___init__(self): assert self.topology + def test__get_ip_flow_range_string(self): + self.scenario_cfg["traffic_options"]["flow"] = \ + self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") + result = '152.16.100.2-152.16.100.254' + self.assertEqual(result, self.s._get_ip_flow_range('152.16.100.2-152.16.100.254')) + def test__get_ip_flow_range(self): self.scenario_cfg["traffic_options"]["flow"] = \ self._get_file_abspath("ipv4_1flow_Packets_vpe.yaml") diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index 450f83f6a..355b69862 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -140,8 +140,15 @@ class NetworkServiceTestCase(base.Scenario): def _get_ip_flow_range(self, ip_start_range): + # IP range is specified as 'x.x.x.x-y.y.y.y' + if isinstance(ip_start_range, six.string_types): + return ip_start_range + node_name, range_or_interface = next(iter(ip_start_range.items()), (None, '0.0.0.0')) - if node_name is not None: + if node_name is None: + # we are manually specifying the range + ip_addr_range = range_or_interface + else: node = self.context_cfg["nodes"].get(node_name, {}) try: # the ip_range is the interface name @@ -163,9 +170,6 @@ class NetworkServiceTestCase(base.Scenario): LOG.warning("Only single IP in range %s", ipaddr) # fall back to single IP range ip_addr_range = ip - else: - # we are manually specifying the range - ip_addr_range = range_or_interface return ip_addr_range def _get_traffic_flow(self): |