blob: edcedc0421a44d9489c2d4d1482784b82e89e515 [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
Chetan Gaonkerea4d9902017-04-05 18:25:43 -050022#import novaclient.v1_1.client as novaclient
23from 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 Karthickbe7768c2017-03-17 11:39:41 -070028from CordTestUtils import get_mac
29from 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
Chetan Gaonker09b77ae2017-03-08 01:44:25 +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:
139 log.info('JSON request returned status %d' %code)
140 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)
156 print novaclient.hypervisors.list()
157 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)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800167 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:
170 print e
171 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
186 print " Tenant and User Created"
187
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:
446 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:
462 print "Network creation is successful"
463 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):
563 image = nova_obj.images.find(name=image_name)
564 flavor = nova_obj.flavors.find(name=flavor_id)
565 network = nova_obj.networks.find(label=net_name)
566 print network.id
567
568 server = nova_obj.servers.create(name = instance_name,
569 image = image.id,
570 flavor = flavor.id,
571 nics = [{'net-id':network.id}])
572 server_details = nova_obj.servers.find(id=server.id)
573 print('Server is launched and status is %s' %server_details.status)
574 if server_details.status == 'BUILD':
575 time.sleep(20)
576 server_details = nova_obj.servers.find(id=server.id)
577 print('After delay server status is %s state'%server_details.status)
578 if server_details.status == 'ERROR':
579 print('Server status is still in %s state'%server_details.status)
580 return server_details
581
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000582 def create_net_subnet_nova_instance(self,net_name, subnet_name, instance_vm_details,management_type):
583 result = self.neutron_network_creation_and_validation(net_name)
584 assert_equal(result, True)
585 neutron_creds = self.get_neutron_credentials()
586 neutron = neutronclient.Client(**neutron_creds)
587 networks = neutron.list_networks(name=net_name)
588 network_id = self.get_key_value(d=networks, key = 'id')
589 sub_result = self.neutron_subnet_creation_and_validation(net_name,subnet_name)# sub_net_start = subnet_name[2], sub_net_end =subnet_name[3])
590 assert_equal(sub_result[0], True)
591 net_type_post = self.sub_network_type_post_to_onos(net_name, management_type)
592 creds = get_nova_credentials()
593 nova = nova_client.Client('2', **creds)
594 new_instance_details = self.nova_instance_creation_and_validation(net_name,nova,instance_vm_details[0],instance_vm_details[1],instance_vm_details[2])
595 #assert_equal(new_instance_details.status, 'ACTIVE')
596 return [nova, new_instance_details]
597
598 def nova_instance_tenants_access_check(self, target_tenants_details, compute_details = None, source_tenants_details = None , check_type = 'Ping_from_compute'):
599 source_tenant_ip = ''
600 target_tenant_ip = ''
601 cmd = ''
602 status = ''
603 output = ''
604
605 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
606 if compute_details is None:
607 compute_ip = '10.1.0.17'
608 else:
609 compute_ip = compute_details.ip
610
611 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
612 if target_tenants_details.addresses == {}:
613 target_tenants_details.addresses = '10.1.0.1'
614
615 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
616 if source_tenants_details is not None:
617 if source_tenants_details.addresses == {}:
618 source_tenants_details.addresses = '10.1.0.1'
619
620 if check_type == "Ping_from_compute":
621 cmd = "ping -c 3 {0}".format(target_tenants_details.addresses)
622 ssh_agent = SSHTestAgent(host = compute_ip)
623 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
624
625 if source_tenants_details is not None:
626 if check_type == "Ping_from_source_tenant":
627 cmd = "ping -c 3 {0}".format(target_tenants_details.addresses)
628 ssh_cmd = 'ssh {} {}'.format(source_tenants_details.addresses, cmd)
629 print ssh_cmd
630 ssh_agent = SSHTestAgent(host = compute_ip)
631 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
632
633 if check_type == "Ping_to_external":
634 cmd = "ping -c 3 google.com"
635 ssh_agent = SSHTestAgent(host = compute_ip)
636 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
637
638 if status == True and output:
639 print "Ping is successful"
640 output = output.strip()
641 else:
642 print "Ping is not successful"
643 output = None
644 return [status, output]
645
646
Thangavelu K S3698fad2017-03-24 17:50:14 +0000647 def nova_instance_deletion(self, nova_obj, server_details):
648 results_nova_instance_deletion=nova_obj.servers.delete(server_details.id)
649 if results_nova_instance_deletion == None:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000650 print"Nova instance is deleted"
Thangavelu K S3698fad2017-03-24 17:50:14 +0000651 else:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000652 print"Nova instance is not deleted"
Thangavelu K S3698fad2017-03-24 17:50:14 +0000653 return results_nova_instance_deletion
Thangavelu K Saea3c672017-03-15 18:57:05 +0000654
655 def test_cordvtn_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
656 """
657 Algo:
658 0. Create vtn_test_1_net.
659 1. Do GET Rest API and validate creation of network.
660 2. Validate network on neutron openstack.
661 """
662 result = self.neutron_network_creation_and_validation('vtn_test_1_net')
663 if result is True:
664 self.neutron_network_deletion('vtn_test_1_net')
665 assert_equal(result, True)
666
667 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
668 """
669 Algo:
670 0. Create Test-Net,
671 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
672 2. Run sync command for cordvtn
673 3. Do GET Rest API and validate creation of network
674 4. Validate network synch with created network in cord-onos
675 """
676 creds = self.get_neutron_credentials()
677 neutron = neutronclient.Client(**creds)
678 body_example = {"network":{"name": "vtn_test_2_net","admin_state_up":True}}
679 net = neutron.create_network(body=body_example)
680 vtn_util = vtn_validation_utils('')
681 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
682 auth = ('karaf','karaf')
683
684 resp = requests.get(url=url, auth=auth)
685 data = json.loads(resp.text)
686 result = self.search_value(data, "vtn_test_2_net")
687 self.neutron_network_deletion('vtn_test_2_net')
688 assert_equal(result, True)
689
690 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_head_node_with_neutron_service(self):
691 """
692 Algo:
693 0. Create Test-Net,
694 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
695 2. Run sync command for cordvtn
696 3. Do GET Rest API and validate creation of network
697 4. Validate network synch with created network in cord-onos
698 """
699 result = self.neutron_network_creation_and_validation('vtn_test_3_net')
700 if result is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000701 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000702 assert_equal(result, True)
703 result_again = self.neutron_network_creation_and_validation('vtn_test_3_net')
704 if result_again is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000705 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000706 assert_equal(result, True)
707
708 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_onos(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 creds = self.get_neutron_credentials()
718 neutron = neutronclient.Client(**creds)
719 body_example = {"network":{"name": "vtn_test_4_net","admin_state_up":True}}
720 net = neutron.create_network(body=body_example)
721 vtn_util = vtn_validation_utils('')
722 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
723 auth = ('karaf','karaf')
724
725 resp = requests.get(url=url, auth=auth)
726 data = json.loads(resp.text)
727 result = self.search_value(data, "vtn_test_4_net")
728 assert_equal(result, True)
729 self.neutron_network_deletion('vtn_test_4_net')
730 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
731 auth = ('karaf','karaf')
732
733 resp = requests.get(url=url, auth=auth)
734 data = json.loads(resp.text)
735 result = self.search_value(data, "vtn_test_4_net")
736 assert_equal(result, False)
737 net = neutron.create_network(body=body_example)
738 vtn_util = vtn_validation_utils('')
739 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
740 auth = ('karaf','karaf')
741
742 resp = requests.get(url=url, auth=auth)
743 data = json.loads(resp.text)
744 result = self.search_value(data, "vtn_test_4_net")
745 self.neutron_network_deletion('vtn_test_4_net')
746 assert_equal(result, True)
747
748 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_head_node_with_neutron_service(self):
749 test_net_name = 'vtn_test_5_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000750 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 +0000751 result = self.neutron_network_creation_and_validation('vtn_test_5_net_management')
752 assert_equal(result, True)
753 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
754 if sub_result[0] is True:
755 self.neutron_network_deletion('vtn_test_5_net_management')
756 assert_equal(sub_result[0], True)
757
758 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_onos(self):
759 self.neutron_network_creation_and_validation('vtn_test_6_net_management')
760 creds = self.get_neutron_credentials()
761 neutron = neutronclient.Client(**creds)
762 networks = neutron.list_networks(name='vtn_test_6_net_management')
763 net_id = self.get_key_value(d=networks, key = 'id')
764 cidr = "172.27.0.0/24"
765 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"}]}}
766 neutron_sub = neutron.create_subnet(body_subnet_example)
767
768 vtn_util = vtn_validation_utils('')
769 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
770 auth = ('karaf','karaf')
771
772 resp = requests.get(url=url, auth=auth)
773 data = json.loads(resp.text)
774 for i in range(len(data['ServiceNetworks'])):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000775 if data['ServiceNetworks'][i]['name'] == 'vtn_test_6_net_management':
Thangavelu K Saea3c672017-03-15 18:57:05 +0000776 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
777 if sub_net_id[2] == " ":
778 log.info('Sub network is not successful')
779 self.neutron_network_deletion('vtn_test_6_net_management')
780 assert_equal(False, True)
781 break
782 elif sub_net_id[2] == cidr:
783 log.info('Sub network is successful')
784 self.neutron_network_deletion('vtn_test_6_net_management')
785 assert_equal(sub_net_id[0], True)
786 break
787
Thangavelu K S3698fad2017-03-24 17:50:14 +0000788 def test_cordvtn_neutron_management_network_creation_and_post_network_type_management_local_to_onos(self):
789 """
790 Algo:
791 0. Create Test-Net,
792 1. Cretae subnetwork whose ip is under management network
793 2. Run sync command for cordvtn
794 3. Do GET Rest API and validate creation of network
795 4. Pushed the network type as management local to onos
796 5. Verified that onos is having under management network
797 """
798 test_net_name = 'vtn_test_7_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000799 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 +0000800 test_management_type = "management_local"
801 result = self.neutron_network_creation_and_validation(test_net_name)
802 assert_equal(result, True)
803 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
804
805 vtn_util = vtn_validation_utils('')
806 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
807 auth = ('karaf','karaf')
808
809 resp = requests.get(url=url, auth=auth)
810 data = json.loads(resp.text)
811 for i in range(len(data['ServiceNetworks'])):
812 if data['ServiceNetworks'][i]['name'] == test_net_name:
813 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
814 if sub_net_id[2] == " ":
815 log.info('Sub network is not successful')
816 assert_equal(False, True)
817 break
818 elif sub_net_id[2] == test_sub_net_cidr[1]:
819 log.info('Sub network is successful')
820 assert_equal(sub_net_id[0], True)
821 break
822
823 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
824 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
825 net_type_json = json.loads(net_type_post.text)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000826 self.neutron_network_deletion(test_net_name)
827 assert_equal(net_type_json['message'], 'null already exists')
828
Thangavelu K S3698fad2017-03-24 17:50:14 +0000829 def test_cordvtn_management_network_creation_with_launching_nova_instance_and_validation_on_head_node_with_nova_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +0000830 """
831 Algo:
832 0. Create Test-Net,
833 1. Cretae subnetwork whose ip is under management network
834 3. Do GET Rest API and validate creation of network
835 4. Create new nova instance under management network
836 5. Validate new nova instance is created on nova service
837 """
838 test_net_name = 'vtn_test_8_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000839 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 +0000840 test_management_type = "management_local"
841 instance_vm_name = 'vtn_test_8_nova_instance_management_net'
842 image_name = "vsg-1.1"
843 flavor_id = 'm1.small'
844 result = self.neutron_network_creation_and_validation(test_net_name)
845 assert_equal(result, True)
846 neutron_creds = self.get_neutron_credentials()
847 neutron = neutronclient.Client(**neutron_creds)
848 networks = neutron.list_networks(name=test_net_name)
849 network_id = self.get_key_value(d=networks, key = 'id')
850 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
851 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000852 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000853 nova = nova_client.Client('2', **creds)
854 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
855 self.neutron_network_deletion(test_net_name)
856 self.nova_instance_deletion(nova, new_instance_details)
857 assert_equal(new_instance_details.status, 'ACTIVE')
858
Thangavelu K S3698fad2017-03-24 17:50:14 +0000859 def test_cordvtn_neutron_public_network_creation_and_validation_on_head_node_with_neutron_service(self):
860 """
861 Algo:
862 0. Create Test-Net,
863 1. Cretae subnetwork who ip is under management network
864 2. Run sync command for cordvtn
865 3. Do GET Rest API and validate creation of network
866 4. Validate network synch with created network in cord-onos
867 """
868 test_net_name = 'vtn_test_9_net_public'
869 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
870 result = self.neutron_network_creation_and_validation(test_net_name)
871 assert_equal(result, True)
872 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
873 if sub_result[0] is True:
874 self.neutron_network_deletion(test_net_name)
875 assert_equal(sub_result[0], True)
876
877 def test_cordvtn_neutron_public_network_creation_and_validation_on_onos(self):
878 """
879 Algo:
880 0. Create Test-Net,
881 1. Cretae subnetwork whoes ip is under management network
882 2. Run sync command for cordvtn
883 3. Do GET Rest API and validate creation of network
884 """
885 test_net_name = 'vtn_test_10_net_public'
886 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
887 result = self.neutron_network_creation_and_validation(test_net_name)
888 assert_equal(result, True)
889 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
890
891 vtn_util = vtn_validation_utils('')
892 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
893 auth = ('karaf','karaf')
894
895 resp = requests.get(url=url, auth=auth)
896 data = json.loads(resp.text)
897 for i in range(len(data['ServiceNetworks'])):
898 if data['ServiceNetworks'][i]['name'] == test_net_name:
899 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
900 if sub_net_id[2] == " ":
901 print('Sub network is not successful')
902 self.neutron_network_deletion(test_net_name)
903 assert_equal(False, True)
904 break
905 elif sub_net_id[2] == test_sub_net_cidr[1]:
906 print('Sub network is successful')
907 self.neutron_network_deletion(test_net_name)
908 assert_equal(sub_net_id[0], True)
909 break
910
911 def test_cordvtn_neutron_public_network_creation_and_post_network_type_as_public_to_onos(self):
912 """
913 Algo:
914 0. Create Test-Net,
915 1. Cretae subnetwork whose ip is under management network
916 2. Run sync command for cordvtn
917 3. Do GET Rest API and validate creation of network
918 4. Pushed the network type as management local to onos
919 5. Verified that onos is having under management network
920 """
921 test_net_name = 'vtn_test_11_net_public'
922 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
923 test_management_type = "public"
924 result = self.neutron_network_creation_and_validation(test_net_name)
925 assert_equal(result, True)
926 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
927
928 vtn_util = vtn_validation_utils('')
929 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
930 auth = ('karaf','karaf')
931
932 resp = requests.get(url=url, auth=auth)
933 data = json.loads(resp.text)
934 for i in range(len(data['ServiceNetworks'])):
935 if data['ServiceNetworks'][i]['name'] == test_net_name:
936 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
937 if sub_net_id[2] == " ":
938 log.info('Sub network is not successful')
939 assert_equal(False, True)
940 break
941 elif sub_net_id[2] == test_sub_net_cidr[1]:
942 log.info('Sub network is successful')
943 assert_equal(sub_net_id[0], True)
944 break
945
946 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
947 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
948 net_type_json = json.loads(net_type_post.text)
949
950 self.neutron_network_deletion(test_net_name)
951 assert_equal(net_type_json['message'], 'null already exists')
952
953 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 +0000954 """
955 Algo:
956 0. Create Test-Net,
957 1. Cretae subnetwork whose ip is under public network
958 3. Do GET Rest API and validate creation of network
959 4. Create new nova instance under public network
960 5. Validate new nova instance is created on nova service
961 """
962 test_net_name = 'vtn_test_12_net_public'
963 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
964 instance_vm_name = 'vtn_test_12_nova_instance_public_net'
965 image_name = "vsg-1.1"
966 flavor_id = 'm1.small'
967 result = self.neutron_network_creation_and_validation(test_net_name)
968 assert_equal(result, True)
969 neutron_creds = self.get_neutron_credentials()
970 neutron = neutronclient.Client(**neutron_creds)
971 networks = neutron.list_networks(name=test_net_name)
972 network_id = self.get_key_value(d=networks, key = 'id')
973 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
974 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000975 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000976 nova = nova_client.Client('2', **creds)
977 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
978 self.neutron_network_deletion(test_net_name)
979 self.nova_instance_deletion(nova, new_instance_details)
980 assert_equal(new_instance_details.status, 'ACTIVE')
981
982 def test_cordvtn_neutron_private_network_creation_and_validation_on_head_node_with_neutron_service(self):
983 """
984 Algo:
985 0. Create Test-Net,
986 1. Cretae subnetwork who ip is under private network
987 2. Run sync command for cordvtn
988 3. Do GET Rest API and validate creation of network
989 4. Validate network synch with created network in cord-onos
990 """
991 test_net_name = 'vtn_test_13_net_private'
992 test_sub_net_cidr = ["private","10.160.160.160/24",'10.160.160.1']
993 result = self.neutron_network_creation_and_validation(test_net_name)
994 assert_equal(result, True)
995 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
996 if sub_result[0] is True:
997 self.neutron_network_deletion(test_net_name)
998 assert_equal(sub_result[0], True)
999
1000 def test_cordvtn_neutron_private_network_creation_and_validation_on_onos(self):
1001 """
1002 Algo:
1003 0. Create Test-Net,
1004 1. Cretae subnetwork whoes ip is under management network
1005 2. Run sync command for cordvtn
1006 3. Do GET Rest API and validate creation of network
1007 """
1008 test_net_name = 'vtn_test_14_net_private'
1009 test_sub_net_cidr = ["private","10.160.160.160/24", '10.160.160.1']
1010 result = self.neutron_network_creation_and_validation(test_net_name)
1011 assert_equal(result, True)
1012 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1013
1014 vtn_util = vtn_validation_utils('')
1015 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1016 auth = ('karaf','karaf')
1017
1018 resp = requests.get(url=url, auth=auth)
1019 data = json.loads(resp.text)
1020 for i in range(len(data['ServiceNetworks'])):
1021 if data['ServiceNetworks'][i]['name'] == test_net_name:
1022 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1023 if sub_net_id[2] == " ":
1024 print('Sub network is not successful')
1025 self.neutron_network_deletion(test_net_name)
1026 assert_equal(False, True)
1027 break
1028 elif sub_net_id[2] == '10.160.160.0/24':
1029 #elif sub_net_id[2] == test_sub_net_cidr[1]:
1030 print('Sub network is successful')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001031 self.neutron_network_deletion(test_net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +00001032 assert_equal(sub_net_id[0], True)
1033 break
1034
1035 def test_cordvtn_neutron_private_network_creation_and_post_network_type_as_private_to_onos(self):
1036 """
1037 Algo:
1038 0. Create Test-Net,
1039 1. Cretae subnetwork whose ip is under management network
1040 2. Run sync command for cordvtn
1041 3. Do GET Rest API and validate creation of network
1042 4. Pushed the network type as management local to onos
1043 5. Verified that onos is having under management network
1044 """
1045 test_net_name = 'vtn_test_15_net_private'
1046 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
1047 test_management_type = "private"
1048 result = self.neutron_network_creation_and_validation(test_net_name)
1049 assert_equal(result, True)
1050 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1051
1052 vtn_util = vtn_validation_utils('')
1053 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1054 auth = ('karaf','karaf')
1055
1056 resp = requests.get(url=url, auth=auth)
1057 data = json.loads(resp.text)
1058 for i in range(len(data['ServiceNetworks'])):
1059 if data['ServiceNetworks'][i]['name'] == test_net_name:
1060 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1061 if sub_net_id[2] == " ":
1062 log.info('Sub network is not successful')
1063 assert_equal(False, True)
1064 break
1065 elif sub_net_id[2] == "192.168.160.0/24":
1066 log.info('Sub network is successful')
1067 assert_equal(sub_net_id[0], True)
1068 break
1069
1070 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1071 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
1072 net_type_json = json.loads(net_type_post.text)
1073
1074 self.neutron_network_deletion(test_net_name)
1075 assert_equal(net_type_json['message'], 'null already exists')
1076
1077 def test_cordvtn_private_network_creation_with_launching_nova_instance_and_validation_on_head_node_with_nova_service(self):
Thangavelu K S3698fad2017-03-24 17:50:14 +00001078 """
1079 Algo:
1080 0. Create Test-Net,
1081 1. Cretae subnetwork whose ip is under private network
1082 3. Do GET Rest API and validate creation of network
1083 4. Create new nova instance under private network
1084 5. Validate new nova instance is created on nova service
1085 """
1086 test_net_name = 'vtn_test_16_net_private'
1087 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001088 instance_vm_name = 'vtn_test_16_nova_instance_private_net'
Thangavelu K S3698fad2017-03-24 17:50:14 +00001089 image_name = "vsg-1.1"
1090 flavor_id = 'm1.small'
1091 result = self.neutron_network_creation_and_validation(test_net_name)
1092 assert_equal(result, True)
1093 neutron_creds = self.get_neutron_credentials()
1094 neutron = neutronclient.Client(**neutron_creds)
1095 networks = neutron.list_networks(name=test_net_name)
1096 network_id = self.get_key_value(d=networks, key = 'id')
1097 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1098 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001099 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +00001100 nova = nova_client.Client('2', **creds)
1101 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1102 self.neutron_network_deletion(test_net_name)
1103 self.nova_instance_deletion(nova, new_instance_details)
1104 assert_equal(new_instance_details.status, 'ACTIVE')
1105
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001106 def test_cordvtn_management_network_instance_ping_form_host_machine_or_compute_node(self):
1107 """
1108 Algo:
1109 0. Create Test-Net,
1110 1. Cretae subnetwork whose ip is under management network
1111 3. Do GET Rest API and validate creation of network
1112 4. Create new nova instance under management network
1113 5. Validate new nova instance is created on nova service
1114 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1115 """
1116 test_net_name = 'vtn_test_17_net_management'
1117 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1118 test_management_type = "management_local"
1119 instance_vm_name = 'vtn_test_17_nova_instance_management_net'
1120 image_name = "vsg-1.1"
1121 flavor_id = 'm1.small'
1122 result = self.neutron_network_creation_and_validation(test_net_name)
1123 assert_equal(result, True)
1124 neutron_creds = self.get_neutron_credentials()
1125 neutron = neutronclient.Client(**neutron_creds)
1126 networks = neutron.list_networks(name=test_net_name)
1127 network_id = self.get_key_value(d=networks, key = 'id')
1128 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1129 assert_equal(sub_result[0], True)
1130 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1131 creds = get_nova_credentials()
1132 nova = nova_client.Client('2', **creds)
1133 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1134 #assert_equal(new_instance_details.status, 'ACTIVE')
1135 compute_details = self.get_compute_nodes()
1136 print new_instance_details.addresses
1137 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1138 self.neutron_network_deletion(test_net_name)
1139 self.nova_instance_deletion(nova, new_instance_details)
1140 assert_equal(status, True)
1141
1142 def test_cordvtn_management_network_instance_ping_to_external_network(self):
1143 """
1144 Algo:
1145 0. Create Test-Net,
1146 1. Cretae subnetwork whose ip is under management network
1147 3. Do GET Rest API and validate creation of network
1148 4. Create new nova instance under management network
1149 5. Validate new nova instance is created on nova service
1150 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1151 """
1152 test_net_name = 'vtn_test_18_net_management'
1153 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1154 test_management_type = "management_local"
1155 instance_vm_name = 'vtn_test_18_nova_instance_management_net'
1156 image_name = "vsg-1.1"
1157 flavor_id = 'm1.small'
1158 result = self.neutron_network_creation_and_validation(test_net_name)
1159 assert_equal(result, True)
1160 neutron_creds = self.get_neutron_credentials()
1161 neutron = neutronclient.Client(**neutron_creds)
1162 networks = neutron.list_networks(name=test_net_name)
1163 network_id = self.get_key_value(d=networks, key = 'id')
1164 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1165 assert_equal(sub_result[0], True)
1166 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1167 creds = get_nova_credentials()
1168 nova = nova_client.Client('2', **creds)
1169 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1170 #assert_equal(new_instance_details.status, 'ACTIVE')
1171 compute_details = self.get_compute_nodes()
1172 print new_instance_details.addresses
1173 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1174 self.neutron_network_deletion(test_net_name)
1175 self.nova_instance_deletion(nova, new_instance_details)
1176 assert_equal(status, False)
1177
1178 def test_cordvtn_management_network_two_instance_ping_between_two_instances(self):
1179 """
1180 Algo:
1181 0. Create Test-Net,
1182 1. Cretae subnetwork whose ip is under management network
1183 3. Do GET Rest API and validate creation of network
1184 4. Create first nova instance under management network
1185 5. Validate first nova instance is created on nova service
1186 6. Create second nova instance under management network
1187 7. Validate second nova instance is created on nova service
1188 8. Now try to ping from one nova instance to other instance, should not success
1189 """
1190 test_net_name = 'vtn_test_19_net_management'
1191 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.2", "172.27.0.200"]
1192 test_management_type = "management_local"
1193 first_instance_vm_name = 'vtn_test_19_nova_1st_instance_management_net'
1194 second_instance_vm_name = 'vtn_test_19_nova_2nd_instance_management_net'
1195 image_name = "vsg-1.1"
1196 flavor_id = 'm1.small'
1197 result = self.neutron_network_creation_and_validation(test_net_name)
1198 assert_equal(result, True)
1199 neutron_creds = self.get_neutron_credentials()
1200 neutron = neutronclient.Client(**neutron_creds)
1201 networks = neutron.list_networks(name=test_net_name)
1202 network_id = self.get_key_value(d=networks, key = 'id')
1203 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1204 assert_equal(sub_result[0], True)
1205 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1206 creds = get_nova_credentials()
1207 nova = nova_client.Client('2', **creds)
1208 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1209 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
1210 #assert_equal(first_instance_details.status, 'ACTIVE')
1211 #assert_equal(second_instance_details.status, 'ACTIVE')
1212 compute_details = self.get_compute_nodes()
1213 print 'New nova instance ip addresses are '
1214 print first_nova_instance_details.addresses
1215 print second_nova_instance_details.addresses
1216 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")
1217 self.neutron_network_deletion(test_net_name)
1218 self.nova_instance_deletion(nova, first_nova_instance_details)
1219 self.nova_instance_deletion(nova, second_nova_instance_details)
1220 assert_equal(status, False)
1221
1222 def test_cordvtn_two_management_network_instances_ping_between_two_networks_via_management_network(self):
1223 """
1224 Algo:
1225 0. Create Test-Net,
1226 1. Cretae subnetwork whose ip is under management network
1227 3. Do GET Rest API and validate creation of network
1228 4. Create new nova instance under management network
1229 5. Validate new nova instance is created on nova service
1230 """
1231 test_netA_name = 'vtn_test_20_netA_management'
1232 test_sub_netA_cidr = ["management","172.27.0.0/24","172.27.0.2", "172.27.0.200"]
1233 netA_instance_vm_name = 'vtn_test_20_nova_netA_instance_management_net'
1234 test_netB_name = 'vtn_test_20_netB_management'
1235 test_sub_netB_cidr = ["management","172.28.0.0/24","172.28.0.2", "172.28.0.200"]
1236 netB_instance_vm_name = 'vtn_test_20_nova_netB_instance_management_net'
1237 test_management_type = "management_local"
1238 image_name = "vsg-1.1"
1239 flavor_id = 'm1.small'
1240 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1241 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1242
1243 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)
1244 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)
1245
1246 #assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1247 #assert_equal(nova_instance_details_netB.status, 'ACTIVE')
1248 compute_details = self.get_compute_nodes()
1249 print 'New nova instance ip addresses are '
1250 print nova_instance_details_netA.addresses
1251 print nova_instance_details_netB.addresses
1252 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")
1253 self.neutron_network_deletion(test_netA_name)
1254 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1255 self.neutron_network_deletion(test_netB_name)
1256 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1257 assert_equal(status, False)
1258
1259 def test_cordvtn_public_network_instance_ping_form_host_machine_or_compute_node(self):
1260
1261 """
1262 Algo:
1263 0. Create Test-Net,
1264 1. Cretae subnetwork whose ip is under public network
1265 3. Do GET Rest API and validate creation of network
1266 4. Create new nova instance under public network
1267 5. Validate new nova instance is created on nova service
1268 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1269 """
1270 test_net_name = 'vtn_test_21_net_public'
1271 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1272 test_management_type = "public"
1273 instance_vm_name = 'vtn_test_21_nova_instance_pulic_net'
1274 image_name = "vsg-1.1"
1275 flavor_id = 'm1.small'
1276 result = self.neutron_network_creation_and_validation(test_net_name)
1277 assert_equal(result, True)
1278 neutron_creds = self.get_neutron_credentials()
1279 neutron = neutronclient.Client(**neutron_creds)
1280 networks = neutron.list_networks(name=test_net_name)
1281 network_id = self.get_key_value(d=networks, key = 'id')
1282 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1283 assert_equal(sub_result[0], True)
1284 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1285 creds = get_nova_credentials()
1286 nova = nova_client.Client('2', **creds)
1287 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1288 #assert_equal(new_instance_details.status, 'ACTIVE')
1289 compute_details = self.get_compute_nodes()
1290 print new_instance_details.addresses
1291 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1292 self.neutron_network_deletion(test_net_name)
1293 self.nova_instance_deletion(nova, new_instance_details)
1294 assert_equal(status, False)
1295
1296 def test_cordvtn_public_network_instance_ping_to_external_network(self):
1297 """
1298 Algo:
1299 0. Create Test-Net,
1300 1. Cretae subnetwork whose ip is under public network
1301 3. Do GET Rest API and validate creation of network
1302 4. Create new nova instance under public network
1303 5. Validate new nova instance is created on nova service
1304 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1305 """
1306 test_net_name = 'vtn_test_22_net_public'
1307 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1308 test_management_type = "public"
1309 instance_vm_name = 'vtn_test_22_nova_instance_public_net'
1310 image_name = "vsg-1.1"
1311 flavor_id = 'm1.small'
1312 result = self.neutron_network_creation_and_validation(test_net_name)
1313 assert_equal(result, True)
1314 neutron_creds = self.get_neutron_credentials()
1315 neutron = neutronclient.Client(**neutron_creds)
1316 networks = neutron.list_networks(name=test_net_name)
1317 network_id = self.get_key_value(d=networks, key = 'id')
1318 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1319 assert_equal(sub_result[0], True)
1320 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1321 creds = get_nova_credentials()
1322 nova = nova_client.Client('2', **creds)
1323 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1324 #assert_equal(new_instance_details.status, 'ACTIVE')
1325 compute_details = self.get_compute_nodes()
1326 print new_instance_details.addresses
1327 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1328 self.neutron_network_deletion(test_net_name)
1329 self.nova_instance_deletion(nova, new_instance_details)
1330 assert_equal(status, True)
1331
1332
1333 def test_cordvtn_public_network_two_instance_ping_between_two_instances(self):
1334 """
1335 Algo:
1336 0. Create Test-Net,
1337 1. Cretae subnetwork whose ip is under public network
1338 3. Do GET Rest API and validate creation of network
1339 4. Create first nova instance under public network
1340 5. Validate first nova instance is created on nova service
1341 6. Create second nova instance under public network
1342 7. Validate second nova instance is created on nova service
1343 8. Now try to ping from one nova instance to other instance, should not success
1344 """
1345 test_net_name = 'vtn_test_23_net_public'
1346 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1347 test_management_type = "public"
1348 first_instance_vm_name = 'vtn_test_23_nova_1st_instance_public_net'
1349 second_instance_vm_name = 'vtn_test_23_nova_2nd_instance_public_net'
1350 image_name = "vsg-1.1"
1351 flavor_id = 'm1.small'
1352 result = self.neutron_network_creation_and_validation(test_net_name)
1353 assert_equal(result, True)
1354 neutron_creds = self.get_neutron_credentials()
1355 neutron = neutronclient.Client(**neutron_creds)
1356 networks = neutron.list_networks(name=test_net_name)
1357 network_id = self.get_key_value(d=networks, key = 'id')
1358 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1359 assert_equal(sub_result[0], True)
1360 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1361 creds = get_nova_credentials()
1362 nova = nova_client.Client('2', **creds)
1363 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1364 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
1365 #assert_equal(first_instance_details.status, 'ACTIVE')
1366 #assert_equal(second_instance_details.status, 'ACTIVE')
1367 compute_details = self.get_compute_nodes()
1368 print 'New nova instance ip addresses are '
1369 print first_nova_instance_details.addresses
1370 print second_nova_instance_details.addresses
1371 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")
1372 self.neutron_network_deletion(test_net_name)
1373 self.nova_instance_deletion(nova, first_nova_instance_details)
1374 self.nova_instance_deletion(nova, second_nova_instance_details)
1375 assert_equal(status, False)
1376
1377 def test_cordvtn_two_public_network_instances_ping_between_two_networks_via_public_network(self):
1378 """
1379 Algo:
1380 0. Create Test-Net,
1381 1. Cretae subnetwork whose ip is under public network
1382 3. Do GET Rest API and validate creation of network
1383 4. Create new nova instance under public network
1384 5. Validate new nova instance is created on nova service
1385 """
1386 test_netA_name = 'vtn_test_24_netA_public'
1387 test_sub_netA_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1388 netA_instance_vm_name = 'vtn_test_24_nova_netA_instance_public_net'
1389 test_netB_name = 'vtn_test_24_netB_public'
1390 test_sub_netB_cidr = ["public","10.6.2.192/26",'10.6.2.193']
1391 netB_instance_vm_name = 'vtn_test_24_nova_netB_instance_public_net'
1392 test_management_type = "public"
1393 image_name = "vsg-1.1"
1394 flavor_id = 'm1.small'
1395 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1396 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1397
1398 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)
1399 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)
1400
1401 #assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1402 #assert_equal(nova_instance_details_netB.status, 'ACTIVE')
1403 compute_details = self.get_compute_nodes()
1404 print 'New nova instance ip addresses are '
1405 print nova_instance_details_netA.addresses
1406 print nova_instance_details_netB.addresses
1407 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")
1408 self.neutron_network_deletion(test_netA_name)
1409 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1410 self.neutron_network_deletion(test_netB_name)
1411 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1412 assert_equal(status, False)
1413
1414 def test_cordvtn_private_network_instance_ping_form_host_machine_or_compute_node(self):
1415 """
1416 Algo:
1417 0. Create Test-Net,
1418 1. Cretae subnetwork whose ip is under private network
1419 3. Do GET Rest API and validate creation of network
1420 4. Create new nova instance under private network
1421 5. Validate new nova instance is created on nova service
1422 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1423 """
1424 test_net_name = 'vtn_test_25_net_private'
1425 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1426 test_management_type = "private"
1427 instance_vm_name = 'vtn_test_25_nova_instance_private_net'
1428 image_name = "vsg-1.1"
1429 flavor_id = 'm1.small'
1430 result = self.neutron_network_creation_and_validation(test_net_name)
1431 assert_equal(result, True)
1432 neutron_creds = self.get_neutron_credentials()
1433 neutron = neutronclient.Client(**neutron_creds)
1434 networks = neutron.list_networks(name=test_net_name)
1435 network_id = self.get_key_value(d=networks, key = 'id')
1436 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1437 assert_equal(sub_result[0], True)
1438 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1439 creds = get_nova_credentials()
1440 nova = nova_client.Client('2', **creds)
1441 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1442 #assert_equal(new_instance_details.status, 'ACTIVE')
1443 compute_details = self.get_compute_nodes()
1444 print new_instance_details.addresses
1445 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1446 self.neutron_network_deletion(test_net_name)
1447 self.nova_instance_deletion(nova, new_instance_details)
1448 assert_equal(status, False)
1449
1450 def test_cordvtn_private_network_instance_ping_to_external_network(self):
1451 """
1452 Algo:
1453 0. Create Test-Net,
1454 1. Cretae subnetwork whose ip is under private network
1455 3. Do GET Rest API and validate creation of network
1456 4. Create new nova instance under private network
1457 5. Validate new nova instance is created on nova service
1458 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1459 """
1460 test_net_name = 'vtn_test_26_net_private'
1461 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1462 test_management_type = "private"
1463 instance_vm_name = 'vtn_test_26_nova_instance_private_net'
1464 image_name = "vsg-1.1"
1465 flavor_id = 'm1.small'
1466 result = self.neutron_network_creation_and_validation(test_net_name)
1467 assert_equal(result, True)
1468 neutron_creds = self.get_neutron_credentials()
1469 neutron = neutronclient.Client(**neutron_creds)
1470 networks = neutron.list_networks(name=test_net_name)
1471 network_id = self.get_key_value(d=networks, key = 'id')
1472 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1473 assert_equal(sub_result[0], True)
1474 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1475 creds = get_nova_credentials()
1476 nova = nova_client.Client('2', **creds)
1477 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1478 #assert_equal(new_instance_details.status, 'ACTIVE')
1479 compute_details = self.get_compute_nodes()
1480 print new_instance_details.addresses
1481 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1482 self.neutron_network_deletion(test_net_name)
1483 self.nova_instance_deletion(nova, new_instance_details)
1484 assert_equal(status, False)
1485
1486 def test_cordvtn_private_network_two_instance_ping_between_two_instances(self):
1487 """
1488 Algo:
1489 0. Create Test-Net,
1490 1. Cretae subnetwork whose ip is under private network
1491 3. Do GET Rest API and validate creation of network
1492 4. Create first nova instance under private network
1493 5. Validate first nova instance is created on nova service
1494 6. Create second nova instance under public network
1495 7. Validate second nova instance is created on nova service
1496 8. Now try to ping from one nova instance to other instance, should not success
1497 """
1498 test_net_name = 'vtn_test_27_net_private'
1499 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1500 test_management_type = "private"
1501 first_instance_vm_name = 'vtn_test_27_nova_1st_instance_private_net'
1502 second_instance_vm_name = 'vtn_test_27_nova_2nd_instance_private_net'
1503 image_name = "vsg-1.1"
1504 flavor_id = 'm1.small'
1505 result = self.neutron_network_creation_and_validation(test_net_name)
1506 assert_equal(result, True)
1507 neutron_creds = self.get_neutron_credentials()
1508 neutron = neutronclient.Client(**neutron_creds)
1509 networks = neutron.list_networks(name=test_net_name)
1510 network_id = self.get_key_value(d=networks, key = 'id')
1511 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1512 assert_equal(sub_result[0], True)
1513 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1514 creds = get_nova_credentials()
1515 nova = nova_client.Client('2', **creds)
1516 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1517 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
1518 #assert_equal(first_instance_details.status, 'ACTIVE')
1519 #assert_equal(second_instance_details.status, 'ACTIVE')
1520 compute_details = self.get_compute_nodes()
1521 print 'New nova instance ip addresses are '
1522 print first_nova_instance_details.addresses
1523 print second_nova_instance_details.addresses
1524 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")
1525 self.neutron_network_deletion(test_net_name)
1526 self.nova_instance_deletion(nova, first_nova_instance_details)
1527 self.nova_instance_deletion(nova, second_nova_instance_details)
1528 assert_equal(status, True)
1529
1530 def test_cordvtn_two_private_network_instances_ping_between_two_networks_via_private_network(self):
1531 """
1532 Algo:
1533 0. Create Test-Net,
1534 1. Cretae subnetwork whose ip is under private network
1535 3. Do GET Rest API and validate creation of network
1536 4. Create new nova instance under private network
1537 5. Validate new nova instance is created on nova service
1538 """
1539 test_netA_name = 'vtn_test_28_netA_private'
1540 test_sub_netA_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1541 netA_instance_vm_name = 'vtn_test_28_nova_netA_instance_private_net'
1542 test_netB_name = 'vtn_test_28_netB_private'
1543 test_sub_netB_cidr = ["private","10.160.161.192/26",'10.160.161.193']
1544 netB_instance_vm_name = 'vtn_test_28_nova_netB_instance_private_net'
1545 test_management_type = "private"
1546 image_name = "vsg-1.1"
1547 flavor_id = 'm1.small'
1548 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1549 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1550
1551 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)
1552 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)
1553
1554 #assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1555 #assert_equal(nova_instance_details_netB.status, 'ACTIVE')
1556 compute_details = self.get_compute_nodes()
1557 print 'New nova instance ip addresses are '
1558 print nova_instance_details_netA.addresses
1559 print nova_instance_details_netB.addresses
1560 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")
1561 self.neutron_network_deletion(test_netA_name)
1562 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1563 self.neutron_network_deletion(test_netB_name)
1564 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1565 assert_equal(status, False)
1566
Thangavelu K Saea3c672017-03-15 18:57:05 +00001567 def test_cordvtn_with_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00001568 """
1569 Algo:
1570 0. Create Test-Net,
1571 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1572 2. Run sync command for cordvtn
1573 3. Do GET Rest API and validate creation of network
1574 4. Validate network synch with created network in cord-onos
1575 """
1576 creds = self.get_neutron_credentials()
1577 neutron = neutronclient.Client(**creds)
1578 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
1579 net = neutron.create_network(body=body_example)
1580 networks = neutron.list_networks(name='Net-1')
1581 vtn_util = vtn_validation_utils('')
1582 data = networks
1583 result = self.search_value(data, "Net-1")
1584 assert_equal(result, True)
1585
1586 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
1587 """
1588 Algo:
1589 0. Create Test-Net,
1590 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1591 2. Run sync command for cordvtn
1592 3. Do GET Rest API and validate creation of network
1593 4. Validate network synch with created network in cord-onos
1594 """
1595 creds = self.get_neutron_credentials()
1596 neutron = neutronclient.Client(**creds)
1597 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
1598 net = neutron.create_network(body=body_example)
1599 networks = neutron.list_networks(name='Net-1')
1600 vtn_util = vtn_validation_utils('')
1601 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1602 auth = ('karaf','karaf')
1603
1604 resp = requests.get(url=url, auth=auth)
1605 data = json.loads(resp.text)
1606 result = self.search_value(data, "Net-1")
1607 assert_equal(result, True)
1608
Thangavelu K S3698fad2017-03-24 17:50:14 +00001609 def test_cordvtn_neutron_network_deletion_and_validation_on_neutron_openstack(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00001610 """
1611 Algo:
1612 0. Create Test-Net,
1613 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1614 2. Run sync command for cordvtn
1615 3. Do GET Rest API and validate creation of network
1616 4. Validate network synch with created network in cord-onos
1617 """
1618 creds = self.get_neutron_credentials()
1619 neutron = neutronclient.Client(**creds)
1620 body_example = {"network":{"name": "Net-1","admin_state_up":False}}
1621 net = neutron.delete_network("Net-1")
1622 networks = neutron.list_networks(name='Net-1')
1623 vtn_util = vtn_validation_utils('')
1624 data = networks
1625 result = self.search_value(data, "Net-1")
1626 assert_equal(result, True)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001627
1628 def test_cordvtn_neutron_network_sync(self):
1629 """
1630 Algo:
1631 0. Create Test-Net,
1632 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1633 2. Run sync command for cordvtn
1634 3. Do GET Rest API and validate creation of network
1635 4. Validate network synch with created network in cord-onos
1636 """
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00001637 creds = self.get_neutron_credentials()
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001638 neutron = neutronclient.Client(**creds)
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00001639 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001640 net = neutron.create_network(body=body_example)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00001641 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1642 auth = ('karaf','karaf')
1643 body_create_subnet = {'subnets': [{'cidr': '192.168.199.0/24',
1644 'ip_version': 4, 'network_id': network_id}]}
1645
1646 subnet = neutron.create_subnet(body=body_create_subnet)
1647
1648 resp = requests.get(url=url, auth=auth)
1649 data = json.loads(resp.text)
1650 result = self.search_value(data, "Test-Net-1")
1651 assert_equal(result, True)
1652
1653 def test_cordvtn_neutron_port_sync(self):
1654 """
1655 Algo:
1656 0. Create Test-Net,
1657 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1658 2. Run sync command for cordvtn
1659 3. Do GET Rest API and validate creation of network
Thangavelu K Saea3c672017-03-15 18:57:05 +00001660 4. Validate network synch with created port in cord-onos
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00001661 """
1662 creds = self.get_neutron_credentials()
1663 neutron = neutronclient.Client(**creds)
1664 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
1665 net = neutron.create_network(body=body_example)
1666 network_id = net['network']['id']
1667 device_id = 'of:{}'.format(get_mac(self.switch))
1668 body_example = {'port': {'admin_state_up': True,'device_id':device_id, 'network_id':network_id}}
1669 response = neutron.create_port(body=body_example)
1670 url = "http://{0}:8181/onos/cordvtn/servicePorts".format(vtn_util.endpoint)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001671 auth = ('karaf','karaf')
1672
1673 resp = requests.get(url=url, auth=auth)
1674 data = json.loads(resp.text)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00001675 result = self.search_value(data, device_id)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001676 assert_equal(result, True)
1677
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001678 def test_cordvtn_basic_tenant(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001679
ChetanGaonker71fe0302016-12-19 17:45:44 -08001680 tenant_1= create_tenant("CORD_Subscriber_Test_Tenant_1")
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001681 if tenant1 != 0:
ChetanGaonker71fe0302016-12-19 17:45:44 -08001682 print "Creation of CORD Subscriber Test Tenant 1"
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001683
ChetanGaonker71fe0302016-12-19 17:45:44 -08001684 tenant_2 = create_tenant("CORD_Subscriber_Test_Tenant_2")
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001685 if tenant2 != 0:
ChetanGaonker71fe0302016-12-19 17:45:44 -08001686 print "Creation of CORD Subscriber Test Tenant 2"
1687
1688 create_net(tenant_1,"a1")
1689 create_subnet(tenant_1,"a1","as1","10.0.1.0/24")
1690
1691 create_net(tenant_2,"a2")
1692 create_subnet(tenant_2,"a2","as1","10.0.2.0/24")
1693
1694 netid_1 = get_id(tenant_1,"net","a1")
1695 netid_2 = get_id(tenant_2,"net","a2")
1696
1697 nova_boot(tenant_1,"vm1",netid=netid)
1698 nova_boot(tenant_2,"vm1",netid=netid)
1699
1700 nova_wait_boot(tenant_1,"vm1", "ACTIVE")
1701 nova_wait_boot(tenant_2,"vm1", "ACTIVE")
1702
1703 router_create(tenant_1,"r1")
1704 router_interface_add(tenant_1,"r1","as1")
1705 router_create(tenant_2,"r1")
1706 router_interface_add(tenant_2,"r1","as1")
1707
1708 create_net(tenant_1,"x1","","--router:external=True")
1709 create_net(tenant_2,"x1","","--router:external=True")
1710
1711 router_gateway_set(tenant_1,"r1","x1")
1712 router_gateway_set(tenant_2,"r1","x1")
1713
1714 subnetid_1 = get_id(tenant_1,"subnet","as1")
1715 subnetid_2 = get_id(tenant_2,"subnet","as1")
1716 port_create(tenant_1,"p1","a1","10.0.1.100",subnetid_1)
1717 port_create(tenant_2,"p1","a1","10.0.1.100",subnetid_2)
1718
1719 port_id_1 = get_id(tenant_1,"port","p1")
1720 port_id_2 = get_id(tenant_2,"port","p1")
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001721 status = validate_vtn_flows()
1722 assert_equal(status, True)
ChetanGaonker71fe0302016-12-19 17:45:44 -08001723
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001724 def test_cordvtn_for_creation_of_network(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001725
1726 ret1 = create_tenant(netA)
1727 if ret1 != 0:
1728 print "Creation of Tenant netA Failed"
1729
1730 ret2 = create_tenant(netB)
1731 if ret2 != 0:
1732 print "Creation of Tenant netB Failed"
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001733 network = {'name': self.network_name, 'admin_state_up': True}
1734 self.neutron.create_network({'network':network})
1735 log.info("Created network:{0}".format(self.network_name))
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001736 status = validate_vtn_flows()
1737 assert_equal(status, True)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001738
1739 def test_cordvtn_to_create_net_work_with_subnet(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001740 ret1 = create_tenant(netA)
1741 if ret1 != 0:
1742 print "Creation of Tenant netA Failed"
1743
1744 ret2 = create_tenant(netB)
1745 if ret2 != 0:
1746 print "Creation of Tenant netB Failed"
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001747 network_name = self.network_name
1748 network = {'name': network_name, 'admin_state_up': True}
1749 network_info = self.neutron.create_network({'network':network})
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001750 network_id = network_info['network']['id']
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001751
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001752 log.info("Created network:{0}".format(network_id))
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001753 self.network_ids.append(network_id)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001754 subnet_count = 1
1755 for cidr in self.subnet_cidrs:
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001756 gateway_ip = str(list(cidr)[1])
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001757 subnet = {"network_id": network_id, "ip_version":4,
1758 "cidr":str(cidr), "enable_dhcp":True,
1759 "host_routes":[{"destination":"0.0.0.0/0", "nexthop":gateway_ip}]
1760 }
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001761 subnet = {"name":"subnet-"+str(subnet_count), "network_id": network_id, "ip_version":4, "cidr":str(cidr), "enable_dhcp":True}
1762 print subnet
1763 self.neutron.create_subnet({'subnet':subnet})
1764 log.info("Created subnet:{0}".format(str(cidr)))
1765 if not self.number_of_subnet - 1:
1766 break
1767 self.number_of_subnet -= 1
1768 subnet_count += 1
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001769 status = validate_vtn_flows()
1770 assert_equal(status, True)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001771
1772 def test_cordvtn_subnet_limit(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001773 ret1 = create_tenant(netA)
1774 if ret1 != 0:
1775 print "Creation of Tenant netA Failed"
1776
1777 ret2 = create_tenant(netB)
1778 if ret2 != 0:
1779 print "Creation of Tenant netB Failed"
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001780 network_name = uuid.uuid4().get_hex()
1781 network = {'name': network_name, 'admin_state_up': True}
1782 network_info = self.neutron.create_network({'network':network})
1783 log.info("Created network:{0}".format(network_name))
1784 network_id = network_info['network']['id']
1785 self.network_ids.append(network_id)
1786 subnet_cidrs = ['11.2.2.0/29', '11.2.2.8/29']
1787 for cidr in subnet_cidrs:
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001788 subnet = {"network_id": network_id, "ip_version":4, "cidr": cidr}
1789 subnet_info = self.neutron.create_subnet({'subnet':subnet})
1790 subnet_id = subnet_info['subnet']['id']
1791 log.info("Created subnet:{0}".format(cidr))
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001792 while True:
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001793 port = {"network_id": network_id, "admin_state_up": True}
1794 port_info = self.neutron.create_port({'port':port})
1795 port_id = port_info['port']['id']
1796 self.port_ids.append(port_id)
1797 log.info("Created Port:{0}".format(port_info['port']['id']))
1798 if not self.quota_limit:
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001799 break
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001800 self.quota_limit -= 1
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001801 status = validate_vtn_flows()
1802 assert_equal(status, True)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001803
1804 def test_cordvtn_floatingip_limit(self):
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001805
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001806 ret1 = create_tenant(netA)
1807 if ret1 != 0:
1808 print "Creation of Tenant netA Failed"
1809
1810 ret2 = create_tenant(netB)
1811 if ret2 != 0:
1812 print "Creation of Tenant netB Failed"
1813 while True:
1814 floatingip = {"floating_network_id": self.floating_nw_id}
1815 fip_info = self.neutron.create_floatingip({'floatingip':floatingip})
1816 fip_id = fip_info['floatingip']['id']
1817 log.info("Created Floating IP:{0}".format(fip_id))
1818 self.fip_ids.append(fip_id)
1819 if not self.quota_limit:
1820 break
1821 self.quota_limit -= 1
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001822 status = validate_vtn_flows()
1823 assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001824
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001825 def test_cordvtn_for_10_neutron_networks(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001826 ret1 = create_tenant(netA)
1827 if ret1 != 0:
1828 print "Creation of Tenant netA Failed"
1829
1830 ret2 = create_tenant(netB)
1831 if ret2 != 0:
1832 print "Creation of Tenant netB Failed"
1833 pool = Pool(processes=10)
1834 ret = os.system("neutron quote-update --network 15")
1835 if ret1 != 0:
1836 print "Neutron network install failed"
1837 for i in range(1, 11):
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001838 pool.apply_async(create_network, (i, ))
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001839
1840 pool.close()
1841 pool.join()
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001842 status = validate_vtn_flows()
1843 assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001844
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001845 def test_cordvtn_for_100_neutron_networks(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001846 ret1 = create_tenant(netA)
1847 if ret1 != 0:
1848 print "Creation of Tenant netA Failed"
1849
1850 ret2 = create_tenant(netB)
1851 if ret2 != 0:
1852 print "Creation of Tenant netB Failed"
1853 pool = Pool(processes=10)
1854
1855 ret = os.system("neutron quote-update --network 105")
1856 if ret1 != 0:
1857 print "Neutron network install failed"
1858 for i in range(1, 101):
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001859 pool.apply_async(create_network, (i, ))
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001860
1861 pool.close()
1862 pool.join()
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001863 status = validate_vtn_flows()
1864 assert_equal(status, True)
1865
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001866 def test_cordvtn_creating_virtual_private_network(self):
1867 """
1868 Algo:
1869 1) Validate that required openstack service is up and running.
1870 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1871 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
1872 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
1873 4) Verify that NetA is being created and validate IP in nova list command.
1874 5) Verify that flow is being added in ovs-switch in compute-node.
1875 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1876 """
1877 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001878
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001879 def test_cordvtn_creating_virtual_local_management_network(self):
1880 """
1881 Algo:
1882 1) Validate that required openstack service is up and running.
1883 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1884 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
1885 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
1886 4) Verify that NetA is being created and validate IP in nova list command.
1887 5) Verify that flow is being added in ovs-switch in compute-node.
1888 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1889 """
1890 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001891
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001892 def test_cordvtn_creating_virtual_vlan_connectivity_network(self):
1893 """
1894 Algo:
1895 1) Validate that required openstack service is up and running.
1896 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1897 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
1898 (neutron port-create net-A-private --name stag-100).
1899 4) Verify that NetA is being created and validate IP in nova list command.
1900 5) Verify that flow is being added in ovs-switch in compute-node.
1901 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1902 """
1903 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001904
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001905 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network(self):
1906 """
1907 Algo:
1908 1) Validate that required openstack service is up and running.
1909 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1910 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
1911 (neutron port-create net-A-private --name stag-500).
1912 4) Verify that NetA is being created and validate IP in nova list command.
1913 5) Verify that flow is being added in ovs-switch in compute-node.
1914 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1915 """
1916 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001917
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001918 def test_cordvtn_creating_virtual_private_network_and_boot_image(self):
1919 """
1920 Algo:
1921 1) Validate that required openstack service is up and running.
1922 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1923 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
1924 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
1925 4) Now boot image in the same created network using nova boot image command (example given below :-
1926 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
1927 5) Wait till VM boots up and starts running.
1928 6) Verify that a VM is launched and running by using novaclient python API.
1929 7) Verify that flow is being added in ovs-switch in compute-node.
1930 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1931 9) Verify that cord-onos pushed flows to OVS switch.
1932 """
1933 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001934
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001935 def test_cordvtn_creating_virtual_public_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001936
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001937 """
1938 Algo:
1939 1) Validate that required openstack service is up and running.
1940 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1941 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
1942 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
1943 4) Now boot image in the same created network using nova boot image command (example given below :-
1944 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
1945 5) Wait till VM boots up and starts running.
1946 6) Verify that a VM is launched and running by using novaclient python API.
1947 7) Verify that flow is being added in ovs-switch in compute-node.
1948 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1949 9) Verify that cord-onos pushed flows to OVS switch.
1950 """
1951 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001952
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001953 def test_cordvtn_creating_virtual_local_management_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001954
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001955 """
1956 Algo:
1957 1) Validate that required openstack service is up and running.
1958 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1959 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
1960 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
1961 4) Now boot image in the same created network using nova boot image command (example given below :-
1962 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
1963 5) Wait till VM boots up and starts running.
1964 6) Verify that a VM is launched and running by using novaclient python API.
1965 7) Verify that flow is being added in ovs-switch in compute-node.
1966 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1967 9) Verify that cord-onos pushed flows to OVS switch.
1968 """
1969 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001970
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001971 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image(self):
1972 """
1973 Algo:
1974 1) Validate that required openstack service is up and running.
1975 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1976 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
1977 (neutron port-create net-A-private --name stag-100).
1978 4) Now boot image in the same created network using nova boot image command (example given below :-
1979 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
1980 5) Wait till VM boots up and starts running.
1981 6) Verify that a VM is launched and running by using novaclient python API.
1982 7) Verify that flow is being added in ovs-switch in compute-node.
1983 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1984 9) Verify that cord-onos pushed flows to OVS switch.
1985 """
1986 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001987
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001988 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image(self):
1989 """
1990 Algo:
1991 1) Validate that required openstack service is up and running.
1992 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1993 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
1994 (neutron port-create net-A-private --name stag-500).
1995 4) Now boot image in the same created network using nova boot image command (example given below :-
1996 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
1997 5) Wait till VM boots up and starts running.
1998 6) Verify that a VM is launched and running by using novaclient python API.
1999 7) Verify that flow is being added in ovs-switch in compute-node.
2000 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2001 9) Verify that cord-onos pushed flows to OVS switch.
2002 """
2003 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002004
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002005 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service(self):
2006 """
2007 Algo:
2008 1) Validate that required openstack service is up and running.
2009 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2010 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2011 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2012 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2013 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2014 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2015 5) Wait till VMs boot up and running.
2016 6) Verify that two VMs are launched and running by using novaclient python API.
2017 7) Verify that flow is being added in ovs-switch in compute-node.
2018 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2019 9) Verify that cord-onos pushed flows to OVS switch.
2020 """
2021 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002022
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002023 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service(self):
2024 """
2025 Algo:
2026 1) Validate that required openstack service is up and running.
2027 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2028 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2029 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2030 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2031 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2032 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2033 5) Wait till VMs boot up and running.
2034 6) Verify that two VMs are launched and running by using novaclient python API.
2035 7) Verify that flow is being added in ovs-switch in compute-node.
2036 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2037 9) Verify that cord-onos pushed flows to OVS switch.
2038 """
2039 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002040
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002041 def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service(self):
2042 """
2043 Algo:
2044 1) Validate that required openstack service is up and running.
2045 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2046 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2047 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2048 4) Now boot two images in the same created network using nova boot image command (example given below :-
2049 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
2050 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
2051 5) Wait till VMs boot up and running.
2052 6) Verify that two VMs are launched and running by using novaclient python API.
2053 7) Verify that flow is being added in ovs-switch in compute-node.
2054 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2055 9) Verify that cord-onos pushed flows to OVS switch.
2056 """
2057 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002058
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002059 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
2060 """
2061 Algo:
2062 1) Validate that required openstack service is up and running.
2063 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2064 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2065 (neutron port-create net-A-private --name stag-100).
2066 4) Now boot two images in the same created network using nova boot image command (example given below :-
2067 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2068 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2069 5) Wait till VMs boot up and running.
2070 6) Verify that two VMs are launched and running by using novaclient python API.
2071 7) Verify that flow is being added in ovs-switch in compute-node.
2072 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2073 9) Verify that cord-onos pushed flows to OVS switch.
2074 """
2075 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002076
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002077 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
2078 """
2079 Algo:
2080 1) Validate that required openstack service is up and running.
2081 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2082 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2083 (neutron port-create net-A-private --name stag-500).
2084 4) Now boot two images in the same created network using nova boot image command (example given below :-
2085 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2086 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2087 5) Wait till VMs boot up and running.
2088 6) Verify that two VMs are launched and running by using novaclient python API.
2089 7) Verify that flow is being added in ovs-switch in compute-node.
2090 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2091 9) Verify that cord-onos pushed flows to OVS switch.
2092 """
2093 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002094
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002095 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity(self):
2096 """
2097 Algo:
2098 1) Validate that required openstack service is up and running.
2099 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2100 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2101 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2102 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2103 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2104 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2105 5) Wait till VMs boot up and running.
2106 6) Verify that two VMs are launched and running by using novaclient python API.
2107 7) Now ping to the VM from other VM which are launched in same network
2108 8) verify that ping is successful
2109 9) Verify that flow is being added in ovs-switch in compute-node.
2110 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2111 11) Verify that cord-onos pushed flows to OVS switch.
2112 """
2113 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002114
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002115 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2116 """
2117 Algo:
2118 1) Validate that required openstack service is up and running.
2119 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2120 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2121 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2122 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2123 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2124 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2125 5) Wait till VMs boot up and running.
2126 6) Verify that two VMs are launched and running by using novaclient python API.
2127 7) Now ping to the VM from other VM which are launched in same network
2128 8) verify that ping is not successful
2129 9) Verify that flow is being added in ovs-switch in compute-node.
2130 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2131 11) Verify that cord-onos pushed flows to OVS switch.
2132 """
2133 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002134
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002135 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 -08002136
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002137 """
2138 Algo:
2139 1) Validate that required openstack service is up and running.
2140 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2141 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2142 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2143 4) Now boot two images in the same created network using nova boot image command (example given below :-
2144 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
2145 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
2146 5) Wait till VMs boot up and running.
2147 6) Verify that two VMs are launched and running by using novaclient python API.
2148 7) Now ping to the VM from other VM which are launched in same network
2149 8) verify that ping is not successful
2150 9) Verify that flow is being added in ovs-switch in compute-node.
2151 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2152 11) Verify that cord-onos pushed flows to OVS switch.
2153 """
2154 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002155
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002156 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 -08002157
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002158 """
2159 Algo:
2160 1) Validate that required openstack service is up and running.
2161 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2162 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2163 (neutron port-create net-A-private --name stag-100).
2164 4) Now boot two images in the same created network using nova boot image command (example given below :-
2165 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2166 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2167 5) Wait till VMs boot up and running.
2168 6) Verify that two VMs are launched and running by using novaclient python API.
2169 7) Now ping to the VM from other VM which are launched in same network
2170 8) verify that ping is not successful
2171 9) Verify that flow is being added in ovs-switch in compute-node.
2172 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2173 11) Verify that cord-onos pushed flows to OVS switch.
2174 """
2175 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002176
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002177 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2178 """
2179 Algo:
2180 1) Validate that required openstack service is up and running.
2181 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2182 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2183 (neutron port-create net-A-private --name stag-500).
2184 4) Now boot two images in the same created network using nova boot image command (example given below :-
2185 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2186 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2187 5) Wait till VMs boot up and running.
2188 6) Verify that two VMs are launched and running by using novaclient python API.
2189 7) Now ping to the VM from other VM which are launched in same network
2190 8) verify that ping is not successful
2191 9) Verify that flow is being added in ovs-switch in compute-node.
2192 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2193 11) Verify that cord-onos pushed flows to OVS switch.
2194 """
2195 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002196
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002197 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
2198 """
2199 Algo:
2200 1) Validate that required openstack service is up and running.
2201 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2202 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2203 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2204 4) Now boot image in the same created network using nova boot image command (example given below :-
2205 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2206 5) Wait till VM boots up and starts running.
2207 6) Verify that a VM is launched and running by using novaclient python API.
2208 7) Now ping to the VM from outside network which are internet network (global ping)
2209 8) verify that ping is not successful
2210 9) Verify that flow is being added in ovs-switch in compute-node.
2211 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2212 11) Verify that cord-onos pushed flows to OVS switch.
2213 """
2214 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002215
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002216 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity(self):
2217 """
2218 Algo:
2219 1) Validate that required openstack service is up and running.
2220 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2221 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2222 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2223 4) Now boot image in the same created network using nova boot image command (example given below :-
2224 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2225 5) Wait till VM boots up and starts running.
2226 6) Verify that a VM is launched and running by using novaclient python API.
2227 7) Now ping to the VM from outside network which are internet network (global ping)
2228 8) verify that ping is successful
2229 9) Verify that flow is being added in ovs-switch in compute-node.
2230 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2231 11) Verify that cord-onos pushed flows to OVS switch.
2232 """
2233 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002234
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002235 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_negative_scenario(self):
2236 """
2237 Algo:
2238 1) Validate that required openstack service is up and running.
2239 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2240 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2241 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2242 4) Now boot image in the same created network using nova boot image command (example given below :-
2243 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
2244 5) Wait till VM boots up and starts running.
2245 6) Verify that a VM is launched and running by using novaclient python API.
2246 7) Now ping to the VM from outside network which are internet network (global ping)
2247 8) verify that ping is not successful
2248 9) Verify that flow is being added in ovs-switch in compute-node.
2249 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2250 11) Verify that cord-onos pushed flows to OVS switch.
2251 """
2252 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002253
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002254 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2255 """
2256 Algo:
2257 1) Validate that required openstack service is up and running.
2258 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2259 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2260 (neutron port-create net-A-private --name stag-100).
2261 4) Now boot image in the same created network using nova boot image command (example given below :-
2262 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2263 5) Wait till VM boots up and starts running.
2264 6) Verify that a VM is launched and running by using novaclient python API.
2265 7) Now ping to the VM from outside network which are internet network (global ping)
2266 8) verify that ping is not successful
2267 9) Verify that flow is being added in ovs-switch in compute-node.
2268 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2269 11) Verify that cord-onos pushed flows to OVS switch.
2270 """
2271 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002272
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002273 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2274 """
2275 Algo:
2276 1) Validate that required openstack service is up and running.
2277 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2278 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2279 (neutron port-create net-A-private --name stag-500).
2280 4) Now boot image in the same created network using nova boot image command (example given below :-
2281 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2282 5) Wait till VM boots up and starts running.
2283 6) Verify that a VM is launched and running by using novaclient python API.
2284 7) Now ping to the VM from outside network which are internet network (global ping)
2285 8) verify that ping is not successful
2286 9) Verify that flow is being added in ovs-switch in compute-node.
2287 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2288 11) Verify that cord-onos pushed flows to OVS switch.
2289 """
2290 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002291
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002292 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
2293 """
2294 Algo:
2295 1) Validate that required openstack service is up and running.
2296 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2297 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2298 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2299 4) Now boot image in the same created network using nova boot image command (example given below :-
2300 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2301 5) Wait till VM boots up and starts running.
2302 6) Verify that a VM is launched and running by using novaclient python API.
2303 7) Now ping to the VM from compute node network which are launched a VM.
2304 8) verify that ping is not successful
2305 9) Verify that flow is being added in ovs-switch in compute-node.
2306 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2307 11) Verify that cord-onos pushed flows to OVS switch.
2308 """
2309 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002310
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002311 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_negative_scenario(self):
2312 """
2313 Algo:
2314 1) Validate that required openstack service is up and running.
2315 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2316 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2317 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2318 4) Now boot image in the same created network using nova boot image command (example given below :-
2319 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2320 5) Wait till VM boots up and starts running.
2321 6) Verify that a VM is launched and running by using novaclient python API.
2322 7) Now ping to the VM from compute node network which are launched a VM.
2323 8) verify that ping is not successful
2324 9) Verify that flow is being added in ovs-switch in compute-node.
2325 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2326 11) Verify that cord-onos pushed flows to OVS switch.
2327 """
2328 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002329
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002330 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity(self):
2331 """
2332 Algo:
2333 1) Validate that required openstack service is up and running.
2334 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2335 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2336 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2337 4) Now boot image in the same created network using nova boot image command (example given below :-
2338 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
2339 5) Wait till VM boots up and starts running.
2340 6) Verify that a VM is launched and running by using novaclient python API.
2341 7) Now ping to the VM from compute node network which are launched a VM.
2342 8) verify that ping is successful
2343 9) Verify that flow is being added in ovs-switch in compute-node.
2344 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2345 11) Verify that cord-onos pushed flows to OVS switch.
2346 """
2347 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002348
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002349 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2350 """
2351 Algo:
2352 1) Validate that required openstack service is up and running.
2353 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2354 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2355 (neutron port-create net-A-private --name stag-100).
2356 4) Now boot image in the same created network using nova boot image command (example given below :-
2357 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2358 5) Wait till VM boots up and starts running.
2359 6) Verify that a VM is launched and running by using novaclient python API.
2360 7) Now ping to the VM from compute node network which are launched a VM.
2361 8) verify that ping is not successful
2362 9) Verify that flow is being added in ovs-switch in compute-node.
2363 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2364 11) Verify that cord-onos pushed flows to OVS switch.
2365 """
2366 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002367
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002368 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2369 """
2370 Algo:
2371 1) Validate that required openstack service is up and running.
2372 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2373 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2374 (neutron port-create net-A-private --name stag-500).
2375 4) Now boot image in the same created network using nova boot image command (example given below :-
2376 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2377 5) Wait till VM boots up and starts running.
2378 6) Verify that a VM is launched and running by using novaclient python API.
2379 7) Now ping to the VM from compute node network which are launched a VM.
2380 8) verify that ping is not successful
2381 9) Verify that flow is being added in ovs-switch in compute-node.
2382 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2383 11) Verify that cord-onos pushed flows to OVS switch.
2384 """
2385 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002386
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002387 def test_cordvtn_creating_virtual_vlan_interface_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002388
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002389 """
2390 Algo:
2391 1) Validate that required openstack service is up and running.
2392 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2393 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2394 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2395 4) Now boot image in the same created network using nova boot image command (example given below :-
2396 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2397 5) Wait till VM boots up and starts running.
2398 6) Verify that a VM is launched and running by using novaclient python API.
2399 7) Create a virtual interface with vlan tag and private ip on VM.
2400 8) Create a same virtual interface with valn tag and private ip on head node.
2401 9) Now ping to the VM from head node network which are launched a openstack service.
2402 10) verify that ping is successful
2403 11) Verify that flow is being added in ovs-switch in compute-node.
2404 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2405 13) Verify that cord-onos pushed flows to OVS switch.
2406 """
2407 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002408
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002409 def test_cordvtn_creating_virtual_vlan_interface_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002410
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002411 """
2412 Algo:
2413 1) Validate that required openstack service is up and running.
2414 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2415 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2416 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2417 4) Now boot image in the same created network using nova boot image command (example given below :-
2418 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2419 5) Wait till VM boots up and starts running.
2420 6) Verify that a VM is launched and running by using novaclient python API.
2421 7) Create a virtual interface with vlan tag and public ip on VM.
2422 8) Create a same virtual interface with valn tag and any pulic ip on head node.
2423 9) Now ping to the VM from head node network which are launched a openstack service.
2424 10) verify that ping is successful
2425 11) Verify that flow is being added in ovs-switch in compute-node.
2426 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2427 13) Verify that cord-onos pushed flows to OVS switch.
2428 """
2429 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002430
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002431 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002432
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002433 """
2434 Algo:
2435 1) Validate that required openstack service is up and running.
2436 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2437 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2438 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2439 4) Now boot image in the same created network using nova boot image command (example given below :-
2440 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
2441 5) Wait till VM boots up and starts running.
2442 6) Verify that a VM is launched and running by using novaclient python API.
2443 7) Create a virtual interface with vlan tag and local management ip on VM.
2444 8) Create a same virtual interface with valn tag and any local management ip on head node.
2445 9) Now ping to the VM from head node network which are launched a openstack service.
2446 10) verify that ping is successful
2447 11) Verify that flow is being added in ovs-switch in compute-node.
2448 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2449 13) Verify that cord-onos pushed flows to OVS switch.
2450 """
2451 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002452
ChetanGaonker901727c2016-11-29 14:05:03 -08002453
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002454 def test_cordvtn_creating_virtual_vlan_interface_floating_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002455
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002456 """
2457 Algo:
2458 1) Validate that required openstack service is up and running.
2459 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2460 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2461 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2462 4) Now boot image in the same created network using nova boot image command (example given below :-
2463 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2464 5) Wait till VM boots up and starts running.
2465 6) Verify that a VM is launched and running by using novaclient python API.
2466 7) Create a virtual interface with vlan tag and private floating ip on VM.
2467 8) Create a same virtual interface with valn tag and private floating ip on head node.
2468 9) Now ping to the VM from head node network which are launched a openstack service.
2469 10) verify that ping is successful
2470 11) Verify that flow is being added in ovs-switch in compute-node.
2471 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2472 13) Verify that cord-onos pushed flows to OVS switch.
2473 """
2474 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002475
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002476 def test_cordvtn_creating_virtual_vlan_interface_floating_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002477
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002478 """
2479 Algo:
2480 1) Validate that required openstack service is up and running.
2481 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2482 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2483 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2484 4) Now boot image in the same created network using nova boot image command (example given below :-
2485 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2486 5) Wait till VM boots up and starts running.
2487 6) Verify that a VM is launched and running by using novaclient python API.
2488 7) Create a virtual interface with vlan tag and public floating ip on VM.
2489 8) Create a same virtual interface with valn tag and any pulic floating ip on head node.
2490 9) Now ping to the VM from head node network which are launched a openstack service.
2491 10) verify that ping is successful
2492 11) Verify that flow is being added in ovs-switch in compute-node.
2493 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2494 13) Verify that cord-onos pushed flows to OVS switch.
2495 """
2496 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002497
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002498 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002499
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002500 """
2501 Algo:
2502 1) Validate that required openstack service is up and running.
2503 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2504 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2505 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2506 4) Now boot image in the same created network using nova boot image command (example given below :-
2507 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
2508 5) Wait till VM boots up and starts running.
2509 6) Verify that a VM is launched and running by using novaclient python API.
2510 7) Create a virtual interface with vlan tag and local management floating ip on VM.
2511 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
2512 9) Now ping to the VM from head node network which are launched a openstack service.
2513 10) verify that ping is successful
2514 11) Verify that flow is being added in ovs-switch in compute-node.
2515 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2516 13) Verify that cord-onos pushed flows to OVS switch.
2517 """
2518 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002519
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002520 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 -08002521
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002522 """
2523 Algo:
2524 1) Validate that required openstack service is up and running.
2525 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2526 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2527 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2528 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2529 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2530 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2531 5) Wait till VMs boot up and running.
2532 6) Verify that two VMs are launched and running by using novaclient python API.
2533 7) Now ping to the VM from other VM which are launched in the private network
2534 8) verify that ping is not successful
2535 9) Verify that flow is being added in ovs-switch in compute-node.
2536 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2537 11) Verify that cord-onos pushed flows to OVS switch.
2538 """
2539 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002540
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002541 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 -08002542
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002543 """
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 an IP as local management network.
2548 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2549 4) Now boot two images in the same created network using nova boot image command (example given below :-
2550 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
2551 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
2552 5) Wait till VMs boot up and running.
2553 6) Verify that two VMs are launched and running by using novaclient python API.
2554 7) Now ping to the VM from other VM which are launched in the private network
2555 8) verify that ping is not successful
2556 9) Verify that flow is being added in ovs-switch in compute-node.
2557 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2558 11) Verify that cord-onos pushed flows to OVS switch.
2559 """
2560 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002561
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002562 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 -08002563
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002564 """
2565 Algo:
2566 1) Validate that required openstack service is up and running.
2567 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2568 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2569 (neutron port-create net-A-private --name stag-100).
2570 4) Now boot two images in the same created network using nova boot image command (example given below :-
2571 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2572 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2573 5) Wait till VMs boot up and running.
2574 6) Verify that two VMs are launched and running by using novaclient python API.
2575 7) Now ping to the VM from other VM which are launched in the private network
2576 8) verify that ping is not successful
2577 9) Verify that flow is being added in ovs-switch in compute-node.
2578 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2579 11) Verify that cord-onos pushed flows to OVS switch.
2580 """
2581 pass
2582
2583 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):
2584
2585 """
2586 Algo:
2587 1) Validate that required openstack service is up and running.
2588 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2589 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2590 (neutron port-create net-A-private --name stag-500).
2591 4) Now boot two images in the same created network using nova boot image command (example given below :-
2592 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2593 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2594 5) Wait till VMs boot up and running.
2595 6) Verify that two VMs are launched and running by using novaclient python API.
2596 7) Now ping to the VM from other VM which are launched in the private network
2597 8) verify that ping is not successful
2598 9) Verify that flow is being added in ovs-switch in compute-node.
2599 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2600 11) Verify that cord-onos pushed flows to OVS switch.
2601 """
2602 pass
2603
2604 def test_cordvtn_creating_one_virtual_local_management_other_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2605
2606 """
2607 Algo:
2608 1) Validate that required openstack service is up and running.
2609 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2610 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2611 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2612 4) Now boot two images in the same created network using nova boot image command (example given below :-
2613 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
2614 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
2615 5) Wait till VMs boot up and running.
2616 6) Verify that two VMs are launched and running by using novaclient python API.
2617 7) Now ping to the VM from other VM which are launched in the public network
2618 8) verify that ping is not successful
2619 9) Verify that flow is being added in ovs-switch in compute-node.
2620 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2621 11) Verify that cord-onos pushed flows to OVS switch.
2622 """
2623 pass
2624
2625 def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2626
2627 """
2628 Algo:
2629 1) Validate that required openstack service is up and running.
2630 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2631 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2632 (neutron port-create net-A-private --name stag-100).
2633 4) Now boot two images in the same created network using nova boot image command (example given below :-
2634 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2635 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2636 5) Wait till VMs boot up and running.
2637 6) Verify that two VMs are launched and running by using novaclient python API.
2638 7) Now ping to the VM from other VM which are launched in the public network
2639 8) verify that ping is not successful
2640 9) Verify that flow is being added in ovs-switch in compute-node.
2641 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2642 11) Verify that cord-onos pushed flows to OVS switch.
2643 """
2644 pass
2645
2646 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):
2647
2648 """
2649 Algo:
2650 1) Validate that required openstack service is up and running.
2651 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2652 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2653 (neutron port-create net-A-private --name stag-500).
2654 4) Now boot two images in the same created network using nova boot image command (example given below :-
2655 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2656 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2657 5) Wait till VMs boot up and running.
2658 6) Verify that two VMs are launched and running by using novaclient python API.
2659 7) Now ping to the VM from other VM which are launched in the public network
2660 8) verify that ping is not successful
2661 9) Verify that flow is being added in ovs-switch in compute-node.
2662 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2663 11) Verify that cord-onos pushed flows to OVS switch.
2664 """
2665 pass
2666
2667 def test_cordvtn_creating_one_virtual_vlan_connectivity_other_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2668
2669 """
2670 Algo:
2671 1) Validate that required openstack service is up and running.
2672 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2673 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2674 (neutron port-create net-A-private --name stag-100).
2675 4) Now boot two images in the same created network using nova boot image command (example given below :-
2676 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2677 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2678 5) Wait till VMs boot up and running.
2679 6) Verify that two VMs are launched and running by using novaclient python API.
2680 7) Now ping to the VM from other VM which are launched in the public network
2681 8) verify that ping is not successful
2682 9) Verify that flow is being added in ovs-switch in compute-node.
2683 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2684 11) Verify that cord-onos pushed flows to OVS switch.
2685 """
2686 pass
2687
2688 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):
2689
2690 """
2691 Algo:
2692 1) Validate that required openstack service is up and running.
2693 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2694 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2695 (neutron port-create net-A-private --name stag-500).
2696 4) Now boot two images in the same created network using nova boot image command (example given below :-
2697 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2698 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2699 5) Wait till VMs boot up and running.
2700 6) Verify that two VMs are launched and running by using novaclient python API.
2701 7) Now ping to the VM from other VM which are launched in the public network
2702 8) verify that ping is not successful
2703 9) Verify that flow is being added in ovs-switch in compute-node.
2704 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2705 11) Verify that cord-onos pushed flows to OVS switch.
2706 """
2707 pass
2708
2709 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):
2710
2711 """
2712 Algo:
2713 1) Validate that required openstack service is up and running.
2714 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2715 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2716 (neutron port-create net-A-private --name stag-500).
2717 4) Now boot two images in the same created network using nova boot image command (example given below :-
2718 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2719 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2720 5) Wait till VMs boot up and running.
2721 6) Verify that two VMs are launched and running by using novaclient python API.
2722 7) Now ping to the VM from other VM which are launched in the public network
2723 8) verify that ping is not successful
2724 9) Verify that flow is being added in ovs-switch in compute-node.
2725 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2726 11) Verify that cord-onos pushed flows to OVS switch.
2727 """
2728 pass
2729
2730 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_with_invalid_public_field_of_onos_network_cfg_json_in_same_service(self):
2731 """
2732 Algo:
2733 1) Validate that required openstack service is up and running.
2734 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2735 3) Push network_cfg.json config file to onos with an invalid public gateway ip in network_cfg.json file.
2736 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2737 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2738 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2739 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2740 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2741 6) Wait till VMs boot up and running.
2742 7) Verify that two VMs are launched and running by using novaclient python API.
2743 8) Verify that flow is being added in ovs-switch in compute-node.
2744 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2745 10) Verify that cord-onos pushed flows to OVS switch.
2746 11) Verify ping from VM to public gateway which is send to ONOS through rest API in network_cfg.json file.
2747 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.
2748 13) Now ping one VM to other VM it should not ping again even it in the same service.
2749 """
2750 pass
2751
2752 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_with_invalid_localManagementIp_field_of_onos_network_cfg_json(self):
2753
2754 """
2755 Algo:
2756 1) Validate that required openstack service is up and running.
2757 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2758 3) Push network_cfg.json config file to onos with an invalid localManagement ip in network_cfg.json file.
2759 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2760 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2761 5) Now boot image in the same created network using nova boot image command (example given below :-
2762 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
2763 6) Wait till VM boots up and starts running.
2764 7) Verify that a VM is launched and running by using novaclient python API.
2765 8) Verify that flow is being added in ovs-switch in compute-node.
2766 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2767 10) Verify that cord-onos pushed flows to OVS switch.
2768 11) Verify ping from VM to local management ip which is send to ONOS through rest API in network_cfg.json file.
2769 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.
2770 """
2771 pass
2772
2773 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OVSDB_port_field_of_onos_network_cfg_json(self):
2774 """
2775 Algo:
2776 1) Validate that required openstack service is up and running.
2777 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2778 3) Push network_cfg.json config file to onos with an invalid ovsdb port in network_cfg.json file.
2779 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2780 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2781 4) Now boot image in the same created network using nova boot image command (example given below :-
2782 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2783 5) Wait till VM boots up and starts running.
2784 6) Verify that a VM is launched and running by using novaclient python API.
2785 7) Verify that flows are being added in ovs-switch in compute-node.
2786 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2787 9) Verify that cord-onos did not push any flows to OVS switch.
2788 """
2789 pass
2790
2791 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OpenStack_details_in_onos_network_cfg_json(self):
2792 """
2793 Algo:
2794 1) Validate that required openstack service is up and running.
2795 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2796 3) Push network_cfg.json config file to onos with an invalid openstack in network_cfg.json file.
2797 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2798 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2799 4) Now boot image in the same created network using nova boot image command (example given below :-
2800 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2801 5) Wait till VM boots up and starts running.
2802 6) Verify that a VM is launched and running by using novaclient python API.
2803 7) Verify that no flows are being added in ovs-switch in compute-node.
2804 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
2805 9) Verify that cord-onos did not push any flows to OVS switch.
2806 """
2807 pass
2808
2809 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_compute_node_details_in_onos_network_cfg_json(self):
2810 """
2811 Algo:
2812 1) Validate that required openstack service is up and running.
2813 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2814 3) Push network_cfg.json config file to onos with an invalid compute node details in network_cfg.json file.
2815 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2816 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2817 4) Now boot image in the same created network using nova boot image command (example given below :-
2818 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2819 5) Wait till VM boots up and starts running.
2820 6) Verify that a VM is launched and running by using novaclient python API.
2821 7) Verify that no flows are being added in ovs-switch in compute-node.
2822 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
2823 9) Verify that cord-onos did not push any flows to OVS switch.
2824 """
2825 pass
2826
2827
2828 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_in_different_services_connectivity(self):
2829 """
2830 Algo:
2831 1) Validate that required openstack service is up and running.
2832 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2833 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as private network.
2834 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2835 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2836 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2837 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2838 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2839 5) Wait till VMs boot up and running.
2840 6) Verify that two VMs are launched and running by using novaclient python API.
2841 7) Verify that flow is being added in ovs-switch in compute-node.
2842 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2843 9) Verify that cord-onos pushed flows to OVS switch.
2844 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2845 11) Verify that no flows are being added in the OVS switch.
2846 """
2847 pass
2848
2849 def test_cordvtn_creating_two_virtual_public_networks_and_boot_images_in_different_service_connectivity(self):
2850 """
2851 Algo:
2852 1) Validate that required openstack service is up and running.
2853 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2854 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as public network.
2855 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2856 (neutron net-create net-A-public, neutron subnet-create net-B-public 198.1.0.0/24).
2857 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2858 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2859 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2860 5) Wait till VMs boot up and running.
2861 6) Verify that two VMs are launched and running by using novaclient python API.
2862 7) Verify that flow is being added in ovs-switch in compute-node.
2863 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2864 9) Verify that cord-onos pushed flows to OVS switch.
2865 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2866 11) Verify that no flows are being added in the OVS switch.
2867 """
2868 pass
2869
2870 def test_cordvtn_creating_two_virtual_local_management_networks_and_boot_images_in_different_service_connectivity(self):
2871 """
2872 Algo:
2873 1) Validate that required openstack service is up and running.
2874 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2875 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.
2876 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2877 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.28.0.0/24 -gateway 172.28.0.1).
2878 4) Now boot two images in the same created network using nova boot image command (example given below :-
2879 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
2880 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
2881 5) Wait till VMs boot up and running.
2882 6) Verify that two VMs are launched and running by using novaclient python API.
2883 7) Verify that flow is being added in ovs-switch in compute-node.
2884 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2885 9) Verify that cord-onos pushed flows to OVS switch.
2886 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2887 11) Verify that no flows are being added in the OVS switch.
2888 """
2889 pass
2890
2891 def test_cordvtn_creating_two_virtual_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
2892 """
2893 Algo:
2894 1) Validate that required openstack service is up and running.
2895 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2896 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with a vlan port-create.
2897 (neutron port-create net-A-private --name stag-100).
2898 (neutron port-create net-B-private --name stag-200).
2899 4) Now boot two images in the same created network using nova boot image command (example given below :-
2900 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2901 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg1-01
2902 5) Wait till VMs boot up and running.
2903 6) Verify that two VMs are launched and running by using novaclient python API.
2904 7) Verify that flow is being added in ovs-switch in compute-node.
2905 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2906 9) Verify that cord-onos pushed flows to OVS switch.
2907 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2908 11) Verify that no flows are being added in the OVS switch.
2909 """
2910 pass
2911 def test_cordvtn_creating_two_virtual_floating_IP_with_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
2912 """
2913 Algo:
2914 1) Validate that required openstack service is up and running.
2915 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2916 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.
2917 (neutron port-create net-A-private --name stag-500).
2918 (neutron port-create net-B-private --name stag-500).
2919 4) Now boot two images in the same created network using nova boot image command (example given below :-
2920 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2921 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2922 5) Wait till VMs boot up and running.
2923 6) Verify that two VMs are launched and running by using novaclient python API.
2924 7) Verify that flow is being added in ovs-switch in compute-node.
2925 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2926 9) Verify that cord-onos pushed flows to OVS switch.
2927 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2928 11) Verify that no flows are being added in the OVS switch.
2929 """
2930 pass
2931
2932 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_direct_access(self):
2933 """
2934 Algo:
2935 1) Validate that required openstack service is up and running.
2936 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2937 3) Push service dependency data.json file to onos to subscriber of other service.
2938 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
2939 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
2940 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2941 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2942 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2943 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2944 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2945 6) Wait till VMs boot up and running.
2946 7) Verify that two VMs are launched and running by using novaclient python API.
2947 8) Verify that flow is being added in ovs-switch in compute-node.
2948 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2949 10) Verify that cord-onos pushed flows to OVS switch.
2950 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
2951 12) Verify that flows are being added in the OVS switch.
2952 """
2953 pass
2954
2955 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_indirect_access(self):
2956 """
2957 Algo:
2958 1) Validate that required openstack service is up and running.
2959 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2960 3) Push service dependency data.json file to onos to subscriber of other service.
2961 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
2962 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
2963 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2964 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2965 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2966 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2967 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2968 6) Wait till VMs boot up and running.
2969 7) Verify that two VMs are launched and running by using novaclient python API.
2970 8) Verify that flow is being added in ovs-switch in compute-node.
2971 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2972 10) Verify that cord-onos pushed flows to OVS switch.
2973 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.
2974 12) Verify that flows are being added in the OVS switch.
2975 """
2976 pass
2977
2978 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_direct_access(self):
2979 """
2980 Algo:
2981 1) Validate that required openstack service is up and running.
2982 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2983 3) Push service dependency data.json file to onos to subscriber of other service.
2984 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
2985 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
2986 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2987 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2988 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2989 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2990 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2991 6) Wait till VMs boot up and running.
2992 7) Verify that two VMs are launched and running by using novaclient python API.
2993 8) Verify that flow is being added in ovs-switch in compute-node.
2994 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2995 10) Verify that cord-onos pushed flows to OVS switch.
2996 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
2997 12) Verify that flows are being added in the OVS switch.
2998 13) Push config data with outservice dependency in data.json file to onos to subscriber of other service.
2999 14) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
3000 15) Verify that no flows are being added in the OVS switch.
3001 """
3002 pass
3003
3004 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_indirect_access(self):
3005 """
3006 Algo:
3007 1) Validate that required openstack service is up and running.
3008 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3009 3) Push service dependency data.json file to onos to subscriber of other service.
3010 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3011 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3012 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3013 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3014 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3015 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3016 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3017 6) Wait till VMs boot up and running.
3018 7) Verify that two VMs are launched and running by using novaclient python API.
3019 8) Verify that flow is being added in ovs-switch in compute-node.
3020 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3021 10) Verify that cord-onos pushed flows to OVS switch.
3022 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.
3023 12) Verify that flows are being added in the OVS switch.
3024 13) Push config data with out service dependency in data.json file to onos to subscriber of other service.
3025 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.
3026 15) Verify that no flows are being added in the OVS switch.
3027 """
3028 pass
3029
3030 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_direct_access(self):
3031 """
3032 Algo:
3033 1) Validate that required openstack service is up and running.
3034 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3035 3) Validate that XOS is up and running.
3036 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3037 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3038 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3039 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3040 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3041 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3042 6) Wait till VMs boot up and running.
3043 7) Verify that two VMs are launched and running by using novaclient python API.
3044 8) Verify that flow is being added in ovs-switch in compute-node.
3045 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3046 10) Verify that cord-onos pushed flows to OVS switch.
3047 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
3048 12) Verify that flows are being added in the OVS switch.
3049 """
3050 pass
3051
3052 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_indirect_access(self):
3053 """
3054 Algo:
3055 1) Validate that required openstack service is up and running.
3056 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3057 3) Validate that XOS is up and running.
3058 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3059 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3060 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3061 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3062 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3063 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3064 6) Wait till VMs boot up and running.
3065 7) Verify that two VMs are launched and running by using novaclient python API.
3066 8) Verify that flow is being added in ovs-switch in compute-node.
3067 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3068 10) Verify that cord-onos pushed flows to OVS switch.
3069 11) Now ping from VM which is Net-B to other VM which is in Net-A, should ping.
3070 12) Verify that flows are being added in the OVS switch.
3071 """
3072 pass
3073
3074 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_network_cfg_connectivity_to_access_device(self):
3075 """
3076 Algo:
3077 1) Validate that required openstack service is up and running.
3078 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3079 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
3080 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3081 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3082 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3083 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3084 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3085 6) We ahve to stop ONOS service to test this
3086 onos-service stop
3087 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3088 7) Now attach to access-agent container and ping to access-device
3089 8) Verify that ping should be success and flows are being added in br-int.
3090 """
3091 pass
3092
3093 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
3094 """
3095 Algo:
3096 1) Validate that required openstack service is up and running.
3097 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3098 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
3099 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3100 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3101 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3102 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3103 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3104 6) We ahve to stop ONOS service to test this
3105 onos-service stop
3106 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3107 7) Now attach to access-agent container and ping to head node
3108 8) Verify that ping should be success and flows are being added in br-int.
3109 """
3110 pass
3111
3112 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_network_cfg_connectivity_to_access_device(self):
3113 """
3114 Algo:
3115 1) Validate that required openstack service is up and running.
3116 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3117 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
3118 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3119 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3120 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3121 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3122 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3123 6) We ahve to stop ONOS service to test this
3124 onos-service stop
3125 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3126 7) Now attach to access-agent container and ping to access-device
3127 8) Verify that ping should not be success and no flows are being added in br-int.
3128 """
3129 pass
3130
3131 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
3132 """
3133 Algo:
3134 1) Validate that required openstack service is up and running.
3135 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3136 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
3137 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3138 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3139 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3140 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3141 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3142 6) We ahve to stop ONOS service to test this
3143 onos-service stop
3144 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3145 7) Now attach to access-agent container and ping to head node
3146 8) Verify that ping should not be success and no flows are being added in br-int.
3147 """
3148 pass
3149
3150 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_VMs(self):
3151 """
3152 Algo:
3153 1) Validate that required openstack service is up and running.
3154 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3155 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3156 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3157 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3158 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3159 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3160 5) Wait till VMs boot up and running.
3161 6) Verify that two VMs are launched and running by using novaclient python API.
3162 7) Now ping to the VM from other VM which are launched in same network
3163 8) verify that ping is successful
3164 9) Verify that flow is being added in ovs-switch in compute-node.
3165 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3166 11) Verify that cord-onos pushed flows to OVS switch.
3167 12) Restart both VMs in same service and repeat steps 7 to 11.
3168 """
3169 pass
3170
3171 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_cord_onos(self):
3172 """
3173 Algo:
3174 1) Validate that required openstack service is up and running.
3175 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3176 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3177 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3178 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3179 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3180 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3181 5) Wait till VMs boot up and running.
3182 6) Verify that two VMs are launched and running by using novaclient python API.
3183 7) Now ping to the VM from other VM which are launched in same network
3184 8) verify that ping is successful
3185 9) Verify that flow is being added in ovs-switch in compute-node.
3186 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3187 11) Verify that cord-onos pushed flows to OVS switch.
3188 12) Restart ONOS service and repeat steps 7 to 11.
3189 """
3190 pass
3191
3192 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_any_VM_recreating_it(self):
3193 """
3194 Algo:
3195 1) Validate that required openstack service is up and running.
3196 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3197 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3198 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3199 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3200 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3201 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3202 5) Wait till VMs boot up and running.
3203 6) Verify that two VMs are launched and running by using novaclient python API.
3204 7) Now ping to the VM from other VM which are launched in same network
3205 8) verify that ping is successful
3206 9) Verify that flow is being added in ovs-switch in compute-node.
3207 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3208 11) Verify that cord-onos pushed flows to OVS switch.
3209 12) Delete a VM which was created earlier and repeat steps 4 to 11.
3210 """
3211 pass
3212
3213 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_and_add_br_int_bridge(self):
3214 """
3215 Algo:
3216 1) Validate that required openstack service is up and running.
3217 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3218 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3219 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3220 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3221 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3222 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3223 5) Wait till VMs boot up and running.
3224 6) Verify that two VMs are launched and running by using novaclient python API.
3225 7) Now ping to the VM from other VM which are launched in same network
3226 8) verify that ping is successful
3227 9) Verify that flow is being added in ovs-switch in compute-node.
3228 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3229 11) Verify that cord-onos pushed flows to OVS switch.
3230 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3231 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3232 """
3233 pass
3234
3235 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_VM(self):
3236
3237 """
3238 Algo:
3239 1) Validate that required openstack service is up and running.
3240 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3241 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3242 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3243 4) Now boot image in the same created network using nova boot image command (example given below :-
3244 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3245 5) Wait till VM boots up and starts running.
3246 6) Verify that a VM is launched and running by using novaclient python API.
3247 7) Now ping to the VM from outside network which are internet network (global ping)
3248 8) verify that ping is successful
3249 9) Verify that flow is being added in ovs-switch in compute-node.
3250 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3251 11) Verify that cord-onos pushed flows to OVS switch.
3252 12) Restart the VM in service and repeat steps 7 to 11.
3253
3254 """
3255 pass
3256
3257 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3258
3259 """
3260 Algo:
3261 1) Validate that required openstack service is up and running.
3262 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3263 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3264 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3265 4) Now boot image in the same created network using nova boot image command (example given below :-
3266 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3267 5) Wait till VM boots up and starts running.
3268 6) Verify that a VM is launched and running by using novaclient python API.
3269 7) Now ping to the VM from outside network which are internet network (global ping)
3270 8) verify that ping is successful
3271 9) Verify that flow is being added in ovs-switch in compute-node.
3272 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3273 11) Verify that cord-onos pushed flows to OVS switch.
3274 12) Restart onos service container and repeat steps 7 to 11.
3275
3276 """
3277 pass
3278
3279 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3280
3281 """
3282 Algo:
3283 1) Validate that required openstack service is up and running.
3284 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3285 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3286 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3287 4) Now boot image in the same created network using nova boot image command (example given below :-
3288 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3289 5) Wait till VM boots up and starts running.
3290 6) Verify that a VM is launched and running by using novaclient python API.
3291 7) Now ping to the VM from outside network which are internet network (global ping)
3292 8) verify that ping is successful
3293 9) Verify that flow is being added in ovs-switch in compute-node.
3294 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3295 11) Verify that cord-onos pushed flows to OVS switch.
3296 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
3297
3298 """
3299 pass
3300
3301 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3302
3303 """
3304 Algo:
3305 1) Validate that required openstack service is up and running.
3306 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3307 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3308 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3309 4) Now boot image in the same created network using nova boot image command (example given below :-
3310 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3311 5) Wait till VM boots up and starts running.
3312 6) Verify that a VM is launched and running by using novaclient python API.
3313 7) Now ping to the VM from outside network which are internet network (global ping)
3314 8) verify that ping is successful
3315 9) Verify that flow is being added in ovs-switch in compute-node.
3316 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3317 11) Verify that cord-onos pushed flows to OVS switch.
3318 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3319 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3320
3321 """
3322 pass
3323
3324 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3325
3326 """
3327 Algo:
3328 1) Validate that required openstack service is up and running.
3329 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3330 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3331 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3332 4) Now boot image in the same created network using nova boot image command (example given below :-
3333 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
3334 5) Wait till VM boots up and starts running.
3335 6) Verify that a VM is launched and running by using novaclient python API.
3336 7) Now ping to the VM from compute node network which are launched a VM.
3337 8) verify that ping is successful
3338 9) Verify that flow is being added in ovs-switch in compute-node.
3339 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3340 11) Verify that cord-onos pushed flows to OVS switch.
3341 12) Restart the VM in service and repeat steps 7 to 11.
3342 """
3343 pass
3344
3345 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3346
3347 """
3348 Algo:
3349 1) Validate that required openstack service is up and running.
3350 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3351 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3352 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
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 --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) Now ping to the VM from compute node network which are launched a VM.
3358 8) verify that ping is successful
3359 9) Verify that flow is being added in ovs-switch in compute-node.
3360 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3361 11) Verify that cord-onos pushed flows to OVS switch.
3362 12) Restart the onos service and repeat steps 7 to 11.
3363 """
3364 pass
3365
3366 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3367
3368 """
3369 Algo:
3370 1) Validate that required openstack service is up and running.
3371 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3372 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3373 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3374 4) Now boot image in the same created network using nova boot image command (example given below :-
3375 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
3376 5) Wait till VM boots up and starts running.
3377 6) Verify that a VM is launched and running by using novaclient python API.
3378 7) Now ping to the VM from compute node network which are launched a VM.
3379 8) verify that ping is successful
3380 9) Verify that flow is being added in ovs-switch in compute-node.
3381 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3382 11) Verify that cord-onos pushed flows to OVS switch.
3383 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
3384 """
3385 pass
3386
3387 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3388
3389 """
3390 Algo:
3391 1) Validate that required openstack service is up and running.
3392 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3393 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3394 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3395 4) Now boot image in the same created network using nova boot image command (example given below :-
3396 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
3397 5) Wait till VM boots up and starts running.
3398 6) Verify that a VM is launched and running by using novaclient python API.
3399 7) Now ping to the VM from compute node network which are launched a VM.
3400 8) verify that ping is successful
3401 9) Verify that flow is being added in ovs-switch in compute-node.
3402 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3403 11) Verify that cord-onos pushed flows to OVS switch.
3404 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3405 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3406 """
3407 pass
3408
3409 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3410
3411 """
3412 Algo:
3413 1) Validate that required openstack service is up and running.
3414 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3415 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3416 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3417 4) Now boot image in the same created network using nova boot image command (example given below :-
3418 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
3419 5) Wait till VM boots up and starts running.
3420 6) Verify that a VM is launched and running by using novaclient python API.
3421 7) Create a virtual interface with vlan tag and local management ip on VM.
3422 8) Create a same virtual interface with valn tag and any local management ip on head node.
3423 9) Now ping to the VM from head node network which are launched a openstack service.
3424 10) verify that ping is successful
3425 11) Verify that flow is being added in ovs-switch in compute-node.
3426 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3427 13) Verify that cord-onos pushed flows to OVS switch.
3428 14) Restart the VM in service and repeat steps 9 to 13.
3429
3430 """
3431 pass
3432
3433 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3434
3435 """
3436 Algo:
3437 1) Validate that required openstack service is up and running.
3438 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3439 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3440 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3441 4) Now boot image in the same created network using nova boot image command (example given below :-
3442 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
3443 5) Wait till VM boots up and starts running.
3444 6) Verify that a VM is launched and running by using novaclient python API.
3445 7) Create a virtual interface with vlan tag and local management ip on VM.
3446 8) Create a same virtual interface with valn tag and any local management ip on head node.
3447 9) Now ping to the VM from head node network which are launched a openstack service.
3448 10) verify that ping is successful
3449 11) Verify that flow is being added in ovs-switch in compute-node.
3450 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3451 13) Verify that cord-onos pushed flows to OVS switch.
3452 14) Restart the ONOS service and repeat steps 9 to 13.
3453
3454 """
3455 pass
3456
3457 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3458
3459 """
3460 Algo:
3461 1) Validate that required openstack service is up and running.
3462 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3463 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3464 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3465 4) Now boot image in the same created network using nova boot image command (example given below :-
3466 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
3467 5) Wait till VM boots up and starts running.
3468 6) Verify that a VM is launched and running by using novaclient python API.
3469 7) Create a virtual interface with vlan tag and local management ip on VM.
3470 8) Create a same virtual interface with valn tag and any local management ip on head node.
3471 9) Now ping to the VM from head node network which are launched a openstack service.
3472 10) verify that ping is successful
3473 11) Verify that flow is being added in ovs-switch in compute-node.
3474 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3475 13) Verify that cord-onos pushed flows to OVS switch.
3476 14) Delete and re-create a VM in service and repeat steps 9 to 13.
3477
3478 """
3479 pass
3480
3481 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3482
3483 """
3484 Algo:
3485 1) Validate that required openstack service is up and running.
3486 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3487 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3488 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3489 4) Now boot image in the same created network using nova boot image command (example given below :-
3490 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
3491 5) Wait till VM boots up and starts running.
3492 6) Verify that a VM is launched and running by using novaclient python API.
3493 7) Create a virtual interface with vlan tag and local management ip on VM.
3494 8) Create a same virtual interface with valn tag and any local management ip on head node.
3495 9) Now ping to the VM from head node network which are launched a openstack service.
3496 10) verify that ping is successful
3497 11) Verify that flow is being added in ovs-switch in compute-node.
3498 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3499 13) Verify that cord-onos pushed flows to OVS switch.
3500 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
3501 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
3502
3503 """
3504 pass
3505
3506 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3507
3508 """
3509 Algo:
3510 1) Validate that required openstack service is up and running.
3511 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3512 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3513 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3514 4) Now boot image in the same created network using nova boot image command (example given below :-
3515 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
3516 5) Wait till VM boots up and starts running.
3517 6) Verify that a VM is launched and running by using novaclient python API.
3518 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3519 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3520 9) Now ping to the VM from head node network which are launched a openstack service.
3521 10) verify that ping is successful
3522 11) Verify that flow is being added in ovs-switch in compute-node.
3523 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3524 13) Verify that cord-onos pushed flows to OVS switch.
3525 14) Restart the VM in service and repeat steps 9 to 13.
3526 """
3527 pass
3528
3529 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3530
3531 """
3532 Algo:
3533 1) Validate that required openstack service is up and running.
3534 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3535 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3536 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3537 4) Now boot image in the same created network using nova boot image command (example given below :-
3538 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
3539 5) Wait till VM boots up and starts running.
3540 6) Verify that a VM is launched and running by using novaclient python API.
3541 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3542 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3543 9) Now ping to the VM from head node network which are launched a openstack service.
3544 10) verify that ping is successful
3545 11) Verify that flow is being added in ovs-switch in compute-node.
3546 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3547 13) Verify that cord-onos pushed flows to OVS switch.
3548 14) Restart the ONOS service and repeat steps 9 to 13.
3549 """
3550 pass
3551
3552 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3553 """
3554 Algo:
3555 1) Validate that required openstack service is up and running.
3556 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3557 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3558 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3559 4) Now boot image in the same created network using nova boot image command (example given below :-
3560 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
3561 5) Wait till VM boots up and starts running.
3562 6) Verify that a VM is launched and running by using novaclient python API.
3563 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3564 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3565 9) Now ping to the VM from head node network which are launched a openstack service.
3566 10) verify that ping is successful
3567 11) Verify that flow is being added in ovs-switch in compute-node.
3568 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3569 13) Verify that cord-onos pushed flows to OVS switch.
3570 14) Delete and re-create a VM in service and repeat steps 9 to 13.
3571 """
3572 pass
3573
3574 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3575
3576 """
3577 Algo:
3578 1) Validate that required openstack service is up and running.
3579 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3580 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3581 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3582 4) Now boot image in the same created network using nova boot image command (example given below :-
3583 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
3584 5) Wait till VM boots up and starts running.
3585 6) Verify that a VM is launched and running by using novaclient python API.
3586 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3587 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3588 9) Now ping to the VM from head node network which are launched a openstack service.
3589 10) verify that ping is successful
3590 11) Verify that flow is being added in ovs-switch in compute-node.
3591 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3592 13) Verify that cord-onos pushed flows to OVS switch.
3593 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
3594 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
3595 """
3596 pass