From 0d00446d7b017f09271f91b34736b520e3fad74b Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Wed, 5 Sep 2018 11:54:01 -0500 Subject: [PATCH] Fix VIM automated tests VIM automated tests were broken after FM APIs were removed from sysinv. This updated contains the following changes that enable VIM automated tests: 1.Add the FM endpoint information to the scenario tests config file 2.Change the alarm-list and event-list CLI from system shell to fm shell 3.Fix two exception error messages Closes-Bug: 1790906 Change-Id: If712d09861a20aa8a8796300bfa18e17f1d3be7d Signed-off-by: Tao Liu --- nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/fm.py | 4 ++-- nfv/nfv-tests/nfv_scenario_tests/config.ini | 6 ++++++ nfv/nfv-tests/nfv_scenario_tests/tests/_test_hosts.py | 6 +++--- nfv/nfv-tests/nfv_scenario_tests/tests/_test_instances.py | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/fm.py b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/fm.py index 38f1b1ed..71202ddf 100755 --- a/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/fm.py +++ b/nfv/nfv-plugins/nfv_plugins/nfvi_plugins/openstack/fm.py @@ -32,7 +32,7 @@ def get_logs(token, start=None, end=None): """ url = token.get_service_url(OPENSTACK_SERVICE.FM) if url is None: - raise ValueError("OpenStack SysInv URL is invalid") + raise ValueError("OpenStack FM URL is invalid") api_cmd = url + "/event_log?logs=True" @@ -61,7 +61,7 @@ def get_alarm_history(token, start=None, end=None): """ url = token.get_service_url(OPENSTACK_SERVICE.FM) if url is None: - raise ValueError("OpenStack SysInv URL is invalid") + raise ValueError("OpenStack FM URL is invalid") api_cmd = url + "/event_log?alarms=True" diff --git a/nfv/nfv-tests/nfv_scenario_tests/config.ini b/nfv/nfv-tests/nfv_scenario_tests/config.ini index a9f79e69..faa5e104 100755 --- a/nfv/nfv-tests/nfv_scenario_tests/config.ini +++ b/nfv/nfv-tests/nfv_scenario_tests/config.ini @@ -69,6 +69,12 @@ service_name=sysinv service_type=platform endpoint_type=admin +[fm] +region_name=RegionOne +service_name=fm +service_type=faultmanagement +endpoint_type=admin + [mtc] endpoint_override=http://localhost:2112 diff --git a/nfv/nfv-tests/nfv_scenario_tests/tests/_test_hosts.py b/nfv/nfv-tests/nfv_scenario_tests/tests/_test_hosts.py index b706ef9f..b6c1dfd3 100755 --- a/nfv/nfv-tests/nfv_scenario_tests/tests/_test_hosts.py +++ b/nfv/nfv-tests/nfv_scenario_tests/tests/_test_hosts.py @@ -120,7 +120,7 @@ class TestHost(_test_base.Test): open(filename, 'w').close() os.system("source /etc/nova/openrc; echo -e '\tALARM-LIST' >> %s; " - "system alarm-list --nowrap | sed 's/^/\t /' >> %s; " + "fm alarm-list --nowrap | sed 's/^/\t /' >> %s; " "echo -e '\n' >> %s" % (filename, filename, filename)) def save_customer_logs(self, filename, wipe=False): @@ -131,7 +131,7 @@ class TestHost(_test_base.Test): open(filename, 'w').close() os.system("source /etc/nova/openrc; echo -e '\tLOG-LIST' >> %s; " - "system event-list --logs --nowrap --nopaging --limit 100 --query " + "fm event-list --logs --nowrap --nopaging --limit 100 --query " "'start=%s;end=%s' | sed 's/^/\t /' >> %s; echo -e '\n' >> %s" % (filename, self._start_datetime, self._end_datetime, filename, filename)) @@ -144,7 +144,7 @@ class TestHost(_test_base.Test): open(filename, 'w').close() os.system("source /etc/nova/openrc; echo -e '\tALARM-HISTORY' >> %s; " - "system event-list --alarms --nowrap --nopaging --limit 100 " + "fm event-list --alarms --nowrap --nopaging --limit 100 " "--query 'start=%s;end=%s' | sed 's/^/\t /' >> %s; " "echo -e '\n' >> %s" % (filename, self._start_datetime, self._end_datetime, diff --git a/nfv/nfv-tests/nfv_scenario_tests/tests/_test_instances.py b/nfv/nfv-tests/nfv_scenario_tests/tests/_test_instances.py index 4a815069..cafc2a3e 100755 --- a/nfv/nfv-tests/nfv_scenario_tests/tests/_test_instances.py +++ b/nfv/nfv-tests/nfv_scenario_tests/tests/_test_instances.py @@ -119,7 +119,7 @@ class TestInstance(_test_base.Test): open(filename, 'w').close() os.system("source /etc/nova/openrc; echo -e '\tALARM-LIST' >> %s; " - "system alarm-list --nowrap | sed 's/^/\t /' >> %s; " + "fm alarm-list --nowrap | sed 's/^/\t /' >> %s; " "echo -e '\n' >> %s" % (filename, filename, filename)) def save_customer_logs(self, filename, wipe=False): @@ -130,7 +130,7 @@ class TestInstance(_test_base.Test): open(filename, 'w').close() os.system("source /etc/nova/openrc; echo -e '\tLOG-LIST' >> %s; " - "system event-list --logs --nowrap --nopaging --limit 100 --query " + "fm event-list --logs --nowrap --nopaging --limit 100 --query " "'start=%s;end=%s' | sed 's/^/\t /' >> %s; echo -e '\n' >> %s" % (filename, self._start_datetime, self._end_datetime, filename, filename)) @@ -143,7 +143,7 @@ class TestInstance(_test_base.Test): open(filename, 'w').close() os.system("source /etc/nova/openrc; echo -e '\tALARM-HISTORY' >> %s; " - "system event-list --alarms --nowrap --nopaging --limit 100 " + "fm event-list --alarms --nowrap --nopaging --limit 100 " "--query 'start=%s;end=%s' | sed 's/^/\t /' >> %s; " "echo -e '\n' >> %s" % (filename, self._start_datetime, self._end_datetime,