Esempio n. 1
0
    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()
Esempio n. 2
0
    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())
Esempio n. 3
0
    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())
Esempio n. 4
0
    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))
Esempio n. 5
0
    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())
Esempio n. 6
0
 def test_get_stats(self):
     stats = RouterVNF.get_stats(self.IP_SHOW_STATS_OUTPUT)
     self.assertDictEqual(stats, self.STATS)
Esempio n. 7
0
 def test___init__(self):
     vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
     router_vnf = RouterVNF(name, vnfd)
     self.assertIsNone(router_vnf._vnf_process)