sgudz | f0ff030 | 2018-01-29 18:50:01 +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. |
| 14 | |
| 15 | import pytest |
| 16 | from tcp_tests.managers.jenkins.client import JenkinsClient |
| 17 | |
| 18 | from tcp_tests import logger |
Oleksii Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 19 | from tcp_tests import settings |
sgudz | f0ff030 | 2018-01-29 18:50:01 +0200 | [diff] [blame] | 20 | |
| 21 | LOG = logger.logger |
| 22 | |
| 23 | |
| 24 | @pytest.mark.deploy |
| 25 | class TestPipeline(object): |
| 26 | """Test class for testing deploy via Pipelines""" |
| 27 | |
| 28 | @pytest.mark.fail_snapshot |
| 29 | def test_pipeline(self, show_step, underlay, |
Dennis Dmitriev | ea48cf5 | 2018-07-18 18:04:39 +0300 | [diff] [blame] | 30 | core_deployed, salt_deployed): |
sgudz | f0ff030 | 2018-01-29 18:50:01 +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. Deploy openstack via pipelines |
| 38 | 5. Deploy CICD via pipelines |
| 39 | """ |
| 40 | nodes = underlay.node_names() |
| 41 | LOG.info("Nodes - {}".format(nodes)) |
| 42 | cfg_node = 'cfg01.ocata-cicd.local' |
| 43 | salt_api = salt_deployed.get_pillar( |
| 44 | cfg_node, '_param:jenkins_salt_api_url') |
| 45 | salt_api = salt_api[0].get(cfg_node) |
| 46 | jenkins = JenkinsClient( |
| 47 | host='http://172.16.49.66:8081', |
| 48 | username='admin', |
| 49 | password='r00tme') |
| 50 | |
| 51 | # Creating param list for openstack deploy |
| 52 | params = jenkins.make_defults_params('deploy_openstack') |
| 53 | params['SALT_MASTER_URL'] = salt_api |
| 54 | params['STACK_INSTALL'] = 'core,kvm,openstack,ovs' |
| 55 | show_step(4) |
| 56 | build = jenkins.run_build('deploy_openstack', params) |
| 57 | jenkins.wait_end_of_build( |
| 58 | name=build[0], |
| 59 | build_id=build[1], |
| 60 | timeout=60 * 60 * 4) |
| 61 | result = jenkins.build_info(name=build[0], |
| 62 | build_id=build[1])['result'] |
| 63 | assert result == 'SUCCESS', "Deploy openstack was failed" |
| 64 | |
| 65 | # Changing param for cicd deploy |
| 66 | show_step(5) |
| 67 | params['STACK_INSTALL'] = 'cicd' |
| 68 | build = jenkins.run_build('deploy_openstack', params) |
| 69 | jenkins.wait_end_of_build( |
| 70 | name=build[0], |
| 71 | build_id=build[1], |
| 72 | timeout=60 * 60 * 2) |
| 73 | result = jenkins.build_info(name=build[0], |
| 74 | build_id=build[1])['result'] |
| 75 | assert result == 'SUCCESS', "Deploy CICD was failed" |
| 76 | |
Oleksii Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 77 | @pytest.mark.fail_snapshot |
| 78 | def test_pipeline_dpdk(self, show_step, underlay, |
| 79 | salt_deployed, tempest_actions): |
| 80 | """Deploy bm via pipeline |
| 81 | |
| 82 | Scenario: |
| 83 | 1. Prepare salt on hosts. |
| 84 | ......................... |
| 85 | """ |
| 86 | nodes = underlay.node_names() |
| 87 | LOG.info("Nodes - {}".format(nodes)) |
Oleksii Butenko | be369b2 | 2018-07-19 12:40:23 +0300 | [diff] [blame] | 88 | cfg_node = 'cfg01.cookied-bm-dpdk-pipeline.local' |
Oleksii Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 89 | salt_api = salt_deployed.get_pillar( |
| 90 | cfg_node, '_param:jenkins_salt_api_url') |
| 91 | salt_api = salt_api[0].get(cfg_node) |
| 92 | jenkins = JenkinsClient( |
| 93 | host='http://172.16.49.2:8081', |
| 94 | username='admin', |
| 95 | password='r00tme') |
| 96 | |
| 97 | # Creating param list for openstack deploy |
| 98 | params = jenkins.make_defults_params('deploy_openstack') |
| 99 | params['SALT_MASTER_URL'] = salt_api |
Oleksii Butenko | be369b2 | 2018-07-19 12:40:23 +0300 | [diff] [blame] | 100 | params['STACK_INSTALL'] = 'core,kvm,cicd' |
Oleksii Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 101 | show_step(4) |
| 102 | build = jenkins.run_build('deploy_openstack', params) |
| 103 | jenkins.wait_end_of_build( |
| 104 | name=build[0], |
| 105 | build_id=build[1], |
| 106 | timeout=60 * 60 * 4) |
| 107 | result = jenkins.build_info(name=build[0], |
| 108 | build_id=build[1])['result'] |
| 109 | assert result == 'SUCCESS', "Deploy openstack was failed" |
Oleksii Butenko | be369b2 | 2018-07-19 12:40:23 +0300 | [diff] [blame] | 110 | # cicd_passwd = "" |
| 111 | # jenkins_cicd = JenkinsClient( |
| 112 | # host='http://10.167.11.90:8081', |
| 113 | # username='admin', |
| 114 | # password='r00tme') |
Oleksii Butenko | f65a004 | 2018-06-27 13:38:43 +0300 | [diff] [blame] | 115 | if settings.RUN_TEMPEST: |
| 116 | tempest_actions.prepare_and_run_tempest() |
sgudz | f0ff030 | 2018-01-29 18:50:01 +0200 | [diff] [blame] | 117 | LOG.info("*************** DONE **************") |