blob: 74b5d2be3c067712acc3607757ce1d919a9f0fbe [file] [log] [blame]
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +02001# Copyright 2016 Mirantis, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020014
15import pytest
16
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020017from tcp_tests import logger
sgudzcced67d2017-10-11 15:56:09 +030018from tcp_tests import settings
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020019
20LOG = logger.logger
21
22
23@pytest.mark.deploy
24class TestOpenContrail(object):
25 """Test class for testing OpenContrail on a TCP lab"""
26
Dennis Dmitriev99b26fe2017-04-26 12:34:44 +030027 @pytest.mark.fail_snapshot
sgudz868f0862018-03-16 21:47:18 +020028 @pytest.mark.with_rally(rally_node="ctl01.")
sgudz850e6072018-06-05 14:46:53 +030029 def test_opencontrail_simple(self, config, underlay, salt_deployed,
30 openstack_deployed, sl_deployed, show_step):
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020031 """Runner for Juniper contrail-tests
32
33 Scenario:
34 1. Prepare salt on hosts
35 2. Setup controller nodes
36 3. Setup compute nodes
sgudz850e6072018-06-05 14:46:53 +030037 4. Run tempest
38 5. Run SL test
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020039 """
sgudzcced67d2017-10-11 15:56:09 +030040 openstack_deployed._salt.local(
41 tgt='*', fun='cmd.run',
42 args='service ntp stop; ntpd -gq; service ntp start')
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020043
sgudzcced67d2017-10-11 15:56:09 +030044 if settings.RUN_TEMPEST:
sgudz850e6072018-06-05 14:46:53 +030045 tempest_conf_name = '/var/lib/contrail_fixed_mcp.conf'
sgudzcaa14a62018-02-07 12:25:07 +020046 openstack_deployed.run_tempest(target='ctl01',
sgudz850e6072018-06-05 14:46:53 +030047 pattern=settings.PATTERN,
48 conf_name=tempest_conf_name)
sgudzcaa14a62018-02-07 12:25:07 +020049 openstack_deployed.download_tempest_report(stored_node='ctl01')
sgudz850e6072018-06-05 14:46:53 +030050 # Run SL component tetsts
51 if settings.RUN_SL_TESTS:
52 show_step(5)
53 sl_deployed.run_sl_functional_tests(
54 'ctl01',
55 '/root/stacklight-pytest/stacklight_tests/',
56 'tests/prometheus',
57 'test_alerts.py')
58 show_step(8)
59 # Download report
60 sl_deployed.download_sl_test_report(
61 'ctl01',
62 '/root/stacklight-pytest/stacklight_tests/report.xml')
sgudzcced67d2017-10-11 15:56:09 +030063 LOG.info("*************** DONE **************")
64
sgudzf5a51222018-05-11 14:20:50 +030065 @pytest.mark.fail_snapshot
66 @pytest.mark.with_rally(rally_node="ctl01.")
sgudz850e6072018-06-05 14:46:53 +030067 def test_opencontrail3_maas(self, config, underlay, salt_actions,
68 openstack_deployed, show_step, sl_deployed):
sgudzf5a51222018-05-11 14:20:50 +030069 """Runner for Juniper contrail-tests
sgudzcced67d2017-10-11 15:56:09 +030070
sgudzf5a51222018-05-11 14:20:50 +030071 Scenario:
72 1. Prepare salt on hosts
73 2. Setup controller nodes
74 3. Setup compute nodes
75 4. Run tempest
76 5. Exporting results
77 6. Check docker services
78 7. Run SL tests
79 8. Download sl tests report
80 """
81 openstack_deployed._salt.local(
82 tgt='*', fun='cmd.run',
83 args='service ntp stop; ntpd -gq; service ntp start')
84
85 if settings.RUN_TEMPEST:
86 show_step(4)
87 openstack_deployed.run_tempest(target='ctl01',
88 pattern=settings.PATTERN)
89 openstack_deployed.download_tempest_report(stored_node='ctl01')
90
91 expected_service_list = ['monitoring_server',
92 'monitoring_remote_agent',
93 'dashboard_grafana',
94 'monitoring_alertmanager',
95 'monitoring_remote_collector',
96 'monitoring_pushgateway']
97 mon_nodes = sl_deployed.get_monitoring_nodes()
98 LOG.debug('Mon nodes list {0}'.format(mon_nodes))
99
100 prometheus_relay_enabled = salt_actions.get_pillar(
101 tgt=mon_nodes[0],
102 pillar="prometheus:relay:enabled")[0]
103 if not prometheus_relay_enabled:
104 # InfluxDB is used if prometheus relay service is not installed
105 expected_service_list.append('monitoring_remote_storage_adapter')
106 show_step(6)
107 sl_deployed.check_docker_services(mon_nodes, expected_service_list)
108 # Run SL component tetsts
109 if settings.RUN_SL_TESTS:
110 show_step(7)
111 sl_deployed.run_sl_functional_tests(
sgudz850e6072018-06-05 14:46:53 +0300112 'ctl01',
sgudzf5a51222018-05-11 14:20:50 +0300113 '/root/stacklight-pytest/stacklight_tests/',
114 'tests/prometheus',
115 'test_alerts.py')
116 show_step(8)
117 # Download report
118 sl_deployed.download_sl_test_report(
sgudz850e6072018-06-05 14:46:53 +0300119 'ctl01',
sgudzf5a51222018-05-11 14:20:50 +0300120 '/root/stacklight-pytest/stacklight_tests/report.xml')
121
122 LOG.info("*************** DONE **************")