diff options
author | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2018-05-29 17:59:49 +0300 |
---|---|---|
committer | Chornyi, TarasX <tarasx.chornyi@intel.com> | 2018-06-29 18:35:37 +0300 |
commit | 98aca839a400b0933d474c1358aa601f36b67369 (patch) | |
tree | f3994c3227bab6f41fa56602005f194d2e4675f1 /yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py | |
parent | ce391da0b431238005746536cef7685e38c71976 (diff) |
NFVI support for standalone, baremetal and heat contexts
JIRA: YARDSTICK-1257
Change-Id: I6733bd49ac91985e8f3d7722e6990e8733bb430e
Signed-off-by: Chornyi, TarasX <tarasx.chornyi@intel.com>
(cherry picked from commit 005358a39a87e42061dd5b344916c2ffe0475961)
Diffstat (limited to 'yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py')
-rw-r--r-- | yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py index 5574c6770..edd0ff796 100644 --- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py +++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_router_vnf.py @@ -18,6 +18,7 @@ import mock from yardstick.tests import STL_MOCKS from yardstick.tests.unit.network_services.vnf_generic.vnf.test_base import mock_ssh +from yardstick.benchmark.contexts import base as ctx_base STLClient = mock.MagicMock() @@ -214,15 +215,25 @@ class TestRouterVNF(unittest.TestCase): stats = RouterVNF.get_stats(self.IP_SHOW_STATS_OUTPUT) self.assertDictEqual(stats, self.STATS) + @mock.patch.object(ctx_base.Context, 'get_physical_node_from_server', return_value='mock_node') @mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.time") @mock.patch(SSH_HELPER) - def test_collect_kpi(self, ssh, _): + def test_collect_kpi(self, ssh, *args): m = mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] router_vnf = RouterVNF(name, vnfd) + router_vnf.scenario_helper.scenario_cfg = { + 'nodes': {router_vnf.name: "mock"} + } router_vnf.ssh_helper = m - result = {'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0, 'link_stats': {}} + result = { + 'physical_node': 'mock_node', + 'packets_dropped': 0, + 'packets_fwd': 0, + 'packets_in': 0, + 'link_stats': {} + } self.assertEqual(result, router_vnf.collect_kpi()) @mock.patch(SSH_HELPER) @@ -235,9 +246,9 @@ class TestRouterVNF(unittest.TestCase): router_vnf._run() router_vnf.ssh_helper.drop_connection.assert_called_once() - @mock.patch("yardstick.network_services.vnf_generic.vnf.router_vnf.Context") + @mock.patch.object(ctx_base, 'Context') @mock.patch(SSH_HELPER) - def test_instantiate(self, ssh, _): + def test_instantiate(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] |