From 8e35dc2c45ec1897690173b374406a05b2132954 Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Thu, 28 Sep 2017 00:10:43 -0700 Subject: NSB PROX test hang fixes The PROX tests were hanging in the duration runner. These are fixes for various errors: raise error in collect_kpi if VNF is down move prox dpdk_rebind after collectd stop fix dpdk nicbind rebind to group by drivers prox: raise error in collect_kpi if the VNF is down prox: add VNF_TYPE for consistency sample_vnf: debug and fix kill_vnf pkill is not matching some executable names, add some debug process dumps and try switching back to killall until we can find the issue sample_vnf: add default timeout, so we can override default 3600 SSH timeout collect_kpi is the point at which we check the VNFs and TGs for failures or exits queues are the problem make sure we aren't silently blocking on non-empty queues by canceling join thread in subprocess fixup duration runner to close queues and other attempt to stop duration runner from hanging VnfdHelper: memoize port_num resource: fail if ssh can't connect at the end of 3600 second test our ssh connection is dead, so we can't actually stop collectd unless we reconnect fix stop() logic to ignore ssh errors Change-Id: I6c8e682a80cb9d00362e2fef4a46df080f304e55 Signed-off-by: Ross Brattain --- .../helpers/test_dpdkbindnic_helper.py | 51 ++++++++++++++-------- 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'tests/unit/network_services/helpers') diff --git a/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py b/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py index dbd8396c8..0f1cf7d92 100644 --- a/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py +++ b/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py @@ -16,19 +16,19 @@ import mock import unittest -from yardstick.network_services.helpers.dpdknicbind_helper import DpdkBindHelper -from yardstick.network_services.helpers.dpdknicbind_helper import DpdkBindHelperException -from yardstick.network_services.helpers.dpdknicbind_helper import NETWORK_KERNEL -from yardstick.network_services.helpers.dpdknicbind_helper import NETWORK_DPDK -from yardstick.network_services.helpers.dpdknicbind_helper import CRYPTO_KERNEL -from yardstick.network_services.helpers.dpdknicbind_helper import CRYPTO_DPDK -from yardstick.network_services.helpers.dpdknicbind_helper import NETWORK_OTHER -from yardstick.network_services.helpers.dpdknicbind_helper import CRYPTO_OTHER +from yardstick.network_services.helpers.dpdkbindnic_helper import DpdkBindHelper +from yardstick.network_services.helpers.dpdkbindnic_helper import DpdkBindHelperException +from yardstick.network_services.helpers.dpdkbindnic_helper import NETWORK_KERNEL +from yardstick.network_services.helpers.dpdkbindnic_helper import NETWORK_DPDK +from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_KERNEL +from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_DPDK +from yardstick.network_services.helpers.dpdkbindnic_helper import NETWORK_OTHER +from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_OTHER pass -class MyTestDpdkBindHelper(unittest.TestCase): +class TestDpdkBindHelper(unittest.TestCase): EXAMPLE_OUTPUT = """ Network devices using DPDK-compatible driver @@ -204,17 +204,31 @@ Other crypto devices def test_bind(self): conn = mock.Mock() conn.execute = mock.Mock(return_value=(0, '', '')) - conn.provision_tool = mock.Mock(return_value='/opt/nsb_bin/dpdk_nic_bind.py') + conn.provision_tool = mock.Mock(return_value='/opt/nsb_bin/dpdk-devbind.py') dpdk_bind_helper = DpdkBindHelper(conn) dpdk_bind_helper.read_status = mock.Mock() dpdk_bind_helper.bind(['0000:00:03.0', '0000:00:04.0'], 'my_driver') - conn.execute.assert_called_with('sudo /opt/nsb_bin/dpdk_nic_bind.py --force ' + conn.execute.assert_called_with('sudo /opt/nsb_bin/dpdk-devbind.py --force ' '-b my_driver 0000:00:03.0 0000:00:04.0') dpdk_bind_helper.read_status.assert_called_once() + def test_bind_single_pci(self): + conn = mock.Mock() + conn.execute = mock.Mock(return_value=(0, '', '')) + conn.provision_tool = mock.Mock(return_value='/opt/nsb_bin/dpdk-devbind.py') + + dpdk_bind_helper = DpdkBindHelper(conn) + dpdk_bind_helper.read_status = mock.Mock() + + dpdk_bind_helper.bind('0000:00:03.0', 'my_driver') + + conn.execute.assert_called_with('sudo /opt/nsb_bin/dpdk-devbind.py --force ' + '-b my_driver 0000:00:03.0') + dpdk_bind_helper.read_status.assert_called_once() + def test_rebind_drivers(self): conn = mock.Mock() @@ -222,14 +236,14 @@ Other crypto devices dpdk_bind_helper.bind = mock.Mock() dpdk_bind_helper.used_drivers = { - '0000:05:00.0': 'd1', - '0000:05:01.0': 'd3', + 'd1': ['0000:05:00.0'], + 'd3': ['0000:05:01.0', '0000:05:02.0'], } dpdk_bind_helper.rebind_drivers() - dpdk_bind_helper.bind.assert_any_call('0000:05:00.0', 'd1', True) - dpdk_bind_helper.bind.assert_any_call('0000:05:01.0', 'd3', True) + dpdk_bind_helper.bind.assert_any_call(['0000:05:00.0'], 'd1', True) + dpdk_bind_helper.bind.assert_any_call(['0000:05:01.0', '0000:05:02.0'], 'd3', True) def test_save_used_drivers(self): conn = mock.Mock() @@ -239,9 +253,8 @@ Other crypto devices dpdk_bind_helper.save_used_drivers() expected = { - '0000:00:04.0': 'igb_uio', - '0000:00:05.0': 'igb_uio', - '0000:00:03.0': 'virtio-pci', + 'igb_uio': ['0000:00:04.0', '0000:00:05.0'], + 'virtio-pci': ['0000:00:03.0'], } - self.assertEqual(expected, dpdk_bind_helper.used_drivers) + self.assertDictEqual(expected, dpdk_bind_helper.used_drivers) -- cgit 1.2.3-korg