示例#1
0
    def test_run_traffic(self):
        tg = tg_pktgen.PktgenTrafficGen('name1', self.VNFD)
        mock_tp = mock.Mock()
        with mock.patch.object(tg, '_is_running', return_value=True):
            tg.run_traffic(mock_tp)

        mock_tp.init.assert_called_once_with(tg._node_ip, tg._lua_node_port)
示例#2
0
 def test__is_running_exception(self):
     tg = tg_pktgen.PktgenTrafficGen('name1', self.VNFD)
     with mock.patch.object(tg, '_traffic_profile') as mock_tp:
         mock_tp.help.side_effect = exceptions.PktgenActionError()
         self.assertFalse(tg._is_running())
示例#3
0
 def test__is_running(self):
     tg = tg_pktgen.PktgenTrafficGen('name1', self.VNFD)
     with mock.patch.object(tg, '_traffic_profile'):
         self.assertTrue(tg._is_running())
示例#4
0
 def test__get_lua_node_port_no_lua_port(self):
     tg = tg_pktgen.PktgenTrafficGen('name1', self.VNFD)
     service_ports = [{'port': '333'}]
     self.assertIsNone(tg._get_lua_node_port(service_ports))
示例#5
0
 def test__get_lua_node_port(self):
     tg = tg_pktgen.PktgenTrafficGen('name1', self.VNFD)
     service_ports = [{'port': constants.LUA_PORT, 'node_port': '12345'}]
     self.assertEqual(12345, tg._get_lua_node_port(service_ports))
示例#6
0
 def test__init(self):
     tg = tg_pktgen.PktgenTrafficGen('name1', self.VNFD)
     self.assertTrue(isinstance(tg, vnf_base.GenericTrafficGen))