diff options
-rw-r--r-- | yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py | 13 | ||||
-rw-r--r-- | yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py index 4db7ab44f..1428c38f4 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -225,11 +225,16 @@ class IxNextgen(object): # pragma: no cover zip(self._cfg['cards'], self._cfg['ports'])] log.info('Create and assign vports: %s', ports) - for port in ports: - vport = self.ixnet.add(self.ixnet.getRoot(), 'vport') - self.ixnet.commit() - self.ixnet.execute('assignPorts', [port], [], [vport], True) + + vports = [] + for _ in ports: + vports.append(self.ixnet.add(self.ixnet.getRoot(), 'vport')) self.ixnet.commit() + + self.ixnet.execute('assignPorts', ports, [], vports, True) + self.ixnet.commit() + + for vport in vports: if self.ixnet.getAttribute(vport, '-state') != 'up': log.warning('Port %s is down', vport) diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index d04dfd42b..3077e3c17 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -346,8 +346,8 @@ class TestIxNextgen(unittest.TestCase): self.ixnet_gen._cfg = config self.assertIsNone(self.ixnet_gen.assign_ports()) - self.assertEqual(self.ixnet.execute.call_count, 2) - self.assertEqual(self.ixnet.commit.call_count, 4) + self.assertEqual(self.ixnet.execute.call_count, 1) + self.assertEqual(self.ixnet.commit.call_count, 3) self.assertEqual(self.ixnet.getAttribute.call_count, 2) @mock.patch.object(ixnet_api, 'log') |