forked from openstack-archive/fuel-qa
/
test_neutron.py
235 lines (201 loc) · 8.3 KB
/
test_neutron.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from proboscis.asserts import assert_equal
from proboscis import test
from fuelweb_test.helpers import checkers
from fuelweb_test.helpers import os_actions
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.settings import DEPLOYMENT_MODE
from fuelweb_test.settings import NEUTRON_SEGMENT
from fuelweb_test.tests.base_test_case import SetupEnvironment
from fuelweb_test.tests.base_test_case import TestBasic
from fuelweb_test import logger
@test(groups=["thread_1", "neutron"])
class NeutronVlan(TestBasic):
"""NeutronVlan.""" # TODO documentation
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
groups=["deploy_neutron_vlan", "ha_one_controller_neutron_vlan",
"deployment", "nova", "nova-compute"])
@log_snapshot_after_test
def deploy_neutron_vlan(self):
"""Deploy cluster in ha mode with 1 controller and Neutron VLAN
Scenario:
1. Create cluster
2. Add 1 node with controller role
3. Add 2 nodes with compute role
4. Deploy the cluster
5. Run network verification
6. Run OSTF
Duration 35m
Snapshot deploy_neutron_vlan
"""
self.env.revert_snapshot("ready_with_3_slaves")
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=DEPLOYMENT_MODE,
settings={
"net_provider": 'neutron',
"net_segment_type": NEUTRON_SEGMENT['vlan'],
'tenant': 'simpleVlan',
'user': 'simpleVlan',
'password': 'simpleVlan'
}
)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['compute'],
'slave-03': ['compute']
}
)
self.fuel_web.deploy_cluster_wait(cluster_id)
cluster = self.fuel_web.client.get_cluster(cluster_id)
assert_equal(str(cluster['net_provider']), 'neutron')
# assert_equal(str(cluster['net_segment_type']), segment_type)
self.fuel_web.verify_network(cluster_id)
self.fuel_web.run_ostf(
cluster_id=cluster_id)
self.env.make_snapshot("deploy_neutron_vlan")
@test(groups=["neutron", "ha", "ha_neutron", "classic_provisioning"])
class NeutronGreHa(TestBasic):
"""NeutronGreHa.""" # TODO documentation
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["deploy_neutron_gre_ha", "ha_neutron_gre"])
@log_snapshot_after_test
def deploy_neutron_gre_ha(self):
"""Deploy cluster in HA mode with Neutron GRE (DEPRECATED)
Scenario:
1. Create cluster
2. Add 3 nodes with controller role
3. Add 2 nodes with compute role
4. Deploy the cluster
5. Run network verification
6. Run OSTF
Duration 80m
Snapshot deploy_neutron_gre_ha
"""
self.env.revert_snapshot("ready_with_5_slaves")
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=DEPLOYMENT_MODE,
settings={
"net_provider": 'neutron',
"net_segment_type": NEUTRON_SEGMENT['gre'],
'tenant': 'haGre',
'user': 'haGre',
'password': 'haGre'
}
)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['controller'],
'slave-03': ['controller'],
'slave-04': ['compute'],
'slave-05': ['compute']
}
)
self.fuel_web.deploy_cluster_wait(cluster_id)
cluster = self.fuel_web.client.get_cluster(cluster_id)
assert_equal(str(cluster['net_provider']), 'neutron')
self.fuel_web.verify_network(cluster_id)
devops_node = self.fuel_web.get_nailgun_primary_node(
self.env.d_env.nodes().slaves[0])
logger.debug("devops node name is {0}".format(devops_node.name))
_ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip']
with self.env.d_env.get_ssh_to_remote(_ip) as remote:
for i in range(5):
try:
checkers.check_swift_ring(remote)
break
except AssertionError:
result = remote.execute(
"/usr/local/bin/swift-rings-rebalance.sh")
logger.debug("command execution result is {0}"
.format(result))
else:
checkers.check_swift_ring(remote)
self.fuel_web.run_ostf(
cluster_id=cluster_id,
test_sets=['ha', 'smoke', 'sanity'])
self.env.make_snapshot("deploy_neutron_gre_ha")
@test(groups=["neutron", "ha", "ha_neutron"])
class NeutronVlanHa(TestBasic):
"""NeutronVlanHa.""" # TODO documentation
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
groups=["deploy_neutron_vlan_ha", "neutron_vlan_ha"])
@log_snapshot_after_test
def deploy_neutron_vlan_ha(self):
"""Deploy cluster in HA mode with Neutron VLAN
Scenario:
1. Create cluster
2. Add 3 nodes with controller role
3. Add 2 nodes with compute role
4. Deploy the cluster
5. Run network verification
6. Run OSTF
Duration 80m
Snapshot deploy_neutron_vlan_ha
"""
self.env.revert_snapshot("ready_with_5_slaves")
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=DEPLOYMENT_MODE,
settings={
"net_provider": 'neutron',
"net_segment_type": NEUTRON_SEGMENT['vlan']
}
)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['controller'],
'slave-03': ['controller'],
'slave-04': ['compute'],
'slave-05': ['compute']
}
)
self.fuel_web.update_internal_network(cluster_id, '192.168.196.0/22',
'192.168.196.1')
self.fuel_web.deploy_cluster_wait(cluster_id)
cluster = self.fuel_web.client.get_cluster(cluster_id)
assert_equal(str(cluster['net_provider']), 'neutron')
os_conn = os_actions.OpenStackActions(
self.fuel_web.get_public_vip(cluster_id))
# assert_equal(str(cluster['net_segment_type']), segment_type)
self.fuel_web.check_fixed_network_cidr(
cluster_id, os_conn)
self.fuel_web.verify_network(cluster_id)
devops_node = self.fuel_web.get_nailgun_primary_node(
self.env.d_env.nodes().slaves[0])
logger.debug("devops node name is {0}".format(devops_node.name))
_ip = self.fuel_web.get_nailgun_node_by_name(devops_node.name)['ip']
with self.env.d_env.get_ssh_to_remote(_ip) as remote:
for i in range(5):
try:
checkers.check_swift_ring(remote)
break
except AssertionError:
result = remote.execute(
"/usr/local/bin/swift-rings-rebalance.sh")
logger.debug("command execution result is {0}"
.format(result))
else:
checkers.check_swift_ring(remote)
self.fuel_web.run_ostf(
cluster_id=cluster_id, test_sets=['ha', 'smoke', 'sanity'])
self.env.make_snapshot("deploy_neutron_vlan_ha")