blob: ed70674cedd77b886a4a585262c099fed50a7d65 [file] [log] [blame]
Matteo Scandolo48d3d2d2017-08-08 13:05:27 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
ChetanGaonker901727c2016-11-29 14:05:03 -080017#
18# Copyright 2016-present Ciena Corporation
19#
20# Licensed under the Apache License, Version 2.0 (the "License");
21# you may not use this file except in compliance with the License.
22# You may obtain a copy of the License at
23#
24# http://www.apache.org/licenses/LICENSE-2.0
25#
26# Unless required by applicable law or agreed to in writing, software
27# distributed under the License is distributed on an "AS IS" BASIS,
28# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29# See the License for the specific language governing permissions and
30# limitations under the License.
31#
32import unittest
33import os,sys
ChetanGaonker901727c2016-11-29 14:05:03 -080034import keystoneclient.v2_0.client as ksclient
35import keystoneclient.apiclient.exceptions
36import neutronclient.v2_0.client as nclient
37import neutronclient.common.exceptions
Thangavelu K S40d22112017-04-14 00:32:10 +000038import novaclient.v1_1.client as novaclient
Chetan Gaonkerea4d9902017-04-05 18:25:43 -050039from novaclient import client as nova_client
ChetanGaonker901727c2016-11-29 14:05:03 -080040from multiprocessing import Pool
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080041from neutronclient.v2_0 import client as neutron_client
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000042import neutronclient.v2_0.client as neutronclient
ChetanGaonker901727c2016-11-29 14:05:03 -080043from nose.tools import assert_equal
A R Karthick76a497a2017-04-12 10:59:39 -070044from CordTestUtils import get_mac, log_test
Thangavelu K Sc12afcf2017-04-21 11:32:12 -060045from onosclidriver import OnosCliDriver
A.R Karthickbe7768c2017-03-17 11:39:41 -070046from OnosCtrl import OnosCtrl
ChetanGaonker901727c2016-11-29 14:05:03 -080047from CordLogger import CordLogger
A.R Karthickd4eed642017-03-09 14:40:52 -080048from TestManifest import TestManifest
Chetan Gaonkera6e23a72017-03-14 01:27:49 +000049from OnosFlowCtrl import OnosFlowCtrl
Thangavelu K S40d22112017-04-14 00:32:10 +000050from scapy.all import *
Thangavelu K Sb8a7b872017-03-31 18:10:53 +000051from credentials import *
52from VSGAccess import VSGAccess
53from SSHTestAgent import SSHTestAgent
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000054import requests
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080055import time
Chetan Gaonker3c8ae682017-02-18 00:50:45 +000056import py_compile
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000057import json
ChetanGaonker901727c2016-11-29 14:05:03 -080058
ChetanGaonker71fe0302016-12-19 17:45:44 -080059PROTO_NAME_TCP = 'tcp'
60PROTO_NAME_ICMP = 'icmp'
61IPv4 = 'IPv4'
62
63OS_USERNAME = 'admin'
Chetan Gaonker0fb91c92017-02-07 01:52:18 +000064OS_PASSWORD = 'VeryLongKeystoneAdminPassword'
ChetanGaonker71fe0302016-12-19 17:45:44 -080065OS_TENANT = 'admin'
Chetan Gaonker0fb91c92017-02-07 01:52:18 +000066OS_AUTH_URL = 'https://keystone.cord.lab:5000/v2.0'
67OS_SERVICE_ENDPOINT = 'https://keystone.cord.lab:5000/v2.0/'
Chetan Gaonker1f422af2017-01-13 21:59:16 +000068VM_BOOT_TIMEOUT = 100
69VM_DELETE_TIMEOUT = 100
70
ChetanGaonker71fe0302016-12-19 17:45:44 -080071
72#VM SSH CREDENTIALS
73VM_USERNAME = 'ubuntu'
74VM_PASSWORD = 'ubuntu'
75
76TENANT_PREFIX = 'test-'
77VM_PREFIX = 'test-'
78NETWORK_PREFIX = 'test-'
79CIDR_PREFIX = '192.168'
80
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000081class vtn_validation_utils:
82
A.R Karthickd4eed642017-03-09 14:40:52 -080083 endpoint = '172.17.0.5'
84 version = ''
85 vtn_app = 'org.opencord.vtn'
86
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000087 def __init__(self, version):
88 self.version = version
A.R Karthickd4eed642017-03-09 14:40:52 -080089 self.manifest = None
90 self.vtn_enabled = False
91 manifest = os.getenv('MANIFEST', None)
92 if manifest:
93 self.manifest = TestManifest(manifest = manifest)
94 self.endpoint = self.manifest.onos_ip
95 self.vtn_enabled = self.manifest.synchronizer == 'vtn'
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000096
A.R Karthickd4eed642017-03-09 14:40:52 -080097 self.app_ctrl = OnosCtrl(self.vtn_app, controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000098
A.R Karthickd4eed642017-03-09 14:40:52 -080099 def getDevices(self):
100 return OnosCtrl.get_devices(controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +0000101
A.R Karthickd4eed642017-03-09 14:40:52 -0800102 def getLinks(self):
103 return OnosCtrl.get_links(controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +0000104
A.R Karthickd4eed642017-03-09 14:40:52 -0800105 def getDevicePorts(self, switch_id):
106 return OnosCtrl.get_ports_device(switch_id, controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +0000107
A.R Karthickd4eed642017-03-09 14:40:52 -0800108 def activateVTNApp(self):
109 return self.app_ctrl.activate()
110
111 def deactivateVTNApp(self):
112 return self.app_ctrl.deactivate()
Chetan Gaonker1c387cf2017-02-22 02:21:43 +0000113
ChetanGaonker901727c2016-11-29 14:05:03 -0800114class cordvtn_exchange(CordLogger):
115
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800116 app_cordvtn = 'org.opencord.vtn'
117 test_path = os.path.dirname(os.path.realpath(__file__))
118 cordvtn_dir = os.path.join(test_path, '..', 'setup')
119 cordvtn_conf_file = os.path.join(test_path, '..', '../cordvtn/network_cfg.json')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000120 head_node_user = 'vagrant'
121 head_node_pass = 'vagrant'
122 head_node = os.getenv('HEAD_NODE', 'prod')
123 head_node_ip = '10.1.0.1'
124 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
125
ChetanGaonker901727c2016-11-29 14:05:03 -0800126
127 @classmethod
128 def setUpClass(cls):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800129 ''' Activate the cordvtn app'''
ChetanGaonker901727c2016-11-29 14:05:03 -0800130 time.sleep(3)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800131 cls.onos_ctrl = OnosCtrl(cls.app_cordvtn)
132 status, _ = cls.onos_ctrl.activate()
Thangavelu K S165c0d82017-04-18 20:50:20 +0000133 #assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800134 time.sleep(3)
135 cls.cordvtn_setup()
ChetanGaonker901727c2016-11-29 14:05:03 -0800136
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800137 @classmethod
138 def tearDownClass(cls):
ChetanGaonker901727c2016-11-29 14:05:03 -0800139 '''Deactivate the cord vtn app'''
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000140 #cls.onos_ctrl.deactivate()
141 #cls.cord_vtn_cleanup()
ChetanGaonker901727c2016-11-29 14:05:03 -0800142
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800143 @classmethod
144 def cordvtn_setup(cls):
145 pass
146
147 @classmethod
148 def cord_vtn_cleanup(cls):
149 ##reset the ONOS port configuration back to default
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000150 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800151
152 @classmethod
153 def onos_load_config(cls, cordvtn_conf_file):
154 status, code = OnosCtrl.config(cordvtn_conf_file)
ChetanGaonker901727c2016-11-29 14:05:03 -0800155 if status is False:
A R Karthick76a497a2017-04-12 10:59:39 -0700156 log_test.info('JSON request returned status %d' %code)
ChetanGaonker901727c2016-11-29 14:05:03 -0800157 assert_equal(status, True)
158 time.sleep(3)
159
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000160 def get_neutron_credentials(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800161 n = {}
162 n['username'] = os.environ['OS_USERNAME']
163 n['password'] = os.environ['OS_PASSWORD']
164 n['auth_url'] = os.environ['OS_AUTH_URL']
165 n['tenant_name'] = os.environ['OS_TENANT_NAME']
Chetan Gaonker80e06152017-03-07 01:07:19 +0000166 n['ca_cert'] = os.environ['REQUESTS_CA_BUNDLE']
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800167 return n
168
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000169 @classmethod
170 def get_compute_nodes(cls):
171 credentials = get_nova_credentials_v2()
172 novaclient = nova_client.Client('2', **credentials)
Thangavelu K S40d22112017-04-14 00:32:10 +0000173 print novaclient.hypervisors.list()
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000174 return novaclient.hypervisors.list()
175
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800176 def create_network(i):
177 neutron_credentials = get_neutron_credentials()
178 neutron = neutron_client.Client(**neutron_credentials)
179 json = {'network': {'name': 'network-' + str(i),
180 'admin_state_up': True}}
181 while True:
182 try:
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000183 net = neutron.create_network(body=json)
Thangavelu K S40d22112017-04-14 00:32:10 +0000184 print '\nnetwork-' + str(i) + ' created'
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000185 return net
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800186 except Exception as e:
Thangavelu K S40d22112017-04-14 00:32:10 +0000187 print e
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800188 continue
189
ChetanGaonker901727c2016-11-29 14:05:03 -0800190 def create_tenant(tenant_name):
191 new_tenant = keystone.tenants.create(tenant_name=tenant_name,
192 description="CORD Tenant \
193 created",
194 enabled=True)
195 tenant_id = new_tenant.id
196 tenant_status = True
197 user_data = []
198 for j in range(2):
199 j += 1
200 user_name = tenant_name + '-user-' + str(j)
201 user_data.append(create_user(user_name, tenant_id))
202
Thangavelu K S40d22112017-04-14 00:32:10 +0000203 print " Tenant and User Created"
ChetanGaonker901727c2016-11-29 14:05:03 -0800204
205 tenant_data = {'tenant_name': tenant_name,
206 'tenant_id': tenant_id,
207 'status': tenant_status}
208 return tenant_data
209
210 def create_user(user_name, tenant_id):
211 new_user = keystone.users.create(name=user_name,
212 password="ubuntu",
213 tenant_id=tenant_id)
214 print(' - Created User %s' % user_name)
215 keystone.roles.add_user_role(new_user, member_role, tenant_id)
216 if assign_admin:
217 admin_user = keystone.users.find(name='admin')
218 admin_role = keystone.roles.find(name='admin')
219 keystone.roles.add_user_role(admin_user, admin_role, tenant_id)
220 user_data = {'name': new_user.name,
221 'id': new_user.id}
222 return user_data
223
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800224 def create_port( router_id, network_id):
225 credentials = get_credentials()
226 neutron = client.Client(**credentials)
227 router = neutron.show_router(router_id)
228
229 value = {'port':{
230 'admin_state_up':True,
231 'device_id': router_id,
232 'name': 'port1',
233 'network_id':network_id,
234 }}
235 response = neutron.create_port(body=value)
236
ChetanGaonker71fe0302016-12-19 17:45:44 -0800237 def router_create(self, name):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800238 external_network = None
239 for network in self.neutron.list_networks()["networks"]:
240 if network.get("router:external"):
241 external_network = network
242 break
243
244 if not external_network:
245 raise Exception("Alarm! Can not to find external network")
246
247 gw_info = {
248 "network_id": external_network["id"],
249 "enable_snat": True
250 }
251 router_info = {
252 "router": {
253 "name": name,
254 "external_gateway_info": gw_info,
255 "tenant_id": self.tenant_id
256 }
257 }
ChetanGaonker71fe0302016-12-19 17:45:44 -0800258 router = self.neutron.router_create(router_info)['router']
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800259 return router
260
ChetanGaonker901727c2016-11-29 14:05:03 -0800261 def delete_tenant(tenant_name):
262 tenant = keystone.tenants.find(name=tenant_name)
263 for j in range(2):
264 j += 1
265 user_name = tenant_name + '-user-' + str(j)
266 delete_user(user_name, tenant.id)
267 tenant.delete()
268 print(' - Deleted Tenant %s ' % tenant_name)
269 return True
270
271 def delete_user(user_name, tenant_id):
272 user = keystone.users.find(name=user_name)
273 user.delete()
274
275 print(' - Deleted User %s' % user_name)
276 return True
277
ChetanGaonker71fe0302016-12-19 17:45:44 -0800278 def set_environment(tenants_num=0, networks_per_tenant=1, vms_per_network=2):
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000279 octet = 115
280 vm_inc = 11
281 image = nova_connection.images.get(IMAGE_ID)
282 flavor = nova_connection.flavors.get(FLAVOR_ID)
ChetanGaonker71fe0302016-12-19 17:45:44 -0800283
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000284 admin_user_id = keystone_connection.users.find(name=OS_USERNAME).id
285 member_role_id = keystone_connection.roles.find(name='Member').id
286 for num_tenant in range(1, tenants_num+1):
287 tenant = keystone_connection.tenants.create('%stenant%s' % (TENANT_PREFIX, num_tenant))
288 keystone_connection.roles.add_user_role(admin_user_id, member_role_id, tenant=tenant.id)
289 for num_network in range(networks_per_tenant):
290 network_json = {'name': '%snet%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
291 'admin_state_up': True,
292 'tenant_id': tenant.id}
293 network = neutron_connection.create_network({'network': network_json})
294 subnet_json = {'name': '%ssubnet%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
295 'network_id': network['network']['id'],
296 'tenant_id': tenant.id,
297 'enable_dhcp': True,
298 'cidr': '%s.%s.0/24' % (CIDR_PREFIX, octet), 'ip_version': 4}
299 octet += 1
300 subnet = neutron_connection.create_subnet({'subnet': subnet_json})
301 router_json = {'name': '%srouter%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
302 'tenant_id': tenant.id}
303 router = neutron_connection.router_create({'router': router_json})
304 port = neutron_connection.add_interface_router(router['router']['id'], {'subnet_id': subnet['subnet']['id']})
305 for num_vm in range(vms_per_network):
306 tenant_nova_connection = novacli.Client(OS_USERNAME, OS_PASSWORD, tenant.name, OS_AUTH_URL)
307 m = tenant_nova_connection.servers.create('%svm%s' % (VM_PREFIX, vm_inc), image, flavor, nics=[{'net-id': network['network']['id']}, {'net-id': MGMT_NET}])
308 vm_inc += 1
ChetanGaonker71fe0302016-12-19 17:45:44 -0800309
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800310 def verify_neutron_crud():
311 x = os.system("neutron_test.sh")
312 return x
ChetanGaonker901727c2016-11-29 14:05:03 -0800313
Author Name91eaeba2017-01-05 13:41:45 -0800314 def list_floatingips( **kwargs):
315 creds = get_neutron_credentials()
316 neutron = client.Client(**creds)
317 return neutron.list_floatingips(**kwargs)['floatingips']
318
319 def list_security_groups( **kwargs):
320 creds = get_neutron_credentials()
321 neutron = client.Client(**creds)
322 return neutron.list_security_groups(**kwargs)['security_groups']
323
324 def list_subnets( **kwargs):
325 creds = get_neutron_credentials()
326 neutron = client.Client(**creds)
327 return neutron.list_subnets(**kwargs)['subnets']
328
329 def list_networks( **kwargs):
330 creds = get_neutron_credentials()
331 neutron = client.Client(**creds)
332 return neutron.list_networks(**kwargs)['networks']
333
334 def list_ports( **kwargs):
335 creds = get_neutron_credentials()
336 neutron = client.Client(**creds)
337 return neutron.list_ports(**kwargs)['ports']
338
339 def list_routers( **kwargs):
340 creds = get_neutron_credentials()
341 neutron = client.Client(**creds)
342 return neutron.list_routers(**kwargs)['routers']
343
344 def update_floatingip( fip, port_id=None):
345 creds = get_neutron_credentials()
346 neutron = client.Client(**creds)
347 neutron.update_floatingip(fip, {"floatingip":
348 {"port_id": port_id}})
349
350 def update_subnet( subnet_id, **subnet_params):
351 creds = get_neutron_credentials()
352 neutron = client.Client(**creds)
353 neutron.update_subnet(subnet_id, {'subnet': subnet_params})
354
355 def update_router( router_id, **router_params):
356 creds = get_neutron_credentials()
357 neutron = client.Client(**creds)
358 neutron.update_router(router_id, {'router': router_params})
359
360 def router_gateway_set( router_id, external_gateway):
361 creds = get_neutron_credentials()
362 neutron = client.Client(**creds)
363 neutron.update_router(
364 router_id, {'router': {'external_gateway_info':
365 {'network_id': external_gateway}}})
366
367 def router_gateway_clear( router_id):
368 creds = get_neutron_credentials()
369 neutron = client.Client(**creds)
370 neutron.update_router(
371 router_id, {'router': {'external_gateway_info': None}})
372
373 def router_add_interface( router_id, subnet_id):
374 creds = get_neutron_credentials()
375 neutron = client.Client(**creds)
376 neutron.add_interface_router(router_id, {'subnet_id': subnet_id})
377
378 def router_rem_interface( router_id, subnet_id):
379 creds = get_neutron_credentials()
380 neutron = client.Client(**creds)
381 neutron.remove_interface_router(
382 router_id, {'subnet_id': subnet_id})
383
384 def create_floatingip( **floatingip_params):
385 creds = get_neutron_credentials()
386 neutron = client.Client(**creds)
387 response = neutron.create_floatingip(
388 {'floatingip': floatingip_params})
389 if 'floatingip' in response and 'id' in response['floatingip']:
390 return response['floatingip']['id']
391
Chetan Gaonker1f422af2017-01-13 21:59:16 +0000392 def make_iperf_pair(server, client, **kwargs):
393 ssh = SSHClient()
394 ssh.set_missing_host_key_policy(MissingHostKeyPolicy())
395
396 ssh.connect(server, username=VM_USERNAME, password=VM_PASSWORD)
397 ssh.exec_command('/usr/local/bin/iperf3 -s -D')
398
399 ssh.connect(client, username=VM_USERNAME, password=VM_PASSWORD)
400 stdin, stdout, stderr = ssh.exec_command('/usr/local/bin/iperf3 -c %s -J' % server)
401
402 rawdata = stdout.read()
403 data = json.loads(rawdata.translate(None,'\t').translate(None,'\n'))
404
405 return data
406
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000407 def connect_ssh(os_ip, private_key_file=None, user='ubuntu'):
408 key = ssh.RSAKey.from_private_key_file(private_key_file)
409 client = ssh.SSHClient()
410 client.set_missing_host_key_policy(ssh.WarningPolicy())
411 client.connect(ip, username=user, pkey=key, timeout=5)
412 return client
Chetan Gaonker1f422af2017-01-13 21:59:16 +0000413
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000414 def validate_vtn_flows(switch):
415 egress = 1
416 ingress = 2
417 egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1' }
418 ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1' }
419 device_id = 'of:{}'.format(get_mac(switch))
Chetan Gaonkera6e23a72017-03-14 01:27:49 +0000420 ctlr = self.ctlr_ip.split(',')[0]
421 flow = OnosFlowCtrl(deviceId = device_id,
422 egressPort = egress,
423 ingressPort = ingress,
424 ethType = '0x800',
425 ipSrc = ('IPV4_SRC', ingress_map['ip']+'/32'),
426 ipDst = ('IPV4_DST', egress_map['ip']+'/32'),
427 controller = ctlr
428 )
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000429 flow_id = flow.findFlow(device_id, IN_PORT = ('port', ingress),
430 ETH_TYPE = ('ethType','0x800'), IPV4_SRC = ('ip', ingress_map['ip']+'/32'),
431 IPV4_DST = ('ip', egress_map['ip']+'/32'))
432 if flow_id:
433 return True
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800434
Thangavelu K Sc12afcf2017-04-21 11:32:12 -0600435 def cliEnter(self):
436 retries = 0
437 while retries < 3:
438 self.cli = OnosCliDriver(connect = True)
439 if self.cli.handle:
440 break
441 else:
442 retries += 1
443 time.sleep(2)
444
445 def cliExit(self):
446 self.cli.disconnect()
447
448
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000449 def cordvtn_config_load(self, config = None):
450 if config:
451 for k in config.keys():
452 if cordvtn_config.has_key(k):
453 cordvtn_config[k] = config[k]
454 self.onos_load_config(self.cordvtn_dict)
455
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000456 def search_value(self, d, pat):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000457 match = False
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000458 for k, v in d.items():
459 if isinstance(v, dict):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000460 match = self.search_value(v, pat)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000461 if match is True:
462 break
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000463 elif type(v) is list:
464 for i in range(len(v)):
465 if type(v[i]) is dict:
466 match = self.search_value(v[i], pat)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000467 if match is True:
468 break
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000469 else:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000470 if v[i] == pat:
471 match = True
472 return match
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000473 elif v == pat:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000474 match = True
475 return match
476 if match is True:
Thangavelu K S40d22112017-04-14 00:32:10 +0000477 print"Network search is successful"
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000478 return match
479
Thangavelu K Saea3c672017-03-15 18:57:05 +0000480 def get_key_value(self, d, key = None, value = None,):
481 match = False
482 ret_k = ""
483 ret_v = ""
484 if type(d) is not dict:
485 if type(d) is not list:
486 match = 'NOT_FOUND'
487 return [match, ret_k, ret_v]
488 else:
489 for i in range(len(d)):
490 if type(d[i]) is dict:
491 match,ret_k,ret_v = self.get_key_value(d[i], key, value)
492 if match is True:
Thangavelu K S40d22112017-04-14 00:32:10 +0000493 print "Network creation is successful"
Thangavelu K Saea3c672017-03-15 18:57:05 +0000494 break
495 else:
496 for k, v in d.items():
497 if isinstance(v, dict):
498 match,ret_k,ret_v = self.get_key_value(v, key, value)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000499 if match is True:
500 break
Thangavelu K Saea3c672017-03-15 18:57:05 +0000501 elif type(v) is list:
502 for i in range(len(v)):
503 if type(v[i]) is dict:
504 match,ret_k,ret_v = self.get_key_value(v[i], key, value)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000505 if match is True:
506 break
Thangavelu K Saea3c672017-03-15 18:57:05 +0000507 else:
508 if key:
509 if k == key:
510 match = True
511 return [match, key, v]
512 elif value:
513 if v == value:
514 match = True
515 return [match, k, value]
516 else:
517 if key:
518 if k == key:
519 match = True
520 return [match, key, v]
521 elif value:
522 if v == value:
523 match = True
524 return [match, k, value]
525 if match == False:
526 match = 'NOT_FOUND'
527 return [match, ret_k, ret_v]
528
529 def neutron_network_creation_and_validation(self, net_name):
530 creds = self.get_neutron_credentials()
531 neutron = neutronclient.Client(**creds)
532 body_example = {"network":{"name": net_name,"admin_state_up":True}}
533 net = neutron.create_network(body=body_example)
534 networks = neutron.list_networks(name=net_name)
535 data = networks
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000536 return self.search_value(data, net_name)
Thangavelu K Saea3c672017-03-15 18:57:05 +0000537
538 def neutron_network_deletion(self, net_name):
539 creds = self.get_neutron_credentials()
540 neutron = neutronclient.Client(**creds)
541 networks = neutron.list_networks(name=net_name)
542 net_id = self.get_key_value(d=networks, key = 'id')
543 net = neutron.delete_network(net_id[2])
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000544 return self.get_key_value(d=networks, value = net_name)
Thangavelu K Saea3c672017-03-15 18:57:05 +0000545
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000546 def temp_neutron_subnet_creation_and_validation_v1(self,net_name,sub_cird, sub_net_start = "172.27.0.2", sub_net_end = "172.27.0.200"):
Thangavelu K Saea3c672017-03-15 18:57:05 +0000547 creds = self.get_neutron_credentials()
548 neutron = neutronclient.Client(**creds)
549 networks = neutron.list_networks(name=net_name)
550 net_id = self.get_key_value(d=networks, key = 'id')
551 cidr = sub_cird
552 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "allocation_pools": [{"start": "172.27.0.20", "end": "172.27.0.21"}]}}
553 neutron_sub = neutron.create_subnet(body_subnet_example)
554 networks = neutron.list_networks(name=net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000555 return self.get_key_value(d=networks, key = 'subnets')
556
557 def neutron_subnet_creation_and_validation(self,net_name,sub_cird):
558 creds = self.get_neutron_credentials()
559 neutron = neutronclient.Client(**creds)
560 networks = neutron.list_networks(name=net_name)
561 net_id = self.get_key_value(d=networks, key = 'id')
562 if sub_cird[0] == 'management':
563 cidr = sub_cird[1]
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000564 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "allocation_pools": [{"start": sub_cird[2], "end": sub_cird[3]}]}}
Thangavelu K S3698fad2017-03-24 17:50:14 +0000565 elif sub_cird[0] == 'public':
566 cidr = sub_cird[1]
567 gate_way = sub_cird[2]
568 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}}
569 elif sub_cird[0] == 'private':
570 cidr = sub_cird[1]
571 gate_way = sub_cird[2]
572 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}}
573
574 neutron_sub = neutron.create_subnet(body_subnet_example)
575 networks = neutron.list_networks(name=net_name)
576 return self.get_key_value(d=networks, key = 'subnets')
577
578 def sub_network_type_post_to_onos(self,net_name,sub_net_type):
579
580 creds = self.get_neutron_credentials()
581 neutron = neutronclient.Client(**creds)
582 networks = neutron.list_networks(name=net_name)
583 net_id = self.get_key_value(d=networks, key = 'id')
584 vtn_util = vtn_validation_utils('')
585
586 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
587 auth = ('karaf','karaf')
588 network_data = {"ServiceNetwork":{"id": net_id[2],"type":sub_net_type, "providerNetworks":[]}}
589 json_network_type_data = json.dumps(network_data)
590 resp = requests.post(url=url, auth=auth, data =json_network_type_data)
591 return resp
592
Thangavelu K Sc12afcf2017-04-21 11:32:12 -0600593 def service_dependency_on_network_post_to_onos(self,service_network_name,provider_network_name,service_network_type ='private'):
594
595 creds = self.get_neutron_credentials()
596 neutron = neutronclient.Client(**creds)
597 service_network = neutron.list_networks(name=service_network_name)
598 service_net_id = self.get_key_value(d=service_network, key = 'id')
599 provider_network = neutron.list_networks(name=provider_network_name)
600 provider_net_id = self.get_key_value(d=provider_network, key = 'id')
601 vtn_util = vtn_validation_utils('')
602
603 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
604 auth = ('karaf','karaf')
605 network_data = {"ServiceNetwork":{"id": service_net_id[2],"type":service_network_type, "providerNetworks":[{"bidirectional": 'true', "id": provider_net_id[2]}]}}
606 json_network_type_data = json.dumps(network_data)
607 resp = requests.post(url=url, auth=auth, data =json_network_type_data)
608 return resp
609
Thangavelu K S3698fad2017-03-24 17:50:14 +0000610 def nova_instance_creation_and_validation(self,net_name,nova_obj,instance_name,image_name, flavor_id):
Thangavelu K S40d22112017-04-14 00:32:10 +0000611 print nova_obj.images.list()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000612 image = nova_obj.images.find(name=image_name)
613 flavor = nova_obj.flavors.find(name=flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +0000614
615 nics_list = ""
616 if len(net_name) == 2:
617 network_1 = nova_obj.networks.find(label=net_name[0])
618 network_2 = nova_obj.networks.find(label=net_name[1])
619 print network_1.id
620 print network_2.id
621 nics_list = [{'net-id':network_1.id},{'net-id':network_2.id}]
622 else:
623 network_1 = nova_obj.networks.find(label=net_name)
624 print network_1.id
625 nics_list = [{'net-id':network_1.id}]
Thangavelu K S3698fad2017-03-24 17:50:14 +0000626
627 server = nova_obj.servers.create(name = instance_name,
628 image = image.id,
629 flavor = flavor.id,
Thangavelu K S40d22112017-04-14 00:32:10 +0000630 nics = nics_list,
631 userdata = "#cloud-config \n password: ubuntu \n chpasswd: { expire: False }\n ssh_pwauth: True")
Thangavelu K S165c0d82017-04-18 20:50:20 +0000632 # key_name = 'id_rsa')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000633 server_details = nova_obj.servers.find(id=server.id)
634 print('Server is launched and status is %s' %server_details.status)
635 if server_details.status == 'BUILD':
Thangavelu K S40d22112017-04-14 00:32:10 +0000636 time.sleep(120)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000637 server_details = nova_obj.servers.find(id=server.id)
638 print('After delay server status is %s state'%server_details.status)
639 if server_details.status == 'ERROR':
640 print('Server status is still in %s state'%server_details.status)
Thangavelu K S40d22112017-04-14 00:32:10 +0000641 server_boot_up_log = nova_obj.servers.get_console_output(server.id)
642 print 'Server boot Up console log \n%s'%server_boot_up_log
Thangavelu K S3698fad2017-03-24 17:50:14 +0000643 return server_details
644
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000645 def create_net_subnet_nova_instance(self,net_name, subnet_name, instance_vm_details,management_type):
646 result = self.neutron_network_creation_and_validation(net_name)
647 assert_equal(result, True)
648 neutron_creds = self.get_neutron_credentials()
649 neutron = neutronclient.Client(**neutron_creds)
650 networks = neutron.list_networks(name=net_name)
651 network_id = self.get_key_value(d=networks, key = 'id')
652 sub_result = self.neutron_subnet_creation_and_validation(net_name,subnet_name)# sub_net_start = subnet_name[2], sub_net_end =subnet_name[3])
653 assert_equal(sub_result[0], True)
654 net_type_post = self.sub_network_type_post_to_onos(net_name, management_type)
655 creds = get_nova_credentials()
656 nova = nova_client.Client('2', **creds)
657 new_instance_details = self.nova_instance_creation_and_validation(net_name,nova,instance_vm_details[0],instance_vm_details[1],instance_vm_details[2])
Thangavelu K S40d22112017-04-14 00:32:10 +0000658 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000659 return [nova, new_instance_details]
660
661 def nova_instance_tenants_access_check(self, target_tenants_details, compute_details = None, source_tenants_details = None , check_type = 'Ping_from_compute'):
662 source_tenant_ip = ''
663 target_tenant_ip = ''
664 cmd = ''
665 status = ''
666 output = ''
667
668 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
669 if compute_details is None:
670 compute_ip = '10.1.0.17'
671 else:
672 compute_ip = compute_details.ip
673
674 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
Thangavelu K S40d22112017-04-14 00:32:10 +0000675 if target_tenants_details == {}:
676 target_tenants_details = '10.1.0.1'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000677
678 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
679 if source_tenants_details is not None:
Thangavelu K S40d22112017-04-14 00:32:10 +0000680 if source_tenants_details == {}:
681 source_tenants_details = '10.1.0.1'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000682
683 if check_type == "Ping_from_compute":
Thangavelu K S40d22112017-04-14 00:32:10 +0000684 cmd2 = "ping -c 3 {0}".format(target_tenants_details)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000685 ssh_agent = SSHTestAgent(host = compute_ip)
Thangavelu K S40d22112017-04-14 00:32:10 +0000686 status, output = ssh_agent.run_cmd(cmd2, timeout = 5)
687 print output
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000688
689 if source_tenants_details is not None:
690 if check_type == "Ping_from_source_tenant":
Thangavelu K S40d22112017-04-14 00:32:10 +0000691 cmd = "ping -c 3 {0}".format(target_tenants_details)
692 ssh_cmd = 'ssh {} {}'.format(source_tenants_details, cmd)
Thangavelu K S165c0d82017-04-18 20:50:20 +0000693 print 'Executing ssh command on compute node %s'%ssh_cmd
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000694 ssh_agent = SSHTestAgent(host = compute_ip)
Thangavelu K S40d22112017-04-14 00:32:10 +0000695 status, output = ssh_agent.run_cmd(ssh_cmd, timeout = 5)
696 print output
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000697
698 if check_type == "Ping_to_external":
699 cmd = "ping -c 3 google.com"
Thangavelu K S40d22112017-04-14 00:32:10 +0000700 ssh_cmd = 'ssh {} {}'.format(target_tenants_details, cmd)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000701 ssh_agent = SSHTestAgent(host = compute_ip)
Thangavelu K S40d22112017-04-14 00:32:10 +0000702 status, output = ssh_agent.run_cmd(ssh_cmd, timeout = 5)
703 print output
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000704
705 if status == True and output:
Thangavelu K S40d22112017-04-14 00:32:10 +0000706 print "Ping is successful"
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000707 output = output.strip()
Thangavelu K S40d22112017-04-14 00:32:10 +0000708 elif status == False:
709 print "Ping is not successful"
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000710 output = None
711 return [status, output]
712
713
Thangavelu K S3698fad2017-03-24 17:50:14 +0000714 def nova_instance_deletion(self, nova_obj, server_details):
715 results_nova_instance_deletion=nova_obj.servers.delete(server_details.id)
716 if results_nova_instance_deletion == None:
Thangavelu K S40d22112017-04-14 00:32:10 +0000717 print"Nova instance is deleted"
Thangavelu K S3698fad2017-03-24 17:50:14 +0000718 else:
Thangavelu K S40d22112017-04-14 00:32:10 +0000719 print"Nova instance is not deleted"
Thangavelu K S3698fad2017-03-24 17:50:14 +0000720 return results_nova_instance_deletion
Thangavelu K Saea3c672017-03-15 18:57:05 +0000721
722 def test_cordvtn_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
723 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000724 Test Method:
Thangavelu K Saea3c672017-03-15 18:57:05 +0000725 0. Create vtn_test_1_net.
726 1. Do GET Rest API and validate creation of network.
727 2. Validate network on neutron openstack.
728 """
729 result = self.neutron_network_creation_and_validation('vtn_test_1_net')
730 if result is True:
731 self.neutron_network_deletion('vtn_test_1_net')
732 assert_equal(result, True)
733
734 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
735 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000736 Test Method:
Thangavelu K Saea3c672017-03-15 18:57:05 +0000737 0. Create Test-Net,
738 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
739 2. Run sync command for cordvtn
740 3. Do GET Rest API and validate creation of network
741 4. Validate network synch with created network in cord-onos
742 """
743 creds = self.get_neutron_credentials()
744 neutron = neutronclient.Client(**creds)
745 body_example = {"network":{"name": "vtn_test_2_net","admin_state_up":True}}
746 net = neutron.create_network(body=body_example)
747 vtn_util = vtn_validation_utils('')
748 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
749 auth = ('karaf','karaf')
750
751 resp = requests.get(url=url, auth=auth)
752 data = json.loads(resp.text)
753 result = self.search_value(data, "vtn_test_2_net")
754 self.neutron_network_deletion('vtn_test_2_net')
755 assert_equal(result, True)
756
757 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_head_node_with_neutron_service(self):
758 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000759 Test Method:
Thangavelu K Saea3c672017-03-15 18:57:05 +0000760 0. Create Test-Net,
761 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
762 2. Run sync command for cordvtn
763 3. Do GET Rest API and validate creation of network
764 4. Validate network synch with created network in cord-onos
765 """
766 result = self.neutron_network_creation_and_validation('vtn_test_3_net')
767 if result is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000768 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000769 assert_equal(result, True)
770 result_again = self.neutron_network_creation_and_validation('vtn_test_3_net')
771 if result_again is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000772 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000773 assert_equal(result, True)
774
775 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_onos(self):
776 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000777 Test Method:
Thangavelu K Saea3c672017-03-15 18:57:05 +0000778 0. Create Test-Net,
779 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
780 2. Run sync command for cordvtn
781 3. Do GET Rest API and validate creation of network
782 4. Validate network synch with created network in cord-onos
783 """
784 creds = self.get_neutron_credentials()
785 neutron = neutronclient.Client(**creds)
786 body_example = {"network":{"name": "vtn_test_4_net","admin_state_up":True}}
787 net = neutron.create_network(body=body_example)
788 vtn_util = vtn_validation_utils('')
789 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
790 auth = ('karaf','karaf')
791
792 resp = requests.get(url=url, auth=auth)
793 data = json.loads(resp.text)
794 result = self.search_value(data, "vtn_test_4_net")
795 assert_equal(result, True)
796 self.neutron_network_deletion('vtn_test_4_net')
797 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
798 auth = ('karaf','karaf')
799
800 resp = requests.get(url=url, auth=auth)
801 data = json.loads(resp.text)
802 result = self.search_value(data, "vtn_test_4_net")
803 assert_equal(result, False)
804 net = neutron.create_network(body=body_example)
805 vtn_util = vtn_validation_utils('')
806 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
807 auth = ('karaf','karaf')
808
809 resp = requests.get(url=url, auth=auth)
810 data = json.loads(resp.text)
811 result = self.search_value(data, "vtn_test_4_net")
812 self.neutron_network_deletion('vtn_test_4_net')
813 assert_equal(result, True)
814
815 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_head_node_with_neutron_service(self):
816 test_net_name = 'vtn_test_5_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000817 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
Thangavelu K Saea3c672017-03-15 18:57:05 +0000818 result = self.neutron_network_creation_and_validation('vtn_test_5_net_management')
819 assert_equal(result, True)
820 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
821 if sub_result[0] is True:
822 self.neutron_network_deletion('vtn_test_5_net_management')
823 assert_equal(sub_result[0], True)
824
825 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_onos(self):
826 self.neutron_network_creation_and_validation('vtn_test_6_net_management')
827 creds = self.get_neutron_credentials()
828 neutron = neutronclient.Client(**creds)
829 networks = neutron.list_networks(name='vtn_test_6_net_management')
830 net_id = self.get_key_value(d=networks, key = 'id')
831 cidr = "172.27.0.0/24"
832 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "allocation_pools": [{"start": "172.27.0.20", "end": "172.27.0.21"}]}}
833 neutron_sub = neutron.create_subnet(body_subnet_example)
834
835 vtn_util = vtn_validation_utils('')
836 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
837 auth = ('karaf','karaf')
838
839 resp = requests.get(url=url, auth=auth)
840 data = json.loads(resp.text)
841 for i in range(len(data['ServiceNetworks'])):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000842 if data['ServiceNetworks'][i]['name'] == 'vtn_test_6_net_management':
Thangavelu K Saea3c672017-03-15 18:57:05 +0000843 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
844 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700845 log_test.info('Sub network is not successful')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000846 self.neutron_network_deletion('vtn_test_6_net_management')
847 assert_equal(False, True)
848 break
849 elif sub_net_id[2] == cidr:
A R Karthick76a497a2017-04-12 10:59:39 -0700850 log_test.info('Sub network is successful')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000851 self.neutron_network_deletion('vtn_test_6_net_management')
852 assert_equal(sub_net_id[0], True)
853 break
854
Thangavelu K S3698fad2017-03-24 17:50:14 +0000855 def test_cordvtn_neutron_management_network_creation_and_post_network_type_management_local_to_onos(self):
856 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000857 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +0000858 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000859 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000860 2. Run sync command for cordvtn
861 3. Do GET Rest API and validate creation of network
862 4. Pushed the network type as management local to onos
863 5. Verified that onos is having under management network
864 """
865 test_net_name = 'vtn_test_7_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000866 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
Thangavelu K S3698fad2017-03-24 17:50:14 +0000867 test_management_type = "management_local"
868 result = self.neutron_network_creation_and_validation(test_net_name)
869 assert_equal(result, True)
870 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
871
872 vtn_util = vtn_validation_utils('')
873 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
874 auth = ('karaf','karaf')
875
876 resp = requests.get(url=url, auth=auth)
877 data = json.loads(resp.text)
878 for i in range(len(data['ServiceNetworks'])):
879 if data['ServiceNetworks'][i]['name'] == test_net_name:
880 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
881 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700882 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000883 assert_equal(False, True)
884 break
885 elif sub_net_id[2] == test_sub_net_cidr[1]:
A R Karthick76a497a2017-04-12 10:59:39 -0700886 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000887 assert_equal(sub_net_id[0], True)
888 break
889
890 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
891 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
892 net_type_json = json.loads(net_type_post.text)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000893 self.neutron_network_deletion(test_net_name)
894 assert_equal(net_type_json['message'], 'null already exists')
895
Thangavelu K S40d22112017-04-14 00:32:10 +0000896 def test_cordvtn_with_management_network_creation_launching_nova_instance_and_validation_on_head_node_with_nova_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000897 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000898 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +0000899 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000900 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000901 3. Do GET Rest API and validate creation of network
902 4. Create new nova instance under management network
903 5. Validate new nova instance is created on nova service
904 """
905 test_net_name = 'vtn_test_8_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000906 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
Thangavelu K S3698fad2017-03-24 17:50:14 +0000907 test_management_type = "management_local"
908 instance_vm_name = 'vtn_test_8_nova_instance_management_net'
909 image_name = "vsg-1.1"
910 flavor_id = 'm1.small'
911 result = self.neutron_network_creation_and_validation(test_net_name)
912 assert_equal(result, True)
913 neutron_creds = self.get_neutron_credentials()
914 neutron = neutronclient.Client(**neutron_creds)
915 networks = neutron.list_networks(name=test_net_name)
916 network_id = self.get_key_value(d=networks, key = 'id')
917 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
918 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000919 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000920 nova = nova_client.Client('2', **creds)
921 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
922 self.neutron_network_deletion(test_net_name)
923 self.nova_instance_deletion(nova, new_instance_details)
924 assert_equal(new_instance_details.status, 'ACTIVE')
925
Thangavelu K S40d22112017-04-14 00:32:10 +0000926 def test_cordvtn_with_public_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000927 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000928 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +0000929 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000930 1. Create subnetwork who ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000931 2. Run sync command for cordvtn
932 3. Do GET Rest API and validate creation of network
933 4. Validate network synch with created network in cord-onos
934 """
935 test_net_name = 'vtn_test_9_net_public'
936 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
937 result = self.neutron_network_creation_and_validation(test_net_name)
938 assert_equal(result, True)
939 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
940 if sub_result[0] is True:
941 self.neutron_network_deletion(test_net_name)
942 assert_equal(sub_result[0], True)
943
Thangavelu K S40d22112017-04-14 00:32:10 +0000944 def test_cordvtn_with_public_network_creation_and_validation_on_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000945 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000946 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +0000947 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000948 1. Create subnetwork whoes ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000949 2. Run sync command for cordvtn
950 3. Do GET Rest API and validate creation of network
951 """
952 test_net_name = 'vtn_test_10_net_public'
953 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
954 result = self.neutron_network_creation_and_validation(test_net_name)
955 assert_equal(result, True)
956 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
957
958 vtn_util = vtn_validation_utils('')
959 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
960 auth = ('karaf','karaf')
961
962 resp = requests.get(url=url, auth=auth)
963 data = json.loads(resp.text)
964 for i in range(len(data['ServiceNetworks'])):
965 if data['ServiceNetworks'][i]['name'] == test_net_name:
966 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
967 if sub_net_id[2] == " ":
968 print('Sub network is not successful')
969 self.neutron_network_deletion(test_net_name)
970 assert_equal(False, True)
971 break
972 elif sub_net_id[2] == test_sub_net_cidr[1]:
973 print('Sub network is successful')
974 self.neutron_network_deletion(test_net_name)
975 assert_equal(sub_net_id[0], True)
976 break
977
Thangavelu K S40d22112017-04-14 00:32:10 +0000978 def test_cordvtn_with_public_network_creation_and_post_network_type_as_public_to_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000979 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +0000980 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +0000981 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000982 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000983 2. Run sync command for cordvtn
984 3. Do GET Rest API and validate creation of network
985 4. Pushed the network type as management local to onos
986 5. Verified that onos is having under management network
987 """
988 test_net_name = 'vtn_test_11_net_public'
989 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
990 test_management_type = "public"
991 result = self.neutron_network_creation_and_validation(test_net_name)
992 assert_equal(result, True)
993 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
994
995 vtn_util = vtn_validation_utils('')
996 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
997 auth = ('karaf','karaf')
998
999 resp = requests.get(url=url, auth=auth)
1000 data = json.loads(resp.text)
1001 for i in range(len(data['ServiceNetworks'])):
1002 if data['ServiceNetworks'][i]['name'] == test_net_name:
1003 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1004 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -07001005 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001006 assert_equal(False, True)
1007 break
1008 elif sub_net_id[2] == test_sub_net_cidr[1]:
A R Karthick76a497a2017-04-12 10:59:39 -07001009 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001010 assert_equal(sub_net_id[0], True)
1011 break
1012
1013 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1014 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
1015 net_type_json = json.loads(net_type_post.text)
1016
1017 self.neutron_network_deletion(test_net_name)
1018 assert_equal(net_type_json['message'], 'null already exists')
1019
1020 def test_cordvtn_public_network_creation_with_launching_nova_instance_and_validation_on_head_node_with_nova_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001021 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001022 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +00001023 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001024 1. Create subnetwork whose ip is under public network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001025 3. Do GET Rest API and validate creation of network
1026 4. Create new nova instance under public network
1027 5. Validate new nova instance is created on nova service
1028 """
1029 test_net_name = 'vtn_test_12_net_public'
1030 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1031 instance_vm_name = 'vtn_test_12_nova_instance_public_net'
1032 image_name = "vsg-1.1"
1033 flavor_id = 'm1.small'
1034 result = self.neutron_network_creation_and_validation(test_net_name)
1035 assert_equal(result, True)
1036 neutron_creds = self.get_neutron_credentials()
1037 neutron = neutronclient.Client(**neutron_creds)
1038 networks = neutron.list_networks(name=test_net_name)
1039 network_id = self.get_key_value(d=networks, key = 'id')
1040 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1041 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001042 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +00001043 nova = nova_client.Client('2', **creds)
1044 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1045 self.neutron_network_deletion(test_net_name)
1046 self.nova_instance_deletion(nova, new_instance_details)
1047 assert_equal(new_instance_details.status, 'ACTIVE')
1048
Thangavelu K S40d22112017-04-14 00:32:10 +00001049 def test_cordvtn_with_private_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001050 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001051 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +00001052 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001053 1. Create subnetwork who ip is under private network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001054 2. Run sync command for cordvtn
1055 3. Do GET Rest API and validate creation of network
1056 4. Validate network synch with created network in cord-onos
1057 """
1058 test_net_name = 'vtn_test_13_net_private'
1059 test_sub_net_cidr = ["private","10.160.160.160/24",'10.160.160.1']
1060 result = self.neutron_network_creation_and_validation(test_net_name)
1061 assert_equal(result, True)
1062 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1063 if sub_result[0] is True:
1064 self.neutron_network_deletion(test_net_name)
1065 assert_equal(sub_result[0], True)
1066
Thangavelu K S40d22112017-04-14 00:32:10 +00001067 def test_cordvtn_with_private_network_creation_and_validation_on_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001068 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001069 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +00001070 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001071 1. Create subnetwork whoes ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001072 2. Run sync command for cordvtn
1073 3. Do GET Rest API and validate creation of network
1074 """
1075 test_net_name = 'vtn_test_14_net_private'
1076 test_sub_net_cidr = ["private","10.160.160.160/24", '10.160.160.1']
1077 result = self.neutron_network_creation_and_validation(test_net_name)
1078 assert_equal(result, True)
1079 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1080
1081 vtn_util = vtn_validation_utils('')
1082 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1083 auth = ('karaf','karaf')
1084
1085 resp = requests.get(url=url, auth=auth)
1086 data = json.loads(resp.text)
1087 for i in range(len(data['ServiceNetworks'])):
1088 if data['ServiceNetworks'][i]['name'] == test_net_name:
1089 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1090 if sub_net_id[2] == " ":
1091 print('Sub network is not successful')
1092 self.neutron_network_deletion(test_net_name)
1093 assert_equal(False, True)
1094 break
1095 elif sub_net_id[2] == '10.160.160.0/24':
1096 #elif sub_net_id[2] == test_sub_net_cidr[1]:
1097 print('Sub network is successful')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001098 self.neutron_network_deletion(test_net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +00001099 assert_equal(sub_net_id[0], True)
1100 break
1101
Thangavelu K S40d22112017-04-14 00:32:10 +00001102 def test_cordvtn_with_private_network_creation_and_post_network_type_as_private_to_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001103 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001104 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +00001105 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001106 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001107 2. Run sync command for cordvtn
1108 3. Do GET Rest API and validate creation of network
1109 4. Pushed the network type as management local to onos
1110 5. Verified that onos is having under management network
1111 """
1112 test_net_name = 'vtn_test_15_net_private'
1113 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
1114 test_management_type = "private"
1115 result = self.neutron_network_creation_and_validation(test_net_name)
1116 assert_equal(result, True)
1117 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1118
1119 vtn_util = vtn_validation_utils('')
1120 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1121 auth = ('karaf','karaf')
1122
1123 resp = requests.get(url=url, auth=auth)
1124 data = json.loads(resp.text)
1125 for i in range(len(data['ServiceNetworks'])):
1126 if data['ServiceNetworks'][i]['name'] == test_net_name:
1127 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1128 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -07001129 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001130 assert_equal(False, True)
1131 break
1132 elif sub_net_id[2] == "192.168.160.0/24":
A R Karthick76a497a2017-04-12 10:59:39 -07001133 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001134 assert_equal(sub_net_id[0], True)
1135 break
1136
1137 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1138 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
1139 net_type_json = json.loads(net_type_post.text)
1140
1141 self.neutron_network_deletion(test_net_name)
1142 assert_equal(net_type_json['message'], 'null already exists')
1143
Thangavelu K S40d22112017-04-14 00:32:10 +00001144 def test_cordvtn_with_private_network_creation_launching_nova_instance_and_validating_on_head_node_with_nova_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001145 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001146 Test Method:
Thangavelu K S3698fad2017-03-24 17:50:14 +00001147 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001148 1. Create subnetwork whose ip is under private network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001149 3. Do GET Rest API and validate creation of network
1150 4. Create new nova instance under private network
1151 5. Validate new nova instance is created on nova service
1152 """
1153 test_net_name = 'vtn_test_16_net_private'
1154 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001155 instance_vm_name = 'vtn_test_16_nova_instance_private_net'
Thangavelu K S3698fad2017-03-24 17:50:14 +00001156 image_name = "vsg-1.1"
1157 flavor_id = 'm1.small'
1158 result = self.neutron_network_creation_and_validation(test_net_name)
1159 assert_equal(result, True)
1160 neutron_creds = self.get_neutron_credentials()
1161 neutron = neutronclient.Client(**neutron_creds)
1162 networks = neutron.list_networks(name=test_net_name)
1163 network_id = self.get_key_value(d=networks, key = 'id')
1164 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1165 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001166 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +00001167 nova = nova_client.Client('2', **creds)
1168 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1169 self.neutron_network_deletion(test_net_name)
1170 self.nova_instance_deletion(nova, new_instance_details)
1171 assert_equal(new_instance_details.status, 'ACTIVE')
1172
Thangavelu K S40d22112017-04-14 00:32:10 +00001173 def test_cordvtn_management_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001174 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001175 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001176 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001177 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001178 3. Do GET Rest API and validate creation of network
1179 4. Create new nova instance under management network
1180 5. Validate new nova instance is created on nova service
1181 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1182 """
1183 test_net_name = 'vtn_test_17_net_management'
1184 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1185 test_management_type = "management_local"
1186 instance_vm_name = 'vtn_test_17_nova_instance_management_net'
Thangavelu K S40d22112017-04-14 00:32:10 +00001187 #image_name = "vsg-1.1"
1188 image_name = "trusty-server-multi-nic"
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001189 flavor_id = 'm1.small'
1190 result = self.neutron_network_creation_and_validation(test_net_name)
1191 assert_equal(result, True)
1192 neutron_creds = self.get_neutron_credentials()
1193 neutron = neutronclient.Client(**neutron_creds)
1194 networks = neutron.list_networks(name=test_net_name)
1195 network_id = self.get_key_value(d=networks, key = 'id')
1196 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1197 assert_equal(sub_result[0], True)
1198 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1199 creds = get_nova_credentials()
1200 nova = nova_client.Client('2', **creds)
1201 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001202 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001203 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001204 print new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001205 address = new_instance_details.addresses
1206 print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr'])
Thangavelu K S40d22112017-04-14 00:32:10 +00001207 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001208 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
Thangavelu K S40d22112017-04-14 00:32:10 +00001209 self.nova_instance_deletion(nova, new_instance_details)
1210 time.sleep(5)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001211 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001212 assert_equal(status, True)
1213
Thangavelu K S40d22112017-04-14 00:32:10 +00001214 def test_cordvtn_for_management_network_instance_and_validate_connectivity_to_external_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001215 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001216 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001217 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001218 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001219 3. Do GET Rest API and validate creation of network
1220 4. Create new nova instance under management network
1221 5. Validate new nova instance is created on nova service
1222 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1223 """
1224 test_net_name = 'vtn_test_18_net_management'
1225 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1226 test_management_type = "management_local"
1227 instance_vm_name = 'vtn_test_18_nova_instance_management_net'
1228 image_name = "vsg-1.1"
1229 flavor_id = 'm1.small'
1230 result = self.neutron_network_creation_and_validation(test_net_name)
1231 assert_equal(result, True)
1232 neutron_creds = self.get_neutron_credentials()
1233 neutron = neutronclient.Client(**neutron_creds)
1234 networks = neutron.list_networks(name=test_net_name)
1235 network_id = self.get_key_value(d=networks, key = 'id')
1236 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1237 assert_equal(sub_result[0], True)
1238 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1239 creds = get_nova_credentials()
1240 nova = nova_client.Client('2', **creds)
1241 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001242 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001243 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001244 print new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001245 address = new_instance_details.addresses
1246 print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr'])
1247 time.sleep(60)
1248 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'], check_type = "Ping_to_external")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001249 self.nova_instance_deletion(nova, new_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001250 time.sleep(5)
1251 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001252 assert_equal(status, False)
1253
Thangavelu K S40d22112017-04-14 00:32:10 +00001254 def test_cordvtn_with_management_network_creating_two_instances_and_validate_connectivity_between_two(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001255 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001256 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001257 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001258 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001259 3. Do GET Rest API and validate creation of network
1260 4. Create first nova instance under management network
1261 5. Validate first nova instance is created on nova service
1262 6. Create second nova instance under management network
1263 7. Validate second nova instance is created on nova service
1264 8. Now try to ping from one nova instance to other instance, should not success
1265 """
1266 test_net_name = 'vtn_test_19_net_management'
1267 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.2", "172.27.0.200"]
1268 test_management_type = "management_local"
1269 first_instance_vm_name = 'vtn_test_19_nova_1st_instance_management_net'
1270 second_instance_vm_name = 'vtn_test_19_nova_2nd_instance_management_net'
1271 image_name = "vsg-1.1"
1272 flavor_id = 'm1.small'
1273 result = self.neutron_network_creation_and_validation(test_net_name)
1274 assert_equal(result, True)
1275 neutron_creds = self.get_neutron_credentials()
1276 neutron = neutronclient.Client(**neutron_creds)
1277 networks = neutron.list_networks(name=test_net_name)
1278 network_id = self.get_key_value(d=networks, key = 'id')
1279 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1280 assert_equal(sub_result[0], True)
1281 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1282 creds = get_nova_credentials()
1283 nova = nova_client.Client('2', **creds)
1284 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1285 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001286 assert_equal(first_instance_details.status, 'ACTIVE')
1287 assert_equal(second_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001288 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001289 print 'New nova instance ip addresses are '
1290 print first_nova_instance_details.addresses
1291 print second_nova_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001292 address_1st_instance = first_nova_instance_details.addresses
1293 address_2nd_instance = second_nova_instance_details.addresses
1294 print 'Nova 1st instance management ip = %s'%(address_1st_instance[test_net_name][0]['addr'])
1295 print 'Nova 2nd instance management ip = %s'%(address_2nd_instance[test_net_name][0]['addr'])
1296 time.sleep(60)
1297 status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_net_name][0]['addr'],source_tenants_details =address_2nd_instance[test_net_name][0]['addr'], check_type = "Ping_from_source_tenant")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001298 self.nova_instance_deletion(nova, first_nova_instance_details)
1299 self.nova_instance_deletion(nova, second_nova_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001300 time.sleep(5)
1301 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001302 assert_equal(status, False)
1303
Thangavelu K S40d22112017-04-14 00:32:10 +00001304 def test_cordvtn_creating_two_management_network_instances_and_validate_connectivity_between_two_networks_via_management_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001305 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001306 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001307 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001308 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001309 3. Do GET Rest API and validate creation of network
1310 4. Create new nova instance under management network
1311 5. Validate new nova instance is created on nova service
1312 """
1313 test_netA_name = 'vtn_test_20_netA_management'
1314 test_sub_netA_cidr = ["management","172.27.0.0/24","172.27.0.2", "172.27.0.200"]
1315 netA_instance_vm_name = 'vtn_test_20_nova_netA_instance_management_net'
1316 test_netB_name = 'vtn_test_20_netB_management'
1317 test_sub_netB_cidr = ["management","172.28.0.0/24","172.28.0.2", "172.28.0.200"]
1318 netB_instance_vm_name = 'vtn_test_20_nova_netB_instance_management_net'
1319 test_management_type = "management_local"
1320 image_name = "vsg-1.1"
1321 flavor_id = 'm1.small'
1322 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1323 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1324
1325 nova_netA, nova_instance_details_netA = self.create_net_subnet_nova_instance(test_netA_name, test_sub_netA_cidr, netA_instance_vm_details, test_management_type)
1326 nova_netB, nova_instance_details_netB = self.create_net_subnet_nova_instance(test_netB_name, test_sub_netB_cidr, netB_instance_vm_details, test_management_type)
1327
Thangavelu K S40d22112017-04-14 00:32:10 +00001328 assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1329 assert_equal(nova_instance_details_netB.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001330 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001331 print 'New nova instance ip addresses are '
1332 print nova_instance_details_netA.addresses
1333 print nova_instance_details_netB.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001334 address_1st_instance = nova_instance_details_netA.addresses
1335 address_2nd_instance = nova_instance_details_netB.addresses
1336 print 'Nova 1st instance management ip = %s'%(address_1st_instance[test_netA_name][0]['addr'])
1337 print 'Nova 2nd instance management ip = %s'%(address_2nd_instance[test_netB_name][0]['addr'])
1338 time.sleep(60)
1339 status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_netA_name][0]['addr'],source_tenants_details =address_2nd_instance[test_netB_name][0]['addr'], check_type = "Ping_from_source_tenant")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001340 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001341 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001342 time.sleep(5)
1343 self.neutron_network_deletion(test_netA_name)
1344 self.neutron_network_deletion(test_netB_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001345 assert_equal(status, False)
1346
Thangavelu K S40d22112017-04-14 00:32:10 +00001347 def test_cordvtn_creating_public_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001348 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001349 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001350 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001351 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001352 3. Do GET Rest API and validate creation of network
1353 4. Create new nova instance under public network
1354 5. Validate new nova instance is created on nova service
1355 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1356 """
1357 test_net_name = 'vtn_test_21_net_public'
1358 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1359 test_management_type = "public"
1360 instance_vm_name = 'vtn_test_21_nova_instance_pulic_net'
1361 image_name = "vsg-1.1"
1362 flavor_id = 'm1.small'
1363 result = self.neutron_network_creation_and_validation(test_net_name)
1364 assert_equal(result, True)
1365 neutron_creds = self.get_neutron_credentials()
1366 neutron = neutronclient.Client(**neutron_creds)
1367 networks = neutron.list_networks(name=test_net_name)
1368 network_id = self.get_key_value(d=networks, key = 'id')
1369 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1370 assert_equal(sub_result[0], True)
1371 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1372 creds = get_nova_credentials()
1373 nova = nova_client.Client('2', **creds)
1374 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001375 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001376 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001377 print new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001378 address = new_instance_details.addresses
1379 print 'Nova instance public ip = %s'%(address[test_net_name][0]['addr'])
1380 time.sleep(60)
1381 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001382 self.nova_instance_deletion(nova, new_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001383 time.sleep(5)
1384 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001385 assert_equal(status, False)
1386
Thangavelu K S40d22112017-04-14 00:32:10 +00001387 def test_cordvtn_creating_public_network_instance_and_validate_connectivity_to_external_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001388 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001389 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001390 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001391 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001392 3. Do GET Rest API and validate creation of network
1393 4. Create new nova instance under public network
1394 5. Validate new nova instance is created on nova service
1395 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1396 """
1397 test_net_name = 'vtn_test_22_net_public'
1398 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1399 test_management_type = "public"
1400 instance_vm_name = 'vtn_test_22_nova_instance_public_net'
1401 image_name = "vsg-1.1"
1402 flavor_id = 'm1.small'
1403 result = self.neutron_network_creation_and_validation(test_net_name)
1404 assert_equal(result, True)
1405 neutron_creds = self.get_neutron_credentials()
1406 neutron = neutronclient.Client(**neutron_creds)
1407 networks = neutron.list_networks(name=test_net_name)
1408 network_id = self.get_key_value(d=networks, key = 'id')
1409 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1410 assert_equal(sub_result[0], True)
1411 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1412 creds = get_nova_credentials()
1413 nova = nova_client.Client('2', **creds)
1414 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001415 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001416 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001417 print new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001418 address = new_instance_details.addresses
1419 print 'Nova instance public ip = %s'%(address[test_net_name][0]['addr'])
1420 time.sleep(60)
1421 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'], check_type = "Ping_to_external")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001422 self.nova_instance_deletion(nova, new_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001423 time.sleep(5)
1424 self.neutron_network_deletion(test_net_name)
1425 assert_equal(status, False)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001426
Thangavelu K S40d22112017-04-14 00:32:10 +00001427 def test_cordvtn_creating_public_network_with_two_instances_and_validate_connectivity_between_two(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001428 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001429 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001430 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001431 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001432 3. Do GET Rest API and validate creation of network
1433 4. Create first nova instance under public network
1434 5. Validate first nova instance is created on nova service
1435 6. Create second nova instance under public network
1436 7. Validate second nova instance is created on nova service
1437 8. Now try to ping from one nova instance to other instance, should not success
1438 """
1439 test_net_name = 'vtn_test_23_net_public'
1440 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1441 test_management_type = "public"
1442 first_instance_vm_name = 'vtn_test_23_nova_1st_instance_public_net'
1443 second_instance_vm_name = 'vtn_test_23_nova_2nd_instance_public_net'
1444 image_name = "vsg-1.1"
1445 flavor_id = 'm1.small'
1446 result = self.neutron_network_creation_and_validation(test_net_name)
1447 assert_equal(result, True)
1448 neutron_creds = self.get_neutron_credentials()
1449 neutron = neutronclient.Client(**neutron_creds)
1450 networks = neutron.list_networks(name=test_net_name)
1451 network_id = self.get_key_value(d=networks, key = 'id')
1452 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1453 assert_equal(sub_result[0], True)
1454 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1455 creds = get_nova_credentials()
1456 nova = nova_client.Client('2', **creds)
1457 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1458 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001459 assert_equal(first_instance_details.status, 'ACTIVE')
1460 assert_equal(second_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001461 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001462 print 'New nova instance ip addresses are '
1463 print first_nova_instance_details.addresses
1464 print second_nova_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001465 address_1st_instance = first_nova_instance_details.addresses
1466 address_2nd_instance = second_nova_instance_details.addresses
1467 print 'Nova 1st instance public ip = %s'%(address_1st_instance[test_net_name][0]['addr'])
1468 print 'Nova 2nd instance public ip = %s'%(address_2nd_instance[test_net_name][0]['addr'])
1469 time.sleep(60)
1470 status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_net_name][0]['addr'],source_tenants_details =address_2nd_instance[test_net_name][0]['addr'], check_type = "Ping_from_source_tenant")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001471 self.nova_instance_deletion(nova, first_nova_instance_details)
1472 self.nova_instance_deletion(nova, second_nova_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001473 time.sleep(5)
1474 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001475 assert_equal(status, False)
1476
Thangavelu K S40d22112017-04-14 00:32:10 +00001477 def test_cordvtn_creating_two_public_network_instances_and_check_connectvity_between_two_networks_via_public_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001478 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001479 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001480 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001481 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001482 3. Do GET Rest API and validate creation of network
1483 4. Create new nova instance under public network
1484 5. Validate new nova instance is created on nova service
1485 """
1486 test_netA_name = 'vtn_test_24_netA_public'
1487 test_sub_netA_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1488 netA_instance_vm_name = 'vtn_test_24_nova_netA_instance_public_net'
1489 test_netB_name = 'vtn_test_24_netB_public'
1490 test_sub_netB_cidr = ["public","10.6.2.192/26",'10.6.2.193']
1491 netB_instance_vm_name = 'vtn_test_24_nova_netB_instance_public_net'
1492 test_management_type = "public"
1493 image_name = "vsg-1.1"
1494 flavor_id = 'm1.small'
1495 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1496 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1497
1498 nova_netA, nova_instance_details_netA = self.create_net_subnet_nova_instance(test_netA_name, test_sub_netA_cidr, netA_instance_vm_details, test_management_type)
1499 nova_netB, nova_instance_details_netB = self.create_net_subnet_nova_instance(test_netB_name, test_sub_netB_cidr, netB_instance_vm_details, test_management_type)
1500
Thangavelu K S40d22112017-04-14 00:32:10 +00001501 assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1502 assert_equal(nova_instance_details_netB.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001503 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001504 print 'New nova instance ip addresses are '
1505 print nova_instance_details_netA.addresses
1506 print nova_instance_details_netB.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001507 address_1st_instance = nova_instance_details_netA.addresses
1508 address_2nd_instance = nova_instance_details_netB.addresses
1509 print 'Nova 1st instance public ip = %s'%(address_1st_instance[test_netA_name][0]['addr'])
1510 print 'Nova 2nd instance public ip = %s'%(address_2nd_instance[test_netB_name][0]['addr'])
1511 time.sleep(60)
1512 status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_netA_name][0]['addr'],source_tenants_details =address_2nd_instance[test_netB_name][0]['addr'], check_type = "Ping_from_source_tenant")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001513 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001514 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001515 time.sleep(5)
1516 self.neutron_network_deletion(test_netA_name)
1517 self.neutron_network_deletion(test_netB_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001518 assert_equal(status, False)
1519
Thangavelu K S40d22112017-04-14 00:32:10 +00001520 def test_cordvtn_creating_private_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001521 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001522 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001523 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001524 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001525 3. Do GET Rest API and validate creation of network
1526 4. Create new nova instance under private network
1527 5. Validate new nova instance is created on nova service
1528 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1529 """
1530 test_net_name = 'vtn_test_25_net_private'
1531 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1532 test_management_type = "private"
1533 instance_vm_name = 'vtn_test_25_nova_instance_private_net'
1534 image_name = "vsg-1.1"
1535 flavor_id = 'm1.small'
1536 result = self.neutron_network_creation_and_validation(test_net_name)
1537 assert_equal(result, True)
1538 neutron_creds = self.get_neutron_credentials()
1539 neutron = neutronclient.Client(**neutron_creds)
1540 networks = neutron.list_networks(name=test_net_name)
1541 network_id = self.get_key_value(d=networks, key = 'id')
1542 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1543 assert_equal(sub_result[0], True)
1544 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1545 creds = get_nova_credentials()
1546 nova = nova_client.Client('2', **creds)
1547 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001548 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001549 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001550 print new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001551 address = new_instance_details.addresses
1552 print 'Nova instance private ip = %s'%(address[test_net_name][0]['addr'])
1553 time.sleep(60)
1554 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001555 self.nova_instance_deletion(nova, new_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001556 time.sleep(5)
1557 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001558 assert_equal(status, False)
1559
Thangavelu K S40d22112017-04-14 00:32:10 +00001560 def test_cordvtn_creating_private_network_instance_and_validate_connectivity_to_external_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001561 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001562 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001563 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001564 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001565 3. Do GET Rest API and validate creation of network
1566 4. Create new nova instance under private network
1567 5. Validate new nova instance is created on nova service
1568 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1569 """
1570 test_net_name = 'vtn_test_26_net_private'
1571 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1572 test_management_type = "private"
1573 instance_vm_name = 'vtn_test_26_nova_instance_private_net'
1574 image_name = "vsg-1.1"
1575 flavor_id = 'm1.small'
1576 result = self.neutron_network_creation_and_validation(test_net_name)
1577 assert_equal(result, True)
1578 neutron_creds = self.get_neutron_credentials()
1579 neutron = neutronclient.Client(**neutron_creds)
1580 networks = neutron.list_networks(name=test_net_name)
1581 network_id = self.get_key_value(d=networks, key = 'id')
1582 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1583 assert_equal(sub_result[0], True)
1584 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1585 creds = get_nova_credentials()
1586 nova = nova_client.Client('2', **creds)
1587 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001588 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001589 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001590 print new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001591 address = new_instance_details.addresses
1592 print 'Nova instance private ip = %s'%(address[test_net_name][0]['addr'])
1593 time.sleep(60)
1594 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'], check_type = "Ping_to_external")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001595 self.nova_instance_deletion(nova, new_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001596 time.sleep(5)
1597 self.neutron_network_deletion(test_net_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001598 assert_equal(status, False)
1599
Thangavelu K S40d22112017-04-14 00:32:10 +00001600 def test_cordvtn_creating_private_network_with_two_instances_and_check_connectvity_between_two_instances(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001601 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001602 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001603 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001604 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001605 3. Do GET Rest API and validate creation of network
1606 4. Create first nova instance under private network
1607 5. Validate first nova instance is created on nova service
1608 6. Create second nova instance under public network
1609 7. Validate second nova instance is created on nova service
1610 8. Now try to ping from one nova instance to other instance, should not success
1611 """
1612 test_net_name = 'vtn_test_27_net_private'
1613 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1614 test_management_type = "private"
1615 first_instance_vm_name = 'vtn_test_27_nova_1st_instance_private_net'
1616 second_instance_vm_name = 'vtn_test_27_nova_2nd_instance_private_net'
1617 image_name = "vsg-1.1"
1618 flavor_id = 'm1.small'
1619 result = self.neutron_network_creation_and_validation(test_net_name)
1620 assert_equal(result, True)
1621 neutron_creds = self.get_neutron_credentials()
1622 neutron = neutronclient.Client(**neutron_creds)
1623 networks = neutron.list_networks(name=test_net_name)
1624 network_id = self.get_key_value(d=networks, key = 'id')
1625 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1626 assert_equal(sub_result[0], True)
1627 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1628 creds = get_nova_credentials()
1629 nova = nova_client.Client('2', **creds)
1630 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1631 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001632 assert_equal(first_instance_details.status, 'ACTIVE')
1633 assert_equal(second_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001634 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001635 print 'New nova instance ip addresses are '
1636 print first_nova_instance_details.addresses
1637 print second_nova_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001638 address_1st_instance = first_nova_instance_details.addresses
1639 address_2nd_instance = second_nova_instance_details.addresses
1640 print 'Nova 1st instance private ip = %s'%(address_1st_instance[test_net_name][0]['addr'])
1641 print 'Nova 2nd instance private ip = %s'%(address_2nd_instance[test_net_name][0]['addr'])
1642 time.sleep(60)
1643 status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_net_name][0]['addr'],source_tenants_details =address_2nd_instance[test_net_name][0]['addr'], check_type = "Ping_from_source_tenant")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001644 self.nova_instance_deletion(nova, first_nova_instance_details)
1645 self.nova_instance_deletion(nova, second_nova_instance_details)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001646 time.sleep(5)
1647 self.neutron_network_deletion(test_net_name)
1648 assert_equal(status, False)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001649
Thangavelu K S40d22112017-04-14 00:32:10 +00001650 def test_cordvtn_creating_two_private_network_instances_and_validate_connectivity_between_two_networks_via_private_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001651 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001652 Test Method:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001653 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001654 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001655 3. Do GET Rest API and validate creation of network
1656 4. Create new nova instance under private network
1657 5. Validate new nova instance is created on nova service
1658 """
1659 test_netA_name = 'vtn_test_28_netA_private'
1660 test_sub_netA_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1661 netA_instance_vm_name = 'vtn_test_28_nova_netA_instance_private_net'
1662 test_netB_name = 'vtn_test_28_netB_private'
1663 test_sub_netB_cidr = ["private","10.160.161.192/26",'10.160.161.193']
1664 netB_instance_vm_name = 'vtn_test_28_nova_netB_instance_private_net'
1665 test_management_type = "private"
1666 image_name = "vsg-1.1"
1667 flavor_id = 'm1.small'
1668 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1669 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1670
1671 nova_netA, nova_instance_details_netA = self.create_net_subnet_nova_instance(test_netA_name, test_sub_netA_cidr, netA_instance_vm_details, test_management_type)
1672 nova_netB, nova_instance_details_netB = self.create_net_subnet_nova_instance(test_netB_name, test_sub_netB_cidr, netB_instance_vm_details, test_management_type)
1673
Thangavelu K S40d22112017-04-14 00:32:10 +00001674 assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1675 assert_equal(nova_instance_details_netB.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001676 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001677 print 'New nova instance ip addresses are '
1678 print nova_instance_details_netA.addresses
1679 print nova_instance_details_netB.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001680 address_1st_instance = nova_instance_details_netA.addresses
1681 address_2nd_instance = nova_instance_details_netB.addresses
1682 print 'Nova 1st instance private ip = %s'%(address_1st_instance[test_netA_name][0]['addr'])
1683 print 'Nova 2nd instance private ip = %s'%(address_2nd_instance[test_netB_name][0]['addr'])
1684 time.sleep(60)
1685 status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_netA_name][0]['addr'],source_tenants_details =address_2nd_instance[test_netB_name][0]['addr'], check_type = "Ping_from_source_tenant")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001686 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001687 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001688 time.sleep(5)
1689 self.neutron_network_deletion(test_netA_name)
1690 self.neutron_network_deletion(test_netB_name)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001691 assert_equal(status, False)
1692
Thangavelu K S40d22112017-04-14 00:32:10 +00001693 def test_cordvtn_creating_management_and_public_network_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
1694 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001695 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00001696 0. Create Test-Net,
1697 1. Create subnetwork whose ip is under management network
1698 3. Do GET Rest API and validate creation of network
1699 4. Create new nova instance under management network
1700 5. Validate new nova instance is created on nova service
1701 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1702 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00001703 test_two_networks_name = ['vtn_test_29_net_management','vtn_test_29_net_public']
1704 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00001705 test_management_type = ["management_local", 'public']
1706 instance_vm_name = 'vtn_test_29_nova_instance_management_net'
1707# image_name = "vsg-1.1"
1708 image_name = "trusty-server-multi-nic"
1709 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00001710 for test_net_name in test_two_network_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00001711 result = self.neutron_network_creation_and_validation(test_net_name)
1712 assert_equal(result, True)
1713 neutron_creds = self.get_neutron_credentials()
1714 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001715 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00001716 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00001717 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001718 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00001719 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001720 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001721 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001722 creds = get_nova_credentials()
1723 nova = nova_client.Client('2', **creds)
1724 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001725 new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001726 time.sleep(60)
1727 assert_equal(new_instance_details.status, 'ACTIVE')
1728 compute_details = self.get_compute_nodes()
1729 print new_instance_details.addresses
1730 address = new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001731 print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr'])
1732 print address[test_two_networks_name[0]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001733 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001734 print address[test_two_networks_name[1]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001735 print nova.security_groups.list()
1736 secgroup = nova.security_groups.find(name="default")
1737# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1738 #from_port="22",
1739 #to_port="22",
1740 # cidr="0.0.0.0/0",)
1741
1742 # nova.security_group_rules.create(secgroup.id,
1743 # ip_protocol="icmp",
1744 # from_port=-1,
1745 # cidr="0.0.0.0/0",
1746 # to_port=-1)
1747 print nova.security_groups.list()
1748
Thangavelu K S165c0d82017-04-18 20:50:20 +00001749 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1750 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001751 self.nova_instance_deletion(nova, new_instance_details)
1752 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001753 self.neutron_network_deletion(test_two_networks_name[0])
1754 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001755 assert_equal(status_1, True)
1756 assert_equal(status_2, True)
1757
1758 def test_cordvtn_creating_management_and_public_network_instance_with_and_without_pause_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
1759 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001760 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00001761 0. Create Test-Net,
1762 1. Create subnetwork whose ip is under management network
1763 3. Do GET Rest API and validate creation of network
1764 4. Create new nova instance under management network
1765 5. Validate new nova instance is created on nova service
1766 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1767 7. Now pause the nova instance and check connectivity
1768 8. Now unpause the nova instance and check connectivity
1769 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00001770 test_two_networks_name = ['vtn_test_30_net_management','vtn_test_30_net_public']
1771 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00001772 test_management_type = ["management_local", 'public']
1773 instance_vm_name = 'vtn_test_30_nova_instance_management_net'
1774# image_name = "vsg-1.1"
1775 image_name = "trusty-server-multi-nic"
1776 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00001777 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00001778 result = self.neutron_network_creation_and_validation(test_net_name)
1779 assert_equal(result, True)
1780 neutron_creds = self.get_neutron_credentials()
1781 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001782 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00001783 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00001784 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001785 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00001786 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001787 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001788 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001789 creds = get_nova_credentials()
1790 nova = nova_client.Client('2', **creds)
1791 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001792 new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001793 time.sleep(60)
1794 assert_equal(new_instance_details.status, 'ACTIVE')
1795 compute_details = self.get_compute_nodes()
1796 print new_instance_details.addresses
1797 address = new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001798 print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr'])
1799 print address[test_two_networks_name[0]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001800 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001801 print address[test_two_networks_name[1]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001802 print nova.security_groups.list()
1803 secgroup = nova.security_groups.find(name="default")
1804# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1805 #from_port="22",
1806 #to_port="22",
1807 # cidr="0.0.0.0/0",)
1808
1809 # nova.security_group_rules.create(secgroup.id,
1810 # ip_protocol="icmp",
1811 # from_port=-1,
1812 # cidr="0.0.0.0/0",
1813 # to_port=-1)
1814 print nova.security_groups.list()
1815
Thangavelu K S165c0d82017-04-18 20:50:20 +00001816 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1817 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001818 if status_1 is False or status_2 is False:
1819 self.nova_instance_deletion(nova, new_instance_details)
1820 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001821 self.neutron_network_deletion(test_two_networks_name[0])
1822 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001823 assert_equal(status_1, True)
1824 assert_equal(status_2, True)
1825 new_instance_details.pause()
1826 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001827 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1828 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001829 if status_1 is True or status_2 is True:
1830 self.nova_instance_deletion(nova, new_instance_details)
1831 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001832 self.neutron_network_deletion(test_two_networks_name[0])
1833 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001834 assert_equal(status_1, False)
1835 assert_equal(status_2, False)
1836 new_instance_details.unpause()
1837 print 'Nova instance is paused and unpasued now checking connectivity'
1838 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001839 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1840 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001841 self.nova_instance_deletion(nova, new_instance_details)
1842 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001843 self.neutron_network_deletion(test_two_networks_name[0])
1844 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001845 assert_equal(status_1, True)
1846 assert_equal(status_2, True)
1847
1848 def test_cordvtn_creating_management_and_public_network_instance_doing_suspend_and_resume_validating_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
1849 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001850 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00001851 0. Create Test-Net,
1852 1. Create subnetwork whose ip is under management network
1853 3. Do GET Rest API and validate creation of network
1854 4. Create new nova instance under management network
1855 5. Validate new nova instance is created on nova service
1856 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1857 7. Now suspend the nova instance and check connectivity
1858 8. Now resume the nova instance and check connectivity
1859 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00001860 test_two_networks_name = ['vtn_test_31_net_management','vtn_test_31_net_public']
1861 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00001862 test_management_type = ["management_local", 'public']
1863 instance_vm_name = 'vtn_test_31_nova_instance_management_net'
1864# image_name = "vsg-1.1"
1865 image_name = "trusty-server-multi-nic"
1866 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00001867 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00001868 result = self.neutron_network_creation_and_validation(test_net_name)
1869 assert_equal(result, True)
1870 neutron_creds = self.get_neutron_credentials()
1871 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001872 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00001873 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00001874 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001875 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00001876 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001877 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001878 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001879 creds = get_nova_credentials()
1880 nova = nova_client.Client('2', **creds)
1881 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001882 new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001883 time.sleep(60)
1884 assert_equal(new_instance_details.status, 'ACTIVE')
1885 compute_details = self.get_compute_nodes()
1886 print new_instance_details.addresses
1887 address = new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001888 print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr'])
1889 print address[test_two_networks_name[0]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001890 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001891 print address[test_two_networks_name[1]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001892 print nova.security_groups.list()
1893 secgroup = nova.security_groups.find(name="default")
1894# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1895 #from_port="22",
1896 #to_port="22",
1897 # cidr="0.0.0.0/0",)
1898
1899 # nova.security_group_rules.create(secgroup.id,
1900 # ip_protocol="icmp",
1901 # from_port=-1,
1902 # cidr="0.0.0.0/0",
1903 # to_port=-1)
1904 print nova.security_groups.list()
1905
Thangavelu K S165c0d82017-04-18 20:50:20 +00001906 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1907 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001908 if status_1 is False or status_2 is False:
1909 self.nova_instance_deletion(nova, new_instance_details)
1910 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001911 self.neutron_network_deletion(test_two_networks_name[0])
1912 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001913 assert_equal(status_1, True)
1914 assert_equal(status_2, True)
1915 new_instance_details.suspend()
1916 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001917 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1918 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001919 if status_1 is True or status_2 is True:
1920 self.nova_instance_deletion(nova, new_instance_details)
1921 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001922 self.neutron_network_deletion(test_two_networks_name[0])
1923 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001924 assert_equal(status_1, False)
1925 assert_equal(status_2, False)
1926 new_instance_details.resume()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001927 print 'Nova instance is suspend and resumed now checking connectivity'
Thangavelu K S40d22112017-04-14 00:32:10 +00001928 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001929 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1930 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001931 self.nova_instance_deletion(nova, new_instance_details)
1932 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001933 self.neutron_network_deletion(test_two_networks_name[0])
1934 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00001935 assert_equal(status_1, True)
1936 assert_equal(status_2, True)
1937
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06001938 def test_cordvtn_creating_mgmt_and_public_network_instance_with_stopping_and_starting_instances_and_checking_connectvity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
Thangavelu K S40d22112017-04-14 00:32:10 +00001939 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00001940 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00001941 0. Create Test-Net,
1942 1. Create subnetwork whose ip is under management network
1943 3. Do GET Rest API and validate creation of network
1944 4. Create new nova instance under management network
1945 5. Validate new nova instance is created on nova service
1946 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1947 7. Now stop the nova instance and check connectivity
1948 8. Now start the nova instance and check connectivity
1949 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00001950 test_two_networks_name = ['vtn_test_32_net_management','vtn_test_32_net_public']
1951 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00001952 test_management_type = ["management_local", 'public']
1953 instance_vm_name = 'vtn_test_32_nova_instance_management_net'
1954# image_name = "vsg-1.1"
1955 image_name = "trusty-server-multi-nic"
1956 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00001957 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00001958 result = self.neutron_network_creation_and_validation(test_net_name)
1959 assert_equal(result, True)
1960 neutron_creds = self.get_neutron_credentials()
1961 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001962 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00001963 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00001964 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001965 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00001966 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001967 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00001968 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00001969 creds = get_nova_credentials()
1970 nova = nova_client.Client('2', **creds)
1971 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001972 new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00001973 time.sleep(60)
1974 assert_equal(new_instance_details.status, 'ACTIVE')
1975 compute_details = self.get_compute_nodes()
1976 print new_instance_details.addresses
1977 address = new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00001978 print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr'])
1979 print address[test_two_networks_name[0]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001980 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00001981 print address[test_two_networks_name[1]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00001982 print nova.security_groups.list()
1983 secgroup = nova.security_groups.find(name="default")
1984# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1985 #from_port="22",
1986 #to_port="22",
1987 # cidr="0.0.0.0/0",)
1988
1989 # nova.security_group_rules.create(secgroup.id,
1990 # ip_protocol="icmp",
1991 # from_port=-1,
1992 # cidr="0.0.0.0/0",
1993 # to_port=-1)
1994 print nova.security_groups.list()
1995
Thangavelu K S165c0d82017-04-18 20:50:20 +00001996 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
1997 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00001998 if status_1 is False or status_2 is False:
1999 self.nova_instance_deletion(nova, new_instance_details)
2000 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002001 self.neutron_network_deletion(test_two_networks_name[0])
2002 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002003 assert_equal(status_1, True)
2004 assert_equal(status_2, True)
2005 new_instance_details.stop()
2006 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002007 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
2008 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00002009 if status_1 is True or status_2 is True:
2010 self.nova_instance_deletion(nova, new_instance_details)
2011 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002012 self.neutron_network_deletion(test_two_networks_name[0])
2013 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002014 assert_equal(status_1, False)
2015 assert_equal(status_2, False)
2016 new_instance_details.start()
2017 print 'Nova instance is stopped and started now checking connectivity'
2018 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002019 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
2020 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00002021 self.nova_instance_deletion(nova, new_instance_details)
2022 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002023 self.neutron_network_deletion(test_two_networks_name[0])
2024 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002025 assert_equal(status_1, True)
2026 assert_equal(status_2, True)
2027
Thangavelu K S40d22112017-04-14 00:32:10 +00002028 def test_cordvtn_creating_mgmt_and_private_network_instance_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
2029 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002030 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00002031 0. Create Test-Net,
2032 1. Create subnetwork whose ip is under management network
2033 3. Do GET Rest API and validate creation of network
2034 4. Create new nova instance under management network
2035 5. Validate new nova instance is created on nova service
2036 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2037 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00002038 test_two_networks_name = ['vtn_test_33_net_management','vtn_test_33_net_private']
2039 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00002040 test_management_type = ["management_local", 'private']
2041 instance_vm_name = 'vtn_test_33_nova_instance_management_net'
2042# image_name = "vsg-1.1"
2043 image_name = "trusty-server-multi-nic"
2044 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00002045 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00002046 result = self.neutron_network_creation_and_validation(test_net_name)
2047 assert_equal(result, True)
2048 neutron_creds = self.get_neutron_credentials()
2049 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002050 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00002051 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00002052 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002053 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00002054 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002055 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002056 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002057 creds = get_nova_credentials()
2058 nova = nova_client.Client('2', **creds)
2059 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002060 new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00002061 time.sleep(60)
2062 assert_equal(new_instance_details.status, 'ACTIVE')
2063 compute_details = self.get_compute_nodes()
2064 print new_instance_details.addresses
2065 address = new_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00002066 print 'Nova instance management ip = %s and private ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr'])
2067 print address[test_two_networks_name[0]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00002068 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002069 print address[test_two_networks_name[1]][0]['addr']
Thangavelu K S40d22112017-04-14 00:32:10 +00002070 print nova.security_groups.list()
2071 secgroup = nova.security_groups.find(name="default")
2072# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2073 #from_port="22",
2074 #to_port="22",
2075 # cidr="0.0.0.0/0",)
2076
2077 # nova.security_group_rules.create(secgroup.id,
2078 # ip_protocol="icmp",
2079 # from_port=-1,
2080 # cidr="0.0.0.0/0",
2081 # to_port=-1)
2082 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002083 status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'])
2084 status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external")
Thangavelu K S40d22112017-04-14 00:32:10 +00002085 self.nova_instance_deletion(nova, new_instance_details)
2086 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002087 self.neutron_network_deletion(test_two_networks_name[0])
2088 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002089 assert_equal(status_1, True)
2090 assert_equal(status_2, False)
2091
2092 def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_check_connectivity_to_other_instance(self):
2093 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002094 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00002095 0. Create Test-Net,
2096 1. Create subnetwork whose ip is under management network
2097 3. Do GET Rest API and validate creation of network
2098 4. Create new nova instance under management network
2099 5. Validate new nova instance is created on nova service
2100 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2101 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00002102 test_two_networks_name = ['vtn_test_34_net_management','vtn_test_34_net_private']
2103 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00002104 test_management_type = ["management_local", 'private']
2105 first_instance_vm_name = 'vtn_test_34_nova_first_instance_management_net'
2106 second_instance_vm_name = 'vtn_test_34_nova_second_instance_management_net'
2107# image_name = "vsg-1.1"
2108 image_name = "trusty-server-multi-nic"
2109 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00002110 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00002111 result = self.neutron_network_creation_and_validation(test_net_name)
2112 assert_equal(result, True)
2113 neutron_creds = self.get_neutron_credentials()
2114 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002115 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00002116 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00002117 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002118 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00002119 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002120 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002121 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002122 creds = get_nova_credentials()
2123 nova = nova_client.Client('2', **creds)
2124 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002125 new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id)
2126 new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00002127 time.sleep(60)
2128 assert_equal(new_first_instance_details.status, 'ACTIVE')
2129 assert_equal(new_second_instance_details.status, 'ACTIVE')
2130 compute_details = self.get_compute_nodes()
2131 first_instance_address = new_first_instance_details.addresses
2132 second_instance_address = new_second_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00002133 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr'])
2134 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr'])
Thangavelu K S40d22112017-04-14 00:32:10 +00002135 secgroup = nova.security_groups.find(name="default")
2136# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2137 #from_port="22",
2138 #to_port="22",
2139 # cidr="0.0.0.0/0",)
2140
2141 # nova.security_group_rules.create(secgroup.id,
2142 # ip_protocol="icmp",
2143 # from_port=-1,
2144 # cidr="0.0.0.0/0",
2145 # to_port=-1)
2146 print nova.security_groups.list()
2147
Thangavelu K S165c0d82017-04-18 20:50:20 +00002148 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2149 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
2150 self.nova_instance_deletion(nova, new_first_instance_details)
2151 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002152 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002153 self.neutron_network_deletion(test_two_networks_name[0])
2154 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002155 assert_equal(status_1, True)
2156 assert_equal(status_2, True)
2157
2158 def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_with_and_without_pause_validating_connectivity_from_host_machine_or_compute_node_and_validating_connectivity_to_other_instance(self):
2159 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002160 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00002161 0. Create Test-Net,
2162 1. Create subnetwork whose ip is under management network
2163 3. Do GET Rest API and validate creation of network
2164 4. Create new nova instance under management network
2165 5. Validate new nova instance is created on nova service
2166 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2167 7. Now pause one of the nova instance and check connectivity
2168 8. Now start the same nova instance and check connectivity
2169 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00002170 test_two_networks_name = ['vtn_test_35_net_management','vtn_test_35_net_private']
2171 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00002172 test_management_type = ["management_local", 'private']
2173 first_instance_vm_name = 'vtn_test_35_nova_first_instance_management_net'
2174 second_instance_vm_name = 'vtn_test_35_nova_second_instance_management_net'
2175# image_name = "vsg-1.1"
2176 image_name = "trusty-server-multi-nic"
2177 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00002178 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00002179 result = self.neutron_network_creation_and_validation(test_net_name)
2180 assert_equal(result, True)
2181 neutron_creds = self.get_neutron_credentials()
2182 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002183 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00002184 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00002185 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002186 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00002187 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002188 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002189 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002190 creds = get_nova_credentials()
2191 nova = nova_client.Client('2', **creds)
2192 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002193 new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id)
2194 new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00002195 time.sleep(60)
2196 assert_equal(new_first_instance_details.status, 'ACTIVE')
2197 assert_equal(new_second_instance_details.status, 'ACTIVE')
2198 compute_details = self.get_compute_nodes()
2199 first_instance_address = new_first_instance_details.addresses
2200 second_instance_address = new_second_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00002201 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr'])
2202 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr'])
Thangavelu K S40d22112017-04-14 00:32:10 +00002203 secgroup = nova.security_groups.find(name="default")
2204# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2205 #from_port="22",
2206 #to_port="22",
2207 # cidr="0.0.0.0/0",)
2208
2209 # nova.security_group_rules.create(secgroup.id,
2210 # ip_protocol="icmp",
2211 # from_port=-1,
2212 # cidr="0.0.0.0/0",
2213 # to_port=-1)
2214 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002215 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2216 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
Thangavelu K S40d22112017-04-14 00:32:10 +00002217 if status_1 is False or status_2 is False:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002218 self.nova_instance_deletion(nova, new_first_instance_details)
2219 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002220 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002221 self.neutron_network_deletion(test_two_networks_name[0])
2222 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002223 assert_equal(status_1, True)
2224 assert_equal(status_2, True)
2225 new_first_instance_details.pause()
2226 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002227 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2228 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
Thangavelu K S40d22112017-04-14 00:32:10 +00002229 if status_1 is True or status_2 is True:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002230 self.nova_instance_deletion(nova, new_first_instance_details)
2231 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002232 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002233 self.neutron_network_deletion(test_two_networks_name[0])
2234 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002235 assert_equal(status_1, False)
2236 assert_equal(status_2, False)
2237 new_first_instance_details.unpause()
2238 print 'Nova instance is paused and unpased now checking connectivity'
2239 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002240 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2241 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
2242 self.nova_instance_deletion(nova, new_first_instance_details)
2243 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002244 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002245 self.neutron_network_deletion(test_two_networks_name[0])
2246 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002247 assert_equal(status_1, True)
2248 assert_equal(status_2, True)
2249
2250 def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_and_doing_suspend_and_resume_validating_connectivity_from_host_machine_or_compute_node_and_validating_connectivity_to_other_instance(self):
2251 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002252 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00002253 0. Create Test-Net,
2254 1. Create subnetwork whose ip is under management network
2255 3. Do GET Rest API and validate creation of network
2256 4. Create new nova instance under management network
2257 5. Validate new nova instance is created on nova service
2258 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2259 7. Now suspend one of the nova instance and check connectivity
2260 8. Now resume the same nova instance and check connectivity
2261 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00002262 test_two_networks_name = ['vtn_test_36_net_management','vtn_test_36_net_private']
2263 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00002264 test_management_type = ["management_local", 'private']
2265 first_instance_vm_name = 'vtn_test_36_nova_first_instance_management_net'
2266 second_instance_vm_name = 'vtn_test_36_nova_second_instance_management_net'
2267# image_name = "vsg-1.1"
2268 image_name = "trusty-server-multi-nic"
2269 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00002270 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00002271 result = self.neutron_network_creation_and_validation(test_net_name)
2272 assert_equal(result, True)
2273 neutron_creds = self.get_neutron_credentials()
2274 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002275 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00002276 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00002277 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002278 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00002279 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002280 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002281 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002282 creds = get_nova_credentials()
2283 nova = nova_client.Client('2', **creds)
2284 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002285 new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id)
2286 new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00002287 time.sleep(60)
2288 assert_equal(new_first_instance_details.status, 'ACTIVE')
2289 assert_equal(new_second_instance_details.status, 'ACTIVE')
2290 compute_details = self.get_compute_nodes()
2291 first_instance_address = new_first_instance_details.addresses
2292 second_instance_address = new_second_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00002293 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr'])
2294 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr'])
Thangavelu K S40d22112017-04-14 00:32:10 +00002295 secgroup = nova.security_groups.find(name="default")
2296# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2297 #from_port="22",
2298 #to_port="22",
2299 # cidr="0.0.0.0/0",)
2300
2301 # nova.security_group_rules.create(secgroup.id,
2302 # ip_protocol="icmp",
2303 # from_port=-1,
2304 # cidr="0.0.0.0/0",
2305 # to_port=-1)
2306 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002307 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2308 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
Thangavelu K S40d22112017-04-14 00:32:10 +00002309 if status_1 is False or status_2 is False:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002310 self.nova_instance_deletion(nova, new_first_instance_details)
2311 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002312 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002313 self.neutron_network_deletion(test_two_networks_name[0])
2314 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002315 assert_equal(status_1, True)
2316 assert_equal(status_2, True)
2317 new_first_instance_details.suspend()
2318 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002319 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2320 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
Thangavelu K S40d22112017-04-14 00:32:10 +00002321 if status_1 is True or status_2 is True:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002322 self.nova_instance_deletion(nova, new_first_instance_details)
2323 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002324 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002325 self.neutron_network_deletion(test_two_networks_name[0])
2326 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002327 assert_equal(status_1, False)
2328 assert_equal(status_2, False)
2329 new_first_instance_details.resume()
2330 print 'Nova instance is suspend and resume now checking connectivity'
2331 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002332 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2333 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
2334 self.nova_instance_deletion(nova, new_first_instance_details)
2335 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002336 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002337 self.neutron_network_deletion(test_two_networks_name[0])
2338 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002339 assert_equal(status_1, True)
2340 assert_equal(status_2, True)
2341
2342 def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_applying_stop_and_start_validating_connectivity_from_host_machine_or_compute_node_and_validating_connectivity_to_other_instance(self):
2343 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002344 Test Method:
Thangavelu K S40d22112017-04-14 00:32:10 +00002345 0. Create Test-Net,
2346 1. Create subnetwork whose ip is under management network
2347 3. Do GET Rest API and validate creation of network
2348 4. Create new nova instance under management network
2349 5. Validate new nova instance is created on nova service
2350 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2351 7. Now stop one of the nova instance and check connectivity
2352 8. Now start the same nova instance and check connectivity
2353 """
Thangavelu K S165c0d82017-04-18 20:50:20 +00002354 test_two_networks_name = ['vtn_test_37_net_management','vtn_test_37_net_private']
2355 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']]
Thangavelu K S40d22112017-04-14 00:32:10 +00002356 test_management_type = ["management_local", 'private']
2357 first_instance_vm_name = 'vtn_test_37_nova_first_instance_management_net'
2358 second_instance_vm_name = 'vtn_test_37_nova_second_instance_management_net'
2359# image_name = "vsg-1.1"
2360 image_name = "trusty-server-multi-nic"
2361 flavor_id = 'm1.small'
Thangavelu K S165c0d82017-04-18 20:50:20 +00002362 for test_net_name in test_two_networks_name:
Thangavelu K S40d22112017-04-14 00:32:10 +00002363 result = self.neutron_network_creation_and_validation(test_net_name)
2364 assert_equal(result, True)
2365 neutron_creds = self.get_neutron_credentials()
2366 neutron = neutronclient.Client(**neutron_creds)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002367 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
Thangavelu K S40d22112017-04-14 00:32:10 +00002368 for i in range(0,2):
Thangavelu K S165c0d82017-04-18 20:50:20 +00002369 networks = neutron.list_networks(name=test_two_networks_name[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002370 network_id = self.get_key_value(d=networks, key = 'id')
Thangavelu K S165c0d82017-04-18 20:50:20 +00002371 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002372 assert_equal(sub_result[0], True)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002373 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K S40d22112017-04-14 00:32:10 +00002374 creds = get_nova_credentials()
2375 nova = nova_client.Client('2', **creds)
2376 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002377 new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id)
2378 new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +00002379 time.sleep(60)
2380 assert_equal(new_first_instance_details.status, 'ACTIVE')
2381 assert_equal(new_second_instance_details.status, 'ACTIVE')
2382 compute_details = self.get_compute_nodes()
2383 first_instance_address = new_first_instance_details.addresses
2384 second_instance_address = new_second_instance_details.addresses
Thangavelu K S165c0d82017-04-18 20:50:20 +00002385 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr'])
2386 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr'])
Thangavelu K S40d22112017-04-14 00:32:10 +00002387 secgroup = nova.security_groups.find(name="default")
2388 print nova.security_groups.list()
Thangavelu K S165c0d82017-04-18 20:50:20 +00002389 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2390 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
Thangavelu K S40d22112017-04-14 00:32:10 +00002391 if status_1 is False or status_2 is False:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002392 self.nova_instance_deletion(nova, new_first_instance_details)
2393 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002394 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002395 self.neutron_network_deletion(test_two_networks_name[0])
2396 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002397 assert_equal(status_1, True)
2398 assert_equal(status_2, True)
2399 new_first_instance_details.stop()
2400 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002401 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2402 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
Thangavelu K S40d22112017-04-14 00:32:10 +00002403 if status_1 is True or status_2 is True:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002404 self.nova_instance_deletion(nova, new_first_instance_details)
2405 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002406 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002407 self.neutron_network_deletion(test_two_networks_name[0])
2408 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002409 assert_equal(status_1, False)
2410 assert_equal(status_2, False)
2411 new_first_instance_details.start()
2412 print 'Nova instance is stopped and started now checking connectivity'
2413 time.sleep(60)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002414 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2415 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
2416 self.nova_instance_deletion(nova, new_first_instance_details)
2417 self.nova_instance_deletion(nova, new_second_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00002418 time.sleep(3)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002419 self.neutron_network_deletion(test_two_networks_name[0])
2420 self.neutron_network_deletion(test_two_networks_name[1])
2421 assert_equal(status_1, True)
2422 assert_equal(status_2, True)
2423
2424 def test_cordvtn_creating_mgmt_and_two_private_network_with_each_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_check_connectivity_to_other_instance(self):
2425 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002426 Test Method:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002427 0. Create Test-Net,
2428 1. Create subnetwork whose ip is under management network
2429 3. Do GET Rest API and validate creation of network
2430 4. Create new nova instance under management network
2431 5. Validate new nova instance is created on nova service
2432 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2433 7. Verify ping is getting successful after ssh toof one instance to other nova instance which is created in step 4.
2434 """
2435 test_two_networks_name = ['vtn_test_39_net_management','vtn_test_39_netA_private','vtn_test_39_netB_private']
2436 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193'], ["private","10.160.161.192/26",'10.160.161.193']]
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002437 test_management_type = ["management_local", 'private','private']
Thangavelu K S165c0d82017-04-18 20:50:20 +00002438 first_instance_vm_name = 'vtn_test_39_nova_first_instance_management_netA'
2439 second_instance_vm_name = 'vtn_test_39_nova_second_instance_management_netB'
2440# image_name = "vsg-1.1"
2441 image_name = "trusty-server-multi-nic"
2442 flavor_id = 'm1.small'
2443 for test_net_name in test_two_networks_name:
2444 result = self.neutron_network_creation_and_validation(test_net_name)
2445 assert_equal(result, True)
2446 neutron_creds = self.get_neutron_credentials()
2447 neutron = neutronclient.Client(**neutron_creds)
2448 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
2449 for i in range(0,3):
2450 networks = neutron.list_networks(name=test_two_networks_name[i])
2451 network_id = self.get_key_value(d=networks, key = 'id')
2452 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
2453 assert_equal(sub_result[0], True)
2454 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
2455 creds = get_nova_credentials()
2456 nova = nova_client.Client('2', **creds)
2457 print nova.security_groups.list()
2458 new_first_instance_details = self.nova_instance_creation_and_validation(['vtn_test_39_net_management','vtn_test_39_netA_private'],nova,first_instance_vm_name,image_name,flavor_id)
2459 new_second_instance_details = self.nova_instance_creation_and_validation(['vtn_test_39_net_management','vtn_test_39_netB_private'],nova,second_instance_vm_name,image_name,flavor_id)
2460 time.sleep(60)
2461 assert_equal(new_first_instance_details.status, 'ACTIVE')
2462 assert_equal(new_second_instance_details.status, 'ACTIVE')
2463 compute_details = self.get_compute_nodes()
2464 first_instance_address = new_first_instance_details.addresses
2465 second_instance_address = new_second_instance_details.addresses
2466 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr'])
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002467 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[2]][0]['addr'])
Thangavelu K S165c0d82017-04-18 20:50:20 +00002468 secgroup = nova.security_groups.find(name="default")
2469# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2470 #from_port="22",
2471 #to_port="22",
2472 # cidr="0.0.0.0/0",)
2473
2474 # nova.security_group_rules.create(secgroup.id,
2475 # ip_protocol="icmp",
2476 # from_port=-1,
2477 # cidr="0.0.0.0/0",
2478 # to_port=-1)
2479 print nova.security_groups.list()
2480
2481 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2482 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
2483 self.nova_instance_deletion(nova, new_first_instance_details)
2484 self.nova_instance_deletion(nova, new_second_instance_details)
2485 time.sleep(3)
2486 self.neutron_network_deletion(test_two_networks_name[0])
2487 self.neutron_network_deletion(test_two_networks_name[1])
2488 assert_equal(status_1, True)
2489 assert_equal(status_2, False)
2490
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002491 def test_cordvtn_service_dependency_without_xos_creating_mgmt_and_two_private_network_with_each_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_check_connectivity_to_other_instance(self):
Thangavelu K S165c0d82017-04-18 20:50:20 +00002492 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002493 Test Method:
Thangavelu K S165c0d82017-04-18 20:50:20 +00002494 0. Create Test-Net,
2495 1. Create subnetwork whose ip is under management network
2496 3. Do GET Rest API and validate creation of network
2497 4. Create new nova instance under management network
2498 5. Validate new nova instance is created on nova service
2499 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2500 7. Verify ping is getting successful after ssh toof one instance to other nova instance which is created in step 4.
2501 """
2502 test_two_networks_name = ['vtn_test_40_net_management','vtn_test_40_netA_private','vtn_test_40_netB_private']
2503 test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193'], ["private","10.160.161.192/26",'10.160.161.193']]
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002504 test_management_type = ["management_local", 'private','private']
Thangavelu K S165c0d82017-04-18 20:50:20 +00002505 first_instance_vm_name = 'vtn_test_40_nova_first_instance_management_netA'
2506 second_instance_vm_name = 'vtn_test_40_nova_second_instance_management_netB'
2507# image_name = "vsg-1.1"
2508 image_name = "trusty-server-multi-nic"
2509 flavor_id = 'm1.small'
2510 for test_net_name in test_two_networks_name:
2511 result = self.neutron_network_creation_and_validation(test_net_name)
2512 assert_equal(result, True)
2513 neutron_creds = self.get_neutron_credentials()
2514 neutron = neutronclient.Client(**neutron_creds)
2515 #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr:
2516 for i in range(0,3):
2517 networks = neutron.list_networks(name=test_two_networks_name[i])
2518 network_id = self.get_key_value(d=networks, key = 'id')
2519 sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i])
2520 assert_equal(sub_result[0], True)
2521 net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i])
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002522 print net_type_post
Thangavelu K S165c0d82017-04-18 20:50:20 +00002523 creds = get_nova_credentials()
2524 nova = nova_client.Client('2', **creds)
2525 print nova.security_groups.list()
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002526 new_first_instance_details = self.nova_instance_creation_and_validation(['vtn_test_40_net_management','vtn_test_40_netA_private'],nova,first_instance_vm_name,image_name,flavor_id)
2527 new_second_instance_details = self.nova_instance_creation_and_validation(['vtn_test_40_net_management','vtn_test_40_netB_private'],nova,second_instance_vm_name,image_name,flavor_id)
Thangavelu K S165c0d82017-04-18 20:50:20 +00002528 time.sleep(60)
2529 assert_equal(new_first_instance_details.status, 'ACTIVE')
2530 assert_equal(new_second_instance_details.status, 'ACTIVE')
2531
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002532 service_dependency_post = self.service_dependency_on_network_post_to_onos(test_two_networks_name[1],test_two_networks_name[2],test_management_type[1])
2533 print service_dependency_post
Thangavelu K S165c0d82017-04-18 20:50:20 +00002534 compute_details = self.get_compute_nodes()
2535 first_instance_address = new_first_instance_details.addresses
2536 second_instance_address = new_second_instance_details.addresses
2537 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr'])
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002538 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[2]][0]['addr'])
Thangavelu K S165c0d82017-04-18 20:50:20 +00002539 secgroup = nova.security_groups.find(name="default")
2540# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2541 #from_port="22",
2542 #to_port="22",
2543 # cidr="0.0.0.0/0",)
2544
2545 # nova.security_group_rules.create(secgroup.id,
2546 # ip_protocol="icmp",
2547 # from_port=-1,
2548 # cidr="0.0.0.0/0",
2549 # to_port=-1)
2550 print nova.security_groups.list()
2551
2552 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'])
2553 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant")
2554 self.nova_instance_deletion(nova, new_first_instance_details)
2555 self.nova_instance_deletion(nova, new_second_instance_details)
2556 time.sleep(3)
2557 self.neutron_network_deletion(test_two_networks_name[0])
2558 self.neutron_network_deletion(test_two_networks_name[1])
Thangavelu K S40d22112017-04-14 00:32:10 +00002559 assert_equal(status_1, True)
2560 assert_equal(status_2, True)
2561
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002562 def test_cordvtn_management_network_instance_and_validate_connectivity_from_host_machine_or_compute_node_after_br_int_bridge_is_down(self):
2563 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002564 Test Method:
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002565 0. Create Test-Net,
2566 1. Create subnetwork whose ip is under management network
2567 3. Do GET Rest API and validate creation of network
2568 4. Create new nova instance under management network
2569 5. Validate new nova instance is created on nova service
2570 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2571 """
2572 test_net_name = 'vtn_test_41_net_management'
2573 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
2574 test_management_type = "management_local"
2575 instance_vm_name = 'vtn_test_41_nova_instance_management_net'
2576 #image_name = "vsg-1.1"
2577 image_name = "trusty-server-multi-nic"
2578 flavor_id = 'm1.small'
2579 result = self.neutron_network_creation_and_validation(test_net_name)
2580 assert_equal(result, True)
2581 neutron_creds = self.get_neutron_credentials()
2582 neutron = neutronclient.Client(**neutron_creds)
2583 networks = neutron.list_networks(name=test_net_name)
2584 network_id = self.get_key_value(d=networks, key = 'id')
2585 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
2586 assert_equal(sub_result[0], True)
2587 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
2588 creds = get_nova_credentials()
2589 nova = nova_client.Client('2', **creds)
2590 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
2591 assert_equal(new_instance_details.status, 'ACTIVE')
2592 compute_details = self.get_compute_nodes()
2593 print new_instance_details.addresses
2594 address = new_instance_details.addresses
2595 print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr'])
2596 time.sleep(60)
2597 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2598 if status is False:
2599 self.nova_instance_deletion(nova, new_instance_details)
2600 time.sleep(5)
2601 self.neutron_network_deletion(test_net_name)
2602 assert_equal(status, True)
2603 cmd = 'sudo ifconfig br-int down'
2604 #compute_details = self.get_compute_nodes()
2605 compute_details = '10.1.0.17'
2606 ssh_agent = SSHTestAgent(host = compute_details)
2607 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
2608 print output
2609 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2610 self.nova_instance_deletion(nova, new_instance_details)
2611 time.sleep(5)
2612 self.neutron_network_deletion(test_net_name)
2613 cmd = 'sudo ifconfig br-int up'
2614 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
2615 assert_equal(status, False)
2616
2617 def test_cordvtn_management_network_instance_and_validate_connectivity_from_host_machine_or_compute_node_toggling_br_int_bridge(self):
2618 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002619 Test Method:
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002620 0. Create Test-Net,
2621 1. Create subnetwork whose ip is under management network
2622 3. Do GET Rest API and validate creation of network
2623 4. Create new nova instance under management network
2624 5. Validate new nova instance is created on nova service
2625 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2626 """
2627 test_net_name = 'vtn_test_42_net_management'
2628 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
2629 test_management_type = "management_local"
2630 instance_vm_name = 'vtn_test_42_nova_instance_management_net'
2631 #image_name = "vsg-1.1"
2632 image_name = "trusty-server-multi-nic"
2633 flavor_id = 'm1.small'
2634 cmd = 'sudo ifconfig br-int down'
2635 #compute_details = self.get_compute_nodes()
2636 compute_details = '10.1.0.17'
2637 ssh_agent = SSHTestAgent(host = compute_details)
2638 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
2639 print output
2640 result = self.neutron_network_creation_and_validation(test_net_name)
2641 assert_equal(result, True)
2642 neutron_creds = self.get_neutron_credentials()
2643 neutron = neutronclient.Client(**neutron_creds)
2644 networks = neutron.list_networks(name=test_net_name)
2645 network_id = self.get_key_value(d=networks, key = 'id')
2646 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
2647 assert_equal(sub_result[0], True)
2648 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
2649 creds = get_nova_credentials()
2650 nova = nova_client.Client('2', **creds)
2651 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
2652 assert_equal(new_instance_details.status, 'ACTIVE')
2653 compute_details = self.get_compute_nodes()
2654 print new_instance_details.addresses
2655 address = new_instance_details.addresses
2656 print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr'])
2657 time.sleep(60)
2658 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2659 if status is True:
2660 self.nova_instance_deletion(nova, new_instance_details)
2661 time.sleep(5)
2662 self.neutron_network_deletion(test_net_name)
2663 assert_equal(status, False)
2664 cmd = 'sudo ifconfig br-int up'
2665 #compute_details = self.get_compute_nodes()
2666 compute_details = '10.1.0.17'
2667 ssh_agent = SSHTestAgent(host = compute_details)
2668 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
2669 print output
2670 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2671 self.nova_instance_deletion(nova, new_instance_details)
2672 time.sleep(5)
2673 self.neutron_network_deletion(test_net_name)
2674 assert_equal(status, True)
2675
2676 def test_cordvtn_management_network_instance_and_validate_connectivity_from_host_machine_or_compute_node_checking_onos_flows(self):
2677 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002678 Test Method:
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002679 0. Create Test-Net,
2680 1. Create subnetwork whose ip is under management network
2681 3. Do GET Rest API and validate creation of network
2682 4. Create new nova instance under management network
2683 5. Validate new nova instance is created on nova service
2684 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2685 """
2686 test_net_name = 'vtn_test_43_net_management'
2687 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
2688 test_management_type = "management_local"
2689 instance_vm_name = 'vtn_test_43_nova_instance_management_net'
2690 #image_name = "vsg-1.1"
2691 image_name = "trusty-server-multi-nic"
2692 flavor_id = 'm1.small'
2693 cmd = 'sudo ifconfig br-int down'
2694 #compute_details = self.get_compute_nodes()
2695 compute_details = '10.1.0.17'
2696 ssh_agent = SSHTestAgent(host = compute_details)
2697 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
2698 print output
2699 result = self.neutron_network_creation_and_validation(test_net_name)
2700 assert_equal(result, True)
2701 neutron_creds = self.get_neutron_credentials()
2702 neutron = neutronclient.Client(**neutron_creds)
2703 networks = neutron.list_networks(name=test_net_name)
2704 network_id = self.get_key_value(d=networks, key = 'id')
2705 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
2706 assert_equal(sub_result[0], True)
2707 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
2708 creds = get_nova_credentials()
2709 nova = nova_client.Client('2', **creds)
2710 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
2711 assert_equal(new_instance_details.status, 'ACTIVE')
2712 compute_details = self.get_compute_nodes()
2713 print new_instance_details.addresses
2714 address = new_instance_details.addresses
2715 print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr'])
2716 time.sleep(60)
2717 self.cliEnter()
2718 flows = json.loads(self.cli.flows(jsonFormat = True))
2719 flows = filter(lambda f: f['flows'], flows)
2720 print flows['IPV4_DST']
2721 self.cliExit()
2722
2723 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2724 if status is True:
2725 self.nova_instance_deletion(nova, new_instance_details)
2726 time.sleep(5)
2727 self.neutron_network_deletion(test_net_name)
2728 assert_equal(status, False)
2729 cmd = 'sudo ifconfig br-int up'
2730 #compute_details = self.get_compute_nodes()
2731 compute_details = '10.1.0.17'
2732 ssh_agent = SSHTestAgent(host = compute_details)
2733 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
2734 print output
2735 self.cliEnter()
2736 flows = json.loads(self.cli.flows(jsonFormat = True))
2737 flows = filter(lambda f: f['flows'], flows)
2738 print flows
2739 self.cliExit()
2740 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2741 self.nova_instance_deletion(nova, new_instance_details)
2742 time.sleep(5)
2743 self.neutron_network_deletion(test_net_name)
2744 assert_equal(status, True)
2745 self.cliEnter()
2746 flows = json.loads(self.cli.flows(jsonFormat = True))
2747 flows = filter(lambda f: f['flows'], flows)
2748 print flows
2749 self.cliExit()
2750
2751 ##### We can't test port-create scenarios on CiaB setup. #### To-DO
2752 def test_cordvtn_creating_vtn_with_vlan_port_connectivity_and_validate_connectivity_from_host_machine_or_compute_node(self):
2753 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002754 Test Method:
Thangavelu K Sc12afcf2017-04-21 11:32:12 -06002755 0. Create Test-Net,
2756 1. Create subnetwork whose ip is under management network
2757 3. Do GET Rest API and validate creation of network
2758 4. Create new nova instance under management network
2759 5. Validate new nova instance is created on nova service
2760 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2761 """
2762 test_net_name = 'vtn_test_41_net_vlan_port'
2763# test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
2764# test_management_type = "management_local"
2765 instance_vm_name = 'vtn_test_41_nova_instance_vlan_port_net'
2766 #image_name = "vsg-1.1"
2767 image_name = "trusty-server-multi-nic"
2768 flavor_id = 'm1.small'
2769# result = self.neutron_network_creation_and_validation(test_net_name)
2770# assert_equal(result, True)
2771 neutron_creds = self.get_neutron_credentials()
2772 neutron = neutronclient.Client(**neutron_creds)
2773 networks = neutron.list_networks(name=test_net_name)
2774 network_id = self.get_key_value(d=networks, key = 'id')
2775# sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
2776# assert_equal(sub_result[0], True)
2777 # net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
2778 creds = get_nova_credentials()
2779 nova = nova_client.Client('2', **creds)
2780# new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
2781# assert_equal(new_instance_details.status, 'ACTIVE')
2782 #body_port_details = {"port": {"admin_state_up" :"True","device_id" :new_instance_details.id, "name":"stag-100","network_id":network_id}}
2783 body_port_details = {"port": {"admin_state_up" :"True","device_id" :"", "name":"stag-100","network_id":network_id}}
2784 response = neutron.create_port(body=body_port_details)
2785 print(response)
2786 """
2787 compute_details = self.get_compute_nodes()
2788 print new_instance_details.addresses
2789 address = new_instance_details.addresses
2790 print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr'])
2791 time.sleep(60)
2792 status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'])
2793 self.nova_instance_deletion(nova, new_instance_details)
2794 time.sleep(5)
2795 self.neutron_network_deletion(test_net_name)
2796 assert_equal(status, True)
2797 """
2798
Thangavelu K Saea3c672017-03-15 18:57:05 +00002799 def test_cordvtn_with_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002800 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002801 Test Method:
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002802 0. Create Test-Net,
2803 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2804 2. Run sync command for cordvtn
2805 3. Do GET Rest API and validate creation of network
2806 4. Validate network synch with created network in cord-onos
2807 """
2808 creds = self.get_neutron_credentials()
2809 neutron = neutronclient.Client(**creds)
2810 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
2811 net = neutron.create_network(body=body_example)
2812 networks = neutron.list_networks(name='Net-1')
2813 vtn_util = vtn_validation_utils('')
2814 data = networks
2815 result = self.search_value(data, "Net-1")
2816 assert_equal(result, True)
2817
2818 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
2819 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002820 Test Method:
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002821 0. Create Test-Net,
2822 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2823 2. Run sync command for cordvtn
2824 3. Do GET Rest API and validate creation of network
2825 4. Validate network synch with created network in cord-onos
2826 """
2827 creds = self.get_neutron_credentials()
2828 neutron = neutronclient.Client(**creds)
2829 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
2830 net = neutron.create_network(body=body_example)
2831 networks = neutron.list_networks(name='Net-1')
2832 vtn_util = vtn_validation_utils('')
2833 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
2834 auth = ('karaf','karaf')
2835
2836 resp = requests.get(url=url, auth=auth)
2837 data = json.loads(resp.text)
2838 result = self.search_value(data, "Net-1")
2839 assert_equal(result, True)
2840
Thangavelu K S3698fad2017-03-24 17:50:14 +00002841 def test_cordvtn_neutron_network_deletion_and_validation_on_neutron_openstack(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002842 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002843 Test Method:
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002844 0. Create Test-Net,
2845 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2846 2. Run sync command for cordvtn
2847 3. Do GET Rest API and validate creation of network
2848 4. Validate network synch with created network in cord-onos
2849 """
2850 creds = self.get_neutron_credentials()
2851 neutron = neutronclient.Client(**creds)
2852 body_example = {"network":{"name": "Net-1","admin_state_up":False}}
2853 net = neutron.delete_network("Net-1")
2854 networks = neutron.list_networks(name='Net-1')
2855 vtn_util = vtn_validation_utils('')
2856 data = networks
2857 result = self.search_value(data, "Net-1")
2858 assert_equal(result, True)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002859
2860 def test_cordvtn_neutron_network_sync(self):
2861 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002862 Test Method:
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002863 0. Create Test-Net,
2864 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2865 2. Run sync command for cordvtn
2866 3. Do GET Rest API and validate creation of network
2867 4. Validate network synch with created network in cord-onos
2868 """
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00002869 creds = self.get_neutron_credentials()
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002870 neutron = neutronclient.Client(**creds)
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00002871 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002872 net = neutron.create_network(body=body_example)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002873 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
2874 auth = ('karaf','karaf')
2875 body_create_subnet = {'subnets': [{'cidr': '192.168.199.0/24',
2876 'ip_version': 4, 'network_id': network_id}]}
2877
2878 subnet = neutron.create_subnet(body=body_create_subnet)
2879
2880 resp = requests.get(url=url, auth=auth)
2881 data = json.loads(resp.text)
2882 result = self.search_value(data, "Test-Net-1")
2883 assert_equal(result, True)
2884
2885 def test_cordvtn_neutron_port_sync(self):
2886 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002887 Test Method:
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002888 0. Create Test-Net,
2889 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2890 2. Run sync command for cordvtn
2891 3. Do GET Rest API and validate creation of network
Thangavelu K Saea3c672017-03-15 18:57:05 +00002892 4. Validate network synch with created port in cord-onos
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002893 """
2894 creds = self.get_neutron_credentials()
2895 neutron = neutronclient.Client(**creds)
2896 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
2897 net = neutron.create_network(body=body_example)
2898 network_id = net['network']['id']
2899 device_id = 'of:{}'.format(get_mac(self.switch))
2900 body_example = {'port': {'admin_state_up': True,'device_id':device_id, 'network_id':network_id}}
2901 response = neutron.create_port(body=body_example)
2902 url = "http://{0}:8181/onos/cordvtn/servicePorts".format(vtn_util.endpoint)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002903 auth = ('karaf','karaf')
2904
2905 resp = requests.get(url=url, auth=auth)
2906 data = json.loads(resp.text)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002907 result = self.search_value(data, device_id)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002908 assert_equal(result, True)
2909
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002910 def test_cordvtn_creating_virtual_private_network(self):
2911 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002912 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002913 1) Validate that required openstack service is up and running.
2914 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2915 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2916 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2917 4) Verify that NetA is being created and validate IP in nova list command.
2918 5) Verify that flow is being added in ovs-switch in compute-node.
2919 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2920 """
2921 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002922
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002923 def test_cordvtn_creating_virtual_local_management_network(self):
2924 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002925 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002926 1) Validate that required openstack service is up and running.
2927 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2928 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2929 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2930 4) Verify that NetA is being created and validate IP in nova list command.
2931 5) Verify that flow is being added in ovs-switch in compute-node.
2932 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2933 """
2934 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002935
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002936 def test_cordvtn_creating_virtual_vlan_connectivity_network(self):
2937 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002938 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002939 1) Validate that required openstack service is up and running.
2940 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2941 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2942 (neutron port-create net-A-private --name stag-100).
2943 4) Verify that NetA is being created and validate IP in nova list command.
2944 5) Verify that flow is being added in ovs-switch in compute-node.
2945 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2946 """
2947 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002948
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002949 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network(self):
2950 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002951 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002952 1) Validate that required openstack service is up and running.
2953 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2954 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2955 (neutron port-create net-A-private --name stag-500).
2956 4) Verify that NetA is being created and validate IP in nova list command.
2957 5) Verify that flow is being added in ovs-switch in compute-node.
2958 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2959 """
2960 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002961
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002962 def test_cordvtn_creating_virtual_private_network_and_boot_image(self):
2963 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002964 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002965 1) Validate that required openstack service is up and running.
2966 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2967 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2968 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2969 4) Now boot image in the same created network using nova boot image command (example given below :-
2970 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2971 5) Wait till VM boots up and starts running.
2972 6) Verify that a VM is launched and running by using novaclient python API.
2973 7) Verify that flow is being added in ovs-switch in compute-node.
2974 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2975 9) Verify that cord-onos pushed flows to OVS switch.
2976 """
2977 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002978
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002979 def test_cordvtn_creating_virtual_public_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002980
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002981 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00002982 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002983 1) Validate that required openstack service is up and running.
2984 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2985 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2986 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2987 4) Now boot image in the same created network using nova boot image command (example given below :-
2988 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2989 5) Wait till VM boots up and starts running.
2990 6) Verify that a VM is launched and running by using novaclient python API.
2991 7) Verify that flow is being added in ovs-switch in compute-node.
2992 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2993 9) Verify that cord-onos pushed flows to OVS switch.
2994 """
2995 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002996
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002997 def test_cordvtn_creating_virtual_local_management_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002998
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002999 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003000 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003001 1) Validate that required openstack service is up and running.
3002 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3003 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3004 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3005 4) Now boot image in the same created network using nova boot image command (example given below :-
3006 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3007 5) Wait till VM boots up and starts running.
3008 6) Verify that a VM is launched and running by using novaclient python API.
3009 7) Verify that flow is being added in ovs-switch in compute-node.
3010 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3011 9) Verify that cord-onos pushed flows to OVS switch.
3012 """
3013 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003014
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003015 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image(self):
3016 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003017 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003018 1) Validate that required openstack service is up and running.
3019 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3020 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3021 (neutron port-create net-A-private --name stag-100).
3022 4) Now boot image in the same created network using nova boot image command (example given below :-
3023 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3024 5) Wait till VM boots up and starts running.
3025 6) Verify that a VM is launched and running by using novaclient python API.
3026 7) Verify that flow is being added in ovs-switch in compute-node.
3027 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3028 9) Verify that cord-onos pushed flows to OVS switch.
3029 """
3030 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003031
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003032 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image(self):
3033 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003034 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003035 1) Validate that required openstack service is up and running.
3036 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3037 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3038 (neutron port-create net-A-private --name stag-500).
3039 4) Now boot image in the same created network using nova boot image command (example given below :-
3040 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3041 5) Wait till VM boots up and starts running.
3042 6) Verify that a VM is launched and running by using novaclient python API.
3043 7) Verify that flow is being added in ovs-switch in compute-node.
3044 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3045 9) Verify that cord-onos pushed flows to OVS switch.
3046 """
3047 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003048
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003049 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service(self):
3050 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003051 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003052 1) Validate that required openstack service is up and running.
3053 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3054 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3055 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3056 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3057 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3058 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3059 5) Wait till VMs boot up and running.
3060 6) Verify that two VMs are launched and running by using novaclient python API.
3061 7) Verify that flow is being added in ovs-switch in compute-node.
3062 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3063 9) Verify that cord-onos pushed flows to OVS switch.
3064 """
3065 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003066
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003067 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service(self):
3068 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003069 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003070 1) Validate that required openstack service is up and running.
3071 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3072 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3073 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3074 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3075 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3076 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3077 5) Wait till VMs boot up and running.
3078 6) Verify that two VMs are launched and running by using novaclient python API.
3079 7) Verify that flow is being added in ovs-switch in compute-node.
3080 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3081 9) Verify that cord-onos pushed flows to OVS switch.
3082 """
3083 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003084
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003085 def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service(self):
3086 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003087 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003088 1) Validate that required openstack service is up and running.
3089 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3090 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3091 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3092 4) Now boot two images in the same created network using nova boot image command (example given below :-
3093 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3094 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3095 5) Wait till VMs boot up and running.
3096 6) Verify that two VMs are launched and running by using novaclient python API.
3097 7) Verify that flow is being added in ovs-switch in compute-node.
3098 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3099 9) Verify that cord-onos pushed flows to OVS switch.
3100 """
3101 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003102
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003103 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
3104 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003105 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003106 1) Validate that required openstack service is up and running.
3107 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3108 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3109 (neutron port-create net-A-private --name stag-100).
3110 4) Now boot two images in the same created network using nova boot image command (example given below :-
3111 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3112 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3113 5) Wait till VMs boot up and running.
3114 6) Verify that two VMs are launched and running by using novaclient python API.
3115 7) Verify that flow is being added in ovs-switch in compute-node.
3116 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3117 9) Verify that cord-onos pushed flows to OVS switch.
3118 """
3119 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00003120
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003121 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
3122 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003123 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003124 1) Validate that required openstack service is up and running.
3125 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3126 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3127 (neutron port-create net-A-private --name stag-500).
3128 4) Now boot two images in the same created network using nova boot image command (example given below :-
3129 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3130 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3131 5) Wait till VMs boot up and running.
3132 6) Verify that two VMs are launched and running by using novaclient python API.
3133 7) Verify that flow is being added in ovs-switch in compute-node.
3134 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3135 9) Verify that cord-onos pushed flows to OVS switch.
3136 """
3137 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003138
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003139 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity(self):
3140 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003141 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003142 1) Validate that required openstack service is up and running.
3143 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3144 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3145 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3146 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3147 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3148 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3149 5) Wait till VMs boot up and running.
3150 6) Verify that two VMs are launched and running by using novaclient python API.
3151 7) Now ping to the VM from other VM which are launched in same network
3152 8) verify that ping is successful
3153 9) Verify that flow is being added in ovs-switch in compute-node.
3154 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3155 11) Verify that cord-onos pushed flows to OVS switch.
3156 """
3157 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003158
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003159 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3160 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003161 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003162 1) Validate that required openstack service is up and running.
3163 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3164 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3165 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3166 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3167 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3168 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3169 5) Wait till VMs boot up and running.
3170 6) Verify that two VMs are launched and running by using novaclient python API.
3171 7) Now ping to the VM from other VM which are launched in same network
3172 8) verify that ping is not successful
3173 9) Verify that flow is being added in ovs-switch in compute-node.
3174 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3175 11) Verify that cord-onos pushed flows to OVS switch.
3176 """
3177 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003178
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003179 def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003180
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003181 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003182 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003183 1) Validate that required openstack service is up and running.
3184 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3185 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3186 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3187 4) Now boot two images in the same created network using nova boot image command (example given below :-
3188 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3189 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3190 5) Wait till VMs boot up and running.
3191 6) Verify that two VMs are launched and running by using novaclient python API.
3192 7) Now ping to the VM from other VM which are launched in same network
3193 8) verify that ping is not successful
3194 9) Verify that flow is being added in ovs-switch in compute-node.
3195 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3196 11) Verify that cord-onos pushed flows to OVS switch.
3197 """
3198 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003199
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003200 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003201
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003202 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003203 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003204 1) Validate that required openstack service is up and running.
3205 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3206 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3207 (neutron port-create net-A-private --name stag-100).
3208 4) Now boot two images in the same created network using nova boot image command (example given below :-
3209 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3210 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3211 5) Wait till VMs boot up and running.
3212 6) Verify that two VMs are launched and running by using novaclient python API.
3213 7) Now ping to the VM from other VM which are launched in same network
3214 8) verify that ping is not successful
3215 9) Verify that flow is being added in ovs-switch in compute-node.
3216 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3217 11) Verify that cord-onos pushed flows to OVS switch.
3218 """
3219 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003220
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003221 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3222 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003223 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003224 1) Validate that required openstack service is up and running.
3225 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3226 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3227 (neutron port-create net-A-private --name stag-500).
3228 4) Now boot two images in the same created network using nova boot image command (example given below :-
3229 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3230 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3231 5) Wait till VMs boot up and running.
3232 6) Verify that two VMs are launched and running by using novaclient python API.
3233 7) Now ping to the VM from other VM which are launched in same network
3234 8) verify that ping is not successful
3235 9) Verify that flow is being added in ovs-switch in compute-node.
3236 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3237 11) Verify that cord-onos pushed flows to OVS switch.
3238 """
3239 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003240
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003241 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
3242 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003243 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003244 1) Validate that required openstack service is up and running.
3245 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3246 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3247 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3248 4) Now boot image in the same created network using nova boot image command (example given below :-
3249 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3250 5) Wait till VM boots up and starts running.
3251 6) Verify that a VM is launched and running by using novaclient python API.
3252 7) Now ping to the VM from outside network which are internet network (global ping)
3253 8) verify that ping is not successful
3254 9) Verify that flow is being added in ovs-switch in compute-node.
3255 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3256 11) Verify that cord-onos pushed flows to OVS switch.
3257 """
3258 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003259
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003260 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity(self):
3261 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003262 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003263 1) Validate that required openstack service is up and running.
3264 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3265 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3266 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3267 4) Now boot image in the same created network using nova boot image command (example given below :-
3268 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3269 5) Wait till VM boots up and starts running.
3270 6) Verify that a VM is launched and running by using novaclient python API.
3271 7) Now ping to the VM from outside network which are internet network (global ping)
3272 8) verify that ping is successful
3273 9) Verify that flow is being added in ovs-switch in compute-node.
3274 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3275 11) Verify that cord-onos pushed flows to OVS switch.
3276 """
3277 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003278
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003279 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_negative_scenario(self):
3280 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003281 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003282 1) Validate that required openstack service is up and running.
3283 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3284 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3285 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3286 4) Now boot image in the same created network using nova boot image command (example given below :-
3287 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3288 5) Wait till VM boots up and starts running.
3289 6) Verify that a VM is launched and running by using novaclient python API.
3290 7) Now ping to the VM from outside network which are internet network (global ping)
3291 8) verify that ping is not successful
3292 9) Verify that flow is being added in ovs-switch in compute-node.
3293 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3294 11) Verify that cord-onos pushed flows to OVS switch.
3295 """
3296 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003297
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003298 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
3299 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003300 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003301 1) Validate that required openstack service is up and running.
3302 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3303 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3304 (neutron port-create net-A-private --name stag-100).
3305 4) Now boot image in the same created network using nova boot image command (example given below :-
3306 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3307 5) Wait till VM boots up and starts running.
3308 6) Verify that a VM is launched and running by using novaclient python API.
3309 7) Now ping to the VM from outside network which are internet network (global ping)
3310 8) verify that ping is not successful
3311 9) Verify that flow is being added in ovs-switch in compute-node.
3312 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3313 11) Verify that cord-onos pushed flows to OVS switch.
3314 """
3315 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003316
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003317 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
3318 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003319 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003320 1) Validate that required openstack service is up and running.
3321 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3322 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3323 (neutron port-create net-A-private --name stag-500).
3324 4) Now boot image in the same created network using nova boot image command (example given below :-
3325 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3326 5) Wait till VM boots up and starts running.
3327 6) Verify that a VM is launched and running by using novaclient python API.
3328 7) Now ping to the VM from outside network which are internet network (global ping)
3329 8) verify that ping is not successful
3330 9) Verify that flow is being added in ovs-switch in compute-node.
3331 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3332 11) Verify that cord-onos pushed flows to OVS switch.
3333 """
3334 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003335
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003336 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
3337 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003338 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003339 1) Validate that required openstack service is up and running.
3340 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3341 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3342 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3343 4) Now boot image in the same created network using nova boot image command (example given below :-
3344 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3345 5) Wait till VM boots up and starts running.
3346 6) Verify that a VM is launched and running by using novaclient python API.
3347 7) Now ping to the VM from compute node network which are launched a VM.
3348 8) verify that ping is not successful
3349 9) Verify that flow is being added in ovs-switch in compute-node.
3350 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3351 11) Verify that cord-onos pushed flows to OVS switch.
3352 """
3353 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003354
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003355 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_negative_scenario(self):
3356 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003357 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003358 1) Validate that required openstack service is up and running.
3359 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3360 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3361 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3362 4) Now boot image in the same created network using nova boot image command (example given below :-
3363 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3364 5) Wait till VM boots up and starts running.
3365 6) Verify that a VM is launched and running by using novaclient python API.
3366 7) Now ping to the VM from compute node network which are launched a VM.
3367 8) verify that ping is not successful
3368 9) Verify that flow is being added in ovs-switch in compute-node.
3369 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3370 11) Verify that cord-onos pushed flows to OVS switch.
3371 """
3372 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003373
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003374 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity(self):
3375 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003376 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003377 1) Validate that required openstack service is up and running.
3378 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3379 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3380 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3381 4) Now boot image in the same created network using nova boot image command (example given below :-
3382 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3383 5) Wait till VM boots up and starts running.
3384 6) Verify that a VM is launched and running by using novaclient python API.
3385 7) Now ping to the VM from compute node network which are launched a VM.
3386 8) verify that ping is successful
3387 9) Verify that flow is being added in ovs-switch in compute-node.
3388 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3389 11) Verify that cord-onos pushed flows to OVS switch.
3390 """
3391 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003392
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003393 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
3394 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003395 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003396 1) Validate that required openstack service is up and running.
3397 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3398 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3399 (neutron port-create net-A-private --name stag-100).
3400 4) Now boot image in the same created network using nova boot image command (example given below :-
3401 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3402 5) Wait till VM boots up and starts running.
3403 6) Verify that a VM is launched and running by using novaclient python API.
3404 7) Now ping to the VM from compute node network which are launched a VM.
3405 8) verify that ping is not successful
3406 9) Verify that flow is being added in ovs-switch in compute-node.
3407 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3408 11) Verify that cord-onos pushed flows to OVS switch.
3409 """
3410 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003411
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003412 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
3413 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003414 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003415 1) Validate that required openstack service is up and running.
3416 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3417 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3418 (neutron port-create net-A-private --name stag-500).
3419 4) Now boot image in the same created network using nova boot image command (example given below :-
3420 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3421 5) Wait till VM boots up and starts running.
3422 6) Verify that a VM is launched and running by using novaclient python API.
3423 7) Now ping to the VM from compute node network which are launched a VM.
3424 8) verify that ping is not successful
3425 9) Verify that flow is being added in ovs-switch in compute-node.
3426 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3427 11) Verify that cord-onos pushed flows to OVS switch.
3428 """
3429 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003430
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003431 def test_cordvtn_creating_virtual_vlan_interface_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003432
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003433 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003434 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003435 1) Validate that required openstack service is up and running.
3436 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3437 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3438 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3439 4) Now boot image in the same created network using nova boot image command (example given below :-
3440 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3441 5) Wait till VM boots up and starts running.
3442 6) Verify that a VM is launched and running by using novaclient python API.
3443 7) Create a virtual interface with vlan tag and private ip on VM.
3444 8) Create a same virtual interface with valn tag and private ip on head node.
3445 9) Now ping to the VM from head node network which are launched a openstack service.
3446 10) verify that ping is successful
3447 11) Verify that flow is being added in ovs-switch in compute-node.
3448 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3449 13) Verify that cord-onos pushed flows to OVS switch.
3450 """
3451 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003452
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003453 def test_cordvtn_creating_virtual_vlan_interface_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003454
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003455 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003456 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003457 1) Validate that required openstack service is up and running.
3458 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3459 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3460 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3461 4) Now boot image in the same created network using nova boot image command (example given below :-
3462 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3463 5) Wait till VM boots up and starts running.
3464 6) Verify that a VM is launched and running by using novaclient python API.
3465 7) Create a virtual interface with vlan tag and public ip on VM.
3466 8) Create a same virtual interface with valn tag and any pulic ip on head node.
3467 9) Now ping to the VM from head node network which are launched a openstack service.
3468 10) verify that ping is successful
3469 11) Verify that flow is being added in ovs-switch in compute-node.
3470 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3471 13) Verify that cord-onos pushed flows to OVS switch.
3472 """
3473 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003474
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003475 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003476
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003477 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003478 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003479 1) Validate that required openstack service is up and running.
3480 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3481 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3482 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3483 4) Now boot image in the same created network using nova boot image command (example given below :-
3484 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3485 5) Wait till VM boots up and starts running.
3486 6) Verify that a VM is launched and running by using novaclient python API.
3487 7) Create a virtual interface with vlan tag and local management ip on VM.
3488 8) Create a same virtual interface with valn tag and any local management ip on head node.
3489 9) Now ping to the VM from head node network which are launched a openstack service.
3490 10) verify that ping is successful
3491 11) Verify that flow is being added in ovs-switch in compute-node.
3492 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3493 13) Verify that cord-onos pushed flows to OVS switch.
3494 """
3495 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003496
ChetanGaonker901727c2016-11-29 14:05:03 -08003497
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003498 def test_cordvtn_creating_virtual_vlan_interface_floating_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003499
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003500 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003501 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003502 1) Validate that required openstack service is up and running.
3503 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3504 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3505 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3506 4) Now boot image in the same created network using nova boot image command (example given below :-
3507 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3508 5) Wait till VM boots up and starts running.
3509 6) Verify that a VM is launched and running by using novaclient python API.
3510 7) Create a virtual interface with vlan tag and private floating ip on VM.
3511 8) Create a same virtual interface with valn tag and private floating ip on head node.
3512 9) Now ping to the VM from head node network which are launched a openstack service.
3513 10) verify that ping is successful
3514 11) Verify that flow is being added in ovs-switch in compute-node.
3515 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3516 13) Verify that cord-onos pushed flows to OVS switch.
3517 """
3518 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003519
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003520 def test_cordvtn_creating_virtual_vlan_interface_floating_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003521
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003522 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003523 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003524 1) Validate that required openstack service is up and running.
3525 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3526 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3527 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3528 4) Now boot image in the same created network using nova boot image command (example given below :-
3529 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3530 5) Wait till VM boots up and starts running.
3531 6) Verify that a VM is launched and running by using novaclient python API.
3532 7) Create a virtual interface with vlan tag and public floating ip on VM.
3533 8) Create a same virtual interface with valn tag and any pulic floating ip on head node.
3534 9) Now ping to the VM from head node network which are launched a openstack service.
3535 10) verify that ping is successful
3536 11) Verify that flow is being added in ovs-switch in compute-node.
3537 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3538 13) Verify that cord-onos pushed flows to OVS switch.
3539 """
3540 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003541
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003542 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003543
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003544 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003545 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003546 1) Validate that required openstack service is up and running.
3547 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3548 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3549 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3550 4) Now boot image in the same created network using nova boot image command (example given below :-
3551 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3552 5) Wait till VM boots up and starts running.
3553 6) Verify that a VM is launched and running by using novaclient python API.
3554 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3555 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3556 9) Now ping to the VM from head node network which are launched a openstack service.
3557 10) verify that ping is successful
3558 11) Verify that flow is being added in ovs-switch in compute-node.
3559 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3560 13) Verify that cord-onos pushed flows to OVS switch.
3561 """
3562 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003563
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003564 def test_cordvtn_creating_one_virtual_public_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003565
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003566 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003567 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003568 1) Validate that required openstack service is up and running.
3569 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3570 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3571 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3572 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3573 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3574 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3575 5) Wait till VMs boot up and running.
3576 6) Verify that two VMs are launched and running by using novaclient python API.
3577 7) Now ping to the VM from other VM which are launched in the private network
3578 8) verify that ping is not successful
3579 9) Verify that flow is being added in ovs-switch in compute-node.
3580 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3581 11) Verify that cord-onos pushed flows to OVS switch.
3582 """
3583 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003584
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003585 def test_cordvtn_creating_one_virtual_local_management_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003586
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003587 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003588 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003589 1) Validate that required openstack service is up and running.
3590 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3591 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3592 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3593 4) Now boot two images in the same created network using nova boot image command (example given below :-
3594 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3595 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3596 5) Wait till VMs boot up and running.
3597 6) Verify that two VMs are launched and running by using novaclient python API.
3598 7) Now ping to the VM from other VM which are launched in the private network
3599 8) verify that ping is not successful
3600 9) Verify that flow is being added in ovs-switch in compute-node.
3601 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3602 11) Verify that cord-onos pushed flows to OVS switch.
3603 """
3604 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003605
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003606 def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003607
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003608 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003609 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003610 1) Validate that required openstack service is up and running.
3611 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3612 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3613 (neutron port-create net-A-private --name stag-100).
3614 4) Now boot two images in the same created network using nova boot image command (example given below :-
3615 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3616 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3617 5) Wait till VMs boot up and running.
3618 6) Verify that two VMs are launched and running by using novaclient python API.
3619 7) Now ping to the VM from other VM which are launched in the private network
3620 8) verify that ping is not successful
3621 9) Verify that flow is being added in ovs-switch in compute-node.
3622 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3623 11) Verify that cord-onos pushed flows to OVS switch.
3624 """
3625 pass
3626
3627 def test_cordvtn_creating_one_virtual_floating_IP_with_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3628
3629 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003630 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003631 1) Validate that required openstack service is up and running.
3632 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3633 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3634 (neutron port-create net-A-private --name stag-500).
3635 4) Now boot two images in the same created network using nova boot image command (example given below :-
3636 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3637 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3638 5) Wait till VMs boot up and running.
3639 6) Verify that two VMs are launched and running by using novaclient python API.
3640 7) Now ping to the VM from other VM which are launched in the private network
3641 8) verify that ping is not successful
3642 9) Verify that flow is being added in ovs-switch in compute-node.
3643 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3644 11) Verify that cord-onos pushed flows to OVS switch.
3645 """
3646 pass
3647
3648 def test_cordvtn_creating_one_virtual_local_management_other_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3649
3650 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003651 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003652 1) Validate that required openstack service is up and running.
3653 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3654 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3655 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3656 4) Now boot two images in the same created network using nova boot image command (example given below :-
3657 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3658 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3659 5) Wait till VMs boot up and running.
3660 6) Verify that two VMs are launched and running by using novaclient python API.
3661 7) Now ping to the VM from other VM which are launched in the public network
3662 8) verify that ping is not successful
3663 9) Verify that flow is being added in ovs-switch in compute-node.
3664 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3665 11) Verify that cord-onos pushed flows to OVS switch.
3666 """
3667 pass
3668
3669 def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3670
3671 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003672 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003673 1) Validate that required openstack service is up and running.
3674 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3675 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3676 (neutron port-create net-A-private --name stag-100).
3677 4) Now boot two images in the same created network using nova boot image command (example given below :-
3678 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3679 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3680 5) Wait till VMs boot up and running.
3681 6) Verify that two VMs are launched and running by using novaclient python API.
3682 7) Now ping to the VM from other VM which are launched in the public network
3683 8) verify that ping is not successful
3684 9) Verify that flow is being added in ovs-switch in compute-node.
3685 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3686 11) Verify that cord-onos pushed flows to OVS switch.
3687 """
3688 pass
3689
3690 def test_cordvtn_creating_one_virtual_floating_IP_with_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3691
3692 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003693 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003694 1) Validate that required openstack service is up and running.
3695 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3696 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3697 (neutron port-create net-A-private --name stag-500).
3698 4) Now boot two images in the same created network using nova boot image command (example given below :-
3699 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3700 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3701 5) Wait till VMs boot up and running.
3702 6) Verify that two VMs are launched and running by using novaclient python API.
3703 7) Now ping to the VM from other VM which are launched in the public network
3704 8) verify that ping is not successful
3705 9) Verify that flow is being added in ovs-switch in compute-node.
3706 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3707 11) Verify that cord-onos pushed flows to OVS switch.
3708 """
3709 pass
3710
3711 def test_cordvtn_creating_one_virtual_vlan_connectivity_other_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3712
3713 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003714 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003715 1) Validate that required openstack service is up and running.
3716 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3717 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3718 (neutron port-create net-A-private --name stag-100).
3719 4) Now boot two images in the same created network using nova boot image command (example given below :-
3720 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3721 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3722 5) Wait till VMs boot up and running.
3723 6) Verify that two VMs are launched and running by using novaclient python API.
3724 7) Now ping to the VM from other VM which are launched in the public network
3725 8) verify that ping is not successful
3726 9) Verify that flow is being added in ovs-switch in compute-node.
3727 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3728 11) Verify that cord-onos pushed flows to OVS switch.
3729 """
3730 pass
3731
3732 def test_cordvtn_creating_one_virtual_floating_IP_with_vlan_connectivity_other_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3733
3734 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003735 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003736 1) Validate that required openstack service is up and running.
3737 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3738 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3739 (neutron port-create net-A-private --name stag-500).
3740 4) Now boot two images in the same created network using nova boot image command (example given below :-
3741 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3742 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3743 5) Wait till VMs boot up and running.
3744 6) Verify that two VMs are launched and running by using novaclient python API.
3745 7) Now ping to the VM from other VM which are launched in the public network
3746 8) verify that ping is not successful
3747 9) Verify that flow is being added in ovs-switch in compute-node.
3748 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3749 11) Verify that cord-onos pushed flows to OVS switch.
3750 """
3751 pass
3752
3753 def test_cordvtn_creating_one_virtual_floating_IP_with_vlan_connectivity_other_virtual_vlan_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3754
3755 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003756 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003757 1) Validate that required openstack service is up and running.
3758 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3759 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3760 (neutron port-create net-A-private --name stag-500).
3761 4) Now boot two images in the same created network using nova boot image command (example given below :-
3762 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3763 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3764 5) Wait till VMs boot up and running.
3765 6) Verify that two VMs are launched and running by using novaclient python API.
3766 7) Now ping to the VM from other VM which are launched in the public network
3767 8) verify that ping is not successful
3768 9) Verify that flow is being added in ovs-switch in compute-node.
3769 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3770 11) Verify that cord-onos pushed flows to OVS switch.
3771 """
3772 pass
3773
3774 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_with_invalid_public_field_of_onos_network_cfg_json_in_same_service(self):
3775 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003776 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003777 1) Validate that required openstack service is up and running.
3778 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3779 3) Push network_cfg.json config file to onos with an invalid public gateway ip in network_cfg.json file.
3780 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3781 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3782 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3783 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3784 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3785 6) Wait till VMs boot up and running.
3786 7) Verify that two VMs are launched and running by using novaclient python API.
3787 8) Verify that flow is being added in ovs-switch in compute-node.
3788 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3789 10) Verify that cord-onos pushed flows to OVS switch.
3790 11) Verify ping from VM to public gateway which is send to ONOS through rest API in network_cfg.json file.
3791 12) 11th step should be failed due to we are passing invalid public IP as gatway and we have not seen any flows in OVS for it.
3792 13) Now ping one VM to other VM it should not ping again even it in the same service.
3793 """
3794 pass
3795
3796 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_with_invalid_localManagementIp_field_of_onos_network_cfg_json(self):
3797
3798 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003799 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003800 1) Validate that required openstack service is up and running.
3801 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3802 3) Push network_cfg.json config file to onos with an invalid localManagement ip in network_cfg.json file.
3803 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3804 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3805 5) Now boot image in the same created network using nova boot image command (example given below :-
3806 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3807 6) Wait till VM boots up and starts running.
3808 7) Verify that a VM is launched and running by using novaclient python API.
3809 8) Verify that flow is being added in ovs-switch in compute-node.
3810 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3811 10) Verify that cord-onos pushed flows to OVS switch.
3812 11) Verify ping from VM to local management ip which is send to ONOS through rest API in network_cfg.json file.
3813 12) 11th step should be failed due to we are passing invalid local management IP and we have not seen any flows in OVS for it.
3814 """
3815 pass
3816
3817 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OVSDB_port_field_of_onos_network_cfg_json(self):
3818 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003819 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003820 1) Validate that required openstack service is up and running.
3821 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3822 3) Push network_cfg.json config file to onos with an invalid ovsdb port in network_cfg.json file.
3823 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3824 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3825 4) Now boot image in the same created network using nova boot image command (example given below :-
3826 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3827 5) Wait till VM boots up and starts running.
3828 6) Verify that a VM is launched and running by using novaclient python API.
3829 7) Verify that flows are being added in ovs-switch in compute-node.
3830 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3831 9) Verify that cord-onos did not push any flows to OVS switch.
3832 """
3833 pass
3834
3835 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OpenStack_details_in_onos_network_cfg_json(self):
3836 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003837 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003838 1) Validate that required openstack service is up and running.
3839 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3840 3) Push network_cfg.json config file to onos with an invalid openstack in network_cfg.json file.
3841 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3842 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3843 4) Now boot image in the same created network using nova boot image command (example given below :-
3844 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3845 5) Wait till VM boots up and starts running.
3846 6) Verify that a VM is launched and running by using novaclient python API.
3847 7) Verify that no flows are being added in ovs-switch in compute-node.
3848 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
3849 9) Verify that cord-onos did not push any flows to OVS switch.
3850 """
3851 pass
3852
3853 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_compute_node_details_in_onos_network_cfg_json(self):
3854 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003855 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003856 1) Validate that required openstack service is up and running.
3857 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3858 3) Push network_cfg.json config file to onos with an invalid compute node details in network_cfg.json file.
3859 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3860 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3861 4) Now boot image in the same created network using nova boot image command (example given below :-
3862 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3863 5) Wait till VM boots up and starts running.
3864 6) Verify that a VM is launched and running by using novaclient python API.
3865 7) Verify that no flows are being added in ovs-switch in compute-node.
3866 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
3867 9) Verify that cord-onos did not push any flows to OVS switch.
3868 """
3869 pass
3870
3871
3872 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_in_different_services_connectivity(self):
3873 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003874 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003875 1) Validate that required openstack service is up and running.
3876 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3877 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as private network.
3878 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3879 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3880 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3881 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3882 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3883 5) Wait till VMs boot up and running.
3884 6) Verify that two VMs are launched and running by using novaclient python API.
3885 7) Verify that flow is being added in ovs-switch in compute-node.
3886 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3887 9) Verify that cord-onos pushed flows to OVS switch.
3888 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3889 11) Verify that no flows are being added in the OVS switch.
3890 """
3891 pass
3892
3893 def test_cordvtn_creating_two_virtual_public_networks_and_boot_images_in_different_service_connectivity(self):
3894 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003895 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003896 1) Validate that required openstack service is up and running.
3897 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3898 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as public network.
3899 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3900 (neutron net-create net-A-public, neutron subnet-create net-B-public 198.1.0.0/24).
3901 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3902 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3903 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3904 5) Wait till VMs boot up and running.
3905 6) Verify that two VMs are launched and running by using novaclient python API.
3906 7) Verify that flow is being added in ovs-switch in compute-node.
3907 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3908 9) Verify that cord-onos pushed flows to OVS switch.
3909 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3910 11) Verify that no flows are being added in the OVS switch.
3911 """
3912 pass
3913
3914 def test_cordvtn_creating_two_virtual_local_management_networks_and_boot_images_in_different_service_connectivity(self):
3915 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003916 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003917 1) Validate that required openstack service is up and running.
3918 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3919 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as local management network.
3920 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3921 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.28.0.0/24 -gateway 172.28.0.1).
3922 4) Now boot two images in the same created network using nova boot image command (example given below :-
3923 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3924 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3925 5) Wait till VMs boot up and running.
3926 6) Verify that two VMs are launched and running by using novaclient python API.
3927 7) Verify that flow is being added in ovs-switch in compute-node.
3928 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3929 9) Verify that cord-onos pushed flows to OVS switch.
3930 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3931 11) Verify that no flows are being added in the OVS switch.
3932 """
3933 pass
3934
3935 def test_cordvtn_creating_two_virtual_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
3936 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003937 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003938 1) Validate that required openstack service is up and running.
3939 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3940 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with a vlan port-create.
3941 (neutron port-create net-A-private --name stag-100).
3942 (neutron port-create net-B-private --name stag-200).
3943 4) Now boot two images in the same created network using nova boot image command (example given below :-
3944 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3945 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg1-01
3946 5) Wait till VMs boot up and running.
3947 6) Verify that two VMs are launched and running by using novaclient python API.
3948 7) Verify that flow is being added in ovs-switch in compute-node.
3949 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3950 9) Verify that cord-onos pushed flows to OVS switch.
3951 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3952 11) Verify that no flows are being added in the OVS switch.
3953 """
3954 pass
3955 def test_cordvtn_creating_two_virtual_floating_IP_with_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
3956 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003957 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003958 1) Validate that required openstack service is up and running.
3959 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3960 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with a floating ip and vlan port-create.
3961 (neutron port-create net-A-private --name stag-500).
3962 (neutron port-create net-B-private --name stag-500).
3963 4) Now boot two images in the same created network using nova boot image command (example given below :-
3964 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3965 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3966 5) Wait till VMs boot up and running.
3967 6) Verify that two VMs are launched and running by using novaclient python API.
3968 7) Verify that flow is being added in ovs-switch in compute-node.
3969 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3970 9) Verify that cord-onos pushed flows to OVS switch.
3971 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3972 11) Verify that no flows are being added in the OVS switch.
3973 """
3974 pass
3975
3976 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_direct_access(self):
3977 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00003978 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003979 1) Validate that required openstack service is up and running.
3980 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3981 3) Push service dependency data.json file to onos to subscriber of other service.
3982 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3983 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3984 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3985 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3986 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3987 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3988 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3989 6) Wait till VMs boot up and running.
3990 7) Verify that two VMs are launched and running by using novaclient python API.
3991 8) Verify that flow is being added in ovs-switch in compute-node.
3992 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3993 10) Verify that cord-onos pushed flows to OVS switch.
3994 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
3995 12) Verify that flows are being added in the OVS switch.
3996 """
3997 pass
3998
3999 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_indirect_access(self):
4000 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004001 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004002 1) Validate that required openstack service is up and running.
4003 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4004 3) Push service dependency data.json file to onos to subscriber of other service.
4005 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
4006 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
4007 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4008 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
4009 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
4010 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4011 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
4012 6) Wait till VMs boot up and running.
4013 7) Verify that two VMs are launched and running by using novaclient python API.
4014 8) Verify that flow is being added in ovs-switch in compute-node.
4015 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4016 10) Verify that cord-onos pushed flows to OVS switch.
4017 11) Now ping from VM which is Net-B to other VM which is in Net-A, capture packets on port for ICMP request packets.
4018 12) Verify that flows are being added in the OVS switch.
4019 """
4020 pass
4021
4022 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_direct_access(self):
4023 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004024 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004025 1) Validate that required openstack service is up and running.
4026 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4027 3) Push service dependency data.json file to onos to subscriber of other service.
4028 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
4029 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
4030 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4031 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
4032 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
4033 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4034 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
4035 6) Wait till VMs boot up and running.
4036 7) Verify that two VMs are launched and running by using novaclient python API.
4037 8) Verify that flow is being added in ovs-switch in compute-node.
4038 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4039 10) Verify that cord-onos pushed flows to OVS switch.
4040 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
4041 12) Verify that flows are being added in the OVS switch.
4042 13) Push config data with outservice dependency in data.json file to onos to subscriber of other service.
4043 14) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
4044 15) Verify that no flows are being added in the OVS switch.
4045 """
4046 pass
4047
4048 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_indirect_access(self):
4049 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004050 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004051 1) Validate that required openstack service is up and running.
4052 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4053 3) Push service dependency data.json file to onos to subscriber of other service.
4054 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
4055 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
4056 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4057 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
4058 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
4059 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4060 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
4061 6) Wait till VMs boot up and running.
4062 7) Verify that two VMs are launched and running by using novaclient python API.
4063 8) Verify that flow is being added in ovs-switch in compute-node.
4064 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4065 10) Verify that cord-onos pushed flows to OVS switch.
4066 11) Now ping from VM which is Net-B to other VM which is in Net-A, capture packets on port for ICMP request packets.
4067 12) Verify that flows are being added in the OVS switch.
4068 13) Push config data with out service dependency in data.json file to onos to subscriber of other service.
4069 14) Now ping from VM which is Net-B to other VM which is in Net-A, should not see any ICMP request packets on port.
4070 15) Verify that no flows are being added in the OVS switch.
4071 """
4072 pass
4073
4074 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_direct_access(self):
4075 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004076 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004077 1) Validate that required openstack service is up and running.
4078 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4079 3) Validate that XOS is up and running.
4080 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
4081 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4082 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
4083 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
4084 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4085 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
4086 6) Wait till VMs boot up and running.
4087 7) Verify that two VMs are launched and running by using novaclient python API.
4088 8) Verify that flow is being added in ovs-switch in compute-node.
4089 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4090 10) Verify that cord-onos pushed flows to OVS switch.
4091 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
4092 12) Verify that flows are being added in the OVS switch.
4093 """
4094 pass
4095
4096 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_indirect_access(self):
4097 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004098 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004099 1) Validate that required openstack service is up and running.
4100 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4101 3) Validate that XOS is up and running.
4102 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
4103 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4104 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
4105 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
4106 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4107 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
4108 6) Wait till VMs boot up and running.
4109 7) Verify that two VMs are launched and running by using novaclient python API.
4110 8) Verify that flow is being added in ovs-switch in compute-node.
4111 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4112 10) Verify that cord-onos pushed flows to OVS switch.
4113 11) Now ping from VM which is Net-B to other VM which is in Net-A, should ping.
4114 12) Verify that flows are being added in the OVS switch.
4115 """
4116 pass
4117
4118 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_network_cfg_connectivity_to_access_device(self):
4119 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004120 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004121 1) Validate that required openstack service is up and running.
4122 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4123 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
4124 4) Launch the access-agent and access-device containers and then restart openstack compute node.
4125 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
4126 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
4127 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
4128 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
4129 6) We ahve to stop ONOS service to test this
4130 onos-service stop
4131 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
4132 7) Now attach to access-agent container and ping to access-device
4133 8) Verify that ping should be success and flows are being added in br-int.
4134 """
4135 pass
4136
4137 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
4138 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004139 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004140 1) Validate that required openstack service is up and running.
4141 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4142 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
4143 4) Launch the access-agent and access-device containers and then restart openstack compute node.
4144 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
4145 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
4146 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
4147 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
4148 6) We ahve to stop ONOS service to test this
4149 onos-service stop
4150 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
4151 7) Now attach to access-agent container and ping to head node
4152 8) Verify that ping should be success and flows are being added in br-int.
4153 """
4154 pass
4155
4156 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_network_cfg_connectivity_to_access_device(self):
4157 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004158 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004159 1) Validate that required openstack service is up and running.
4160 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4161 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
4162 4) Launch the access-agent and access-device containers and then restart openstack compute node.
4163 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
4164 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
4165 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
4166 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
4167 6) We ahve to stop ONOS service to test this
4168 onos-service stop
4169 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
4170 7) Now attach to access-agent container and ping to access-device
4171 8) Verify that ping should not be success and no flows are being added in br-int.
4172 """
4173 pass
4174
4175 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
4176 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004177 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004178 1) Validate that required openstack service is up and running.
4179 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4180 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
4181 4) Launch the access-agent and access-device containers and then restart openstack compute node.
4182 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
4183 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
4184 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
4185 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
4186 6) We ahve to stop ONOS service to test this
4187 onos-service stop
4188 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
4189 7) Now attach to access-agent container and ping to head node
4190 8) Verify that ping should not be success and no flows are being added in br-int.
4191 """
4192 pass
4193
4194 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_VMs(self):
4195 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004196 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004197 1) Validate that required openstack service is up and running.
4198 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4199 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
4200 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4201 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
4202 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4203 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
4204 5) Wait till VMs boot up and running.
4205 6) Verify that two VMs are launched and running by using novaclient python API.
4206 7) Now ping to the VM from other VM which are launched in same network
4207 8) verify that ping is successful
4208 9) Verify that flow is being added in ovs-switch in compute-node.
4209 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4210 11) Verify that cord-onos pushed flows to OVS switch.
4211 12) Restart both VMs in same service and repeat steps 7 to 11.
4212 """
4213 pass
4214
4215 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_cord_onos(self):
4216 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004217 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004218 1) Validate that required openstack service is up and running.
4219 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4220 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
4221 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4222 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
4223 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4224 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
4225 5) Wait till VMs boot up and running.
4226 6) Verify that two VMs are launched and running by using novaclient python API.
4227 7) Now ping to the VM from other VM which are launched in same network
4228 8) verify that ping is successful
4229 9) Verify that flow is being added in ovs-switch in compute-node.
4230 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4231 11) Verify that cord-onos pushed flows to OVS switch.
4232 12) Restart ONOS service and repeat steps 7 to 11.
4233 """
4234 pass
4235
4236 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_any_VM_recreating_it(self):
4237 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004238 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004239 1) Validate that required openstack service is up and running.
4240 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4241 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
4242 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4243 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
4244 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4245 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
4246 5) Wait till VMs boot up and running.
4247 6) Verify that two VMs are launched and running by using novaclient python API.
4248 7) Now ping to the VM from other VM which are launched in same network
4249 8) verify that ping is successful
4250 9) Verify that flow is being added in ovs-switch in compute-node.
4251 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4252 11) Verify that cord-onos pushed flows to OVS switch.
4253 12) Delete a VM which was created earlier and repeat steps 4 to 11.
4254 """
4255 pass
4256
4257 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_and_add_br_int_bridge(self):
4258 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004259 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004260 1) Validate that required openstack service is up and running.
4261 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4262 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
4263 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
4264 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
4265 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4266 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
4267 5) Wait till VMs boot up and running.
4268 6) Verify that two VMs are launched and running by using novaclient python API.
4269 7) Now ping to the VM from other VM which are launched in same network
4270 8) verify that ping is successful
4271 9) Verify that flow is being added in ovs-switch in compute-node.
4272 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4273 11) Verify that cord-onos pushed flows to OVS switch.
4274 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
4275 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
4276 """
4277 pass
4278
4279 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_VM(self):
4280
4281 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004282 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004283 1) Validate that required openstack service is up and running.
4284 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4285 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
4286 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
4287 4) Now boot image in the same created network using nova boot image command (example given below :-
4288 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4289 5) Wait till VM boots up and starts running.
4290 6) Verify that a VM is launched and running by using novaclient python API.
4291 7) Now ping to the VM from outside network which are internet network (global ping)
4292 8) verify that ping is successful
4293 9) Verify that flow is being added in ovs-switch in compute-node.
4294 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4295 11) Verify that cord-onos pushed flows to OVS switch.
4296 12) Restart the VM in service and repeat steps 7 to 11.
4297
4298 """
4299 pass
4300
4301 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
4302
4303 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004304 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004305 1) Validate that required openstack service is up and running.
4306 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4307 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
4308 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
4309 4) Now boot image in the same created network using nova boot image command (example given below :-
4310 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4311 5) Wait till VM boots up and starts running.
4312 6) Verify that a VM is launched and running by using novaclient python API.
4313 7) Now ping to the VM from outside network which are internet network (global ping)
4314 8) verify that ping is successful
4315 9) Verify that flow is being added in ovs-switch in compute-node.
4316 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4317 11) Verify that cord-onos pushed flows to OVS switch.
4318 12) Restart onos service container and repeat steps 7 to 11.
4319
4320 """
4321 pass
4322
4323 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
4324
4325 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004326 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004327 1) Validate that required openstack service is up and running.
4328 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4329 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
4330 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
4331 4) Now boot image in the same created network using nova boot image command (example given below :-
4332 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4333 5) Wait till VM boots up and starts running.
4334 6) Verify that a VM is launched and running by using novaclient python API.
4335 7) Now ping to the VM from outside network which are internet network (global ping)
4336 8) verify that ping is successful
4337 9) Verify that flow is being added in ovs-switch in compute-node.
4338 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4339 11) Verify that cord-onos pushed flows to OVS switch.
4340 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
4341
4342 """
4343 pass
4344
4345 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
4346
4347 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004348 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004349 1) Validate that required openstack service is up and running.
4350 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4351 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
4352 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
4353 4) Now boot image in the same created network using nova boot image command (example given below :-
4354 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4355 5) Wait till VM boots up and starts running.
4356 6) Verify that a VM is launched and running by using novaclient python API.
4357 7) Now ping to the VM from outside network which are internet network (global ping)
4358 8) verify that ping is successful
4359 9) Verify that flow is being added in ovs-switch in compute-node.
4360 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4361 11) Verify that cord-onos pushed flows to OVS switch.
4362 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
4363 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
4364
4365 """
4366 pass
4367
4368 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
4369
4370 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004371 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004372 1) Validate that required openstack service is up and running.
4373 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4374 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4375 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4376 4) Now boot image in the same created network using nova boot image command (example given below :-
4377 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4378 5) Wait till VM boots up and starts running.
4379 6) Verify that a VM is launched and running by using novaclient python API.
4380 7) Now ping to the VM from compute node network which are launched a VM.
4381 8) verify that ping is successful
4382 9) Verify that flow is being added in ovs-switch in compute-node.
4383 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4384 11) Verify that cord-onos pushed flows to OVS switch.
4385 12) Restart the VM in service and repeat steps 7 to 11.
4386 """
4387 pass
4388
4389 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
4390
4391 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004392 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004393 1) Validate that required openstack service is up and running.
4394 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4395 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4396 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4397 4) Now boot image in the same created network using nova boot image command (example given below :-
4398 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4399 5) Wait till VM boots up and starts running.
4400 6) Verify that a VM is launched and running by using novaclient python API.
4401 7) Now ping to the VM from compute node network which are launched a VM.
4402 8) verify that ping is successful
4403 9) Verify that flow is being added in ovs-switch in compute-node.
4404 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4405 11) Verify that cord-onos pushed flows to OVS switch.
4406 12) Restart the onos service and repeat steps 7 to 11.
4407 """
4408 pass
4409
4410 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
4411
4412 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004413 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004414 1) Validate that required openstack service is up and running.
4415 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4416 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4417 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4418 4) Now boot image in the same created network using nova boot image command (example given below :-
4419 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4420 5) Wait till VM boots up and starts running.
4421 6) Verify that a VM is launched and running by using novaclient python API.
4422 7) Now ping to the VM from compute node network which are launched a VM.
4423 8) verify that ping is successful
4424 9) Verify that flow is being added in ovs-switch in compute-node.
4425 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4426 11) Verify that cord-onos pushed flows to OVS switch.
4427 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
4428 """
4429 pass
4430
4431 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
4432
4433 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004434 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004435 1) Validate that required openstack service is up and running.
4436 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4437 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4438 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4439 4) Now boot image in the same created network using nova boot image command (example given below :-
4440 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4441 5) Wait till VM boots up and starts running.
4442 6) Verify that a VM is launched and running by using novaclient python API.
4443 7) Now ping to the VM from compute node network which are launched a VM.
4444 8) verify that ping is successful
4445 9) Verify that flow is being added in ovs-switch in compute-node.
4446 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4447 11) Verify that cord-onos pushed flows to OVS switch.
4448 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
4449 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
4450 """
4451 pass
4452
4453 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
4454
4455 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004456 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004457 1) Validate that required openstack service is up and running.
4458 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4459 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4460 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4461 4) Now boot image in the same created network using nova boot image command (example given below :-
4462 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4463 5) Wait till VM boots up and starts running.
4464 6) Verify that a VM is launched and running by using novaclient python API.
4465 7) Create a virtual interface with vlan tag and local management ip on VM.
4466 8) Create a same virtual interface with valn tag and any local management ip on head node.
4467 9) Now ping to the VM from head node network which are launched a openstack service.
4468 10) verify that ping is successful
4469 11) Verify that flow is being added in ovs-switch in compute-node.
4470 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4471 13) Verify that cord-onos pushed flows to OVS switch.
4472 14) Restart the VM in service and repeat steps 9 to 13.
4473
4474 """
4475 pass
4476
4477 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
4478
4479 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004480 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004481 1) Validate that required openstack service is up and running.
4482 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4483 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4484 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4485 4) Now boot image in the same created network using nova boot image command (example given below :-
4486 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4487 5) Wait till VM boots up and starts running.
4488 6) Verify that a VM is launched and running by using novaclient python API.
4489 7) Create a virtual interface with vlan tag and local management ip on VM.
4490 8) Create a same virtual interface with valn tag and any local management ip on head node.
4491 9) Now ping to the VM from head node network which are launched a openstack service.
4492 10) verify that ping is successful
4493 11) Verify that flow is being added in ovs-switch in compute-node.
4494 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4495 13) Verify that cord-onos pushed flows to OVS switch.
4496 14) Restart the ONOS service and repeat steps 9 to 13.
4497
4498 """
4499 pass
4500
4501 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
4502
4503 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004504 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004505 1) Validate that required openstack service is up and running.
4506 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4507 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4508 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4509 4) Now boot image in the same created network using nova boot image command (example given below :-
4510 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4511 5) Wait till VM boots up and starts running.
4512 6) Verify that a VM is launched and running by using novaclient python API.
4513 7) Create a virtual interface with vlan tag and local management ip on VM.
4514 8) Create a same virtual interface with valn tag and any local management ip on head node.
4515 9) Now ping to the VM from head node network which are launched a openstack service.
4516 10) verify that ping is successful
4517 11) Verify that flow is being added in ovs-switch in compute-node.
4518 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4519 13) Verify that cord-onos pushed flows to OVS switch.
4520 14) Delete and re-create a VM in service and repeat steps 9 to 13.
4521
4522 """
4523 pass
4524
4525 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
4526
4527 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004528 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004529 1) Validate that required openstack service is up and running.
4530 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4531 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4532 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4533 4) Now boot image in the same created network using nova boot image command (example given below :-
4534 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4535 5) Wait till VM boots up and starts running.
4536 6) Verify that a VM is launched and running by using novaclient python API.
4537 7) Create a virtual interface with vlan tag and local management ip on VM.
4538 8) Create a same virtual interface with valn tag and any local management ip on head node.
4539 9) Now ping to the VM from head node network which are launched a openstack service.
4540 10) verify that ping is successful
4541 11) Verify that flow is being added in ovs-switch in compute-node.
4542 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4543 13) Verify that cord-onos pushed flows to OVS switch.
4544 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
4545 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
4546
4547 """
4548 pass
4549
4550 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
4551
4552 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004553 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004554 1) Validate that required openstack service is up and running.
4555 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4556 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4557 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4558 4) Now boot image in the same created network using nova boot image command (example given below :-
4559 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4560 5) Wait till VM boots up and starts running.
4561 6) Verify that a VM is launched and running by using novaclient python API.
4562 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4563 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4564 9) Now ping to the VM from head node network which are launched a openstack service.
4565 10) verify that ping is successful
4566 11) Verify that flow is being added in ovs-switch in compute-node.
4567 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4568 13) Verify that cord-onos pushed flows to OVS switch.
4569 14) Restart the VM in service and repeat steps 9 to 13.
4570 """
4571 pass
4572
4573 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
4574
4575 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004576 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004577 1) Validate that required openstack service is up and running.
4578 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4579 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4580 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4581 4) Now boot image in the same created network using nova boot image command (example given below :-
4582 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4583 5) Wait till VM boots up and starts running.
4584 6) Verify that a VM is launched and running by using novaclient python API.
4585 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4586 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4587 9) Now ping to the VM from head node network which are launched a openstack service.
4588 10) verify that ping is successful
4589 11) Verify that flow is being added in ovs-switch in compute-node.
4590 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4591 13) Verify that cord-onos pushed flows to OVS switch.
4592 14) Restart the ONOS service and repeat steps 9 to 13.
4593 """
4594 pass
4595
4596 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
4597 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004598 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004599 1) Validate that required openstack service is up and running.
4600 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4601 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4602 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4603 4) Now boot image in the same created network using nova boot image command (example given below :-
4604 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4605 5) Wait till VM boots up and starts running.
4606 6) Verify that a VM is launched and running by using novaclient python API.
4607 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4608 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4609 9) Now ping to the VM from head node network which are launched a openstack service.
4610 10) verify that ping is successful
4611 11) Verify that flow is being added in ovs-switch in compute-node.
4612 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4613 13) Verify that cord-onos pushed flows to OVS switch.
4614 14) Delete and re-create a VM in service and repeat steps 9 to 13.
4615 """
4616 pass
4617
4618 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
4619
4620 """
Chetan Gaonker72f3c4e2017-05-10 18:16:49 +00004621 Test Method:
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00004622 1) Validate that required openstack service is up and running.
4623 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4624 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4625 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4626 4) Now boot image in the same created network using nova boot image command (example given below :-
4627 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
4628 5) Wait till VM boots up and starts running.
4629 6) Verify that a VM is launched and running by using novaclient python API.
4630 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4631 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4632 9) Now ping to the VM from head node network which are launched a openstack service.
4633 10) verify that ping is successful
4634 11) Verify that flow is being added in ovs-switch in compute-node.
4635 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4636 13) Verify that cord-onos pushed flows to OVS switch.
4637 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
4638 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
4639 """
4640 pass
Thangavelu K S165c0d82017-04-18 20:50:20 +00004641