blob: efc37c819b3b49b1da6b947049fcd1748302d65e [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,
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030030 openstack_deployed, stacklight_deployed,
31 show_step):
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020032 """Runner for Juniper contrail-tests
33
34 Scenario:
35 1. Prepare salt on hosts
36 2. Setup controller nodes
37 3. Setup compute nodes
sgudz850e6072018-06-05 14:46:53 +030038 4. Run tempest
39 5. Run SL test
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020040 """
sgudzcced67d2017-10-11 15:56:09 +030041 openstack_deployed._salt.local(
42 tgt='*', fun='cmd.run',
43 args='service ntp stop; ntpd -gq; service ntp start')
Dennis Dmitriev2cbf2352016-11-11 15:34:21 +020044
sgudzcced67d2017-10-11 15:56:09 +030045 if settings.RUN_TEMPEST:
sgudz850e6072018-06-05 14:46:53 +030046 tempest_conf_name = '/var/lib/contrail_fixed_mcp.conf'
sgudzcaa14a62018-02-07 12:25:07 +020047 openstack_deployed.run_tempest(target='ctl01',
sgudz850e6072018-06-05 14:46:53 +030048 pattern=settings.PATTERN,
49 conf_name=tempest_conf_name)
sgudzcaa14a62018-02-07 12:25:07 +020050 openstack_deployed.download_tempest_report(stored_node='ctl01')
sgudz850e6072018-06-05 14:46:53 +030051 # Run SL component tetsts
52 if settings.RUN_SL_TESTS:
53 show_step(5)
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030054 stacklight_deployed.run_sl_functional_tests(
sgudz850e6072018-06-05 14:46:53 +030055 'ctl01',
56 '/root/stacklight-pytest/stacklight_tests/',
57 'tests/prometheus',
58 'test_alerts.py')
59 show_step(8)
60 # Download report
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030061 stacklight_deployed.download_sl_test_report(
sgudz850e6072018-06-05 14:46:53 +030062 'ctl01',
63 '/root/stacklight-pytest/stacklight_tests/report.xml')
sgudzcced67d2017-10-11 15:56:09 +030064 LOG.info("*************** DONE **************")
65
sgudzf5a51222018-05-11 14:20:50 +030066 @pytest.mark.fail_snapshot
67 @pytest.mark.with_rally(rally_node="ctl01.")
sgudz850e6072018-06-05 14:46:53 +030068 def test_opencontrail3_maas(self, config, underlay, salt_actions,
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030069 openstack_deployed, show_step,
70 stacklight_deployed):
sgudzf5a51222018-05-11 14:20:50 +030071 """Runner for Juniper contrail-tests
sgudzcced67d2017-10-11 15:56:09 +030072
sgudzf5a51222018-05-11 14:20:50 +030073 Scenario:
74 1. Prepare salt on hosts
75 2. Setup controller nodes
76 3. Setup compute nodes
77 4. Run tempest
78 5. Exporting results
79 6. Check docker services
80 7. Run SL tests
81 8. Download sl tests report
82 """
83 openstack_deployed._salt.local(
84 tgt='*', fun='cmd.run',
85 args='service ntp stop; ntpd -gq; service ntp start')
86
87 if settings.RUN_TEMPEST:
88 show_step(4)
89 openstack_deployed.run_tempest(target='ctl01',
90 pattern=settings.PATTERN)
91 openstack_deployed.download_tempest_report(stored_node='ctl01')
92
93 expected_service_list = ['monitoring_server',
94 'monitoring_remote_agent',
95 'dashboard_grafana',
96 'monitoring_alertmanager',
97 'monitoring_remote_collector',
98 'monitoring_pushgateway']
Dennis Dmitrievea48cf52018-07-18 18:04:39 +030099 mon_nodes = stacklight_deployed.get_monitoring_nodes()
sgudzf5a51222018-05-11 14:20:50 +0300100 LOG.debug('Mon nodes list {0}'.format(mon_nodes))
101
102 prometheus_relay_enabled = salt_actions.get_pillar(
103 tgt=mon_nodes[0],
104 pillar="prometheus:relay:enabled")[0]
105 if not prometheus_relay_enabled:
106 # InfluxDB is used if prometheus relay service is not installed
107 expected_service_list.append('monitoring_remote_storage_adapter')
108 show_step(6)
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300109 stacklight_deployed.check_docker_services(mon_nodes,
110 expected_service_list)
sgudzf5a51222018-05-11 14:20:50 +0300111 # Run SL component tetsts
112 if settings.RUN_SL_TESTS:
113 show_step(7)
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300114 stacklight_deployed.run_sl_functional_tests(
sgudz850e6072018-06-05 14:46:53 +0300115 'ctl01',
sgudzf5a51222018-05-11 14:20:50 +0300116 '/root/stacklight-pytest/stacklight_tests/',
117 'tests/prometheus',
118 'test_alerts.py')
119 show_step(8)
120 # Download report
Dennis Dmitrievea48cf52018-07-18 18:04:39 +0300121 stacklight_deployed.download_sl_test_report(
sgudz850e6072018-06-05 14:46:53 +0300122 'ctl01',
sgudzf5a51222018-05-11 14:20:50 +0300123 '/root/stacklight-pytest/stacklight_tests/report.xml')
124
125 LOG.info("*************** DONE **************")