update refresh alarms/logs method to fit fm containerization

changes: when the test case refresh customer alarms/logs/alarm history
get alarms/logs from fm in pods and extend them with alarms/logs
get from fm in host.

Depends-On: https://review.opendev.org/#/c/655749/
Depends-On: https://review.opendev.org/#/c/677118/
Change-Id: Ibca8b43ee42c41e0aeacec771dac5b14cc356d05
Story: 2004008
Task: 30931
This commit is contained in:
SidneyAn 2019-05-23 10:35:01 +08:00 committed by Ran An
parent 8b082fa1a2
commit 68028319d2

View File

@ -13,6 +13,7 @@ from nfv_common import debug
from nfv_plugins.nfvi_plugins import config
from nfv_plugins.nfvi_plugins.openstack import fm
from nfv_plugins.nfvi_plugins.openstack import nova
from nfv_plugins.nfvi_plugins.openstack.objects import OPENSTACK_SERVICE
from nfv_plugins.nfvi_plugins.openstack import openstack
from tests import _instances
@ -181,24 +182,47 @@ class TestInstance(_test_base.Test):
"""
Fetch the customer alarms raised
"""
self._customer_alarms = fm.get_alarms(self.platform_token).result_data
alarms_in_fm = fm.get_alarms(self.platform_token).result_data["alarms"]
alarms_in_fm.extend(fm.get_alarms(self.openstack_token,
OPENSTACK_SERVICE.FM).result_data["alarms"])
self._customer_alarms = dict()
self._customer_alarms["alarms"] = alarms_in_fm
def _refresh_customer_logs(self):
"""
Fetch the customer logs
"""
self._customer_logs = fm.get_logs(self.platform_token,
self.start_datetime,
self.end_datetime).result_data
logs_in_fm = fm.get_logs(self.platform_token,
self.start_datetime,
self.end_datetime).result_data["event_log"]
logs_in_fm.extend(fm.get_logs(self.openstack_token,
self.start_datetime,
self.end_datetime,
OPENSTACK_SERVICE.FM).result_data["event_log"])
self._customer_logs = dict()
self._customer_logs["event_log"] = logs_in_fm
def _refresh_customer_alarm_history(self):
"""
Fetch the customer alarm history
"""
self._customer_alarm_history = fm.get_alarm_history(
alarm_history_in_fm = fm.get_alarm_history(
self.platform_token,
self.start_datetime,
self.end_datetime).result_data
self.end_datetime).result_data["event_log"]
alarm_history_in_fm.extend(fm.get_alarm_history(
self.openstack_token,
self.start_datetime,
self.end_datetime,
OPENSTACK_SERVICE.FM).result_data["event_log"])
self._customer_alarm_history = dict()
self._customer_alarm_history["event_log"] = alarm_history_in_fm
class TestInstanceStart(TestInstance):