Пример #1
0
 def __init__(self):
     super(VNFMPlugin, self).__init__()
     self._pool = eventlet.GreenPool()
     self.boot_wait = cfg.CONF.tacker.boot_wait
     self.vim_client = vim_client.VimClient()
     self._vnf_manager = driver_manager.DriverManager(
         'tacker.tacker.vnfm.drivers', cfg.CONF.tacker.infra_driver)
     self._vnf_action = driver_manager.DriverManager(
         'tacker.tacker.policy.actions', cfg.CONF.tacker.policy_action)
     self._vnf_monitor = monitor.VNFMonitor(self.boot_wait)
     self._vnf_alarm_monitor = monitor.VNFAlarmMonitor()
     self._vnf_reservation_monitor = monitor.VNFReservationAlarmMonitor()
     self._vnf_app_monitor = monitor.VNFAppMonitor()
     self._init_monitoring()
Пример #2
0
 def test_process_alarm_for_vnf(self):
     vnf = {'id': 'a737497c-761c-11e5-89c3-9cb6541d805d'}
     trigger = {
         'params': {
             'data': {
                 'alarm_id': 'a737497c-761c-11e5-89c3-9cb6541d805d',
                 'current': 'alarm'
             }
         }
     }
     test_vnf_reservation_monitor = monitor.VNFReservationAlarmMonitor()
     response = test_vnf_reservation_monitor.process_alarm_for_vnf(
         vnf, trigger)
     self.assertEqual(response, True)
Пример #3
0
 def test_update_vnf_with_alarm(self, mock_get_vnf_policies,
                                mock_db_service):
     mock_get_vnf_policies.return_value = [{
         'name':
         'SP_RSV',
         'type':
         'tosca.policies.tacker.Scaling'
     }]
     mock_db_service.return_value = {
         'event_type': 'MONITOR',
         'resource_id': '9770fa22-747d-426e-9819-057a95cb778c',
         'timestamp': '2018-10-30 06:01:45.628162',
         'event_details': {
             'Alarm URL set successfully': {
                 'start_actions': 'alarm'
             }
         },
         'resource_state': 'CREATE',
         'id': '4583',
         'resource_type': 'vnf'
     }
     vnf = {
         'id': 'a737497c-761c-11e5-89c3-9cb6541d805d',
         'status': 'insufficient_data'
     }
     test_vnf_reservation_monitor = monitor.VNFReservationAlarmMonitor()
     policy_dict = {
         'type': 'tosca.policies.tacker.Reservation',
         'reservation': {
             'before_end_actions': ['SP_RSV'],
             'end_actions': ['noop'],
             'start_actions': ['SP_RSV'],
             'properties': {
                 'lease_id': 'ffa079a0-9d6f-411d-ab15-89219c0ee14d'
             }
         }
     }
     response = test_vnf_reservation_monitor.update_vnf_with_reservation(
         self.plugin, self.context, vnf, policy_dict)
     self.assertEqual(len(response.keys()), 3)