def test_run_router(self, ssh): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] router_vnf = RouterVNF(name, vnfd) router_vnf.scenario_helper.scenario_cfg = self.scenario_cfg router_vnf._run() router_vnf.ssh_helper.drop_connection.assert_called_once()
def test_terminate(self, ssh, _): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] router_vnf = RouterVNF(name, vnfd) router_vnf._vnf_process = mock.MagicMock() router_vnf._vnf_process.terminate = mock.Mock() self.assertIsNone(router_vnf.terminate())
def test_collect_kpi(self, ssh, _): m = mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] router_vnf = RouterVNF(name, vnfd) router_vnf.ssh_helper = m result = {'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0, 'link_stats': {}} self.assertEqual(result, router_vnf.collect_kpi())
def test_instantiate(self, ssh, *args): mock_ssh(ssh) vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] router_vnf = RouterVNF(name, vnfd) router_vnf.WAIT_TIME = 0 router_vnf.INTERFACE_WAIT = 0 self.scenario_cfg.update({"nodes": {"vnf__1": ""}}) self.assertIsNone(router_vnf.instantiate(self.scenario_cfg, self.context_cfg))
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 = { 'physical_node': 'mock_node', 'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0, 'link_stats': {} } self.assertEqual(result, router_vnf.collect_kpi())
def test_get_stats(self): stats = RouterVNF.get_stats(self.IP_SHOW_STATS_OUTPUT) self.assertDictEqual(stats, self.STATS)
def test___init__(self): vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0] router_vnf = RouterVNF(name, vnfd) self.assertIsNone(router_vnf._vnf_process)