diff options
author | Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com> | 2018-09-13 14:36:24 +0100 |
---|---|---|
committer | Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com> | 2018-09-13 15:51:18 +0100 |
commit | ca7f539f1071d925676273c14daf6137685a3d91 (patch) | |
tree | 23575a396c9bb434dde1d72dfcf16cbae6f552e4 | |
parent | 7dfd3b0f70dc6ee7011031aa43606d679831db90 (diff) |
Assign IXIA ports in one call instead of one by one
Assigning IXIA ports one by one takes more time than
assign all ports by once. Also, assigning ports in
one call resolves the assign port issues caused on
some IXIA chassis versions.
JIRA: YARDSTICK-1425
Change-Id: Ibb08e40ee1a8762573f6752bdd1f583c5a1d9d2a
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
-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') |