Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 1 | # 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 Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 14 | |
| 15 | import pytest |
| 16 | |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 17 | from tcp_tests import logger |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 18 | from tcp_tests import settings |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 19 | |
| 20 | LOG = logger.logger |
| 21 | |
| 22 | |
| 23 | @pytest.mark.deploy |
| 24 | class TestOpenContrail(object): |
| 25 | """Test class for testing OpenContrail on a TCP lab""" |
| 26 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 27 | @pytest.mark.fail_snapshot |
sgudz | 868f086 | 2018-03-16 21:47:18 +0200 | [diff] [blame] | 28 | @pytest.mark.with_rally(rally_node="ctl01.") |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 29 | def test_opencontrail(self, config, openstack_deployed, |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 30 | show_step, sl_deployed): |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 31 | """Runner for Juniper contrail-tests |
| 32 | |
| 33 | Scenario: |
| 34 | 1. Prepare salt on hosts |
| 35 | 2. Setup controller nodes |
| 36 | 3. Setup compute nodes |
| 37 | 4. Prepare contrail-tests on ctl01 node |
| 38 | 5. Run contrail-tests |
| 39 | """ |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 40 | openstack_deployed._salt.local( |
| 41 | tgt='*', fun='cmd.run', |
| 42 | args='service ntp stop; ntpd -gq; service ntp start') |
Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame] | 43 | |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 44 | if settings.RUN_TEMPEST: |
sgudz | caa14a6 | 2018-02-07 12:25:07 +0200 | [diff] [blame] | 45 | openstack_deployed.run_tempest(target='ctl01', |
| 46 | pattern=settings.PATTERN) |
| 47 | openstack_deployed.download_tempest_report(stored_node='ctl01') |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 48 | LOG.info("*************** DONE **************") |
| 49 | |
sgudz | f5a5122 | 2018-05-11 14:20:50 +0300 | [diff] [blame] | 50 | @pytest.mark.fail_snapshot |
| 51 | @pytest.mark.with_rally(rally_node="ctl01.") |
| 52 | def test_opencontrail_maas(self, config, underlay, salt_actions, |
| 53 | openstack_deployed, show_step, sl_deployed): |
| 54 | """Runner for Juniper contrail-tests |
sgudz | cced67d | 2017-10-11 15:56:09 +0300 | [diff] [blame] | 55 | |
sgudz | f5a5122 | 2018-05-11 14:20:50 +0300 | [diff] [blame] | 56 | Scenario: |
| 57 | 1. Prepare salt on hosts |
| 58 | 2. Setup controller nodes |
| 59 | 3. Setup compute nodes |
| 60 | 4. Run tempest |
| 61 | 5. Exporting results |
| 62 | 6. Check docker services |
| 63 | 7. Run SL tests |
| 64 | 8. Download sl tests report |
| 65 | """ |
| 66 | openstack_deployed._salt.local( |
| 67 | tgt='*', fun='cmd.run', |
| 68 | args='service ntp stop; ntpd -gq; service ntp start') |
| 69 | |
| 70 | if settings.RUN_TEMPEST: |
| 71 | show_step(4) |
| 72 | openstack_deployed.run_tempest(target='ctl01', |
| 73 | pattern=settings.PATTERN) |
| 74 | openstack_deployed.download_tempest_report(stored_node='ctl01') |
| 75 | |
| 76 | expected_service_list = ['monitoring_server', |
| 77 | 'monitoring_remote_agent', |
| 78 | 'dashboard_grafana', |
| 79 | 'monitoring_alertmanager', |
| 80 | 'monitoring_remote_collector', |
| 81 | 'monitoring_pushgateway'] |
| 82 | mon_nodes = sl_deployed.get_monitoring_nodes() |
| 83 | LOG.debug('Mon nodes list {0}'.format(mon_nodes)) |
| 84 | |
| 85 | prometheus_relay_enabled = salt_actions.get_pillar( |
| 86 | tgt=mon_nodes[0], |
| 87 | pillar="prometheus:relay:enabled")[0] |
| 88 | if not prometheus_relay_enabled: |
| 89 | # InfluxDB is used if prometheus relay service is not installed |
| 90 | expected_service_list.append('monitoring_remote_storage_adapter') |
| 91 | show_step(6) |
| 92 | sl_deployed.check_docker_services(mon_nodes, expected_service_list) |
| 93 | # Run SL component tetsts |
| 94 | if settings.RUN_SL_TESTS: |
| 95 | show_step(7) |
| 96 | sl_deployed.run_sl_functional_tests( |
| 97 | 'cfg01', |
| 98 | '/root/stacklight-pytest/stacklight_tests/', |
| 99 | 'tests/prometheus', |
| 100 | 'test_alerts.py') |
| 101 | show_step(8) |
| 102 | # Download report |
| 103 | sl_deployed.download_sl_test_report( |
| 104 | 'cfg01', |
| 105 | '/root/stacklight-pytest/stacklight_tests/report.xml') |
| 106 | |
| 107 | LOG.info("*************** DONE **************") |