blob: 9852f5f1a97669e386d2497ea5a0013bf067aca6 [file] [log] [blame]
sgudzf0ff0302018-01-29 18:50:01 +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.
14
15import pytest
16from tcp_tests.managers.jenkins.client import JenkinsClient
17
18from tcp_tests import logger
Oleksii Butenkof65a0042018-06-27 13:38:43 +030019from tcp_tests import settings
sgudzf0ff0302018-01-29 18:50:01 +020020
21LOG = logger.logger
22
23
24@pytest.mark.deploy
25class 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 Dmitrievea48cf52018-07-18 18:04:39 +030030 core_deployed, salt_deployed):
sgudzf0ff0302018-01-29 18:50:01 +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
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 Butenkof65a0042018-06-27 13:38:43 +030077 @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.
Oleksii Butenkof1970522018-07-23 15:31:30 +030084 2. Connect to jenkins on cfg01 node
85 3. Run deploy on cfg01 node
86 4. Connect to jenkins on cid node
87 5. Run deploy on cid node
Oleksii Butenkof65a0042018-06-27 13:38:43 +030088 """
Oleksii Butenkof1970522018-07-23 15:31:30 +030089 show_step(1)
Oleksii Butenkof65a0042018-06-27 13:38:43 +030090 nodes = underlay.node_names()
91 LOG.info("Nodes - {}".format(nodes))
Oleksii Butenkof1970522018-07-23 15:31:30 +030092 show_step(2)
93
Oleksii Butenkobe369b22018-07-19 12:40:23 +030094 cfg_node = 'cfg01.cookied-bm-dpdk-pipeline.local'
Oleksii Butenkof65a0042018-06-27 13:38:43 +030095 salt_api = salt_deployed.get_pillar(
96 cfg_node, '_param:jenkins_salt_api_url')
97 salt_api = salt_api[0].get(cfg_node)
98 jenkins = JenkinsClient(
99 host='http://172.16.49.2:8081',
100 username='admin',
101 password='r00tme')
Oleksii Butenkof65a0042018-06-27 13:38:43 +0300102 params = jenkins.make_defults_params('deploy_openstack')
103 params['SALT_MASTER_URL'] = salt_api
Oleksii Butenkobe369b22018-07-19 12:40:23 +0300104 params['STACK_INSTALL'] = 'core,kvm,cicd'
Oleksii Butenkof1970522018-07-23 15:31:30 +0300105
106 show_step(3)
Oleksii Butenkof65a0042018-06-27 13:38:43 +0300107 build = jenkins.run_build('deploy_openstack', params)
108 jenkins.wait_end_of_build(
109 name=build[0],
110 build_id=build[1],
111 timeout=60 * 60 * 4)
112 result = jenkins.build_info(name=build[0],
113 build_id=build[1])['result']
114 assert result == 'SUCCESS', "Deploy openstack was failed"
Oleksii Butenkof1970522018-07-23 15:31:30 +0300115
116 show_step(4)
117 cid_node = 'cid01.cookied-bm-dpdk-pipeline.local'
118 salt_output = salt_deployed.get_pillar(
119 cid_node, 'jenkins:client:master:password')
120 cid_passwd = salt_output[0].get(cid_node)
121 jenkins = JenkinsClient(
122 host='http://10.167.11.90:8081',
123 username='admin',
124 password=cid_passwd)
125 params['STACK_INSTALL'] = 'ovs,openstack'
126 show_step(5)
127 build = jenkins.run_build('deploy_openstack', params)
128 jenkins.wait_end_of_build(
129 name=build[0],
130 build_id=build[1],
131 timeout=60 * 60 * 4)
132 result = jenkins.build_info(name=build[0],
133 build_id=build[1])['result']
134 assert result == 'SUCCESS', "Deploy openstack was failed"
135
Oleksii Butenkof65a0042018-06-27 13:38:43 +0300136 if settings.RUN_TEMPEST:
137 tempest_actions.prepare_and_run_tempest()
sgudzf0ff0302018-01-29 18:50:01 +0200138 LOG.info("*************** DONE **************")