Ejemplo n.º 1
0
 def test_add_hosting_vnf(self, mock_monitor_run):
     test_device_dict = MOCK_VNF_DEVICE
     test_boot_wait = 30
     test_vnfmonitor = VNFMonitor(test_boot_wait)
     test_vnfmonitor.add_hosting_vnf(test_device_dict)
     test_device_id = test_vnfmonitor._hosting_vnfs.keys()[0]
     self.assertEqual(test_device_id, MOCK_DEVICE_ID)
Ejemplo n.º 2
0
 def test_run_monitor(self, mock_monitor_run):
     test_hosting_vnf = MOCK_VNF_DEVICE
     test_hosting_vnf['device'] = {}
     test_boot_wait = 30
     mock_kwargs = {
         'count': 1,
         'monitoring_delay': 0,
         'interval': 0,
         'mgmt_ip': 'a.b.c.d',
         'timeout': 2
     }
     test_vnfmonitor = VNFMonitor(test_boot_wait)
     self.mock_monitor_manager.invoke = mock.MagicMock()
     test_vnfmonitor._monitor_manager = self.mock_monitor_manager
     test_vnfmonitor.run_monitor(test_hosting_vnf)
     self.mock_monitor_manager\
         .invoke.assert_called_once_with('ping', 'monitor_call', device={},
                                         kwargs=mock_kwargs)