blob: bb5087fe536c6f5151c288d67d68feb7b242ce55 [file] [log] [blame]
ChetanGaonker901727c2016-11-29 14:05:03 -08001#
2# Copyright 2016-present Ciena Corporation
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#
16import unittest
17import os,sys
ChetanGaonker901727c2016-11-29 14:05:03 -080018import keystoneclient.v2_0.client as ksclient
19import keystoneclient.apiclient.exceptions
20import neutronclient.v2_0.client as nclient
21import neutronclient.common.exceptions
Thangavelu K S40d22112017-04-14 00:32:10 +000022import novaclient.v1_1.client as novaclient
Chetan Gaonkerea4d9902017-04-05 18:25:43 -050023from novaclient import client as nova_client
ChetanGaonker901727c2016-11-29 14:05:03 -080024from multiprocessing import Pool
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080025from neutronclient.v2_0 import client as neutron_client
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000026import neutronclient.v2_0.client as neutronclient
ChetanGaonker901727c2016-11-29 14:05:03 -080027from nose.tools import assert_equal
A R Karthick76a497a2017-04-12 10:59:39 -070028from CordTestUtils import get_mac, log_test
A.R Karthickbe7768c2017-03-17 11:39:41 -070029from OnosCtrl import OnosCtrl
ChetanGaonker901727c2016-11-29 14:05:03 -080030from CordLogger import CordLogger
A.R Karthickd4eed642017-03-09 14:40:52 -080031from TestManifest import TestManifest
Chetan Gaonkera6e23a72017-03-14 01:27:49 +000032from OnosFlowCtrl import OnosFlowCtrl
Thangavelu K S40d22112017-04-14 00:32:10 +000033from scapy.all import *
Thangavelu K Sb8a7b872017-03-31 18:10:53 +000034from credentials import *
35from VSGAccess import VSGAccess
36from SSHTestAgent import SSHTestAgent
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000037import requests
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080038import time
Chetan Gaonker3c8ae682017-02-18 00:50:45 +000039import py_compile
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000040import json
ChetanGaonker901727c2016-11-29 14:05:03 -080041
ChetanGaonker71fe0302016-12-19 17:45:44 -080042PROTO_NAME_TCP = 'tcp'
43PROTO_NAME_ICMP = 'icmp'
44IPv4 = 'IPv4'
45
46OS_USERNAME = 'admin'
Chetan Gaonker0fb91c92017-02-07 01:52:18 +000047OS_PASSWORD = 'VeryLongKeystoneAdminPassword'
ChetanGaonker71fe0302016-12-19 17:45:44 -080048OS_TENANT = 'admin'
Chetan Gaonker0fb91c92017-02-07 01:52:18 +000049OS_AUTH_URL = 'https://keystone.cord.lab:5000/v2.0'
50OS_SERVICE_ENDPOINT = 'https://keystone.cord.lab:5000/v2.0/'
Chetan Gaonker1f422af2017-01-13 21:59:16 +000051VM_BOOT_TIMEOUT = 100
52VM_DELETE_TIMEOUT = 100
53
ChetanGaonker71fe0302016-12-19 17:45:44 -080054
55#VM SSH CREDENTIALS
56VM_USERNAME = 'ubuntu'
57VM_PASSWORD = 'ubuntu'
58
59TENANT_PREFIX = 'test-'
60VM_PREFIX = 'test-'
61NETWORK_PREFIX = 'test-'
62CIDR_PREFIX = '192.168'
63
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000064class vtn_validation_utils:
65
A.R Karthickd4eed642017-03-09 14:40:52 -080066 endpoint = '172.17.0.5'
67 version = ''
68 vtn_app = 'org.opencord.vtn'
69
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000070 def __init__(self, version):
71 self.version = version
A.R Karthickd4eed642017-03-09 14:40:52 -080072 self.manifest = None
73 self.vtn_enabled = False
74 manifest = os.getenv('MANIFEST', None)
75 if manifest:
76 self.manifest = TestManifest(manifest = manifest)
77 self.endpoint = self.manifest.onos_ip
78 self.vtn_enabled = self.manifest.synchronizer == 'vtn'
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000079
A.R Karthickd4eed642017-03-09 14:40:52 -080080 self.app_ctrl = OnosCtrl(self.vtn_app, controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000081
A.R Karthickd4eed642017-03-09 14:40:52 -080082 def getDevices(self):
83 return OnosCtrl.get_devices(controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000084
A.R Karthickd4eed642017-03-09 14:40:52 -080085 def getLinks(self):
86 return OnosCtrl.get_links(controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000087
A.R Karthickd4eed642017-03-09 14:40:52 -080088 def getDevicePorts(self, switch_id):
89 return OnosCtrl.get_ports_device(switch_id, controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000090
A.R Karthickd4eed642017-03-09 14:40:52 -080091 def activateVTNApp(self):
92 return self.app_ctrl.activate()
93
94 def deactivateVTNApp(self):
95 return self.app_ctrl.deactivate()
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000096
ChetanGaonker901727c2016-11-29 14:05:03 -080097class cordvtn_exchange(CordLogger):
98
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080099 app_cordvtn = 'org.opencord.vtn'
100 test_path = os.path.dirname(os.path.realpath(__file__))
101 cordvtn_dir = os.path.join(test_path, '..', 'setup')
102 cordvtn_conf_file = os.path.join(test_path, '..', '../cordvtn/network_cfg.json')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000103 head_node_user = 'vagrant'
104 head_node_pass = 'vagrant'
105 head_node = os.getenv('HEAD_NODE', 'prod')
106 head_node_ip = '10.1.0.1'
107 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
108
ChetanGaonker901727c2016-11-29 14:05:03 -0800109
110 @classmethod
111 def setUpClass(cls):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800112 ''' Activate the cordvtn app'''
ChetanGaonker901727c2016-11-29 14:05:03 -0800113 time.sleep(3)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800114 cls.onos_ctrl = OnosCtrl(cls.app_cordvtn)
115 status, _ = cls.onos_ctrl.activate()
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000116 assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800117 time.sleep(3)
118 cls.cordvtn_setup()
ChetanGaonker901727c2016-11-29 14:05:03 -0800119
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800120 @classmethod
121 def tearDownClass(cls):
ChetanGaonker901727c2016-11-29 14:05:03 -0800122 '''Deactivate the cord vtn app'''
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000123 #cls.onos_ctrl.deactivate()
124 #cls.cord_vtn_cleanup()
ChetanGaonker901727c2016-11-29 14:05:03 -0800125
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800126 @classmethod
127 def cordvtn_setup(cls):
128 pass
129
130 @classmethod
131 def cord_vtn_cleanup(cls):
132 ##reset the ONOS port configuration back to default
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000133 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800134
135 @classmethod
136 def onos_load_config(cls, cordvtn_conf_file):
137 status, code = OnosCtrl.config(cordvtn_conf_file)
ChetanGaonker901727c2016-11-29 14:05:03 -0800138 if status is False:
A R Karthick76a497a2017-04-12 10:59:39 -0700139 log_test.info('JSON request returned status %d' %code)
ChetanGaonker901727c2016-11-29 14:05:03 -0800140 assert_equal(status, True)
141 time.sleep(3)
142
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000143 def get_neutron_credentials(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800144 n = {}
145 n['username'] = os.environ['OS_USERNAME']
146 n['password'] = os.environ['OS_PASSWORD']
147 n['auth_url'] = os.environ['OS_AUTH_URL']
148 n['tenant_name'] = os.environ['OS_TENANT_NAME']
Chetan Gaonker80e06152017-03-07 01:07:19 +0000149 n['ca_cert'] = os.environ['REQUESTS_CA_BUNDLE']
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800150 return n
151
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000152 @classmethod
153 def get_compute_nodes(cls):
154 credentials = get_nova_credentials_v2()
155 novaclient = nova_client.Client('2', **credentials)
Thangavelu K S40d22112017-04-14 00:32:10 +0000156 print novaclient.hypervisors.list()
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000157 return novaclient.hypervisors.list()
158
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800159 def create_network(i):
160 neutron_credentials = get_neutron_credentials()
161 neutron = neutron_client.Client(**neutron_credentials)
162 json = {'network': {'name': 'network-' + str(i),
163 'admin_state_up': True}}
164 while True:
165 try:
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000166 net = neutron.create_network(body=json)
Thangavelu K S40d22112017-04-14 00:32:10 +0000167 print '\nnetwork-' + str(i) + ' created'
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000168 return net
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800169 except Exception as e:
Thangavelu K S40d22112017-04-14 00:32:10 +0000170 print e
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800171 continue
172
ChetanGaonker901727c2016-11-29 14:05:03 -0800173 def create_tenant(tenant_name):
174 new_tenant = keystone.tenants.create(tenant_name=tenant_name,
175 description="CORD Tenant \
176 created",
177 enabled=True)
178 tenant_id = new_tenant.id
179 tenant_status = True
180 user_data = []
181 for j in range(2):
182 j += 1
183 user_name = tenant_name + '-user-' + str(j)
184 user_data.append(create_user(user_name, tenant_id))
185
Thangavelu K S40d22112017-04-14 00:32:10 +0000186 print " Tenant and User Created"
ChetanGaonker901727c2016-11-29 14:05:03 -0800187
188 tenant_data = {'tenant_name': tenant_name,
189 'tenant_id': tenant_id,
190 'status': tenant_status}
191 return tenant_data
192
193 def create_user(user_name, tenant_id):
194 new_user = keystone.users.create(name=user_name,
195 password="ubuntu",
196 tenant_id=tenant_id)
197 print(' - Created User %s' % user_name)
198 keystone.roles.add_user_role(new_user, member_role, tenant_id)
199 if assign_admin:
200 admin_user = keystone.users.find(name='admin')
201 admin_role = keystone.roles.find(name='admin')
202 keystone.roles.add_user_role(admin_user, admin_role, tenant_id)
203 user_data = {'name': new_user.name,
204 'id': new_user.id}
205 return user_data
206
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800207 def create_port( router_id, network_id):
208 credentials = get_credentials()
209 neutron = client.Client(**credentials)
210 router = neutron.show_router(router_id)
211
212 value = {'port':{
213 'admin_state_up':True,
214 'device_id': router_id,
215 'name': 'port1',
216 'network_id':network_id,
217 }}
218 response = neutron.create_port(body=value)
219
ChetanGaonker71fe0302016-12-19 17:45:44 -0800220 def router_create(self, name):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800221 external_network = None
222 for network in self.neutron.list_networks()["networks"]:
223 if network.get("router:external"):
224 external_network = network
225 break
226
227 if not external_network:
228 raise Exception("Alarm! Can not to find external network")
229
230 gw_info = {
231 "network_id": external_network["id"],
232 "enable_snat": True
233 }
234 router_info = {
235 "router": {
236 "name": name,
237 "external_gateway_info": gw_info,
238 "tenant_id": self.tenant_id
239 }
240 }
ChetanGaonker71fe0302016-12-19 17:45:44 -0800241 router = self.neutron.router_create(router_info)['router']
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800242 return router
243
ChetanGaonker901727c2016-11-29 14:05:03 -0800244 def delete_tenant(tenant_name):
245 tenant = keystone.tenants.find(name=tenant_name)
246 for j in range(2):
247 j += 1
248 user_name = tenant_name + '-user-' + str(j)
249 delete_user(user_name, tenant.id)
250 tenant.delete()
251 print(' - Deleted Tenant %s ' % tenant_name)
252 return True
253
254 def delete_user(user_name, tenant_id):
255 user = keystone.users.find(name=user_name)
256 user.delete()
257
258 print(' - Deleted User %s' % user_name)
259 return True
260
ChetanGaonker71fe0302016-12-19 17:45:44 -0800261 def set_environment(tenants_num=0, networks_per_tenant=1, vms_per_network=2):
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000262 octet = 115
263 vm_inc = 11
264 image = nova_connection.images.get(IMAGE_ID)
265 flavor = nova_connection.flavors.get(FLAVOR_ID)
ChetanGaonker71fe0302016-12-19 17:45:44 -0800266
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000267 admin_user_id = keystone_connection.users.find(name=OS_USERNAME).id
268 member_role_id = keystone_connection.roles.find(name='Member').id
269 for num_tenant in range(1, tenants_num+1):
270 tenant = keystone_connection.tenants.create('%stenant%s' % (TENANT_PREFIX, num_tenant))
271 keystone_connection.roles.add_user_role(admin_user_id, member_role_id, tenant=tenant.id)
272 for num_network in range(networks_per_tenant):
273 network_json = {'name': '%snet%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
274 'admin_state_up': True,
275 'tenant_id': tenant.id}
276 network = neutron_connection.create_network({'network': network_json})
277 subnet_json = {'name': '%ssubnet%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
278 'network_id': network['network']['id'],
279 'tenant_id': tenant.id,
280 'enable_dhcp': True,
281 'cidr': '%s.%s.0/24' % (CIDR_PREFIX, octet), 'ip_version': 4}
282 octet += 1
283 subnet = neutron_connection.create_subnet({'subnet': subnet_json})
284 router_json = {'name': '%srouter%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
285 'tenant_id': tenant.id}
286 router = neutron_connection.router_create({'router': router_json})
287 port = neutron_connection.add_interface_router(router['router']['id'], {'subnet_id': subnet['subnet']['id']})
288 for num_vm in range(vms_per_network):
289 tenant_nova_connection = novacli.Client(OS_USERNAME, OS_PASSWORD, tenant.name, OS_AUTH_URL)
290 m = tenant_nova_connection.servers.create('%svm%s' % (VM_PREFIX, vm_inc), image, flavor, nics=[{'net-id': network['network']['id']}, {'net-id': MGMT_NET}])
291 vm_inc += 1
ChetanGaonker71fe0302016-12-19 17:45:44 -0800292
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800293 def verify_neutron_crud():
294 x = os.system("neutron_test.sh")
295 return x
ChetanGaonker901727c2016-11-29 14:05:03 -0800296
Author Name91eaeba2017-01-05 13:41:45 -0800297 def list_floatingips( **kwargs):
298 creds = get_neutron_credentials()
299 neutron = client.Client(**creds)
300 return neutron.list_floatingips(**kwargs)['floatingips']
301
302 def list_security_groups( **kwargs):
303 creds = get_neutron_credentials()
304 neutron = client.Client(**creds)
305 return neutron.list_security_groups(**kwargs)['security_groups']
306
307 def list_subnets( **kwargs):
308 creds = get_neutron_credentials()
309 neutron = client.Client(**creds)
310 return neutron.list_subnets(**kwargs)['subnets']
311
312 def list_networks( **kwargs):
313 creds = get_neutron_credentials()
314 neutron = client.Client(**creds)
315 return neutron.list_networks(**kwargs)['networks']
316
317 def list_ports( **kwargs):
318 creds = get_neutron_credentials()
319 neutron = client.Client(**creds)
320 return neutron.list_ports(**kwargs)['ports']
321
322 def list_routers( **kwargs):
323 creds = get_neutron_credentials()
324 neutron = client.Client(**creds)
325 return neutron.list_routers(**kwargs)['routers']
326
327 def update_floatingip( fip, port_id=None):
328 creds = get_neutron_credentials()
329 neutron = client.Client(**creds)
330 neutron.update_floatingip(fip, {"floatingip":
331 {"port_id": port_id}})
332
333 def update_subnet( subnet_id, **subnet_params):
334 creds = get_neutron_credentials()
335 neutron = client.Client(**creds)
336 neutron.update_subnet(subnet_id, {'subnet': subnet_params})
337
338 def update_router( router_id, **router_params):
339 creds = get_neutron_credentials()
340 neutron = client.Client(**creds)
341 neutron.update_router(router_id, {'router': router_params})
342
343 def router_gateway_set( router_id, external_gateway):
344 creds = get_neutron_credentials()
345 neutron = client.Client(**creds)
346 neutron.update_router(
347 router_id, {'router': {'external_gateway_info':
348 {'network_id': external_gateway}}})
349
350 def router_gateway_clear( router_id):
351 creds = get_neutron_credentials()
352 neutron = client.Client(**creds)
353 neutron.update_router(
354 router_id, {'router': {'external_gateway_info': None}})
355
356 def router_add_interface( router_id, subnet_id):
357 creds = get_neutron_credentials()
358 neutron = client.Client(**creds)
359 neutron.add_interface_router(router_id, {'subnet_id': subnet_id})
360
361 def router_rem_interface( router_id, subnet_id):
362 creds = get_neutron_credentials()
363 neutron = client.Client(**creds)
364 neutron.remove_interface_router(
365 router_id, {'subnet_id': subnet_id})
366
367 def create_floatingip( **floatingip_params):
368 creds = get_neutron_credentials()
369 neutron = client.Client(**creds)
370 response = neutron.create_floatingip(
371 {'floatingip': floatingip_params})
372 if 'floatingip' in response and 'id' in response['floatingip']:
373 return response['floatingip']['id']
374
Chetan Gaonker1f422af2017-01-13 21:59:16 +0000375 def make_iperf_pair(server, client, **kwargs):
376 ssh = SSHClient()
377 ssh.set_missing_host_key_policy(MissingHostKeyPolicy())
378
379 ssh.connect(server, username=VM_USERNAME, password=VM_PASSWORD)
380 ssh.exec_command('/usr/local/bin/iperf3 -s -D')
381
382 ssh.connect(client, username=VM_USERNAME, password=VM_PASSWORD)
383 stdin, stdout, stderr = ssh.exec_command('/usr/local/bin/iperf3 -c %s -J' % server)
384
385 rawdata = stdout.read()
386 data = json.loads(rawdata.translate(None,'\t').translate(None,'\n'))
387
388 return data
389
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000390 def connect_ssh(os_ip, private_key_file=None, user='ubuntu'):
391 key = ssh.RSAKey.from_private_key_file(private_key_file)
392 client = ssh.SSHClient()
393 client.set_missing_host_key_policy(ssh.WarningPolicy())
394 client.connect(ip, username=user, pkey=key, timeout=5)
395 return client
Chetan Gaonker1f422af2017-01-13 21:59:16 +0000396
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000397 def validate_vtn_flows(switch):
398 egress = 1
399 ingress = 2
400 egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1' }
401 ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1' }
402 device_id = 'of:{}'.format(get_mac(switch))
Chetan Gaonkera6e23a72017-03-14 01:27:49 +0000403 ctlr = self.ctlr_ip.split(',')[0]
404 flow = OnosFlowCtrl(deviceId = device_id,
405 egressPort = egress,
406 ingressPort = ingress,
407 ethType = '0x800',
408 ipSrc = ('IPV4_SRC', ingress_map['ip']+'/32'),
409 ipDst = ('IPV4_DST', egress_map['ip']+'/32'),
410 controller = ctlr
411 )
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000412 flow_id = flow.findFlow(device_id, IN_PORT = ('port', ingress),
413 ETH_TYPE = ('ethType','0x800'), IPV4_SRC = ('ip', ingress_map['ip']+'/32'),
414 IPV4_DST = ('ip', egress_map['ip']+'/32'))
415 if flow_id:
416 return True
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800417
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000418 def cordvtn_config_load(self, config = None):
419 if config:
420 for k in config.keys():
421 if cordvtn_config.has_key(k):
422 cordvtn_config[k] = config[k]
423 self.onos_load_config(self.cordvtn_dict)
424
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000425 def search_value(self, d, pat):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000426 match = False
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000427 for k, v in d.items():
428 if isinstance(v, dict):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000429 match = self.search_value(v, pat)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000430 if match is True:
431 break
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000432 elif type(v) is list:
433 for i in range(len(v)):
434 if type(v[i]) is dict:
435 match = self.search_value(v[i], pat)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000436 if match is True:
437 break
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000438 else:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000439 if v[i] == pat:
440 match = True
441 return match
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000442 elif v == pat:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000443 match = True
444 return match
445 if match is True:
Thangavelu K S40d22112017-04-14 00:32:10 +0000446 print"Network search is successful"
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000447 return match
448
Thangavelu K Saea3c672017-03-15 18:57:05 +0000449 def get_key_value(self, d, key = None, value = None,):
450 match = False
451 ret_k = ""
452 ret_v = ""
453 if type(d) is not dict:
454 if type(d) is not list:
455 match = 'NOT_FOUND'
456 return [match, ret_k, ret_v]
457 else:
458 for i in range(len(d)):
459 if type(d[i]) is dict:
460 match,ret_k,ret_v = self.get_key_value(d[i], key, value)
461 if match is True:
Thangavelu K S40d22112017-04-14 00:32:10 +0000462 print "Network creation is successful"
Thangavelu K Saea3c672017-03-15 18:57:05 +0000463 break
464 else:
465 for k, v in d.items():
466 if isinstance(v, dict):
467 match,ret_k,ret_v = self.get_key_value(v, key, value)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000468 if match is True:
469 break
Thangavelu K Saea3c672017-03-15 18:57:05 +0000470 elif type(v) is list:
471 for i in range(len(v)):
472 if type(v[i]) is dict:
473 match,ret_k,ret_v = self.get_key_value(v[i], key, value)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000474 if match is True:
475 break
Thangavelu K Saea3c672017-03-15 18:57:05 +0000476 else:
477 if key:
478 if k == key:
479 match = True
480 return [match, key, v]
481 elif value:
482 if v == value:
483 match = True
484 return [match, k, value]
485 else:
486 if key:
487 if k == key:
488 match = True
489 return [match, key, v]
490 elif value:
491 if v == value:
492 match = True
493 return [match, k, value]
494 if match == False:
495 match = 'NOT_FOUND'
496 return [match, ret_k, ret_v]
497
498 def neutron_network_creation_and_validation(self, net_name):
499 creds = self.get_neutron_credentials()
500 neutron = neutronclient.Client(**creds)
501 body_example = {"network":{"name": net_name,"admin_state_up":True}}
502 net = neutron.create_network(body=body_example)
503 networks = neutron.list_networks(name=net_name)
504 data = networks
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000505 return self.search_value(data, net_name)
Thangavelu K Saea3c672017-03-15 18:57:05 +0000506
507 def neutron_network_deletion(self, net_name):
508 creds = self.get_neutron_credentials()
509 neutron = neutronclient.Client(**creds)
510 networks = neutron.list_networks(name=net_name)
511 net_id = self.get_key_value(d=networks, key = 'id')
512 net = neutron.delete_network(net_id[2])
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000513 return self.get_key_value(d=networks, value = net_name)
Thangavelu K Saea3c672017-03-15 18:57:05 +0000514
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000515 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 +0000516 creds = self.get_neutron_credentials()
517 neutron = neutronclient.Client(**creds)
518 networks = neutron.list_networks(name=net_name)
519 net_id = self.get_key_value(d=networks, key = 'id')
520 cidr = sub_cird
521 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"}]}}
522 neutron_sub = neutron.create_subnet(body_subnet_example)
523 networks = neutron.list_networks(name=net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000524 return self.get_key_value(d=networks, key = 'subnets')
525
526 def neutron_subnet_creation_and_validation(self,net_name,sub_cird):
527 creds = self.get_neutron_credentials()
528 neutron = neutronclient.Client(**creds)
529 networks = neutron.list_networks(name=net_name)
530 net_id = self.get_key_value(d=networks, key = 'id')
531 if sub_cird[0] == 'management':
532 cidr = sub_cird[1]
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000533 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 +0000534 elif sub_cird[0] == 'public':
535 cidr = sub_cird[1]
536 gate_way = sub_cird[2]
537 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}}
538 elif sub_cird[0] == 'private':
539 cidr = sub_cird[1]
540 gate_way = sub_cird[2]
541 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}}
542
543 neutron_sub = neutron.create_subnet(body_subnet_example)
544 networks = neutron.list_networks(name=net_name)
545 return self.get_key_value(d=networks, key = 'subnets')
546
547 def sub_network_type_post_to_onos(self,net_name,sub_net_type):
548
549 creds = self.get_neutron_credentials()
550 neutron = neutronclient.Client(**creds)
551 networks = neutron.list_networks(name=net_name)
552 net_id = self.get_key_value(d=networks, key = 'id')
553 vtn_util = vtn_validation_utils('')
554
555 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
556 auth = ('karaf','karaf')
557 network_data = {"ServiceNetwork":{"id": net_id[2],"type":sub_net_type, "providerNetworks":[]}}
558 json_network_type_data = json.dumps(network_data)
559 resp = requests.post(url=url, auth=auth, data =json_network_type_data)
560 return resp
561
562 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 +0000563 print nova_obj.images.list()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000564 image = nova_obj.images.find(name=image_name)
565 flavor = nova_obj.flavors.find(name=flavor_id)
Thangavelu K S40d22112017-04-14 00:32:10 +0000566
567 nics_list = ""
568 if len(net_name) == 2:
569 network_1 = nova_obj.networks.find(label=net_name[0])
570 network_2 = nova_obj.networks.find(label=net_name[1])
571 print network_1.id
572 print network_2.id
573 nics_list = [{'net-id':network_1.id},{'net-id':network_2.id}]
574 else:
575 network_1 = nova_obj.networks.find(label=net_name)
576 print network_1.id
577 nics_list = [{'net-id':network_1.id}]
Thangavelu K S3698fad2017-03-24 17:50:14 +0000578
579 server = nova_obj.servers.create(name = instance_name,
580 image = image.id,
581 flavor = flavor.id,
Thangavelu K S40d22112017-04-14 00:32:10 +0000582 nics = nics_list,
583 userdata = "#cloud-config \n password: ubuntu \n chpasswd: { expire: False }\n ssh_pwauth: True")
584 # key_name = keypair.name)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000585 server_details = nova_obj.servers.find(id=server.id)
586 print('Server is launched and status is %s' %server_details.status)
587 if server_details.status == 'BUILD':
Thangavelu K S40d22112017-04-14 00:32:10 +0000588 time.sleep(120)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000589 server_details = nova_obj.servers.find(id=server.id)
590 print('After delay server status is %s state'%server_details.status)
591 if server_details.status == 'ERROR':
592 print('Server status is still in %s state'%server_details.status)
Thangavelu K S40d22112017-04-14 00:32:10 +0000593 server_boot_up_log = nova_obj.servers.get_console_output(server.id)
594 print 'Server boot Up console log \n%s'%server_boot_up_log
Thangavelu K S3698fad2017-03-24 17:50:14 +0000595 return server_details
596
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000597 def create_net_subnet_nova_instance(self,net_name, subnet_name, instance_vm_details,management_type):
598 result = self.neutron_network_creation_and_validation(net_name)
599 assert_equal(result, True)
600 neutron_creds = self.get_neutron_credentials()
601 neutron = neutronclient.Client(**neutron_creds)
602 networks = neutron.list_networks(name=net_name)
603 network_id = self.get_key_value(d=networks, key = 'id')
604 sub_result = self.neutron_subnet_creation_and_validation(net_name,subnet_name)# sub_net_start = subnet_name[2], sub_net_end =subnet_name[3])
605 assert_equal(sub_result[0], True)
606 net_type_post = self.sub_network_type_post_to_onos(net_name, management_type)
607 creds = get_nova_credentials()
608 nova = nova_client.Client('2', **creds)
609 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 +0000610 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000611 return [nova, new_instance_details]
612
613 def nova_instance_tenants_access_check(self, target_tenants_details, compute_details = None, source_tenants_details = None , check_type = 'Ping_from_compute'):
614 source_tenant_ip = ''
615 target_tenant_ip = ''
616 cmd = ''
617 status = ''
618 output = ''
619
620 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
621 if compute_details is None:
622 compute_ip = '10.1.0.17'
623 else:
624 compute_ip = compute_details.ip
625
626 ## 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 +0000627 if target_tenants_details == {}:
628 target_tenants_details = '10.1.0.1'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000629
630 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
631 if source_tenants_details is not None:
Thangavelu K S40d22112017-04-14 00:32:10 +0000632 if source_tenants_details == {}:
633 source_tenants_details = '10.1.0.1'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000634
635 if check_type == "Ping_from_compute":
Thangavelu K S40d22112017-04-14 00:32:10 +0000636 cmd2 = "ping -c 3 {0}".format(target_tenants_details)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000637 ssh_agent = SSHTestAgent(host = compute_ip)
Thangavelu K S40d22112017-04-14 00:32:10 +0000638 status, output = ssh_agent.run_cmd(cmd2, timeout = 5)
639 print output
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000640
641 if source_tenants_details is not None:
642 if check_type == "Ping_from_source_tenant":
Thangavelu K S40d22112017-04-14 00:32:10 +0000643 cmd = "ping -c 3 {0}".format(target_tenants_details)
644 ssh_cmd = 'ssh {} {}'.format(source_tenants_details, cmd)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000645 ssh_agent = SSHTestAgent(host = compute_ip)
Thangavelu K S40d22112017-04-14 00:32:10 +0000646 status, output = ssh_agent.run_cmd(ssh_cmd, timeout = 5)
647 print output
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000648
649 if check_type == "Ping_to_external":
650 cmd = "ping -c 3 google.com"
Thangavelu K S40d22112017-04-14 00:32:10 +0000651 ssh_cmd = 'ssh {} {}'.format(target_tenants_details, cmd)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000652 ssh_agent = SSHTestAgent(host = compute_ip)
Thangavelu K S40d22112017-04-14 00:32:10 +0000653 status, output = ssh_agent.run_cmd(ssh_cmd, timeout = 5)
654 print output
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000655
656 if status == True and output:
Thangavelu K S40d22112017-04-14 00:32:10 +0000657 print "Ping is successful"
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000658 output = output.strip()
Thangavelu K S40d22112017-04-14 00:32:10 +0000659 elif status == False:
660 print "Ping is not successful"
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000661 output = None
662 return [status, output]
663
664
Thangavelu K S3698fad2017-03-24 17:50:14 +0000665 def nova_instance_deletion(self, nova_obj, server_details):
666 results_nova_instance_deletion=nova_obj.servers.delete(server_details.id)
667 if results_nova_instance_deletion == None:
Thangavelu K S40d22112017-04-14 00:32:10 +0000668 print"Nova instance is deleted"
Thangavelu K S3698fad2017-03-24 17:50:14 +0000669 else:
Thangavelu K S40d22112017-04-14 00:32:10 +0000670 print"Nova instance is not deleted"
Thangavelu K S3698fad2017-03-24 17:50:14 +0000671 return results_nova_instance_deletion
Thangavelu K Saea3c672017-03-15 18:57:05 +0000672
673 def test_cordvtn_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
674 """
675 Algo:
676 0. Create vtn_test_1_net.
677 1. Do GET Rest API and validate creation of network.
678 2. Validate network on neutron openstack.
679 """
680 result = self.neutron_network_creation_and_validation('vtn_test_1_net')
681 if result is True:
682 self.neutron_network_deletion('vtn_test_1_net')
683 assert_equal(result, True)
684
685 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
686 """
687 Algo:
688 0. Create Test-Net,
689 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
690 2. Run sync command for cordvtn
691 3. Do GET Rest API and validate creation of network
692 4. Validate network synch with created network in cord-onos
693 """
694 creds = self.get_neutron_credentials()
695 neutron = neutronclient.Client(**creds)
696 body_example = {"network":{"name": "vtn_test_2_net","admin_state_up":True}}
697 net = neutron.create_network(body=body_example)
698 vtn_util = vtn_validation_utils('')
699 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
700 auth = ('karaf','karaf')
701
702 resp = requests.get(url=url, auth=auth)
703 data = json.loads(resp.text)
704 result = self.search_value(data, "vtn_test_2_net")
705 self.neutron_network_deletion('vtn_test_2_net')
706 assert_equal(result, True)
707
708 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_head_node_with_neutron_service(self):
709 """
710 Algo:
711 0. Create Test-Net,
712 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
713 2. Run sync command for cordvtn
714 3. Do GET Rest API and validate creation of network
715 4. Validate network synch with created network in cord-onos
716 """
717 result = self.neutron_network_creation_and_validation('vtn_test_3_net')
718 if result is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000719 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000720 assert_equal(result, True)
721 result_again = self.neutron_network_creation_and_validation('vtn_test_3_net')
722 if result_again is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000723 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000724 assert_equal(result, True)
725
726 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_onos(self):
727 """
728 Algo:
729 0. Create Test-Net,
730 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
731 2. Run sync command for cordvtn
732 3. Do GET Rest API and validate creation of network
733 4. Validate network synch with created network in cord-onos
734 """
735 creds = self.get_neutron_credentials()
736 neutron = neutronclient.Client(**creds)
737 body_example = {"network":{"name": "vtn_test_4_net","admin_state_up":True}}
738 net = neutron.create_network(body=body_example)
739 vtn_util = vtn_validation_utils('')
740 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
741 auth = ('karaf','karaf')
742
743 resp = requests.get(url=url, auth=auth)
744 data = json.loads(resp.text)
745 result = self.search_value(data, "vtn_test_4_net")
746 assert_equal(result, True)
747 self.neutron_network_deletion('vtn_test_4_net')
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_4_net")
754 assert_equal(result, False)
755 net = neutron.create_network(body=body_example)
756 vtn_util = vtn_validation_utils('')
757 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
758 auth = ('karaf','karaf')
759
760 resp = requests.get(url=url, auth=auth)
761 data = json.loads(resp.text)
762 result = self.search_value(data, "vtn_test_4_net")
763 self.neutron_network_deletion('vtn_test_4_net')
764 assert_equal(result, True)
765
766 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_head_node_with_neutron_service(self):
767 test_net_name = 'vtn_test_5_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000768 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 +0000769 result = self.neutron_network_creation_and_validation('vtn_test_5_net_management')
770 assert_equal(result, True)
771 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
772 if sub_result[0] is True:
773 self.neutron_network_deletion('vtn_test_5_net_management')
774 assert_equal(sub_result[0], True)
775
776 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_onos(self):
777 self.neutron_network_creation_and_validation('vtn_test_6_net_management')
778 creds = self.get_neutron_credentials()
779 neutron = neutronclient.Client(**creds)
780 networks = neutron.list_networks(name='vtn_test_6_net_management')
781 net_id = self.get_key_value(d=networks, key = 'id')
782 cidr = "172.27.0.0/24"
783 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"}]}}
784 neutron_sub = neutron.create_subnet(body_subnet_example)
785
786 vtn_util = vtn_validation_utils('')
787 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
788 auth = ('karaf','karaf')
789
790 resp = requests.get(url=url, auth=auth)
791 data = json.loads(resp.text)
792 for i in range(len(data['ServiceNetworks'])):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000793 if data['ServiceNetworks'][i]['name'] == 'vtn_test_6_net_management':
Thangavelu K Saea3c672017-03-15 18:57:05 +0000794 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
795 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700796 log_test.info('Sub network is not successful')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000797 self.neutron_network_deletion('vtn_test_6_net_management')
798 assert_equal(False, True)
799 break
800 elif sub_net_id[2] == cidr:
A R Karthick76a497a2017-04-12 10:59:39 -0700801 log_test.info('Sub network is successful')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000802 self.neutron_network_deletion('vtn_test_6_net_management')
803 assert_equal(sub_net_id[0], True)
804 break
805
Thangavelu K S3698fad2017-03-24 17:50:14 +0000806 def test_cordvtn_neutron_management_network_creation_and_post_network_type_management_local_to_onos(self):
807 """
808 Algo:
809 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000810 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000811 2. Run sync command for cordvtn
812 3. Do GET Rest API and validate creation of network
813 4. Pushed the network type as management local to onos
814 5. Verified that onos is having under management network
815 """
816 test_net_name = 'vtn_test_7_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 S3698fad2017-03-24 17:50:14 +0000818 test_management_type = "management_local"
819 result = self.neutron_network_creation_and_validation(test_net_name)
820 assert_equal(result, True)
821 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
822
823 vtn_util = vtn_validation_utils('')
824 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
825 auth = ('karaf','karaf')
826
827 resp = requests.get(url=url, auth=auth)
828 data = json.loads(resp.text)
829 for i in range(len(data['ServiceNetworks'])):
830 if data['ServiceNetworks'][i]['name'] == test_net_name:
831 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
832 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700833 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000834 assert_equal(False, True)
835 break
836 elif sub_net_id[2] == test_sub_net_cidr[1]:
A R Karthick76a497a2017-04-12 10:59:39 -0700837 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000838 assert_equal(sub_net_id[0], True)
839 break
840
841 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
842 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
843 net_type_json = json.loads(net_type_post.text)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000844 self.neutron_network_deletion(test_net_name)
845 assert_equal(net_type_json['message'], 'null already exists')
846
Thangavelu K S40d22112017-04-14 00:32:10 +0000847 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 +0000848 """
849 Algo:
850 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000851 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000852 3. Do GET Rest API and validate creation of network
853 4. Create new nova instance under management network
854 5. Validate new nova instance is created on nova service
855 """
856 test_net_name = 'vtn_test_8_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000857 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 +0000858 test_management_type = "management_local"
859 instance_vm_name = 'vtn_test_8_nova_instance_management_net'
860 image_name = "vsg-1.1"
861 flavor_id = 'm1.small'
862 result = self.neutron_network_creation_and_validation(test_net_name)
863 assert_equal(result, True)
864 neutron_creds = self.get_neutron_credentials()
865 neutron = neutronclient.Client(**neutron_creds)
866 networks = neutron.list_networks(name=test_net_name)
867 network_id = self.get_key_value(d=networks, key = 'id')
868 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
869 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000870 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000871 nova = nova_client.Client('2', **creds)
872 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
873 self.neutron_network_deletion(test_net_name)
874 self.nova_instance_deletion(nova, new_instance_details)
875 assert_equal(new_instance_details.status, 'ACTIVE')
876
Thangavelu K S40d22112017-04-14 00:32:10 +0000877 def test_cordvtn_with_public_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000878 """
879 Algo:
880 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000881 1. Create subnetwork who ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000882 2. Run sync command for cordvtn
883 3. Do GET Rest API and validate creation of network
884 4. Validate network synch with created network in cord-onos
885 """
886 test_net_name = 'vtn_test_9_net_public'
887 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
888 result = self.neutron_network_creation_and_validation(test_net_name)
889 assert_equal(result, True)
890 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
891 if sub_result[0] is True:
892 self.neutron_network_deletion(test_net_name)
893 assert_equal(sub_result[0], True)
894
Thangavelu K S40d22112017-04-14 00:32:10 +0000895 def test_cordvtn_with_public_network_creation_and_validation_on_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000896 """
897 Algo:
898 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000899 1. Create subnetwork whoes ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000900 2. Run sync command for cordvtn
901 3. Do GET Rest API and validate creation of network
902 """
903 test_net_name = 'vtn_test_10_net_public'
904 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
905 result = self.neutron_network_creation_and_validation(test_net_name)
906 assert_equal(result, True)
907 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
908
909 vtn_util = vtn_validation_utils('')
910 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
911 auth = ('karaf','karaf')
912
913 resp = requests.get(url=url, auth=auth)
914 data = json.loads(resp.text)
915 for i in range(len(data['ServiceNetworks'])):
916 if data['ServiceNetworks'][i]['name'] == test_net_name:
917 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
918 if sub_net_id[2] == " ":
919 print('Sub network is not successful')
920 self.neutron_network_deletion(test_net_name)
921 assert_equal(False, True)
922 break
923 elif sub_net_id[2] == test_sub_net_cidr[1]:
924 print('Sub network is successful')
925 self.neutron_network_deletion(test_net_name)
926 assert_equal(sub_net_id[0], True)
927 break
928
Thangavelu K S40d22112017-04-14 00:32:10 +0000929 def test_cordvtn_with_public_network_creation_and_post_network_type_as_public_to_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000930 """
931 Algo:
932 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000933 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000934 2. Run sync command for cordvtn
935 3. Do GET Rest API and validate creation of network
936 4. Pushed the network type as management local to onos
937 5. Verified that onos is having under management network
938 """
939 test_net_name = 'vtn_test_11_net_public'
940 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
941 test_management_type = "public"
942 result = self.neutron_network_creation_and_validation(test_net_name)
943 assert_equal(result, True)
944 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
945
946 vtn_util = vtn_validation_utils('')
947 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
948 auth = ('karaf','karaf')
949
950 resp = requests.get(url=url, auth=auth)
951 data = json.loads(resp.text)
952 for i in range(len(data['ServiceNetworks'])):
953 if data['ServiceNetworks'][i]['name'] == test_net_name:
954 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
955 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700956 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000957 assert_equal(False, True)
958 break
959 elif sub_net_id[2] == test_sub_net_cidr[1]:
A R Karthick76a497a2017-04-12 10:59:39 -0700960 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000961 assert_equal(sub_net_id[0], True)
962 break
963
964 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
965 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
966 net_type_json = json.loads(net_type_post.text)
967
968 self.neutron_network_deletion(test_net_name)
969 assert_equal(net_type_json['message'], 'null already exists')
970
971 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 +0000972 """
973 Algo:
974 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +0000975 1. Create subnetwork whose ip is under public network
Thangavelu K S3698fad2017-03-24 17:50:14 +0000976 3. Do GET Rest API and validate creation of network
977 4. Create new nova instance under public network
978 5. Validate new nova instance is created on nova service
979 """
980 test_net_name = 'vtn_test_12_net_public'
981 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
982 instance_vm_name = 'vtn_test_12_nova_instance_public_net'
983 image_name = "vsg-1.1"
984 flavor_id = 'm1.small'
985 result = self.neutron_network_creation_and_validation(test_net_name)
986 assert_equal(result, True)
987 neutron_creds = self.get_neutron_credentials()
988 neutron = neutronclient.Client(**neutron_creds)
989 networks = neutron.list_networks(name=test_net_name)
990 network_id = self.get_key_value(d=networks, key = 'id')
991 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
992 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000993 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000994 nova = nova_client.Client('2', **creds)
995 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
996 self.neutron_network_deletion(test_net_name)
997 self.nova_instance_deletion(nova, new_instance_details)
998 assert_equal(new_instance_details.status, 'ACTIVE')
999
Thangavelu K S40d22112017-04-14 00:32:10 +00001000 def test_cordvtn_with_private_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001001 """
1002 Algo:
1003 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001004 1. Create subnetwork who ip is under private network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001005 2. Run sync command for cordvtn
1006 3. Do GET Rest API and validate creation of network
1007 4. Validate network synch with created network in cord-onos
1008 """
1009 test_net_name = 'vtn_test_13_net_private'
1010 test_sub_net_cidr = ["private","10.160.160.160/24",'10.160.160.1']
1011 result = self.neutron_network_creation_and_validation(test_net_name)
1012 assert_equal(result, True)
1013 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1014 if sub_result[0] is True:
1015 self.neutron_network_deletion(test_net_name)
1016 assert_equal(sub_result[0], True)
1017
Thangavelu K S40d22112017-04-14 00:32:10 +00001018 def test_cordvtn_with_private_network_creation_and_validation_on_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001019 """
1020 Algo:
1021 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001022 1. Create subnetwork whoes ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001023 2. Run sync command for cordvtn
1024 3. Do GET Rest API and validate creation of network
1025 """
1026 test_net_name = 'vtn_test_14_net_private'
1027 test_sub_net_cidr = ["private","10.160.160.160/24", '10.160.160.1']
1028 result = self.neutron_network_creation_and_validation(test_net_name)
1029 assert_equal(result, True)
1030 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1031
1032 vtn_util = vtn_validation_utils('')
1033 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1034 auth = ('karaf','karaf')
1035
1036 resp = requests.get(url=url, auth=auth)
1037 data = json.loads(resp.text)
1038 for i in range(len(data['ServiceNetworks'])):
1039 if data['ServiceNetworks'][i]['name'] == test_net_name:
1040 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1041 if sub_net_id[2] == " ":
1042 print('Sub network is not successful')
1043 self.neutron_network_deletion(test_net_name)
1044 assert_equal(False, True)
1045 break
1046 elif sub_net_id[2] == '10.160.160.0/24':
1047 #elif sub_net_id[2] == test_sub_net_cidr[1]:
1048 print('Sub network is successful')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001049 self.neutron_network_deletion(test_net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +00001050 assert_equal(sub_net_id[0], True)
1051 break
1052
Thangavelu K S40d22112017-04-14 00:32:10 +00001053 def test_cordvtn_with_private_network_creation_and_post_network_type_as_private_to_onos(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001054 """
1055 Algo:
1056 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001057 1. Create subnetwork whose ip is under management network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001058 2. Run sync command for cordvtn
1059 3. Do GET Rest API and validate creation of network
1060 4. Pushed the network type as management local to onos
1061 5. Verified that onos is having under management network
1062 """
1063 test_net_name = 'vtn_test_15_net_private'
1064 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
1065 test_management_type = "private"
1066 result = self.neutron_network_creation_and_validation(test_net_name)
1067 assert_equal(result, True)
1068 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1069
1070 vtn_util = vtn_validation_utils('')
1071 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1072 auth = ('karaf','karaf')
1073
1074 resp = requests.get(url=url, auth=auth)
1075 data = json.loads(resp.text)
1076 for i in range(len(data['ServiceNetworks'])):
1077 if data['ServiceNetworks'][i]['name'] == test_net_name:
1078 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1079 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -07001080 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001081 assert_equal(False, True)
1082 break
1083 elif sub_net_id[2] == "192.168.160.0/24":
A R Karthick76a497a2017-04-12 10:59:39 -07001084 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001085 assert_equal(sub_net_id[0], True)
1086 break
1087
1088 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1089 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
1090 net_type_json = json.loads(net_type_post.text)
1091
1092 self.neutron_network_deletion(test_net_name)
1093 assert_equal(net_type_json['message'], 'null already exists')
1094
Thangavelu K S40d22112017-04-14 00:32:10 +00001095 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 +00001096 """
1097 Algo:
1098 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001099 1. Create subnetwork whose ip is under private network
Thangavelu K S3698fad2017-03-24 17:50:14 +00001100 3. Do GET Rest API and validate creation of network
1101 4. Create new nova instance under private network
1102 5. Validate new nova instance is created on nova service
1103 """
1104 test_net_name = 'vtn_test_16_net_private'
1105 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001106 instance_vm_name = 'vtn_test_16_nova_instance_private_net'
Thangavelu K S3698fad2017-03-24 17:50:14 +00001107 image_name = "vsg-1.1"
1108 flavor_id = 'm1.small'
1109 result = self.neutron_network_creation_and_validation(test_net_name)
1110 assert_equal(result, True)
1111 neutron_creds = self.get_neutron_credentials()
1112 neutron = neutronclient.Client(**neutron_creds)
1113 networks = neutron.list_networks(name=test_net_name)
1114 network_id = self.get_key_value(d=networks, key = 'id')
1115 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1116 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001117 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +00001118 nova = nova_client.Client('2', **creds)
1119 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1120 self.neutron_network_deletion(test_net_name)
1121 self.nova_instance_deletion(nova, new_instance_details)
1122 assert_equal(new_instance_details.status, 'ACTIVE')
1123
Thangavelu K S40d22112017-04-14 00:32:10 +00001124 def test_cordvtn_management_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001125 """
1126 Algo:
1127 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001128 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001129 3. Do GET Rest API and validate creation of network
1130 4. Create new nova instance under management network
1131 5. Validate new nova instance is created on nova service
1132 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1133 """
1134 test_net_name = 'vtn_test_17_net_management'
1135 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1136 test_management_type = "management_local"
1137 instance_vm_name = 'vtn_test_17_nova_instance_management_net'
Thangavelu K S40d22112017-04-14 00:32:10 +00001138 #image_name = "vsg-1.1"
1139 image_name = "trusty-server-multi-nic"
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001140 flavor_id = 'm1.small'
1141 result = self.neutron_network_creation_and_validation(test_net_name)
1142 assert_equal(result, True)
1143 neutron_creds = self.get_neutron_credentials()
1144 neutron = neutronclient.Client(**neutron_creds)
1145 networks = neutron.list_networks(name=test_net_name)
1146 network_id = self.get_key_value(d=networks, key = 'id')
1147 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1148 assert_equal(sub_result[0], True)
1149 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1150 creds = get_nova_credentials()
1151 nova = nova_client.Client('2', **creds)
1152 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 +00001153 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001154 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001155 print new_instance_details.addresses
1156 time.sleep(60)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001157 status, output = self.nova_instance_tenants_access_check(new_instance_details)
Thangavelu K S40d22112017-04-14 00:32:10 +00001158 self.nova_instance_deletion(nova, new_instance_details)
1159 time.sleep(5)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001160 self.neutron_network_deletion(test_net_name)
1161 self.nova_instance_deletion(nova, new_instance_details)
1162 assert_equal(status, True)
1163
Thangavelu K S40d22112017-04-14 00:32:10 +00001164 def test_cordvtn_for_management_network_instance_and_validate_connectivity_to_external_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001165 """
1166 Algo:
1167 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001168 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001169 3. Do GET Rest API and validate creation of network
1170 4. Create new nova instance under management network
1171 5. Validate new nova instance is created on nova service
1172 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1173 """
1174 test_net_name = 'vtn_test_18_net_management'
1175 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1176 test_management_type = "management_local"
1177 instance_vm_name = 'vtn_test_18_nova_instance_management_net'
1178 image_name = "vsg-1.1"
1179 flavor_id = 'm1.small'
1180 result = self.neutron_network_creation_and_validation(test_net_name)
1181 assert_equal(result, True)
1182 neutron_creds = self.get_neutron_credentials()
1183 neutron = neutronclient.Client(**neutron_creds)
1184 networks = neutron.list_networks(name=test_net_name)
1185 network_id = self.get_key_value(d=networks, key = 'id')
1186 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1187 assert_equal(sub_result[0], True)
1188 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1189 creds = get_nova_credentials()
1190 nova = nova_client.Client('2', **creds)
1191 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 +00001192 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001193 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001194 print new_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001195 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1196 self.neutron_network_deletion(test_net_name)
1197 self.nova_instance_deletion(nova, new_instance_details)
1198 assert_equal(status, False)
1199
Thangavelu K S40d22112017-04-14 00:32:10 +00001200 def test_cordvtn_with_management_network_creating_two_instances_and_validate_connectivity_between_two(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001201 """
1202 Algo:
1203 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001204 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001205 3. Do GET Rest API and validate creation of network
1206 4. Create first nova instance under management network
1207 5. Validate first nova instance is created on nova service
1208 6. Create second nova instance under management network
1209 7. Validate second nova instance is created on nova service
1210 8. Now try to ping from one nova instance to other instance, should not success
1211 """
1212 test_net_name = 'vtn_test_19_net_management'
1213 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.2", "172.27.0.200"]
1214 test_management_type = "management_local"
1215 first_instance_vm_name = 'vtn_test_19_nova_1st_instance_management_net'
1216 second_instance_vm_name = 'vtn_test_19_nova_2nd_instance_management_net'
1217 image_name = "vsg-1.1"
1218 flavor_id = 'm1.small'
1219 result = self.neutron_network_creation_and_validation(test_net_name)
1220 assert_equal(result, True)
1221 neutron_creds = self.get_neutron_credentials()
1222 neutron = neutronclient.Client(**neutron_creds)
1223 networks = neutron.list_networks(name=test_net_name)
1224 network_id = self.get_key_value(d=networks, key = 'id')
1225 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1226 assert_equal(sub_result[0], True)
1227 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1228 creds = get_nova_credentials()
1229 nova = nova_client.Client('2', **creds)
1230 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1231 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 +00001232 assert_equal(first_instance_details.status, 'ACTIVE')
1233 assert_equal(second_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001234 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001235 print 'New nova instance ip addresses are '
1236 print first_nova_instance_details.addresses
1237 print second_nova_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001238 status, output = self.nova_instance_tenants_access_check(first_nova_instance_details,source_tenants_details = second_nova_instance_details, check_type = "Ping_from_source_tenant")
1239 self.neutron_network_deletion(test_net_name)
1240 self.nova_instance_deletion(nova, first_nova_instance_details)
1241 self.nova_instance_deletion(nova, second_nova_instance_details)
1242 assert_equal(status, False)
1243
Thangavelu K S40d22112017-04-14 00:32:10 +00001244 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 +00001245 """
1246 Algo:
1247 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001248 1. Create subnetwork whose ip is under management network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001249 3. Do GET Rest API and validate creation of network
1250 4. Create new nova instance under management network
1251 5. Validate new nova instance is created on nova service
1252 """
1253 test_netA_name = 'vtn_test_20_netA_management'
1254 test_sub_netA_cidr = ["management","172.27.0.0/24","172.27.0.2", "172.27.0.200"]
1255 netA_instance_vm_name = 'vtn_test_20_nova_netA_instance_management_net'
1256 test_netB_name = 'vtn_test_20_netB_management'
1257 test_sub_netB_cidr = ["management","172.28.0.0/24","172.28.0.2", "172.28.0.200"]
1258 netB_instance_vm_name = 'vtn_test_20_nova_netB_instance_management_net'
1259 test_management_type = "management_local"
1260 image_name = "vsg-1.1"
1261 flavor_id = 'm1.small'
1262 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1263 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1264
1265 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)
1266 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)
1267
Thangavelu K S40d22112017-04-14 00:32:10 +00001268 assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1269 assert_equal(nova_instance_details_netB.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001270 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001271 print 'New nova instance ip addresses are '
1272 print nova_instance_details_netA.addresses
1273 print nova_instance_details_netB.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001274 status, output = self.nova_instance_tenants_access_check(nova_instance_details_netA, source_tenants_details = nova_instance_details_netB,check_type = "Ping_from_source_tenant")
1275 self.neutron_network_deletion(test_netA_name)
1276 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1277 self.neutron_network_deletion(test_netB_name)
1278 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1279 assert_equal(status, False)
1280
Thangavelu K S40d22112017-04-14 00:32:10 +00001281 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 +00001282 """
1283 Algo:
1284 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001285 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001286 3. Do GET Rest API and validate creation of network
1287 4. Create new nova instance under public network
1288 5. Validate new nova instance is created on nova service
1289 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1290 """
1291 test_net_name = 'vtn_test_21_net_public'
1292 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1293 test_management_type = "public"
1294 instance_vm_name = 'vtn_test_21_nova_instance_pulic_net'
1295 image_name = "vsg-1.1"
1296 flavor_id = 'm1.small'
1297 result = self.neutron_network_creation_and_validation(test_net_name)
1298 assert_equal(result, True)
1299 neutron_creds = self.get_neutron_credentials()
1300 neutron = neutronclient.Client(**neutron_creds)
1301 networks = neutron.list_networks(name=test_net_name)
1302 network_id = self.get_key_value(d=networks, key = 'id')
1303 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1304 assert_equal(sub_result[0], True)
1305 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1306 creds = get_nova_credentials()
1307 nova = nova_client.Client('2', **creds)
1308 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 +00001309 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001310 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001311 print new_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001312 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1313 self.neutron_network_deletion(test_net_name)
1314 self.nova_instance_deletion(nova, new_instance_details)
1315 assert_equal(status, False)
1316
Thangavelu K S40d22112017-04-14 00:32:10 +00001317 def test_cordvtn_creating_public_network_instance_and_validate_connectivity_to_external_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001318 """
1319 Algo:
1320 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001321 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001322 3. Do GET Rest API and validate creation of network
1323 4. Create new nova instance under public network
1324 5. Validate new nova instance is created on nova service
1325 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1326 """
1327 test_net_name = 'vtn_test_22_net_public'
1328 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1329 test_management_type = "public"
1330 instance_vm_name = 'vtn_test_22_nova_instance_public_net'
1331 image_name = "vsg-1.1"
1332 flavor_id = 'm1.small'
1333 result = self.neutron_network_creation_and_validation(test_net_name)
1334 assert_equal(result, True)
1335 neutron_creds = self.get_neutron_credentials()
1336 neutron = neutronclient.Client(**neutron_creds)
1337 networks = neutron.list_networks(name=test_net_name)
1338 network_id = self.get_key_value(d=networks, key = 'id')
1339 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1340 assert_equal(sub_result[0], True)
1341 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1342 creds = get_nova_credentials()
1343 nova = nova_client.Client('2', **creds)
1344 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 +00001345 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001346 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001347 print new_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001348 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1349 self.neutron_network_deletion(test_net_name)
1350 self.nova_instance_deletion(nova, new_instance_details)
1351 assert_equal(status, True)
1352
Thangavelu K S40d22112017-04-14 00:32:10 +00001353 def test_cordvtn_creating_public_network_with_two_instances_and_validate_connectivity_between_two(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001354 """
1355 Algo:
1356 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001357 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001358 3. Do GET Rest API and validate creation of network
1359 4. Create first nova instance under public network
1360 5. Validate first nova instance is created on nova service
1361 6. Create second nova instance under public network
1362 7. Validate second nova instance is created on nova service
1363 8. Now try to ping from one nova instance to other instance, should not success
1364 """
1365 test_net_name = 'vtn_test_23_net_public'
1366 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1367 test_management_type = "public"
1368 first_instance_vm_name = 'vtn_test_23_nova_1st_instance_public_net'
1369 second_instance_vm_name = 'vtn_test_23_nova_2nd_instance_public_net'
1370 image_name = "vsg-1.1"
1371 flavor_id = 'm1.small'
1372 result = self.neutron_network_creation_and_validation(test_net_name)
1373 assert_equal(result, True)
1374 neutron_creds = self.get_neutron_credentials()
1375 neutron = neutronclient.Client(**neutron_creds)
1376 networks = neutron.list_networks(name=test_net_name)
1377 network_id = self.get_key_value(d=networks, key = 'id')
1378 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1379 assert_equal(sub_result[0], True)
1380 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1381 creds = get_nova_credentials()
1382 nova = nova_client.Client('2', **creds)
1383 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1384 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 +00001385 assert_equal(first_instance_details.status, 'ACTIVE')
1386 assert_equal(second_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001387 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001388 print 'New nova instance ip addresses are '
1389 print first_nova_instance_details.addresses
1390 print second_nova_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001391 status, output = self.nova_instance_tenants_access_check(first_nova_instance_details,source_tenants_details = second_nova_instance_details, check_type = "Ping_from_source_tenant")
1392 self.neutron_network_deletion(test_net_name)
1393 self.nova_instance_deletion(nova, first_nova_instance_details)
1394 self.nova_instance_deletion(nova, second_nova_instance_details)
1395 assert_equal(status, False)
1396
Thangavelu K S40d22112017-04-14 00:32:10 +00001397 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 +00001398 """
1399 Algo:
1400 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001401 1. Create subnetwork whose ip is under public network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001402 3. Do GET Rest API and validate creation of network
1403 4. Create new nova instance under public network
1404 5. Validate new nova instance is created on nova service
1405 """
1406 test_netA_name = 'vtn_test_24_netA_public'
1407 test_sub_netA_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1408 netA_instance_vm_name = 'vtn_test_24_nova_netA_instance_public_net'
1409 test_netB_name = 'vtn_test_24_netB_public'
1410 test_sub_netB_cidr = ["public","10.6.2.192/26",'10.6.2.193']
1411 netB_instance_vm_name = 'vtn_test_24_nova_netB_instance_public_net'
1412 test_management_type = "public"
1413 image_name = "vsg-1.1"
1414 flavor_id = 'm1.small'
1415 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1416 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1417
1418 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)
1419 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)
1420
Thangavelu K S40d22112017-04-14 00:32:10 +00001421 assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1422 assert_equal(nova_instance_details_netB.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001423 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001424 print 'New nova instance ip addresses are '
1425 print nova_instance_details_netA.addresses
1426 print nova_instance_details_netB.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001427 status, output = self.nova_instance_tenants_access_check(nova_instance_details_netA, source_tenants_details = nova_instance_details_netB,check_type = "Ping_from_source_tenant")
1428 self.neutron_network_deletion(test_netA_name)
1429 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1430 self.neutron_network_deletion(test_netB_name)
1431 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1432 assert_equal(status, False)
1433
Thangavelu K S40d22112017-04-14 00:32:10 +00001434 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 +00001435 """
1436 Algo:
1437 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001438 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001439 3. Do GET Rest API and validate creation of network
1440 4. Create new nova instance under private network
1441 5. Validate new nova instance is created on nova service
1442 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1443 """
1444 test_net_name = 'vtn_test_25_net_private'
1445 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1446 test_management_type = "private"
1447 instance_vm_name = 'vtn_test_25_nova_instance_private_net'
1448 image_name = "vsg-1.1"
1449 flavor_id = 'm1.small'
1450 result = self.neutron_network_creation_and_validation(test_net_name)
1451 assert_equal(result, True)
1452 neutron_creds = self.get_neutron_credentials()
1453 neutron = neutronclient.Client(**neutron_creds)
1454 networks = neutron.list_networks(name=test_net_name)
1455 network_id = self.get_key_value(d=networks, key = 'id')
1456 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1457 assert_equal(sub_result[0], True)
1458 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1459 creds = get_nova_credentials()
1460 nova = nova_client.Client('2', **creds)
1461 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 +00001462 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001463 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001464 print new_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001465 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1466 self.neutron_network_deletion(test_net_name)
1467 self.nova_instance_deletion(nova, new_instance_details)
1468 assert_equal(status, False)
1469
Thangavelu K S40d22112017-04-14 00:32:10 +00001470 def test_cordvtn_creating_private_network_instance_and_validate_connectivity_to_external_network(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001471 """
1472 Algo:
1473 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001474 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001475 3. Do GET Rest API and validate creation of network
1476 4. Create new nova instance under private network
1477 5. Validate new nova instance is created on nova service
1478 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1479 """
1480 test_net_name = 'vtn_test_26_net_private'
1481 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1482 test_management_type = "private"
1483 instance_vm_name = 'vtn_test_26_nova_instance_private_net'
1484 image_name = "vsg-1.1"
1485 flavor_id = 'm1.small'
1486 result = self.neutron_network_creation_and_validation(test_net_name)
1487 assert_equal(result, True)
1488 neutron_creds = self.get_neutron_credentials()
1489 neutron = neutronclient.Client(**neutron_creds)
1490 networks = neutron.list_networks(name=test_net_name)
1491 network_id = self.get_key_value(d=networks, key = 'id')
1492 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1493 assert_equal(sub_result[0], True)
1494 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1495 creds = get_nova_credentials()
1496 nova = nova_client.Client('2', **creds)
1497 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 +00001498 assert_equal(new_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001499 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001500 print new_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001501 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1502 self.neutron_network_deletion(test_net_name)
1503 self.nova_instance_deletion(nova, new_instance_details)
1504 assert_equal(status, False)
1505
Thangavelu K S40d22112017-04-14 00:32:10 +00001506 def test_cordvtn_creating_private_network_with_two_instances_and_check_connectvity_between_two_instances(self):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001507 """
1508 Algo:
1509 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001510 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001511 3. Do GET Rest API and validate creation of network
1512 4. Create first nova instance under private network
1513 5. Validate first nova instance is created on nova service
1514 6. Create second nova instance under public network
1515 7. Validate second nova instance is created on nova service
1516 8. Now try to ping from one nova instance to other instance, should not success
1517 """
1518 test_net_name = 'vtn_test_27_net_private'
1519 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1520 test_management_type = "private"
1521 first_instance_vm_name = 'vtn_test_27_nova_1st_instance_private_net'
1522 second_instance_vm_name = 'vtn_test_27_nova_2nd_instance_private_net'
1523 image_name = "vsg-1.1"
1524 flavor_id = 'm1.small'
1525 result = self.neutron_network_creation_and_validation(test_net_name)
1526 assert_equal(result, True)
1527 neutron_creds = self.get_neutron_credentials()
1528 neutron = neutronclient.Client(**neutron_creds)
1529 networks = neutron.list_networks(name=test_net_name)
1530 network_id = self.get_key_value(d=networks, key = 'id')
1531 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1532 assert_equal(sub_result[0], True)
1533 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1534 creds = get_nova_credentials()
1535 nova = nova_client.Client('2', **creds)
1536 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1537 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 +00001538 assert_equal(first_instance_details.status, 'ACTIVE')
1539 assert_equal(second_instance_details.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001540 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001541 print 'New nova instance ip addresses are '
1542 print first_nova_instance_details.addresses
1543 print second_nova_instance_details.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001544 status, output = self.nova_instance_tenants_access_check(first_nova_instance_details,source_tenants_details = second_nova_instance_details, check_type = "Ping_from_source_tenant")
1545 self.neutron_network_deletion(test_net_name)
1546 self.nova_instance_deletion(nova, first_nova_instance_details)
1547 self.nova_instance_deletion(nova, second_nova_instance_details)
1548 assert_equal(status, True)
1549
Thangavelu K S40d22112017-04-14 00:32:10 +00001550 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 +00001551 """
1552 Algo:
1553 0. Create Test-Net,
Thangavelu K S40d22112017-04-14 00:32:10 +00001554 1. Create subnetwork whose ip is under private network
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001555 3. Do GET Rest API and validate creation of network
1556 4. Create new nova instance under private network
1557 5. Validate new nova instance is created on nova service
1558 """
1559 test_netA_name = 'vtn_test_28_netA_private'
1560 test_sub_netA_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1561 netA_instance_vm_name = 'vtn_test_28_nova_netA_instance_private_net'
1562 test_netB_name = 'vtn_test_28_netB_private'
1563 test_sub_netB_cidr = ["private","10.160.161.192/26",'10.160.161.193']
1564 netB_instance_vm_name = 'vtn_test_28_nova_netB_instance_private_net'
1565 test_management_type = "private"
1566 image_name = "vsg-1.1"
1567 flavor_id = 'm1.small'
1568 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1569 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1570
1571 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)
1572 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)
1573
Thangavelu K S40d22112017-04-14 00:32:10 +00001574 assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1575 assert_equal(nova_instance_details_netB.status, 'ACTIVE')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001576 compute_details = self.get_compute_nodes()
Thangavelu K S40d22112017-04-14 00:32:10 +00001577 print 'New nova instance ip addresses are '
1578 print nova_instance_details_netA.addresses
1579 print nova_instance_details_netB.addresses
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001580 status, output = self.nova_instance_tenants_access_check(nova_instance_details_netA, source_tenants_details = nova_instance_details_netB,check_type = "Ping_from_source_tenant")
1581 self.neutron_network_deletion(test_netA_name)
1582 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1583 self.neutron_network_deletion(test_netB_name)
1584 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1585 assert_equal(status, False)
1586
Thangavelu K S40d22112017-04-14 00:32:10 +00001587 def test_cordvtn_creating_management_and_public_network_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
1588 """
1589 Algo:
1590 0. Create Test-Net,
1591 1. Create subnetwork whose ip is under management network
1592 3. Do GET Rest API and validate creation of network
1593 4. Create new nova instance under management network
1594 5. Validate new nova instance is created on nova service
1595 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1596 """
1597 test_second_network_name = ['vtn_test_29_net_management','vtn_test_29_net_public']
1598 test_sub_second_network_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']]
1599 test_management_type = ["management_local", 'public']
1600 instance_vm_name = 'vtn_test_29_nova_instance_management_net'
1601# image_name = "vsg-1.1"
1602 image_name = "trusty-server-multi-nic"
1603 flavor_id = 'm1.small'
1604 for test_net_name in test_second_network_name:
1605 result = self.neutron_network_creation_and_validation(test_net_name)
1606 assert_equal(result, True)
1607 neutron_creds = self.get_neutron_credentials()
1608 neutron = neutronclient.Client(**neutron_creds)
1609 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
1610 for i in range(0,2):
1611 networks = neutron.list_networks(name=test_second_network_name[i])
1612 network_id = self.get_key_value(d=networks, key = 'id')
1613 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
1614 assert_equal(sub_result[0], True)
1615 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
1616 creds = get_nova_credentials()
1617 nova = nova_client.Client('2', **creds)
1618 print nova.security_groups.list()
1619 new_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,instance_vm_name,image_name,flavor_id)
1620 time.sleep(60)
1621 assert_equal(new_instance_details.status, 'ACTIVE')
1622 compute_details = self.get_compute_nodes()
1623 print new_instance_details.addresses
1624 address = new_instance_details.addresses
1625 print 'Nova instance management ip = %s and public ip %s'%(address[test_second_network_name[0]][0]['addr'],address[test_2networks_name[1]][0]['addr'])
1626 print address[test_second_network_name[0]][0]['addr']
1627 print nova.security_groups.list()
1628 print address[test_second_network_name[1]][0]['addr']
1629 print nova.security_groups.list()
1630 secgroup = nova.security_groups.find(name="default")
1631# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1632 #from_port="22",
1633 #to_port="22",
1634 # cidr="0.0.0.0/0",)
1635
1636 # nova.security_group_rules.create(secgroup.id,
1637 # ip_protocol="icmp",
1638 # from_port=-1,
1639 # cidr="0.0.0.0/0",
1640 # to_port=-1)
1641 print nova.security_groups.list()
1642
1643 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1644 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1645 self.nova_instance_deletion(nova, new_instance_details)
1646 time.sleep(3)
1647 self.neutron_network_deletion(test_second_network_name[0])
1648 self.neutron_network_deletion(test_second_network_name[1])
1649 assert_equal(status_1, True)
1650 assert_equal(status_2, True)
1651
1652 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):
1653 """
1654 Algo:
1655 0. Create Test-Net,
1656 1. Create subnetwork whose ip is under management network
1657 3. Do GET Rest API and validate creation of network
1658 4. Create new nova instance under management network
1659 5. Validate new nova instance is created on nova service
1660 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1661 7. Now pause the nova instance and check connectivity
1662 8. Now unpause the nova instance and check connectivity
1663 """
1664 test_second_network_name = ['vtn_test_30_net_management','vtn_test_30_net_public']
1665 test_sub_second_network_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']]
1666 test_management_type = ["management_local", 'public']
1667 instance_vm_name = 'vtn_test_30_nova_instance_management_net'
1668# image_name = "vsg-1.1"
1669 image_name = "trusty-server-multi-nic"
1670 flavor_id = 'm1.small'
1671 for test_net_name in test_second_network_name:
1672 result = self.neutron_network_creation_and_validation(test_net_name)
1673 assert_equal(result, True)
1674 neutron_creds = self.get_neutron_credentials()
1675 neutron = neutronclient.Client(**neutron_creds)
1676 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
1677 for i in range(0,2):
1678 networks = neutron.list_networks(name=test_second_network_name[i])
1679 network_id = self.get_key_value(d=networks, key = 'id')
1680 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
1681 assert_equal(sub_result[0], True)
1682 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
1683 creds = get_nova_credentials()
1684 nova = nova_client.Client('2', **creds)
1685 print nova.security_groups.list()
1686 new_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,instance_vm_name,image_name,flavor_id)
1687 time.sleep(60)
1688 assert_equal(new_instance_details.status, 'ACTIVE')
1689 compute_details = self.get_compute_nodes()
1690 print new_instance_details.addresses
1691 address = new_instance_details.addresses
1692 print 'Nova instance management ip = %s and public ip %s'%(address[test_second_network_name[0]][0]['addr'],address[test_2networks_name[1]][0]['addr'])
1693 print address[test_second_network_name[0]][0]['addr']
1694 print nova.security_groups.list()
1695 print address[test_second_network_name[1]][0]['addr']
1696 print nova.security_groups.list()
1697 secgroup = nova.security_groups.find(name="default")
1698# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1699 #from_port="22",
1700 #to_port="22",
1701 # cidr="0.0.0.0/0",)
1702
1703 # nova.security_group_rules.create(secgroup.id,
1704 # ip_protocol="icmp",
1705 # from_port=-1,
1706 # cidr="0.0.0.0/0",
1707 # to_port=-1)
1708 print nova.security_groups.list()
1709
1710 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1711 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1712 if status_1 is False or status_2 is False:
1713 self.nova_instance_deletion(nova, new_instance_details)
1714 time.sleep(3)
1715 self.neutron_network_deletion(test_second_network_name[0])
1716 self.neutron_network_deletion(test_second_network_name[1])
1717 assert_equal(status_1, True)
1718 assert_equal(status_2, True)
1719 new_instance_details.pause()
1720 time.sleep(60)
1721 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1722 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1723 if status_1 is True or status_2 is True:
1724 self.nova_instance_deletion(nova, new_instance_details)
1725 time.sleep(3)
1726 self.neutron_network_deletion(test_second_network_name[0])
1727 self.neutron_network_deletion(test_second_network_name[1])
1728 assert_equal(status_1, False)
1729 assert_equal(status_2, False)
1730 new_instance_details.unpause()
1731 print 'Nova instance is paused and unpasued now checking connectivity'
1732 time.sleep(60)
1733 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1734 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1735 self.nova_instance_deletion(nova, new_instance_details)
1736 time.sleep(3)
1737 self.neutron_network_deletion(test_second_network_name[0])
1738 self.neutron_network_deletion(test_second_network_name[1])
1739 assert_equal(status_1, True)
1740 assert_equal(status_2, True)
1741
1742 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):
1743 """
1744 Algo:
1745 0. Create Test-Net,
1746 1. Create subnetwork whose ip is under management network
1747 3. Do GET Rest API and validate creation of network
1748 4. Create new nova instance under management network
1749 5. Validate new nova instance is created on nova service
1750 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1751 7. Now suspend the nova instance and check connectivity
1752 8. Now resume the nova instance and check connectivity
1753 """
1754 test_second_network_name = ['vtn_test_31_net_management','vtn_test_31_net_public']
1755 test_sub_second_network_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']]
1756 test_management_type = ["management_local", 'public']
1757 instance_vm_name = 'vtn_test_31_nova_instance_management_net'
1758# image_name = "vsg-1.1"
1759 image_name = "trusty-server-multi-nic"
1760 flavor_id = 'm1.small'
1761 for test_net_name in test_second_network_name:
1762 result = self.neutron_network_creation_and_validation(test_net_name)
1763 assert_equal(result, True)
1764 neutron_creds = self.get_neutron_credentials()
1765 neutron = neutronclient.Client(**neutron_creds)
1766 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
1767 for i in range(0,2):
1768 networks = neutron.list_networks(name=test_second_network_name[i])
1769 network_id = self.get_key_value(d=networks, key = 'id')
1770 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
1771 assert_equal(sub_result[0], True)
1772 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
1773 creds = get_nova_credentials()
1774 nova = nova_client.Client('2', **creds)
1775 print nova.security_groups.list()
1776 new_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,instance_vm_name,image_name,flavor_id)
1777 time.sleep(60)
1778 assert_equal(new_instance_details.status, 'ACTIVE')
1779 compute_details = self.get_compute_nodes()
1780 print new_instance_details.addresses
1781 address = new_instance_details.addresses
1782 print 'Nova instance management ip = %s and public ip %s'%(address[test_second_network_name[0]][0]['addr'],address[test_2networks_name[1]][0]['addr'])
1783 print address[test_second_network_name[0]][0]['addr']
1784 print nova.security_groups.list()
1785 print address[test_second_network_name[1]][0]['addr']
1786 print nova.security_groups.list()
1787 secgroup = nova.security_groups.find(name="default")
1788# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1789 #from_port="22",
1790 #to_port="22",
1791 # cidr="0.0.0.0/0",)
1792
1793 # nova.security_group_rules.create(secgroup.id,
1794 # ip_protocol="icmp",
1795 # from_port=-1,
1796 # cidr="0.0.0.0/0",
1797 # to_port=-1)
1798 print nova.security_groups.list()
1799
1800 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1801 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1802 if status_1 is False or status_2 is False:
1803 self.nova_instance_deletion(nova, new_instance_details)
1804 time.sleep(3)
1805 self.neutron_network_deletion(test_second_network_name[0])
1806 self.neutron_network_deletion(test_second_network_name[1])
1807 assert_equal(status_1, True)
1808 assert_equal(status_2, True)
1809 new_instance_details.suspend()
1810 time.sleep(60)
1811 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1812 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1813 if status_1 is True or status_2 is True:
1814 self.nova_instance_deletion(nova, new_instance_details)
1815 time.sleep(3)
1816 self.neutron_network_deletion(test_second_network_name[0])
1817 self.neutron_network_deletion(test_second_network_name[1])
1818 assert_equal(status_1, False)
1819 assert_equal(status_2, False)
1820 new_instance_details.resume()
1821 print 'Nova instance is suspend and rsumed now checking connectivity'
1822 time.sleep(60)
1823 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1824 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1825 self.nova_instance_deletion(nova, new_instance_details)
1826 time.sleep(3)
1827 self.neutron_network_deletion(test_second_network_name[0])
1828 self.neutron_network_deletion(test_second_network_name[1])
1829 assert_equal(status_1, True)
1830 assert_equal(status_2, True)
1831
1832 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):
1833 """
1834 Algo:
1835 0. Create Test-Net,
1836 1. Create subnetwork whose ip is under management network
1837 3. Do GET Rest API and validate creation of network
1838 4. Create new nova instance under management network
1839 5. Validate new nova instance is created on nova service
1840 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1841 7. Now stop the nova instance and check connectivity
1842 8. Now start the nova instance and check connectivity
1843 """
1844 test_second_network_name = ['vtn_test_32_net_management','vtn_test_32_net_public']
1845 test_sub_second_network_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']]
1846 test_management_type = ["management_local", 'public']
1847 instance_vm_name = 'vtn_test_32_nova_instance_management_net'
1848# image_name = "vsg-1.1"
1849 image_name = "trusty-server-multi-nic"
1850 flavor_id = 'm1.small'
1851 for test_net_name in test_second_network_name:
1852 result = self.neutron_network_creation_and_validation(test_net_name)
1853 assert_equal(result, True)
1854 neutron_creds = self.get_neutron_credentials()
1855 neutron = neutronclient.Client(**neutron_creds)
1856 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
1857 for i in range(0,2):
1858 networks = neutron.list_networks(name=test_second_network_name[i])
1859 network_id = self.get_key_value(d=networks, key = 'id')
1860 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
1861 assert_equal(sub_result[0], True)
1862 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
1863 creds = get_nova_credentials()
1864 nova = nova_client.Client('2', **creds)
1865 print nova.security_groups.list()
1866 new_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,instance_vm_name,image_name,flavor_id)
1867 time.sleep(60)
1868 assert_equal(new_instance_details.status, 'ACTIVE')
1869 compute_details = self.get_compute_nodes()
1870 print new_instance_details.addresses
1871 address = new_instance_details.addresses
1872 print 'Nova instance management ip = %s and public ip %s'%(address[test_second_network_name[0]][0]['addr'],address[test_2networks_name[1]][0]['addr'])
1873 print address[test_second_network_name[0]][0]['addr']
1874 print nova.security_groups.list()
1875 print address[test_second_network_name[1]][0]['addr']
1876 print nova.security_groups.list()
1877 secgroup = nova.security_groups.find(name="default")
1878# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1879 #from_port="22",
1880 #to_port="22",
1881 # cidr="0.0.0.0/0",)
1882
1883 # nova.security_group_rules.create(secgroup.id,
1884 # ip_protocol="icmp",
1885 # from_port=-1,
1886 # cidr="0.0.0.0/0",
1887 # to_port=-1)
1888 print nova.security_groups.list()
1889
1890 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1891 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1892 if status_1 is False or status_2 is False:
1893 self.nova_instance_deletion(nova, new_instance_details)
1894 time.sleep(3)
1895 self.neutron_network_deletion(test_second_network_name[0])
1896 self.neutron_network_deletion(test_second_network_name[1])
1897 assert_equal(status_1, True)
1898 assert_equal(status_2, True)
1899 new_instance_details.stop()
1900 time.sleep(60)
1901 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1902 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1903 if status_1 is True or status_2 is True:
1904 self.nova_instance_deletion(nova, new_instance_details)
1905 time.sleep(3)
1906 self.neutron_network_deletion(test_second_network_name[0])
1907 self.neutron_network_deletion(test_second_network_name[1])
1908 assert_equal(status_1, False)
1909 assert_equal(status_2, False)
1910 new_instance_details.start()
1911 print 'Nova instance is stopped and started now checking connectivity'
1912 time.sleep(60)
1913 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1914 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'],check_type = "Ping_to_external")
1915 self.nova_instance_deletion(nova, new_instance_details)
1916 time.sleep(3)
1917 self.neutron_network_deletion(test_second_network_name[0])
1918 self.neutron_network_deletion(test_second_network_name[1])
1919 assert_equal(status_1, True)
1920 assert_equal(status_2, True)
1921
1922
1923 def test_cordvtn_creating_mgmt_and_private_network_instance_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self):
1924 """
1925 Algo:
1926 0. Create Test-Net,
1927 1. Create subnetwork whose ip is under management network
1928 3. Do GET Rest API and validate creation of network
1929 4. Create new nova instance under management network
1930 5. Validate new nova instance is created on nova service
1931 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1932 """
1933 test_second_network_name = ['vtn_test_33_net_management','vtn_test_33_net_private']
1934 test_sub_second_network_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']]
1935 test_management_type = ["management_local", 'private']
1936 instance_vm_name = 'vtn_test_33_nova_instance_management_net'
1937# image_name = "vsg-1.1"
1938 image_name = "trusty-server-multi-nic"
1939 flavor_id = 'm1.small'
1940 for test_net_name in test_second_network_name:
1941 result = self.neutron_network_creation_and_validation(test_net_name)
1942 assert_equal(result, True)
1943 neutron_creds = self.get_neutron_credentials()
1944 neutron = neutronclient.Client(**neutron_creds)
1945 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
1946 for i in range(0,2):
1947 networks = neutron.list_networks(name=test_second_network_name[i])
1948 network_id = self.get_key_value(d=networks, key = 'id')
1949 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
1950 assert_equal(sub_result[0], True)
1951 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
1952 creds = get_nova_credentials()
1953 nova = nova_client.Client('2', **creds)
1954 print nova.security_groups.list()
1955 new_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,instance_vm_name,image_name,flavor_id)
1956 time.sleep(60)
1957 assert_equal(new_instance_details.status, 'ACTIVE')
1958 compute_details = self.get_compute_nodes()
1959 print new_instance_details.addresses
1960 address = new_instance_details.addresses
1961 print 'Nova instance management ip = %s and private ip %s'%(address[test_second_network_name[0]][0]['addr'],address[test_2networks_name[1]][0]['addr'])
1962 print address[test_second_network_name[0]][0]['addr']
1963 print nova.security_groups.list()
1964 print address[test_second_network_name[1]][0]['addr']
1965 print nova.security_groups.list()
1966 secgroup = nova.security_groups.find(name="default")
1967# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
1968 #from_port="22",
1969 #to_port="22",
1970 # cidr="0.0.0.0/0",)
1971
1972 # nova.security_group_rules.create(secgroup.id,
1973 # ip_protocol="icmp",
1974 # from_port=-1,
1975 # cidr="0.0.0.0/0",
1976 # to_port=-1)
1977 print nova.security_groups.list()
1978 status_1, output = self.nova_instance_tenants_access_check(address[test_second_network_name[0]][0]['addr'])
1979 status_2, output = self.nova_instance_tenants_access_check(address[test_second_network_name[1]][0]['addr'],check_type = "Ping_to_external")
1980 self.nova_instance_deletion(nova, new_instance_details)
1981 time.sleep(3)
1982 self.neutron_network_deletion(test_second_network_name[0])
1983 self.neutron_network_deletion(test_second_network_name[1])
1984 assert_equal(status_1, True)
1985 assert_equal(status_2, False)
1986
1987 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):
1988 """
1989 Algo:
1990 0. Create Test-Net,
1991 1. Create subnetwork whose ip is under management network
1992 3. Do GET Rest API and validate creation of network
1993 4. Create new nova instance under management network
1994 5. Validate new nova instance is created on nova service
1995 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1996 """
1997 test_second_network_name = ['vtn_test_34_net_management','vtn_test_34_net_private']
1998 test_sub_second_network_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']]
1999 test_management_type = ["management_local", 'private']
2000 first_instance_vm_name = 'vtn_test_34_nova_first_instance_management_net'
2001 second_instance_vm_name = 'vtn_test_34_nova_second_instance_management_net'
2002# image_name = "vsg-1.1"
2003 image_name = "trusty-server-multi-nic"
2004 flavor_id = 'm1.small'
2005 for test_net_name in test_second_network_name:
2006 result = self.neutron_network_creation_and_validation(test_net_name)
2007 assert_equal(result, True)
2008 neutron_creds = self.get_neutron_credentials()
2009 neutron = neutronclient.Client(**neutron_creds)
2010 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
2011 for i in range(0,2):
2012 networks = neutron.list_networks(name=test_second_network_name[i])
2013 network_id = self.get_key_value(d=networks, key = 'id')
2014 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
2015 assert_equal(sub_result[0], True)
2016 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
2017 creds = get_nova_credentials()
2018 nova = nova_client.Client('2', **creds)
2019 print nova.security_groups.list()
2020 new_first_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,first_instance_vm_name,image_name,flavor_id)
2021 new_second_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,second_instance_vm_name,image_name,flavor_id)
2022 time.sleep(60)
2023 assert_equal(new_first_instance_details.status, 'ACTIVE')
2024 assert_equal(new_second_instance_details.status, 'ACTIVE')
2025 compute_details = self.get_compute_nodes()
2026 first_instance_address = new_first_instance_details.addresses
2027 second_instance_address = new_second_instance_details.addresses
2028 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_second_network_name[0]][0]['addr'],first_instance_address[test_2networks_name[1]][0]['addr'])
2029 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_second_network_name[0]][0]['addr'],second_instance_address[test_2networks_name[1]][0]['addr'])
2030 secgroup = nova.security_groups.find(name="default")
2031# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2032 #from_port="22",
2033 #to_port="22",
2034 # cidr="0.0.0.0/0",)
2035
2036 # nova.security_group_rules.create(secgroup.id,
2037 # ip_protocol="icmp",
2038 # from_port=-1,
2039 # cidr="0.0.0.0/0",
2040 # to_port=-1)
2041 print nova.security_groups.list()
2042
2043 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2044 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2045 self.nova_instance_deletion(nova, new_instance_details)
2046 time.sleep(3)
2047 self.neutron_network_deletion(test_second_network_name[0])
2048 self.neutron_network_deletion(test_second_network_name[1])
2049 assert_equal(status_1, True)
2050 assert_equal(status_2, True)
2051
2052 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):
2053 """
2054 Algo:
2055 0. Create Test-Net,
2056 1. Create subnetwork whose ip is under management network
2057 3. Do GET Rest API and validate creation of network
2058 4. Create new nova instance under management network
2059 5. Validate new nova instance is created on nova service
2060 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2061 7. Now pause one of the nova instance and check connectivity
2062 8. Now start the same nova instance and check connectivity
2063 """
2064 test_second_network_name = ['vtn_test_35_net_management','vtn_test_35_net_private']
2065 test_sub_second_network_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']]
2066 test_management_type = ["management_local", 'private']
2067 first_instance_vm_name = 'vtn_test_35_nova_first_instance_management_net'
2068 second_instance_vm_name = 'vtn_test_35_nova_second_instance_management_net'
2069# image_name = "vsg-1.1"
2070 image_name = "trusty-server-multi-nic"
2071 flavor_id = 'm1.small'
2072 for test_net_name in test_second_network_name:
2073 result = self.neutron_network_creation_and_validation(test_net_name)
2074 assert_equal(result, True)
2075 neutron_creds = self.get_neutron_credentials()
2076 neutron = neutronclient.Client(**neutron_creds)
2077 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
2078 for i in range(0,2):
2079 networks = neutron.list_networks(name=test_second_network_name[i])
2080 network_id = self.get_key_value(d=networks, key = 'id')
2081 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
2082 assert_equal(sub_result[0], True)
2083 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
2084 creds = get_nova_credentials()
2085 nova = nova_client.Client('2', **creds)
2086 print nova.security_groups.list()
2087 new_first_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,first_instance_vm_name,image_name,flavor_id)
2088 new_second_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,second_instance_vm_name,image_name,flavor_id)
2089 time.sleep(60)
2090 assert_equal(new_first_instance_details.status, 'ACTIVE')
2091 assert_equal(new_second_instance_details.status, 'ACTIVE')
2092 compute_details = self.get_compute_nodes()
2093 first_instance_address = new_first_instance_details.addresses
2094 second_instance_address = new_second_instance_details.addresses
2095 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_second_network_name[0]][0]['addr'],first_instance_address[test_2networks_name[1]][0]['addr'])
2096 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_second_network_name[0]][0]['addr'],second_instance_address[test_2networks_name[1]][0]['addr'])
2097 secgroup = nova.security_groups.find(name="default")
2098# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2099 #from_port="22",
2100 #to_port="22",
2101 # cidr="0.0.0.0/0",)
2102
2103 # nova.security_group_rules.create(secgroup.id,
2104 # ip_protocol="icmp",
2105 # from_port=-1,
2106 # cidr="0.0.0.0/0",
2107 # to_port=-1)
2108 print nova.security_groups.list()
2109 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2110 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2111 if status_1 is False or status_2 is False:
2112 self.nova_instance_deletion(nova, new_instance_details)
2113 time.sleep(3)
2114 self.neutron_network_deletion(test_second_network_name[0])
2115 self.neutron_network_deletion(test_second_network_name[1])
2116 assert_equal(status_1, True)
2117 assert_equal(status_2, True)
2118 new_first_instance_details.pause()
2119 time.sleep(60)
2120 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2121 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2122 if status_1 is True or status_2 is True:
2123 self.nova_instance_deletion(nova, new_instance_details)
2124 time.sleep(3)
2125 self.neutron_network_deletion(test_second_network_name[0])
2126 self.neutron_network_deletion(test_second_network_name[1])
2127 assert_equal(status_1, False)
2128 assert_equal(status_2, False)
2129 new_first_instance_details.unpause()
2130 print 'Nova instance is paused and unpased now checking connectivity'
2131 time.sleep(60)
2132 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2133 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2134 self.nova_instance_deletion(nova, new_instance_details)
2135 time.sleep(3)
2136 self.neutron_network_deletion(test_second_network_name[0])
2137 self.neutron_network_deletion(test_second_network_name[1])
2138 assert_equal(status_1, True)
2139 assert_equal(status_2, True)
2140
2141 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):
2142 """
2143 Algo:
2144 0. Create Test-Net,
2145 1. Create subnetwork whose ip is under management network
2146 3. Do GET Rest API and validate creation of network
2147 4. Create new nova instance under management network
2148 5. Validate new nova instance is created on nova service
2149 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2150 7. Now suspend one of the nova instance and check connectivity
2151 8. Now resume the same nova instance and check connectivity
2152 """
2153 test_second_network_name = ['vtn_test_36_net_management','vtn_test_36_net_private']
2154 test_sub_second_network_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']]
2155 test_management_type = ["management_local", 'private']
2156 first_instance_vm_name = 'vtn_test_36_nova_first_instance_management_net'
2157 second_instance_vm_name = 'vtn_test_36_nova_second_instance_management_net'
2158# image_name = "vsg-1.1"
2159 image_name = "trusty-server-multi-nic"
2160 flavor_id = 'm1.small'
2161 for test_net_name in test_second_network_name:
2162 result = self.neutron_network_creation_and_validation(test_net_name)
2163 assert_equal(result, True)
2164 neutron_creds = self.get_neutron_credentials()
2165 neutron = neutronclient.Client(**neutron_creds)
2166 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
2167 for i in range(0,2):
2168 networks = neutron.list_networks(name=test_second_network_name[i])
2169 network_id = self.get_key_value(d=networks, key = 'id')
2170 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
2171 assert_equal(sub_result[0], True)
2172 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
2173 creds = get_nova_credentials()
2174 nova = nova_client.Client('2', **creds)
2175 print nova.security_groups.list()
2176 new_first_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,first_instance_vm_name,image_name,flavor_id)
2177 new_second_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,second_instance_vm_name,image_name,flavor_id)
2178 time.sleep(60)
2179 assert_equal(new_first_instance_details.status, 'ACTIVE')
2180 assert_equal(new_second_instance_details.status, 'ACTIVE')
2181 compute_details = self.get_compute_nodes()
2182 first_instance_address = new_first_instance_details.addresses
2183 second_instance_address = new_second_instance_details.addresses
2184 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_second_network_name[0]][0]['addr'],first_instance_address[test_2networks_name[1]][0]['addr'])
2185 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_second_network_name[0]][0]['addr'],second_instance_address[test_2networks_name[1]][0]['addr'])
2186 secgroup = nova.security_groups.find(name="default")
2187# nova.security_group_rules.create(secgroup.id,ip_protocol="tcp",
2188 #from_port="22",
2189 #to_port="22",
2190 # cidr="0.0.0.0/0",)
2191
2192 # nova.security_group_rules.create(secgroup.id,
2193 # ip_protocol="icmp",
2194 # from_port=-1,
2195 # cidr="0.0.0.0/0",
2196 # to_port=-1)
2197 print nova.security_groups.list()
2198 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2199 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2200 if status_1 is False or status_2 is False:
2201 self.nova_instance_deletion(nova, new_instance_details)
2202 time.sleep(3)
2203 self.neutron_network_deletion(test_second_network_name[0])
2204 self.neutron_network_deletion(test_second_network_name[1])
2205 assert_equal(status_1, True)
2206 assert_equal(status_2, True)
2207 new_first_instance_details.suspend()
2208 time.sleep(60)
2209 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2210 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2211 if status_1 is True or status_2 is True:
2212 self.nova_instance_deletion(nova, new_instance_details)
2213 time.sleep(3)
2214 self.neutron_network_deletion(test_second_network_name[0])
2215 self.neutron_network_deletion(test_second_network_name[1])
2216 assert_equal(status_1, False)
2217 assert_equal(status_2, False)
2218 new_first_instance_details.resume()
2219 print 'Nova instance is suspend and resume now checking connectivity'
2220 time.sleep(60)
2221 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2222 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2223 self.nova_instance_deletion(nova, new_instance_details)
2224 time.sleep(3)
2225 self.neutron_network_deletion(test_second_network_name[0])
2226 self.neutron_network_deletion(test_second_network_name[1])
2227 assert_equal(status_1, True)
2228 assert_equal(status_2, True)
2229
2230 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):
2231 """
2232 Algo:
2233 0. Create Test-Net,
2234 1. Create subnetwork whose ip is under management network
2235 3. Do GET Rest API and validate creation of network
2236 4. Create new nova instance under management network
2237 5. Validate new nova instance is created on nova service
2238 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
2239 7. Now stop one of the nova instance and check connectivity
2240 8. Now start the same nova instance and check connectivity
2241 """
2242 test_second_network_name = ['vtn_test_37_net_management','vtn_test_37_net_private']
2243 test_sub_second_network_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']]
2244 test_management_type = ["management_local", 'private']
2245 first_instance_vm_name = 'vtn_test_37_nova_first_instance_management_net'
2246 second_instance_vm_name = 'vtn_test_37_nova_second_instance_management_net'
2247# image_name = "vsg-1.1"
2248 image_name = "trusty-server-multi-nic"
2249 flavor_id = 'm1.small'
2250 for test_net_name in test_second_network_name:
2251 result = self.neutron_network_creation_and_validation(test_net_name)
2252 assert_equal(result, True)
2253 neutron_creds = self.get_neutron_credentials()
2254 neutron = neutronclient.Client(**neutron_creds)
2255 #for test_net_name,test_sub_net_cidr in test_second_network_name test_sub_2networks_cidr:
2256 for i in range(0,2):
2257 networks = neutron.list_networks(name=test_second_network_name[i])
2258 network_id = self.get_key_value(d=networks, key = 'id')
2259 sub_result = self.neutron_subnet_creation_and_validation(test_second_network_name[i],test_sub_2networks_cidr[i])
2260 assert_equal(sub_result[0], True)
2261 net_type_post = self.sub_network_type_post_to_onos(test_second_network_name[i], test_management_type[i])
2262 creds = get_nova_credentials()
2263 nova = nova_client.Client('2', **creds)
2264 print nova.security_groups.list()
2265 new_first_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,first_instance_vm_name,image_name,flavor_id)
2266 new_second_instance_details = self.nova_instance_creation_and_validation(test_second_network_name,nova,second_instance_vm_name,image_name,flavor_id)
2267 time.sleep(60)
2268 assert_equal(new_first_instance_details.status, 'ACTIVE')
2269 assert_equal(new_second_instance_details.status, 'ACTIVE')
2270 compute_details = self.get_compute_nodes()
2271 first_instance_address = new_first_instance_details.addresses
2272 second_instance_address = new_second_instance_details.addresses
2273 print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_second_network_name[0]][0]['addr'],first_instance_address[test_2networks_name[1]][0]['addr'])
2274 print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_second_network_name[0]][0]['addr'],second_instance_address[test_2networks_name[1]][0]['addr'])
2275 secgroup = nova.security_groups.find(name="default")
2276 print nova.security_groups.list()
2277 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2278 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2279 if status_1 is False or status_2 is False:
2280 self.nova_instance_deletion(nova, new_instance_details)
2281 time.sleep(3)
2282 self.neutron_network_deletion(test_second_network_name[0])
2283 self.neutron_network_deletion(test_second_network_name[1])
2284 assert_equal(status_1, True)
2285 assert_equal(status_2, True)
2286 new_first_instance_details.stop()
2287 time.sleep(60)
2288 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2289 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2290 if status_1 is True or status_2 is True:
2291 self.nova_instance_deletion(nova, new_instance_details)
2292 time.sleep(3)
2293 self.neutron_network_deletion(test_second_network_name[0])
2294 self.neutron_network_deletion(test_second_network_name[1])
2295 assert_equal(status_1, False)
2296 assert_equal(status_2, False)
2297 new_first_instance_details.start()
2298 print 'Nova instance is stopped and started now checking connectivity'
2299 time.sleep(60)
2300 status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'])
2301 status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_second_network_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_2networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant")
2302 self.nova_instance_deletion(nova, new_instance_details)
2303 time.sleep(3)
2304 self.neutron_network_deletion(test_second_network_name[0])
2305 self.neutron_network_deletion(test_second_network_name[1])
2306 assert_equal(status_1, True)
2307 assert_equal(status_2, True)
2308
Thangavelu K Saea3c672017-03-15 18:57:05 +00002309 def test_cordvtn_with_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002310 """
2311 Algo:
2312 0. Create Test-Net,
2313 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2314 2. Run sync command for cordvtn
2315 3. Do GET Rest API and validate creation of network
2316 4. Validate network synch with created network in cord-onos
2317 """
2318 creds = self.get_neutron_credentials()
2319 neutron = neutronclient.Client(**creds)
2320 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
2321 net = neutron.create_network(body=body_example)
2322 networks = neutron.list_networks(name='Net-1')
2323 vtn_util = vtn_validation_utils('')
2324 data = networks
2325 result = self.search_value(data, "Net-1")
2326 assert_equal(result, True)
2327
2328 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
2329 """
2330 Algo:
2331 0. Create Test-Net,
2332 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2333 2. Run sync command for cordvtn
2334 3. Do GET Rest API and validate creation of network
2335 4. Validate network synch with created network in cord-onos
2336 """
2337 creds = self.get_neutron_credentials()
2338 neutron = neutronclient.Client(**creds)
2339 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
2340 net = neutron.create_network(body=body_example)
2341 networks = neutron.list_networks(name='Net-1')
2342 vtn_util = vtn_validation_utils('')
2343 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
2344 auth = ('karaf','karaf')
2345
2346 resp = requests.get(url=url, auth=auth)
2347 data = json.loads(resp.text)
2348 result = self.search_value(data, "Net-1")
2349 assert_equal(result, True)
2350
Thangavelu K S3698fad2017-03-24 17:50:14 +00002351 def test_cordvtn_neutron_network_deletion_and_validation_on_neutron_openstack(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00002352 """
2353 Algo:
2354 0. Create Test-Net,
2355 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2356 2. Run sync command for cordvtn
2357 3. Do GET Rest API and validate creation of network
2358 4. Validate network synch with created network in cord-onos
2359 """
2360 creds = self.get_neutron_credentials()
2361 neutron = neutronclient.Client(**creds)
2362 body_example = {"network":{"name": "Net-1","admin_state_up":False}}
2363 net = neutron.delete_network("Net-1")
2364 networks = neutron.list_networks(name='Net-1')
2365 vtn_util = vtn_validation_utils('')
2366 data = networks
2367 result = self.search_value(data, "Net-1")
2368 assert_equal(result, True)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002369
2370 def test_cordvtn_neutron_network_sync(self):
2371 """
2372 Algo:
2373 0. Create Test-Net,
2374 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2375 2. Run sync command for cordvtn
2376 3. Do GET Rest API and validate creation of network
2377 4. Validate network synch with created network in cord-onos
2378 """
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00002379 creds = self.get_neutron_credentials()
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002380 neutron = neutronclient.Client(**creds)
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00002381 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002382 net = neutron.create_network(body=body_example)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002383 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
2384 auth = ('karaf','karaf')
2385 body_create_subnet = {'subnets': [{'cidr': '192.168.199.0/24',
2386 'ip_version': 4, 'network_id': network_id}]}
2387
2388 subnet = neutron.create_subnet(body=body_create_subnet)
2389
2390 resp = requests.get(url=url, auth=auth)
2391 data = json.loads(resp.text)
2392 result = self.search_value(data, "Test-Net-1")
2393 assert_equal(result, True)
2394
2395 def test_cordvtn_neutron_port_sync(self):
2396 """
2397 Algo:
2398 0. Create Test-Net,
2399 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
2400 2. Run sync command for cordvtn
2401 3. Do GET Rest API and validate creation of network
Thangavelu K Saea3c672017-03-15 18:57:05 +00002402 4. Validate network synch with created port in cord-onos
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002403 """
2404 creds = self.get_neutron_credentials()
2405 neutron = neutronclient.Client(**creds)
2406 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
2407 net = neutron.create_network(body=body_example)
2408 network_id = net['network']['id']
2409 device_id = 'of:{}'.format(get_mac(self.switch))
2410 body_example = {'port': {'admin_state_up': True,'device_id':device_id, 'network_id':network_id}}
2411 response = neutron.create_port(body=body_example)
2412 url = "http://{0}:8181/onos/cordvtn/servicePorts".format(vtn_util.endpoint)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002413 auth = ('karaf','karaf')
2414
2415 resp = requests.get(url=url, auth=auth)
2416 data = json.loads(resp.text)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00002417 result = self.search_value(data, device_id)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00002418 assert_equal(result, True)
2419
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002420 def test_cordvtn_creating_virtual_private_network(self):
2421 """
2422 Algo:
2423 1) Validate that required openstack service is up and running.
2424 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2425 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2426 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2427 4) Verify that NetA is being created and validate IP in nova list command.
2428 5) Verify that flow is being added in ovs-switch in compute-node.
2429 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2430 """
2431 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002432
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002433 def test_cordvtn_creating_virtual_local_management_network(self):
2434 """
2435 Algo:
2436 1) Validate that required openstack service is up and running.
2437 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2438 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2439 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2440 4) Verify that NetA is being created and validate IP in nova list command.
2441 5) Verify that flow is being added in ovs-switch in compute-node.
2442 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2443 """
2444 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002445
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002446 def test_cordvtn_creating_virtual_vlan_connectivity_network(self):
2447 """
2448 Algo:
2449 1) Validate that required openstack service is up and running.
2450 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2451 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2452 (neutron port-create net-A-private --name stag-100).
2453 4) Verify that NetA is being created and validate IP in nova list command.
2454 5) Verify that flow is being added in ovs-switch in compute-node.
2455 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2456 """
2457 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002458
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002459 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network(self):
2460 """
2461 Algo:
2462 1) Validate that required openstack service is up and running.
2463 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2464 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2465 (neutron port-create net-A-private --name stag-500).
2466 4) Verify that NetA is being created and validate IP in nova list command.
2467 5) Verify that flow is being added in ovs-switch in compute-node.
2468 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2469 """
2470 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002471
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002472 def test_cordvtn_creating_virtual_private_network_and_boot_image(self):
2473 """
2474 Algo:
2475 1) Validate that required openstack service is up and running.
2476 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2477 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2478 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2479 4) Now boot image in the same created network using nova boot image command (example given below :-
2480 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2481 5) Wait till VM boots up and starts running.
2482 6) Verify that a VM is launched and running by using novaclient python API.
2483 7) Verify that flow is being added in ovs-switch in compute-node.
2484 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2485 9) Verify that cord-onos pushed flows to OVS switch.
2486 """
2487 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002488
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002489 def test_cordvtn_creating_virtual_public_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002490
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002491 """
2492 Algo:
2493 1) Validate that required openstack service is up and running.
2494 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2495 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2496 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2497 4) Now boot image in the same created network using nova boot image command (example given below :-
2498 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2499 5) Wait till VM boots up and starts running.
2500 6) Verify that a VM is launched and running by using novaclient python API.
2501 7) Verify that flow is being added in ovs-switch in compute-node.
2502 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2503 9) Verify that cord-onos pushed flows to OVS switch.
2504 """
2505 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002506
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002507 def test_cordvtn_creating_virtual_local_management_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002508
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002509 """
2510 Algo:
2511 1) Validate that required openstack service is up and running.
2512 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2513 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2514 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2515 4) Now boot image in the same created network using nova boot image command (example given below :-
2516 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
2517 5) Wait till VM boots up and starts running.
2518 6) Verify that a VM is launched and running by using novaclient python API.
2519 7) Verify that flow is being added in ovs-switch in compute-node.
2520 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2521 9) Verify that cord-onos pushed flows to OVS switch.
2522 """
2523 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002524
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002525 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image(self):
2526 """
2527 Algo:
2528 1) Validate that required openstack service is up and running.
2529 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2530 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2531 (neutron port-create net-A-private --name stag-100).
2532 4) Now boot image in the same created network using nova boot image command (example given below :-
2533 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2534 5) Wait till VM boots up and starts running.
2535 6) Verify that a VM is launched and running by using novaclient python API.
2536 7) Verify that flow is being added in ovs-switch in compute-node.
2537 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2538 9) Verify that cord-onos pushed flows to OVS switch.
2539 """
2540 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002541
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002542 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image(self):
2543 """
2544 Algo:
2545 1) Validate that required openstack service is up and running.
2546 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2547 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2548 (neutron port-create net-A-private --name stag-500).
2549 4) Now boot image in the same created network using nova boot image command (example given below :-
2550 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2551 5) Wait till VM boots up and starts running.
2552 6) Verify that a VM is launched and running by using novaclient python API.
2553 7) Verify that flow is being added in ovs-switch in compute-node.
2554 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2555 9) Verify that cord-onos pushed flows to OVS switch.
2556 """
2557 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002558
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002559 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service(self):
2560 """
2561 Algo:
2562 1) Validate that required openstack service is up and running.
2563 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2564 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2565 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2566 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2567 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2568 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2569 5) Wait till VMs boot up and running.
2570 6) Verify that two VMs are launched and running by using novaclient python API.
2571 7) Verify that flow is being added in ovs-switch in compute-node.
2572 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2573 9) Verify that cord-onos pushed flows to OVS switch.
2574 """
2575 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002576
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002577 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service(self):
2578 """
2579 Algo:
2580 1) Validate that required openstack service is up and running.
2581 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2582 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2583 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2584 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2585 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2586 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2587 5) Wait till VMs boot up and running.
2588 6) Verify that two VMs are launched and running by using novaclient python API.
2589 7) Verify that flow is being added in ovs-switch in compute-node.
2590 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2591 9) Verify that cord-onos pushed flows to OVS switch.
2592 """
2593 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002594
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002595 def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service(self):
2596 """
2597 Algo:
2598 1) Validate that required openstack service is up and running.
2599 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2600 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2601 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2602 4) Now boot two images in the same created network using nova boot image command (example given below :-
2603 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
2604 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
2605 5) Wait till VMs boot up and running.
2606 6) Verify that two VMs are launched and running by using novaclient python API.
2607 7) Verify that flow is being added in ovs-switch in compute-node.
2608 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2609 9) Verify that cord-onos pushed flows to OVS switch.
2610 """
2611 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002612
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002613 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
2614 """
2615 Algo:
2616 1) Validate that required openstack service is up and running.
2617 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2618 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2619 (neutron port-create net-A-private --name stag-100).
2620 4) Now boot two images in the same created network using nova boot image command (example given below :-
2621 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2622 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2623 5) Wait till VMs boot up and running.
2624 6) Verify that two VMs are launched and running by using novaclient python API.
2625 7) Verify that flow is being added in ovs-switch in compute-node.
2626 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2627 9) Verify that cord-onos pushed flows to OVS switch.
2628 """
2629 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002630
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002631 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
2632 """
2633 Algo:
2634 1) Validate that required openstack service is up and running.
2635 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2636 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2637 (neutron port-create net-A-private --name stag-500).
2638 4) Now boot two images in the same created network using nova boot image command (example given below :-
2639 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2640 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2641 5) Wait till VMs boot up and running.
2642 6) Verify that two VMs are launched and running by using novaclient python API.
2643 7) Verify that flow is being added in ovs-switch in compute-node.
2644 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2645 9) Verify that cord-onos pushed flows to OVS switch.
2646 """
2647 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002648
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002649 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity(self):
2650 """
2651 Algo:
2652 1) Validate that required openstack service is up and running.
2653 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2654 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2655 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2656 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2657 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2658 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2659 5) Wait till VMs boot up and running.
2660 6) Verify that two VMs are launched and running by using novaclient python API.
2661 7) Now ping to the VM from other VM which are launched in same network
2662 8) verify that ping is successful
2663 9) Verify that flow is being added in ovs-switch in compute-node.
2664 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2665 11) Verify that cord-onos pushed flows to OVS switch.
2666 """
2667 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002668
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002669 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2670 """
2671 Algo:
2672 1) Validate that required openstack service is up and running.
2673 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2674 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2675 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2676 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2677 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2678 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2679 5) Wait till VMs boot up and running.
2680 6) Verify that two VMs are launched and running by using novaclient python API.
2681 7) Now ping to the VM from other VM which are launched in same network
2682 8) verify that ping is not successful
2683 9) Verify that flow is being added in ovs-switch in compute-node.
2684 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2685 11) Verify that cord-onos pushed flows to OVS switch.
2686 """
2687 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002688
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002689 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 -08002690
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002691 """
2692 Algo:
2693 1) Validate that required openstack service is up and running.
2694 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2695 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2696 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2697 4) Now boot two images in the same created network using nova boot image command (example given below :-
2698 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
2699 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
2700 5) Wait till VMs boot up and running.
2701 6) Verify that two VMs are launched and running by using novaclient python API.
2702 7) Now ping to the VM from other VM which are launched in same network
2703 8) verify that ping is not successful
2704 9) Verify that flow is being added in ovs-switch in compute-node.
2705 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2706 11) Verify that cord-onos pushed flows to OVS switch.
2707 """
2708 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002709
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002710 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 -08002711
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002712 """
2713 Algo:
2714 1) Validate that required openstack service is up and running.
2715 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2716 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2717 (neutron port-create net-A-private --name stag-100).
2718 4) Now boot two images in the same created network using nova boot image command (example given below :-
2719 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2720 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2721 5) Wait till VMs boot up and running.
2722 6) Verify that two VMs are launched and running by using novaclient python API.
2723 7) Now ping to the VM from other VM which are launched in same network
2724 8) verify that ping is not successful
2725 9) Verify that flow is being added in ovs-switch in compute-node.
2726 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2727 11) Verify that cord-onos pushed flows to OVS switch.
2728 """
2729 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002730
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002731 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2732 """
2733 Algo:
2734 1) Validate that required openstack service is up and running.
2735 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2736 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2737 (neutron port-create net-A-private --name stag-500).
2738 4) Now boot two images in the same created network using nova boot image command (example given below :-
2739 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2740 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2741 5) Wait till VMs boot up and running.
2742 6) Verify that two VMs are launched and running by using novaclient python API.
2743 7) Now ping to the VM from other VM which are launched in same network
2744 8) verify that ping is not successful
2745 9) Verify that flow is being added in ovs-switch in compute-node.
2746 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2747 11) Verify that cord-onos pushed flows to OVS switch.
2748 """
2749 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002750
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002751 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
2752 """
2753 Algo:
2754 1) Validate that required openstack service is up and running.
2755 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2756 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2757 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2758 4) Now boot image in the same created network using nova boot image command (example given below :-
2759 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2760 5) Wait till VM boots up and starts running.
2761 6) Verify that a VM is launched and running by using novaclient python API.
2762 7) Now ping to the VM from outside network which are internet network (global ping)
2763 8) verify that ping is not successful
2764 9) Verify that flow is being added in ovs-switch in compute-node.
2765 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2766 11) Verify that cord-onos pushed flows to OVS switch.
2767 """
2768 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002769
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002770 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity(self):
2771 """
2772 Algo:
2773 1) Validate that required openstack service is up and running.
2774 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2775 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2776 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2777 4) Now boot image in the same created network using nova boot image command (example given below :-
2778 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2779 5) Wait till VM boots up and starts running.
2780 6) Verify that a VM is launched and running by using novaclient python API.
2781 7) Now ping to the VM from outside network which are internet network (global ping)
2782 8) verify that ping is successful
2783 9) Verify that flow is being added in ovs-switch in compute-node.
2784 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2785 11) Verify that cord-onos pushed flows to OVS switch.
2786 """
2787 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002788
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002789 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_negative_scenario(self):
2790 """
2791 Algo:
2792 1) Validate that required openstack service is up and running.
2793 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2794 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2795 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2796 4) Now boot image in the same created network using nova boot image command (example given below :-
2797 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
2798 5) Wait till VM boots up and starts running.
2799 6) Verify that a VM is launched and running by using novaclient python API.
2800 7) Now ping to the VM from outside network which are internet network (global ping)
2801 8) verify that ping is not successful
2802 9) Verify that flow is being added in ovs-switch in compute-node.
2803 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2804 11) Verify that cord-onos pushed flows to OVS switch.
2805 """
2806 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002807
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002808 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2809 """
2810 Algo:
2811 1) Validate that required openstack service is up and running.
2812 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2813 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2814 (neutron port-create net-A-private --name stag-100).
2815 4) Now boot image in the same created network using nova boot image command (example given below :-
2816 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2817 5) Wait till VM boots up and starts running.
2818 6) Verify that a VM is launched and running by using novaclient python API.
2819 7) Now ping to the VM from outside network which are internet network (global ping)
2820 8) verify that ping is not successful
2821 9) Verify that flow is being added in ovs-switch in compute-node.
2822 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2823 11) Verify that cord-onos pushed flows to OVS switch.
2824 """
2825 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002826
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002827 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2828 """
2829 Algo:
2830 1) Validate that required openstack service is up and running.
2831 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2832 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2833 (neutron port-create net-A-private --name stag-500).
2834 4) Now boot image in the same created network using nova boot image command (example given below :-
2835 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2836 5) Wait till VM boots up and starts running.
2837 6) Verify that a VM is launched and running by using novaclient python API.
2838 7) Now ping to the VM from outside network which are internet network (global ping)
2839 8) verify that ping is not successful
2840 9) Verify that flow is being added in ovs-switch in compute-node.
2841 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2842 11) Verify that cord-onos pushed flows to OVS switch.
2843 """
2844 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002845
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002846 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
2847 """
2848 Algo:
2849 1) Validate that required openstack service is up and running.
2850 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2851 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2852 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2853 4) Now boot image in the same created network using nova boot image command (example given below :-
2854 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2855 5) Wait till VM boots up and starts running.
2856 6) Verify that a VM is launched and running by using novaclient python API.
2857 7) Now ping to the VM from compute node network which are launched a VM.
2858 8) verify that ping is not successful
2859 9) Verify that flow is being added in ovs-switch in compute-node.
2860 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2861 11) Verify that cord-onos pushed flows to OVS switch.
2862 """
2863 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002864
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002865 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_negative_scenario(self):
2866 """
2867 Algo:
2868 1) Validate that required openstack service is up and running.
2869 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2870 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2871 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2872 4) Now boot image in the same created network using nova boot image command (example given below :-
2873 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2874 5) Wait till VM boots up and starts running.
2875 6) Verify that a VM is launched and running by using novaclient python API.
2876 7) Now ping to the VM from compute node network which are launched a VM.
2877 8) verify that ping is not successful
2878 9) Verify that flow is being added in ovs-switch in compute-node.
2879 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2880 11) Verify that cord-onos pushed flows to OVS switch.
2881 """
2882 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002883
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002884 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity(self):
2885 """
2886 Algo:
2887 1) Validate that required openstack service is up and running.
2888 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2889 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2890 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2891 4) Now boot image in the same created network using nova boot image command (example given below :-
2892 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
2893 5) Wait till VM boots up and starts running.
2894 6) Verify that a VM is launched and running by using novaclient python API.
2895 7) Now ping to the VM from compute node network which are launched a VM.
2896 8) verify that ping is successful
2897 9) Verify that flow is being added in ovs-switch in compute-node.
2898 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2899 11) Verify that cord-onos pushed flows to OVS switch.
2900 """
2901 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002902
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002903 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2904 """
2905 Algo:
2906 1) Validate that required openstack service is up and running.
2907 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2908 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2909 (neutron port-create net-A-private --name stag-100).
2910 4) Now boot image in the same created network using nova boot image command (example given below :-
2911 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2912 5) Wait till VM boots up and starts running.
2913 6) Verify that a VM is launched and running by using novaclient python API.
2914 7) Now ping to the VM from compute node network which are launched a VM.
2915 8) verify that ping is not successful
2916 9) Verify that flow is being added in ovs-switch in compute-node.
2917 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2918 11) Verify that cord-onos pushed flows to OVS switch.
2919 """
2920 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002921
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002922 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2923 """
2924 Algo:
2925 1) Validate that required openstack service is up and running.
2926 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2927 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2928 (neutron port-create net-A-private --name stag-500).
2929 4) Now boot image in the same created network using nova boot image command (example given below :-
2930 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2931 5) Wait till VM boots up and starts running.
2932 6) Verify that a VM is launched and running by using novaclient python API.
2933 7) Now ping to the VM from compute node network which are launched a VM.
2934 8) verify that ping is not successful
2935 9) Verify that flow is being added in ovs-switch in compute-node.
2936 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2937 11) Verify that cord-onos pushed flows to OVS switch.
2938 """
2939 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002940
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002941 def test_cordvtn_creating_virtual_vlan_interface_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002942
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002943 """
2944 Algo:
2945 1) Validate that required openstack service is up and running.
2946 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2947 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2948 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2949 4) Now boot image in the same created network using nova boot image command (example given below :-
2950 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2951 5) Wait till VM boots up and starts running.
2952 6) Verify that a VM is launched and running by using novaclient python API.
2953 7) Create a virtual interface with vlan tag and private ip on VM.
2954 8) Create a same virtual interface with valn tag and private ip on head node.
2955 9) Now ping to the VM from head node network which are launched a openstack service.
2956 10) verify that ping is successful
2957 11) Verify that flow is being added in ovs-switch in compute-node.
2958 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2959 13) Verify that cord-onos pushed flows to OVS switch.
2960 """
2961 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002962
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002963 def test_cordvtn_creating_virtual_vlan_interface_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002964
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002965 """
2966 Algo:
2967 1) Validate that required openstack service is up and running.
2968 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2969 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2970 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2971 4) Now boot image in the same created network using nova boot image command (example given below :-
2972 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2973 5) Wait till VM boots up and starts running.
2974 6) Verify that a VM is launched and running by using novaclient python API.
2975 7) Create a virtual interface with vlan tag and public ip on VM.
2976 8) Create a same virtual interface with valn tag and any pulic ip on head node.
2977 9) Now ping to the VM from head node network which are launched a openstack service.
2978 10) verify that ping is successful
2979 11) Verify that flow is being added in ovs-switch in compute-node.
2980 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2981 13) Verify that cord-onos pushed flows to OVS switch.
2982 """
2983 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002984
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002985 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002986
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002987 """
2988 Algo:
2989 1) Validate that required openstack service is up and running.
2990 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2991 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2992 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2993 4) Now boot image in the same created network using nova boot image command (example given below :-
2994 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
2995 5) Wait till VM boots up and starts running.
2996 6) Verify that a VM is launched and running by using novaclient python API.
2997 7) Create a virtual interface with vlan tag and local management ip on VM.
2998 8) Create a same virtual interface with valn tag and any local management ip on head node.
2999 9) Now ping to the VM from head node network which are launched a openstack service.
3000 10) verify that ping is successful
3001 11) Verify that flow is being added in ovs-switch in compute-node.
3002 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3003 13) Verify that cord-onos pushed flows to OVS switch.
3004 """
3005 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003006
ChetanGaonker901727c2016-11-29 14:05:03 -08003007
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003008 def test_cordvtn_creating_virtual_vlan_interface_floating_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003009
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003010 """
3011 Algo:
3012 1) Validate that required openstack service is up and running.
3013 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3014 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3015 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3016 4) Now boot image in the same created network using nova boot image command (example given below :-
3017 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3018 5) Wait till VM boots up and starts running.
3019 6) Verify that a VM is launched and running by using novaclient python API.
3020 7) Create a virtual interface with vlan tag and private floating ip on VM.
3021 8) Create a same virtual interface with valn tag and private floating ip on head node.
3022 9) Now ping to the VM from head node network which are launched a openstack service.
3023 10) verify that ping is successful
3024 11) Verify that flow is being added in ovs-switch in compute-node.
3025 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3026 13) Verify that cord-onos pushed flows to OVS switch.
3027 """
3028 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003029
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003030 def test_cordvtn_creating_virtual_vlan_interface_floating_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003031
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003032 """
3033 Algo:
3034 1) Validate that required openstack service is up and running.
3035 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3036 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3037 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3038 4) Now boot image in the same created network using nova boot image command (example given below :-
3039 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3040 5) Wait till VM boots up and starts running.
3041 6) Verify that a VM is launched and running by using novaclient python API.
3042 7) Create a virtual interface with vlan tag and public floating ip on VM.
3043 8) Create a same virtual interface with valn tag and any pulic floating ip on head node.
3044 9) Now ping to the VM from head node network which are launched a openstack service.
3045 10) verify that ping is successful
3046 11) Verify that flow is being added in ovs-switch in compute-node.
3047 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3048 13) Verify that cord-onos pushed flows to OVS switch.
3049 """
3050 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003051
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003052 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08003053
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003054 """
3055 Algo:
3056 1) Validate that required openstack service is up and running.
3057 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3058 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3059 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3060 4) Now boot image in the same created network using nova boot image command (example given below :-
3061 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
3062 5) Wait till VM boots up and starts running.
3063 6) Verify that a VM is launched and running by using novaclient python API.
3064 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3065 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3066 9) Now ping to the VM from head node network which are launched a openstack service.
3067 10) verify that ping is successful
3068 11) Verify that flow is being added in ovs-switch in compute-node.
3069 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3070 13) Verify that cord-onos pushed flows to OVS switch.
3071 """
3072 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003073
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003074 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 -08003075
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003076 """
3077 Algo:
3078 1) Validate that required openstack service is up and running.
3079 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3080 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3081 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3082 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3083 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3084 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3085 5) Wait till VMs boot up and running.
3086 6) Verify that two VMs are launched and running by using novaclient python API.
3087 7) Now ping to the VM from other VM which are launched in the private network
3088 8) verify that ping is not successful
3089 9) Verify that flow is being added in ovs-switch in compute-node.
3090 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3091 11) Verify that cord-onos pushed flows to OVS switch.
3092 """
3093 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08003094
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003095 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 -08003096
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003097 """
3098 Algo:
3099 1) Validate that required openstack service is up and running.
3100 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3101 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3102 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3103 4) Now boot two images in the same created network using nova boot image command (example given below :-
3104 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
3105 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
3106 5) Wait till VMs boot up and running.
3107 6) Verify that two VMs are launched and running by using novaclient python API.
3108 7) Now ping to the VM from other VM which are launched in the private network
3109 8) verify that ping is not successful
3110 9) Verify that flow is being added in ovs-switch in compute-node.
3111 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3112 11) Verify that cord-onos pushed flows to OVS switch.
3113 """
3114 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08003115
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003116 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 -08003117
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00003118 """
3119 Algo:
3120 1) Validate that required openstack service is up and running.
3121 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3122 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3123 (neutron port-create net-A-private --name stag-100).
3124 4) Now boot two images in the same created network using nova boot image command (example given below :-
3125 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3126 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3127 5) Wait till VMs boot up and running.
3128 6) Verify that two VMs are launched and running by using novaclient python API.
3129 7) Now ping to the VM from other VM which are launched in the private network
3130 8) verify that ping is not successful
3131 9) Verify that flow is being added in ovs-switch in compute-node.
3132 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3133 11) Verify that cord-onos pushed flows to OVS switch.
3134 """
3135 pass
3136
3137 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):
3138
3139 """
3140 Algo:
3141 1) Validate that required openstack service is up and running.
3142 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3143 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3144 (neutron port-create net-A-private --name stag-500).
3145 4) Now boot two images in the same created network using nova boot image command (example given below :-
3146 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3147 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3148 5) Wait till VMs boot up and running.
3149 6) Verify that two VMs are launched and running by using novaclient python API.
3150 7) Now ping to the VM from other VM which are launched in the private network
3151 8) verify that ping is not successful
3152 9) Verify that flow is being added in ovs-switch in compute-node.
3153 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3154 11) Verify that cord-onos pushed flows to OVS switch.
3155 """
3156 pass
3157
3158 def test_cordvtn_creating_one_virtual_local_management_other_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3159
3160 """
3161 Algo:
3162 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 local management network.
3165 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3166 4) Now boot two 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 --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 --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 the public 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
3178
3179 def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3180
3181 """
3182 Algo:
3183 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 a vlan port-create.
3186 (neutron port-create net-A-private --name stag-100).
3187 4) Now boot two images in the same created network using nova boot image command (example given below :-
3188 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3189 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
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 the public 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
3199
3200 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):
3201
3202 """
3203 Algo:
3204 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 floating ip and vlan port-create.
3207 (neutron port-create net-A-private --name stag-500).
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-02
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 the public 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
3220
3221 def test_cordvtn_creating_one_virtual_vlan_connectivity_other_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
3222
3223 """
3224 Algo:
3225 1) Validate that required openstack service is up and running.
3226 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3227 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
3228 (neutron port-create net-A-private --name stag-100).
3229 4) Now boot two images in the same created network using nova boot image command (example given below :-
3230 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3231 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3232 5) Wait till VMs boot up and running.
3233 6) Verify that two VMs are launched and running by using novaclient python API.
3234 7) Now ping to the VM from other VM which are launched in the public network
3235 8) verify that ping is not successful
3236 9) Verify that flow is being added in ovs-switch in compute-node.
3237 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3238 11) Verify that cord-onos pushed flows to OVS switch.
3239 """
3240 pass
3241
3242 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):
3243
3244 """
3245 Algo:
3246 1) Validate that required openstack service is up and running.
3247 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3248 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3249 (neutron port-create net-A-private --name stag-500).
3250 4) Now boot two images in the same created network using nova boot image command (example given below :-
3251 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3252 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3253 5) Wait till VMs boot up and running.
3254 6) Verify that two VMs are launched and running by using novaclient python API.
3255 7) Now ping to the VM from other VM which are launched in the public network
3256 8) verify that ping is not successful
3257 9) Verify that flow is being added in ovs-switch in compute-node.
3258 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3259 11) Verify that cord-onos pushed flows to OVS switch.
3260 """
3261 pass
3262
3263 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):
3264
3265 """
3266 Algo:
3267 1) Validate that required openstack service is up and running.
3268 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3269 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
3270 (neutron port-create net-A-private --name stag-500).
3271 4) Now boot two images in the same created network using nova boot image command (example given below :-
3272 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3273 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3274 5) Wait till VMs boot up and running.
3275 6) Verify that two VMs are launched and running by using novaclient python API.
3276 7) Now ping to the VM from other VM which are launched in the public network
3277 8) verify that ping is not successful
3278 9) Verify that flow is being added in ovs-switch in compute-node.
3279 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3280 11) Verify that cord-onos pushed flows to OVS switch.
3281 """
3282 pass
3283
3284 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_with_invalid_public_field_of_onos_network_cfg_json_in_same_service(self):
3285 """
3286 Algo:
3287 1) Validate that required openstack service is up and running.
3288 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3289 3) Push network_cfg.json config file to onos with an invalid public gateway ip in network_cfg.json file.
3290 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3291 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3292 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3293 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3294 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3295 6) Wait till VMs boot up and running.
3296 7) Verify that two VMs are launched and running by using novaclient python API.
3297 8) Verify that flow is being added in ovs-switch in compute-node.
3298 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3299 10) Verify that cord-onos pushed flows to OVS switch.
3300 11) Verify ping from VM to public gateway which is send to ONOS through rest API in network_cfg.json file.
3301 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.
3302 13) Now ping one VM to other VM it should not ping again even it in the same service.
3303 """
3304 pass
3305
3306 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_with_invalid_localManagementIp_field_of_onos_network_cfg_json(self):
3307
3308 """
3309 Algo:
3310 1) Validate that required openstack service is up and running.
3311 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3312 3) Push network_cfg.json config file to onos with an invalid localManagement ip in network_cfg.json file.
3313 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3314 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3315 5) Now boot image in the same created network using nova boot image command (example given below :-
3316 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
3317 6) Wait till VM boots up and starts running.
3318 7) Verify that a VM is launched and running by using novaclient python API.
3319 8) Verify that flow is being added in ovs-switch in compute-node.
3320 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3321 10) Verify that cord-onos pushed flows to OVS switch.
3322 11) Verify ping from VM to local management ip which is send to ONOS through rest API in network_cfg.json file.
3323 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.
3324 """
3325 pass
3326
3327 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OVSDB_port_field_of_onos_network_cfg_json(self):
3328 """
3329 Algo:
3330 1) Validate that required openstack service is up and running.
3331 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3332 3) Push network_cfg.json config file to onos with an invalid ovsdb port in network_cfg.json file.
3333 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3334 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3335 4) Now boot image in the same created network using nova boot image command (example given below :-
3336 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3337 5) Wait till VM boots up and starts running.
3338 6) Verify that a VM is launched and running by using novaclient python API.
3339 7) Verify that flows are being added in ovs-switch in compute-node.
3340 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3341 9) Verify that cord-onos did not push any flows to OVS switch.
3342 """
3343 pass
3344
3345 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OpenStack_details_in_onos_network_cfg_json(self):
3346 """
3347 Algo:
3348 1) Validate that required openstack service is up and running.
3349 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3350 3) Push network_cfg.json config file to onos with an invalid openstack in network_cfg.json file.
3351 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3352 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3353 4) Now boot image in the same created network using nova boot image command (example given below :-
3354 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3355 5) Wait till VM boots up and starts running.
3356 6) Verify that a VM is launched and running by using novaclient python API.
3357 7) Verify that no flows are being added in ovs-switch in compute-node.
3358 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
3359 9) Verify that cord-onos did not push any flows to OVS switch.
3360 """
3361 pass
3362
3363 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_compute_node_details_in_onos_network_cfg_json(self):
3364 """
3365 Algo:
3366 1) Validate that required openstack service is up and running.
3367 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3368 3) Push network_cfg.json config file to onos with an invalid compute node details in network_cfg.json file.
3369 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3370 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3371 4) Now boot image in the same created network using nova boot image command (example given below :-
3372 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3373 5) Wait till VM boots up and starts running.
3374 6) Verify that a VM is launched and running by using novaclient python API.
3375 7) Verify that no flows are being added in ovs-switch in compute-node.
3376 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
3377 9) Verify that cord-onos did not push any flows to OVS switch.
3378 """
3379 pass
3380
3381
3382 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_in_different_services_connectivity(self):
3383 """
3384 Algo:
3385 1) Validate that required openstack service is up and running.
3386 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3387 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as private network.
3388 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3389 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3390 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3391 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3392 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3393 5) Wait till VMs boot up and running.
3394 6) Verify that two VMs are launched and running by using novaclient python API.
3395 7) Verify that flow is being added in ovs-switch in compute-node.
3396 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3397 9) Verify that cord-onos pushed flows to OVS switch.
3398 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3399 11) Verify that no flows are being added in the OVS switch.
3400 """
3401 pass
3402
3403 def test_cordvtn_creating_two_virtual_public_networks_and_boot_images_in_different_service_connectivity(self):
3404 """
3405 Algo:
3406 1) Validate that required openstack service is up and running.
3407 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3408 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as public network.
3409 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3410 (neutron net-create net-A-public, neutron subnet-create net-B-public 198.1.0.0/24).
3411 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3412 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3413 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3414 5) Wait till VMs boot up and running.
3415 6) Verify that two VMs are launched and running by using novaclient python API.
3416 7) Verify that flow is being added in ovs-switch in compute-node.
3417 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3418 9) Verify that cord-onos pushed flows to OVS switch.
3419 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3420 11) Verify that no flows are being added in the OVS switch.
3421 """
3422 pass
3423
3424 def test_cordvtn_creating_two_virtual_local_management_networks_and_boot_images_in_different_service_connectivity(self):
3425 """
3426 Algo:
3427 1) Validate that required openstack service is up and running.
3428 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3429 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.
3430 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3431 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.28.0.0/24 -gateway 172.28.0.1).
3432 4) Now boot two images in the same created network using nova boot image command (example given below :-
3433 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
3434 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
3435 5) Wait till VMs boot up and running.
3436 6) Verify that two VMs are launched and running by using novaclient python API.
3437 7) Verify that flow is being added in ovs-switch in compute-node.
3438 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3439 9) Verify that cord-onos pushed flows to OVS switch.
3440 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3441 11) Verify that no flows are being added in the OVS switch.
3442 """
3443 pass
3444
3445 def test_cordvtn_creating_two_virtual_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
3446 """
3447 Algo:
3448 1) Validate that required openstack service is up and running.
3449 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3450 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with a vlan port-create.
3451 (neutron port-create net-A-private --name stag-100).
3452 (neutron port-create net-B-private --name stag-200).
3453 4) Now boot two images in the same created network using nova boot image command (example given below :-
3454 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3455 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg1-01
3456 5) Wait till VMs boot up and running.
3457 6) Verify that two VMs are launched and running by using novaclient python API.
3458 7) Verify that flow is being added in ovs-switch in compute-node.
3459 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3460 9) Verify that cord-onos pushed flows to OVS switch.
3461 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3462 11) Verify that no flows are being added in the OVS switch.
3463 """
3464 pass
3465 def test_cordvtn_creating_two_virtual_floating_IP_with_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
3466 """
3467 Algo:
3468 1) Validate that required openstack service is up and running.
3469 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3470 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.
3471 (neutron port-create net-A-private --name stag-500).
3472 (neutron port-create net-B-private --name stag-500).
3473 4) Now boot two images in the same created network using nova boot image command (example given below :-
3474 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
3475 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
3476 5) Wait till VMs boot up and running.
3477 6) Verify that two VMs are launched and running by using novaclient python API.
3478 7) Verify that flow is being added in ovs-switch in compute-node.
3479 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3480 9) Verify that cord-onos pushed flows to OVS switch.
3481 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3482 11) Verify that no flows are being added in the OVS switch.
3483 """
3484 pass
3485
3486 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_direct_access(self):
3487 """
3488 Algo:
3489 1) Validate that required openstack service is up and running.
3490 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3491 3) Push service dependency data.json file to onos to subscriber of other service.
3492 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3493 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3494 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3495 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3496 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3497 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3498 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3499 6) Wait till VMs boot up and running.
3500 7) Verify that two VMs are launched and running by using novaclient python API.
3501 8) Verify that flow is being added in ovs-switch in compute-node.
3502 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3503 10) Verify that cord-onos pushed flows to OVS switch.
3504 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
3505 12) Verify that flows are being added in the OVS switch.
3506 """
3507 pass
3508
3509 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_indirect_access(self):
3510 """
3511 Algo:
3512 1) Validate that required openstack service is up and running.
3513 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3514 3) Push service dependency data.json file to onos to subscriber of other service.
3515 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3516 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3517 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3518 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3519 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3520 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3521 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3522 6) Wait till VMs boot up and running.
3523 7) Verify that two VMs are launched and running by using novaclient python API.
3524 8) Verify that flow is being added in ovs-switch in compute-node.
3525 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3526 10) Verify that cord-onos pushed flows to OVS switch.
3527 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.
3528 12) Verify that flows are being added in the OVS switch.
3529 """
3530 pass
3531
3532 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_direct_access(self):
3533 """
3534 Algo:
3535 1) Validate that required openstack service is up and running.
3536 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3537 3) Push service dependency data.json file to onos to subscriber of other service.
3538 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3539 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3540 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3541 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3542 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3543 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3544 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3545 6) Wait till VMs boot up and running.
3546 7) Verify that two VMs are launched and running by using novaclient python API.
3547 8) Verify that flow is being added in ovs-switch in compute-node.
3548 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3549 10) Verify that cord-onos pushed flows to OVS switch.
3550 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
3551 12) Verify that flows are being added in the OVS switch.
3552 13) Push config data with outservice dependency in data.json file to onos to subscriber of other service.
3553 14) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3554 15) Verify that no flows are being added in the OVS switch.
3555 """
3556 pass
3557
3558 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_indirect_access(self):
3559 """
3560 Algo:
3561 1) Validate that required openstack service is up and running.
3562 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3563 3) Push service dependency data.json file to onos to subscriber of other service.
3564 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3565 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3566 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3567 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3568 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3569 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3570 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3571 6) Wait till VMs boot up and running.
3572 7) Verify that two VMs are launched and running by using novaclient python API.
3573 8) Verify that flow is being added in ovs-switch in compute-node.
3574 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3575 10) Verify that cord-onos pushed flows to OVS switch.
3576 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.
3577 12) Verify that flows are being added in the OVS switch.
3578 13) Push config data with out service dependency in data.json file to onos to subscriber of other service.
3579 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.
3580 15) Verify that no flows are being added in the OVS switch.
3581 """
3582 pass
3583
3584 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_direct_access(self):
3585 """
3586 Algo:
3587 1) Validate that required openstack service is up and running.
3588 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3589 3) Validate that XOS is up and running.
3590 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3591 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3592 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3593 5) Now boot 2 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 net-A-vm-01
3595 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3596 6) Wait till VMs boot up and running.
3597 7) Verify that two VMs are launched and running by using novaclient python API.
3598 8) Verify that flow is being added in ovs-switch in compute-node.
3599 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3600 10) Verify that cord-onos pushed flows to OVS switch.
3601 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
3602 12) Verify that flows are being added in the OVS switch.
3603 """
3604 pass
3605
3606 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_indirect_access(self):
3607 """
3608 Algo:
3609 1) Validate that required openstack service is up and running.
3610 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3611 3) Validate that XOS is up and running.
3612 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3613 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3614 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3615 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3616 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3617 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3618 6) Wait till VMs boot up and running.
3619 7) Verify that two VMs are launched and running by using novaclient python API.
3620 8) Verify that flow is being added in ovs-switch in compute-node.
3621 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3622 10) Verify that cord-onos pushed flows to OVS switch.
3623 11) Now ping from VM which is Net-B to other VM which is in Net-A, should ping.
3624 12) Verify that flows are being added in the OVS switch.
3625 """
3626 pass
3627
3628 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_network_cfg_connectivity_to_access_device(self):
3629 """
3630 Algo:
3631 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) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
3634 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3635 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3636 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3637 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3638 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3639 6) We ahve to stop ONOS service to test this
3640 onos-service stop
3641 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3642 7) Now attach to access-agent container and ping to access-device
3643 8) Verify that ping should be success and flows are being added in br-int.
3644 """
3645 pass
3646
3647 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
3648 """
3649 Algo:
3650 1) Validate that required openstack service is up and running.
3651 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3652 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
3653 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3654 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3655 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3656 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3657 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3658 6) We ahve to stop ONOS service to test this
3659 onos-service stop
3660 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3661 7) Now attach to access-agent container and ping to head node
3662 8) Verify that ping should be success and flows are being added in br-int.
3663 """
3664 pass
3665
3666 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_network_cfg_connectivity_to_access_device(self):
3667 """
3668 Algo:
3669 1) Validate that required openstack service is up and running.
3670 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3671 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
3672 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3673 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3674 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3675 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3676 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3677 6) We ahve to stop ONOS service to test this
3678 onos-service stop
3679 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3680 7) Now attach to access-agent container and ping to access-device
3681 8) Verify that ping should not be success and no flows are being added in br-int.
3682 """
3683 pass
3684
3685 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
3686 """
3687 Algo:
3688 1) Validate that required openstack service is up and running.
3689 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3690 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
3691 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3692 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3693 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3694 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3695 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3696 6) We ahve to stop ONOS service to test this
3697 onos-service stop
3698 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3699 7) Now attach to access-agent container and ping to head node
3700 8) Verify that ping should not be success and no flows are being added in br-int.
3701 """
3702 pass
3703
3704 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_VMs(self):
3705 """
3706 Algo:
3707 1) Validate that required openstack service is up and running.
3708 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3709 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3710 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3711 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3712 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3713 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3714 5) Wait till VMs boot up and running.
3715 6) Verify that two VMs are launched and running by using novaclient python API.
3716 7) Now ping to the VM from other VM which are launched in same network
3717 8) verify that ping is successful
3718 9) Verify that flow is being added in ovs-switch in compute-node.
3719 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3720 11) Verify that cord-onos pushed flows to OVS switch.
3721 12) Restart both VMs in same service and repeat steps 7 to 11.
3722 """
3723 pass
3724
3725 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_cord_onos(self):
3726 """
3727 Algo:
3728 1) Validate that required openstack service is up and running.
3729 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3730 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3731 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3732 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3733 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3734 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3735 5) Wait till VMs boot up and running.
3736 6) Verify that two VMs are launched and running by using novaclient python API.
3737 7) Now ping to the VM from other VM which are launched in same network
3738 8) verify that ping is successful
3739 9) Verify that flow is being added in ovs-switch in compute-node.
3740 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3741 11) Verify that cord-onos pushed flows to OVS switch.
3742 12) Restart ONOS service and repeat steps 7 to 11.
3743 """
3744 pass
3745
3746 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_any_VM_recreating_it(self):
3747 """
3748 Algo:
3749 1) Validate that required openstack service is up and running.
3750 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3751 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3752 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3753 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3754 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3755 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3756 5) Wait till VMs boot up and running.
3757 6) Verify that two VMs are launched and running by using novaclient python API.
3758 7) Now ping to the VM from other VM which are launched in same network
3759 8) verify that ping is successful
3760 9) Verify that flow is being added in ovs-switch in compute-node.
3761 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3762 11) Verify that cord-onos pushed flows to OVS switch.
3763 12) Delete a VM which was created earlier and repeat steps 4 to 11.
3764 """
3765 pass
3766
3767 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_and_add_br_int_bridge(self):
3768 """
3769 Algo:
3770 1) Validate that required openstack service is up and running.
3771 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3772 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3773 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3774 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3775 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3776 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3777 5) Wait till VMs boot up and running.
3778 6) Verify that two VMs are launched and running by using novaclient python API.
3779 7) Now ping to the VM from other VM which are launched in same network
3780 8) verify that ping is successful
3781 9) Verify that flow is being added in ovs-switch in compute-node.
3782 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3783 11) Verify that cord-onos pushed flows to OVS switch.
3784 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3785 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3786 """
3787 pass
3788
3789 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_VM(self):
3790
3791 """
3792 Algo:
3793 1) Validate that required openstack service is up and running.
3794 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3795 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3796 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3797 4) Now boot image in the same created network using nova boot image command (example given below :-
3798 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3799 5) Wait till VM boots up and starts running.
3800 6) Verify that a VM is launched and running by using novaclient python API.
3801 7) Now ping to the VM from outside network which are internet network (global ping)
3802 8) verify that ping is successful
3803 9) Verify that flow is being added in ovs-switch in compute-node.
3804 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3805 11) Verify that cord-onos pushed flows to OVS switch.
3806 12) Restart the VM in service and repeat steps 7 to 11.
3807
3808 """
3809 pass
3810
3811 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3812
3813 """
3814 Algo:
3815 1) Validate that required openstack service is up and running.
3816 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3817 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3818 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3819 4) Now boot image in the same created network using nova boot image command (example given below :-
3820 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3821 5) Wait till VM boots up and starts running.
3822 6) Verify that a VM is launched and running by using novaclient python API.
3823 7) Now ping to the VM from outside network which are internet network (global ping)
3824 8) verify that ping is successful
3825 9) Verify that flow is being added in ovs-switch in compute-node.
3826 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3827 11) Verify that cord-onos pushed flows to OVS switch.
3828 12) Restart onos service container and repeat steps 7 to 11.
3829
3830 """
3831 pass
3832
3833 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3834
3835 """
3836 Algo:
3837 1) Validate that required openstack service is up and running.
3838 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3839 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3840 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3841 4) Now boot image in the same created network using nova boot image command (example given below :-
3842 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3843 5) Wait till VM boots up and starts running.
3844 6) Verify that a VM is launched and running by using novaclient python API.
3845 7) Now ping to the VM from outside network which are internet network (global ping)
3846 8) verify that ping is successful
3847 9) Verify that flow is being added in ovs-switch in compute-node.
3848 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3849 11) Verify that cord-onos pushed flows to OVS switch.
3850 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
3851
3852 """
3853 pass
3854
3855 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3856
3857 """
3858 Algo:
3859 1) Validate that required openstack service is up and running.
3860 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3861 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3862 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3863 4) Now boot image in the same created network using nova boot image command (example given below :-
3864 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3865 5) Wait till VM boots up and starts running.
3866 6) Verify that a VM is launched and running by using novaclient python API.
3867 7) Now ping to the VM from outside network which are internet network (global ping)
3868 8) verify that ping is successful
3869 9) Verify that flow is being added in ovs-switch in compute-node.
3870 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3871 11) Verify that cord-onos pushed flows to OVS switch.
3872 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3873 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3874
3875 """
3876 pass
3877
3878 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3879
3880 """
3881 Algo:
3882 1) Validate that required openstack service is up and running.
3883 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3884 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3885 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3886 4) Now boot image in the same created network using nova boot image command (example given below :-
3887 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
3888 5) Wait till VM boots up and starts running.
3889 6) Verify that a VM is launched and running by using novaclient python API.
3890 7) Now ping to the VM from compute node network which are launched a VM.
3891 8) verify that ping is successful
3892 9) Verify that flow is being added in ovs-switch in compute-node.
3893 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3894 11) Verify that cord-onos pushed flows to OVS switch.
3895 12) Restart the VM in service and repeat steps 7 to 11.
3896 """
3897 pass
3898
3899 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3900
3901 """
3902 Algo:
3903 1) Validate that required openstack service is up and running.
3904 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3905 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3906 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3907 4) Now boot image in the same created network using nova boot image command (example given below :-
3908 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
3909 5) Wait till VM boots up and starts running.
3910 6) Verify that a VM is launched and running by using novaclient python API.
3911 7) Now ping to the VM from compute node network which are launched a VM.
3912 8) verify that ping is successful
3913 9) Verify that flow is being added in ovs-switch in compute-node.
3914 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3915 11) Verify that cord-onos pushed flows to OVS switch.
3916 12) Restart the onos service and repeat steps 7 to 11.
3917 """
3918 pass
3919
3920 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3921
3922 """
3923 Algo:
3924 1) Validate that required openstack service is up and running.
3925 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3926 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3927 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3928 4) Now boot image in the same created network using nova boot image command (example given below :-
3929 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
3930 5) Wait till VM boots up and starts running.
3931 6) Verify that a VM is launched and running by using novaclient python API.
3932 7) Now ping to the VM from compute node network which are launched a VM.
3933 8) verify that ping is successful
3934 9) Verify that flow is being added in ovs-switch in compute-node.
3935 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3936 11) Verify that cord-onos pushed flows to OVS switch.
3937 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
3938 """
3939 pass
3940
3941 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3942
3943 """
3944 Algo:
3945 1) Validate that required openstack service is up and running.
3946 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3947 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3948 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3949 4) Now boot image in the same created network using nova boot image command (example given below :-
3950 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
3951 5) Wait till VM boots up and starts running.
3952 6) Verify that a VM is launched and running by using novaclient python API.
3953 7) Now ping to the VM from compute node network which are launched a VM.
3954 8) verify that ping is successful
3955 9) Verify that flow is being added in ovs-switch in compute-node.
3956 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3957 11) Verify that cord-onos pushed flows to OVS switch.
3958 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3959 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3960 """
3961 pass
3962
3963 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3964
3965 """
3966 Algo:
3967 1) Validate that required openstack service is up and running.
3968 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3969 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3970 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3971 4) Now boot image in the same created network using nova boot image command (example given below :-
3972 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
3973 5) Wait till VM boots up and starts running.
3974 6) Verify that a VM is launched and running by using novaclient python API.
3975 7) Create a virtual interface with vlan tag and local management ip on VM.
3976 8) Create a same virtual interface with valn tag and any local management ip on head node.
3977 9) Now ping to the VM from head node network which are launched a openstack service.
3978 10) verify that ping is successful
3979 11) Verify that flow is being added in ovs-switch in compute-node.
3980 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3981 13) Verify that cord-onos pushed flows to OVS switch.
3982 14) Restart the VM in service and repeat steps 9 to 13.
3983
3984 """
3985 pass
3986
3987 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3988
3989 """
3990 Algo:
3991 1) Validate that required openstack service is up and running.
3992 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3993 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3994 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3995 4) Now boot image in the same created network using nova boot image command (example given below :-
3996 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
3997 5) Wait till VM boots up and starts running.
3998 6) Verify that a VM is launched and running by using novaclient python API.
3999 7) Create a virtual interface with vlan tag and local management ip on VM.
4000 8) Create a same virtual interface with valn tag and any local management ip on head node.
4001 9) Now ping to the VM from head node network which are launched a openstack service.
4002 10) verify that ping is successful
4003 11) Verify that flow is being added in ovs-switch in compute-node.
4004 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4005 13) Verify that cord-onos pushed flows to OVS switch.
4006 14) Restart the ONOS service and repeat steps 9 to 13.
4007
4008 """
4009 pass
4010
4011 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
4012
4013 """
4014 Algo:
4015 1) Validate that required openstack service is up and running.
4016 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4017 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4018 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4019 4) Now boot image in the same created network using nova boot image command (example given below :-
4020 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
4021 5) Wait till VM boots up and starts running.
4022 6) Verify that a VM is launched and running by using novaclient python API.
4023 7) Create a virtual interface with vlan tag and local management ip on VM.
4024 8) Create a same virtual interface with valn tag and any local management ip on head node.
4025 9) Now ping to the VM from head node network which are launched a openstack service.
4026 10) verify that ping is successful
4027 11) Verify that flow is being added in ovs-switch in compute-node.
4028 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4029 13) Verify that cord-onos pushed flows to OVS switch.
4030 14) Delete and re-create a VM in service and repeat steps 9 to 13.
4031
4032 """
4033 pass
4034
4035 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
4036
4037 """
4038 Algo:
4039 1) Validate that required openstack service is up and running.
4040 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4041 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4042 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4043 4) Now boot image in the same created network using nova boot image command (example given below :-
4044 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
4045 5) Wait till VM boots up and starts running.
4046 6) Verify that a VM is launched and running by using novaclient python API.
4047 7) Create a virtual interface with vlan tag and local management ip on VM.
4048 8) Create a same virtual interface with valn tag and any local management ip on head node.
4049 9) Now ping to the VM from head node network which are launched a openstack service.
4050 10) verify that ping is successful
4051 11) Verify that flow is being added in ovs-switch in compute-node.
4052 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4053 13) Verify that cord-onos pushed flows to OVS switch.
4054 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
4055 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
4056
4057 """
4058 pass
4059
4060 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
4061
4062 """
4063 Algo:
4064 1) Validate that required openstack service is up and running.
4065 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4066 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4067 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4068 4) Now boot image in the same created network using nova boot image command (example given below :-
4069 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
4070 5) Wait till VM boots up and starts running.
4071 6) Verify that a VM is launched and running by using novaclient python API.
4072 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4073 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4074 9) Now ping to the VM from head node network which are launched a openstack service.
4075 10) verify that ping is successful
4076 11) Verify that flow is being added in ovs-switch in compute-node.
4077 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4078 13) Verify that cord-onos pushed flows to OVS switch.
4079 14) Restart the VM in service and repeat steps 9 to 13.
4080 """
4081 pass
4082
4083 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
4084
4085 """
4086 Algo:
4087 1) Validate that required openstack service is up and running.
4088 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4089 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4090 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4091 4) Now boot image in the same created network using nova boot image command (example given below :-
4092 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
4093 5) Wait till VM boots up and starts running.
4094 6) Verify that a VM is launched and running by using novaclient python API.
4095 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4096 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4097 9) Now ping to the VM from head node network which are launched a openstack service.
4098 10) verify that ping is successful
4099 11) Verify that flow is being added in ovs-switch in compute-node.
4100 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4101 13) Verify that cord-onos pushed flows to OVS switch.
4102 14) Restart the ONOS service and repeat steps 9 to 13.
4103 """
4104 pass
4105
4106 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
4107 """
4108 Algo:
4109 1) Validate that required openstack service is up and running.
4110 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4111 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4112 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4113 4) Now boot image in the same created network using nova boot image command (example given below :-
4114 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
4115 5) Wait till VM boots up and starts running.
4116 6) Verify that a VM is launched and running by using novaclient python API.
4117 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4118 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4119 9) Now ping to the VM from head node network which are launched a openstack service.
4120 10) verify that ping is successful
4121 11) Verify that flow is being added in ovs-switch in compute-node.
4122 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4123 13) Verify that cord-onos pushed flows to OVS switch.
4124 14) Delete and re-create a VM in service and repeat steps 9 to 13.
4125 """
4126 pass
4127
4128 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
4129
4130 """
4131 Algo:
4132 1) Validate that required openstack service is up and running.
4133 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
4134 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
4135 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
4136 4) Now boot image in the same created network using nova boot image command (example given below :-
4137 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
4138 5) Wait till VM boots up and starts running.
4139 6) Verify that a VM is launched and running by using novaclient python API.
4140 7) Create a virtual interface with vlan tag and local management floating ip on VM.
4141 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
4142 9) Now ping to the VM from head node network which are launched a openstack service.
4143 10) verify that ping is successful
4144 11) Verify that flow is being added in ovs-switch in compute-node.
4145 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
4146 13) Verify that cord-onos pushed flows to OVS switch.
4147 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
4148 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
4149 """
4150 pass