Ejemplo n.º 1
0
    def test_collect_kpi(self, ssh, *args):
        mock_ssh(ssh)
        prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
        prox_traffic_gen.scenario_helper.scenario_cfg = {
            'nodes': {prox_traffic_gen.name: "mock"}
        }
        prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock(
            **{"self.check_if_system_agent_running.return_value": [False]})

        vnfd_helper = mock.MagicMock()
        vnfd_helper.ports_iter.return_value = [('xe0', 0), ('xe1', 1)]
        prox_traffic_gen.resource_helper.vnfd_helper = vnfd_helper

        prox_traffic_gen._vnf_wrapper.resource_helper.client = mock.MagicMock()
        prox_traffic_gen._vnf_wrapper.resource_helper.client.multi_port_stats.return_value = \
            [[0, 1, 2, 3, 4, 5], [1, 1, 2, 3, 4, 5]]
        prox_traffic_gen._vnf_wrapper.resource_helper.client.multi_port_stats_diff.return_value = \
            [0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7]
        prox_traffic_gen._vnf_wrapper.resource_helper.client.\
            multi_port_stats_tuple.return_value = \
                {"xe0": {"in_packets": 1, "out_packets": 2}}

        prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
        expected = {
            'collect_stats': {'live_stats': {'xe0': {'in_packets': 1, 'out_packets': 2}}},
            'physical_node': 'mock_node'
        }
        result = prox_traffic_gen.collect_kpi()
        self.assertDictEqual(result, expected)
    def test_collect_kpi(self, ssh, mock_time):
        mock_ssh(ssh)

        prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
        prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock(
            **{"check_if_sa_running.return_value": [False]})
        prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
        self.assertEqual({}, prox_traffic_gen.collect_kpi())
Ejemplo n.º 3
0
    def test_collect_kpi(self, ssh, mock_time):
        mock_ssh(ssh)

        prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
        prox_traffic_gen._vnf_wrapper.resource = mock.Mock(
            autospec=ResourceProfile)
        prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
        self.assertEqual({}, prox_traffic_gen.collect_kpi())
Ejemplo n.º 4
0
 def test_collect_kpi(self, ssh, *args):
     mock_ssh(ssh)
     prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
     prox_traffic_gen.scenario_helper.scenario_cfg = {
         'nodes': {
             prox_traffic_gen.name: "mock"
         }
     }
     prox_traffic_gen._vnf_wrapper.resource_helper.resource = mock.MagicMock(
         **{"self.check_if_system_agent_running.return_value": [False]})
     prox_traffic_gen._vnf_wrapper.vnf_execute = mock.Mock(return_value="")
     expected = {'collect_stats': {}, 'physical_node': 'mock_node'}
     self.assertEqual(prox_traffic_gen.collect_kpi(), expected)
Ejemplo n.º 5
0
    def test_collect_kpi(self, ssh, mock_time):
        mock_ssh(ssh)

        prox_traffic_gen = ProxTrafficGen(NAME, self.VNFD0)
        prox_traffic_gen._queue = mock.MagicMock()
        self.assertEqual({}, prox_traffic_gen.collect_kpi())