blob: 8c2f49b15958dbe2b021153fb3264e0e9c9483a7 [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 Karthick76a497a2017-04-12 10:59:39 -070028from CordTestUtils import get_mac, log_test
A.R Karthickbe7768c2017-03-17 11:39:41 -070029from OnosCtrl import OnosCtrl
ChetanGaonker901727c2016-11-29 14:05:03 -080030from CordLogger import CordLogger
A.R Karthickd4eed642017-03-09 14:40:52 -080031from TestManifest import TestManifest
Chetan Gaonkera6e23a72017-03-14 01:27:49 +000032from OnosFlowCtrl import OnosFlowCtrl
Thangavelu K Sb8a7b872017-03-31 18:10:53 +000033from credentials import *
34from VSGAccess import VSGAccess
35from SSHTestAgent import SSHTestAgent
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000036import requests
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080037import time
Chetan Gaonker3c8ae682017-02-18 00:50:45 +000038import py_compile
Chetan Gaonker09b77ae2017-03-08 01:44:25 +000039import json
ChetanGaonker901727c2016-11-29 14:05:03 -080040
ChetanGaonker71fe0302016-12-19 17:45:44 -080041PROTO_NAME_TCP = 'tcp'
42PROTO_NAME_ICMP = 'icmp'
43IPv4 = 'IPv4'
44
45OS_USERNAME = 'admin'
Chetan Gaonker0fb91c92017-02-07 01:52:18 +000046OS_PASSWORD = 'VeryLongKeystoneAdminPassword'
ChetanGaonker71fe0302016-12-19 17:45:44 -080047OS_TENANT = 'admin'
Chetan Gaonker0fb91c92017-02-07 01:52:18 +000048OS_AUTH_URL = 'https://keystone.cord.lab:5000/v2.0'
49OS_SERVICE_ENDPOINT = 'https://keystone.cord.lab:5000/v2.0/'
Chetan Gaonker1f422af2017-01-13 21:59:16 +000050VM_BOOT_TIMEOUT = 100
51VM_DELETE_TIMEOUT = 100
52
ChetanGaonker71fe0302016-12-19 17:45:44 -080053
54#VM SSH CREDENTIALS
55VM_USERNAME = 'ubuntu'
56VM_PASSWORD = 'ubuntu'
57
58TENANT_PREFIX = 'test-'
59VM_PREFIX = 'test-'
60NETWORK_PREFIX = 'test-'
61CIDR_PREFIX = '192.168'
62
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000063class vtn_validation_utils:
64
A.R Karthickd4eed642017-03-09 14:40:52 -080065 endpoint = '172.17.0.5'
66 version = ''
67 vtn_app = 'org.opencord.vtn'
68
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000069 def __init__(self, version):
70 self.version = version
A.R Karthickd4eed642017-03-09 14:40:52 -080071 self.manifest = None
72 self.vtn_enabled = False
73 manifest = os.getenv('MANIFEST', None)
74 if manifest:
75 self.manifest = TestManifest(manifest = manifest)
76 self.endpoint = self.manifest.onos_ip
77 self.vtn_enabled = self.manifest.synchronizer == 'vtn'
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000078
A.R Karthickd4eed642017-03-09 14:40:52 -080079 self.app_ctrl = OnosCtrl(self.vtn_app, controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000080
A.R Karthickd4eed642017-03-09 14:40:52 -080081 def getDevices(self):
82 return OnosCtrl.get_devices(controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000083
A.R Karthickd4eed642017-03-09 14:40:52 -080084 def getLinks(self):
85 return OnosCtrl.get_links(controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000086
A.R Karthickd4eed642017-03-09 14:40:52 -080087 def getDevicePorts(self, switch_id):
88 return OnosCtrl.get_ports_device(switch_id, controller = self.endpoint)
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000089
A.R Karthickd4eed642017-03-09 14:40:52 -080090 def activateVTNApp(self):
91 return self.app_ctrl.activate()
92
93 def deactivateVTNApp(self):
94 return self.app_ctrl.deactivate()
Chetan Gaonker1c387cf2017-02-22 02:21:43 +000095
ChetanGaonker901727c2016-11-29 14:05:03 -080096class cordvtn_exchange(CordLogger):
97
ChetanGaonkeraaea6b62016-12-16 17:06:39 -080098 app_cordvtn = 'org.opencord.vtn'
99 test_path = os.path.dirname(os.path.realpath(__file__))
100 cordvtn_dir = os.path.join(test_path, '..', 'setup')
101 cordvtn_conf_file = os.path.join(test_path, '..', '../cordvtn/network_cfg.json')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000102 head_node_user = 'vagrant'
103 head_node_pass = 'vagrant'
104 head_node = os.getenv('HEAD_NODE', 'prod')
105 head_node_ip = '10.1.0.1'
106 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
107
ChetanGaonker901727c2016-11-29 14:05:03 -0800108
109 @classmethod
110 def setUpClass(cls):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800111 ''' Activate the cordvtn app'''
ChetanGaonker901727c2016-11-29 14:05:03 -0800112 time.sleep(3)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800113 cls.onos_ctrl = OnosCtrl(cls.app_cordvtn)
114 status, _ = cls.onos_ctrl.activate()
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000115 assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800116 time.sleep(3)
117 cls.cordvtn_setup()
ChetanGaonker901727c2016-11-29 14:05:03 -0800118
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800119 @classmethod
120 def tearDownClass(cls):
ChetanGaonker901727c2016-11-29 14:05:03 -0800121 '''Deactivate the cord vtn app'''
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000122 #cls.onos_ctrl.deactivate()
123 #cls.cord_vtn_cleanup()
ChetanGaonker901727c2016-11-29 14:05:03 -0800124
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800125 @classmethod
126 def cordvtn_setup(cls):
127 pass
128
129 @classmethod
130 def cord_vtn_cleanup(cls):
131 ##reset the ONOS port configuration back to default
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000132 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800133
134 @classmethod
135 def onos_load_config(cls, cordvtn_conf_file):
136 status, code = OnosCtrl.config(cordvtn_conf_file)
ChetanGaonker901727c2016-11-29 14:05:03 -0800137 if status is False:
A R Karthick76a497a2017-04-12 10:59:39 -0700138 log_test.info('JSON request returned status %d' %code)
ChetanGaonker901727c2016-11-29 14:05:03 -0800139 assert_equal(status, True)
140 time.sleep(3)
141
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000142 def get_neutron_credentials(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800143 n = {}
144 n['username'] = os.environ['OS_USERNAME']
145 n['password'] = os.environ['OS_PASSWORD']
146 n['auth_url'] = os.environ['OS_AUTH_URL']
147 n['tenant_name'] = os.environ['OS_TENANT_NAME']
Chetan Gaonker80e06152017-03-07 01:07:19 +0000148 n['ca_cert'] = os.environ['REQUESTS_CA_BUNDLE']
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800149 return n
150
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000151 @classmethod
152 def get_compute_nodes(cls):
153 credentials = get_nova_credentials_v2()
154 novaclient = nova_client.Client('2', **credentials)
A R Karthick76a497a2017-04-12 10:59:39 -0700155 print(novaclient.hypervisors.list())
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000156 return novaclient.hypervisors.list()
157
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800158 def create_network(i):
159 neutron_credentials = get_neutron_credentials()
160 neutron = neutron_client.Client(**neutron_credentials)
161 json = {'network': {'name': 'network-' + str(i),
162 'admin_state_up': True}}
163 while True:
164 try:
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000165 net = neutron.create_network(body=json)
A R Karthick76a497a2017-04-12 10:59:39 -0700166 print('\nnetwork-' + str(i) + ' created')
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000167 return net
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800168 except Exception as e:
A R Karthick76a497a2017-04-12 10:59:39 -0700169 print(e)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800170 continue
171
ChetanGaonker901727c2016-11-29 14:05:03 -0800172 def create_tenant(tenant_name):
173 new_tenant = keystone.tenants.create(tenant_name=tenant_name,
174 description="CORD Tenant \
175 created",
176 enabled=True)
177 tenant_id = new_tenant.id
178 tenant_status = True
179 user_data = []
180 for j in range(2):
181 j += 1
182 user_name = tenant_name + '-user-' + str(j)
183 user_data.append(create_user(user_name, tenant_id))
184
A R Karthick76a497a2017-04-12 10:59:39 -0700185 print(" Tenant and User Created")
ChetanGaonker901727c2016-11-29 14:05:03 -0800186
187 tenant_data = {'tenant_name': tenant_name,
188 'tenant_id': tenant_id,
189 'status': tenant_status}
190 return tenant_data
191
192 def create_user(user_name, tenant_id):
193 new_user = keystone.users.create(name=user_name,
194 password="ubuntu",
195 tenant_id=tenant_id)
196 print(' - Created User %s' % user_name)
197 keystone.roles.add_user_role(new_user, member_role, tenant_id)
198 if assign_admin:
199 admin_user = keystone.users.find(name='admin')
200 admin_role = keystone.roles.find(name='admin')
201 keystone.roles.add_user_role(admin_user, admin_role, tenant_id)
202 user_data = {'name': new_user.name,
203 'id': new_user.id}
204 return user_data
205
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800206 def create_port( router_id, network_id):
207 credentials = get_credentials()
208 neutron = client.Client(**credentials)
209 router = neutron.show_router(router_id)
210
211 value = {'port':{
212 'admin_state_up':True,
213 'device_id': router_id,
214 'name': 'port1',
215 'network_id':network_id,
216 }}
217 response = neutron.create_port(body=value)
218
ChetanGaonker71fe0302016-12-19 17:45:44 -0800219 def router_create(self, name):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800220 external_network = None
221 for network in self.neutron.list_networks()["networks"]:
222 if network.get("router:external"):
223 external_network = network
224 break
225
226 if not external_network:
227 raise Exception("Alarm! Can not to find external network")
228
229 gw_info = {
230 "network_id": external_network["id"],
231 "enable_snat": True
232 }
233 router_info = {
234 "router": {
235 "name": name,
236 "external_gateway_info": gw_info,
237 "tenant_id": self.tenant_id
238 }
239 }
ChetanGaonker71fe0302016-12-19 17:45:44 -0800240 router = self.neutron.router_create(router_info)['router']
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800241 return router
242
ChetanGaonker901727c2016-11-29 14:05:03 -0800243 def delete_tenant(tenant_name):
244 tenant = keystone.tenants.find(name=tenant_name)
245 for j in range(2):
246 j += 1
247 user_name = tenant_name + '-user-' + str(j)
248 delete_user(user_name, tenant.id)
249 tenant.delete()
250 print(' - Deleted Tenant %s ' % tenant_name)
251 return True
252
253 def delete_user(user_name, tenant_id):
254 user = keystone.users.find(name=user_name)
255 user.delete()
256
257 print(' - Deleted User %s' % user_name)
258 return True
259
ChetanGaonker71fe0302016-12-19 17:45:44 -0800260 def set_environment(tenants_num=0, networks_per_tenant=1, vms_per_network=2):
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000261 octet = 115
262 vm_inc = 11
263 image = nova_connection.images.get(IMAGE_ID)
264 flavor = nova_connection.flavors.get(FLAVOR_ID)
ChetanGaonker71fe0302016-12-19 17:45:44 -0800265
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000266 admin_user_id = keystone_connection.users.find(name=OS_USERNAME).id
267 member_role_id = keystone_connection.roles.find(name='Member').id
268 for num_tenant in range(1, tenants_num+1):
269 tenant = keystone_connection.tenants.create('%stenant%s' % (TENANT_PREFIX, num_tenant))
270 keystone_connection.roles.add_user_role(admin_user_id, member_role_id, tenant=tenant.id)
271 for num_network in range(networks_per_tenant):
272 network_json = {'name': '%snet%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
273 'admin_state_up': True,
274 'tenant_id': tenant.id}
275 network = neutron_connection.create_network({'network': network_json})
276 subnet_json = {'name': '%ssubnet%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
277 'network_id': network['network']['id'],
278 'tenant_id': tenant.id,
279 'enable_dhcp': True,
280 'cidr': '%s.%s.0/24' % (CIDR_PREFIX, octet), 'ip_version': 4}
281 octet += 1
282 subnet = neutron_connection.create_subnet({'subnet': subnet_json})
283 router_json = {'name': '%srouter%s' % (NETWORK_PREFIX, num_tenant*10+num_network),
284 'tenant_id': tenant.id}
285 router = neutron_connection.router_create({'router': router_json})
286 port = neutron_connection.add_interface_router(router['router']['id'], {'subnet_id': subnet['subnet']['id']})
287 for num_vm in range(vms_per_network):
288 tenant_nova_connection = novacli.Client(OS_USERNAME, OS_PASSWORD, tenant.name, OS_AUTH_URL)
289 m = tenant_nova_connection.servers.create('%svm%s' % (VM_PREFIX, vm_inc), image, flavor, nics=[{'net-id': network['network']['id']}, {'net-id': MGMT_NET}])
290 vm_inc += 1
ChetanGaonker71fe0302016-12-19 17:45:44 -0800291
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800292 def verify_neutron_crud():
293 x = os.system("neutron_test.sh")
294 return x
ChetanGaonker901727c2016-11-29 14:05:03 -0800295
Author Name91eaeba2017-01-05 13:41:45 -0800296 def list_floatingips( **kwargs):
297 creds = get_neutron_credentials()
298 neutron = client.Client(**creds)
299 return neutron.list_floatingips(**kwargs)['floatingips']
300
301 def list_security_groups( **kwargs):
302 creds = get_neutron_credentials()
303 neutron = client.Client(**creds)
304 return neutron.list_security_groups(**kwargs)['security_groups']
305
306 def list_subnets( **kwargs):
307 creds = get_neutron_credentials()
308 neutron = client.Client(**creds)
309 return neutron.list_subnets(**kwargs)['subnets']
310
311 def list_networks( **kwargs):
312 creds = get_neutron_credentials()
313 neutron = client.Client(**creds)
314 return neutron.list_networks(**kwargs)['networks']
315
316 def list_ports( **kwargs):
317 creds = get_neutron_credentials()
318 neutron = client.Client(**creds)
319 return neutron.list_ports(**kwargs)['ports']
320
321 def list_routers( **kwargs):
322 creds = get_neutron_credentials()
323 neutron = client.Client(**creds)
324 return neutron.list_routers(**kwargs)['routers']
325
326 def update_floatingip( fip, port_id=None):
327 creds = get_neutron_credentials()
328 neutron = client.Client(**creds)
329 neutron.update_floatingip(fip, {"floatingip":
330 {"port_id": port_id}})
331
332 def update_subnet( subnet_id, **subnet_params):
333 creds = get_neutron_credentials()
334 neutron = client.Client(**creds)
335 neutron.update_subnet(subnet_id, {'subnet': subnet_params})
336
337 def update_router( router_id, **router_params):
338 creds = get_neutron_credentials()
339 neutron = client.Client(**creds)
340 neutron.update_router(router_id, {'router': router_params})
341
342 def router_gateway_set( router_id, external_gateway):
343 creds = get_neutron_credentials()
344 neutron = client.Client(**creds)
345 neutron.update_router(
346 router_id, {'router': {'external_gateway_info':
347 {'network_id': external_gateway}}})
348
349 def router_gateway_clear( router_id):
350 creds = get_neutron_credentials()
351 neutron = client.Client(**creds)
352 neutron.update_router(
353 router_id, {'router': {'external_gateway_info': None}})
354
355 def router_add_interface( router_id, subnet_id):
356 creds = get_neutron_credentials()
357 neutron = client.Client(**creds)
358 neutron.add_interface_router(router_id, {'subnet_id': subnet_id})
359
360 def router_rem_interface( router_id, subnet_id):
361 creds = get_neutron_credentials()
362 neutron = client.Client(**creds)
363 neutron.remove_interface_router(
364 router_id, {'subnet_id': subnet_id})
365
366 def create_floatingip( **floatingip_params):
367 creds = get_neutron_credentials()
368 neutron = client.Client(**creds)
369 response = neutron.create_floatingip(
370 {'floatingip': floatingip_params})
371 if 'floatingip' in response and 'id' in response['floatingip']:
372 return response['floatingip']['id']
373
Chetan Gaonker1f422af2017-01-13 21:59:16 +0000374 def make_iperf_pair(server, client, **kwargs):
375 ssh = SSHClient()
376 ssh.set_missing_host_key_policy(MissingHostKeyPolicy())
377
378 ssh.connect(server, username=VM_USERNAME, password=VM_PASSWORD)
379 ssh.exec_command('/usr/local/bin/iperf3 -s -D')
380
381 ssh.connect(client, username=VM_USERNAME, password=VM_PASSWORD)
382 stdin, stdout, stderr = ssh.exec_command('/usr/local/bin/iperf3 -c %s -J' % server)
383
384 rawdata = stdout.read()
385 data = json.loads(rawdata.translate(None,'\t').translate(None,'\n'))
386
387 return data
388
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000389 def connect_ssh(os_ip, private_key_file=None, user='ubuntu'):
390 key = ssh.RSAKey.from_private_key_file(private_key_file)
391 client = ssh.SSHClient()
392 client.set_missing_host_key_policy(ssh.WarningPolicy())
393 client.connect(ip, username=user, pkey=key, timeout=5)
394 return client
Chetan Gaonker1f422af2017-01-13 21:59:16 +0000395
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000396 def validate_vtn_flows(switch):
397 egress = 1
398 ingress = 2
399 egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1' }
400 ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1' }
401 device_id = 'of:{}'.format(get_mac(switch))
Chetan Gaonkera6e23a72017-03-14 01:27:49 +0000402 ctlr = self.ctlr_ip.split(',')[0]
403 flow = OnosFlowCtrl(deviceId = device_id,
404 egressPort = egress,
405 ingressPort = ingress,
406 ethType = '0x800',
407 ipSrc = ('IPV4_SRC', ingress_map['ip']+'/32'),
408 ipDst = ('IPV4_DST', egress_map['ip']+'/32'),
409 controller = ctlr
410 )
Chetan Gaonker0fb91c92017-02-07 01:52:18 +0000411 flow_id = flow.findFlow(device_id, IN_PORT = ('port', ingress),
412 ETH_TYPE = ('ethType','0x800'), IPV4_SRC = ('ip', ingress_map['ip']+'/32'),
413 IPV4_DST = ('ip', egress_map['ip']+'/32'))
414 if flow_id:
415 return True
ChetanGaonkeraaea6b62016-12-16 17:06:39 -0800416
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000417 def cordvtn_config_load(self, config = None):
418 if config:
419 for k in config.keys():
420 if cordvtn_config.has_key(k):
421 cordvtn_config[k] = config[k]
422 self.onos_load_config(self.cordvtn_dict)
423
Chetan Gaonker09b77ae2017-03-08 01:44:25 +0000424 def search_value(self, d, pat):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000425 match = False
Chetan Gaonker3c8ae682017-02-18 00:50:45 +0000426 for k, v in d.items():
427 if isinstance(v, dict):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000428 match = self.search_value(v, pat)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000429 if match is True:
430 break
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000431 elif type(v) is list:
432 for i in range(len(v)):
433 if type(v[i]) is dict:
434 match = self.search_value(v[i], pat)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000435 if match is True:
436 break
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000437 else:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000438 if v[i] == pat:
439 match = True
440 return match
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000441 elif v == pat:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000442 match = True
443 return match
444 if match is True:
A R Karthick76a497a2017-04-12 10:59:39 -0700445 print("Network search is successful")
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +0000446 return match
447
Thangavelu K Saea3c672017-03-15 18:57:05 +0000448 def get_key_value(self, d, key = None, value = None,):
449 match = False
450 ret_k = ""
451 ret_v = ""
452 if type(d) is not dict:
453 if type(d) is not list:
454 match = 'NOT_FOUND'
455 return [match, ret_k, ret_v]
456 else:
457 for i in range(len(d)):
458 if type(d[i]) is dict:
459 match,ret_k,ret_v = self.get_key_value(d[i], key, value)
460 if match is True:
A R Karthick76a497a2017-04-12 10:59:39 -0700461 print("Network creation is successful")
Thangavelu K Saea3c672017-03-15 18:57:05 +0000462 break
463 else:
464 for k, v in d.items():
465 if isinstance(v, dict):
466 match,ret_k,ret_v = self.get_key_value(v, key, value)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000467 if match is True:
468 break
Thangavelu K Saea3c672017-03-15 18:57:05 +0000469 elif type(v) is list:
470 for i in range(len(v)):
471 if type(v[i]) is dict:
472 match,ret_k,ret_v = self.get_key_value(v[i], key, value)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000473 if match is True:
474 break
Thangavelu K Saea3c672017-03-15 18:57:05 +0000475 else:
476 if key:
477 if k == key:
478 match = True
479 return [match, key, v]
480 elif value:
481 if v == value:
482 match = True
483 return [match, k, value]
484 else:
485 if key:
486 if k == key:
487 match = True
488 return [match, key, v]
489 elif value:
490 if v == value:
491 match = True
492 return [match, k, value]
493 if match == False:
494 match = 'NOT_FOUND'
495 return [match, ret_k, ret_v]
496
497 def neutron_network_creation_and_validation(self, net_name):
498 creds = self.get_neutron_credentials()
499 neutron = neutronclient.Client(**creds)
500 body_example = {"network":{"name": net_name,"admin_state_up":True}}
501 net = neutron.create_network(body=body_example)
502 networks = neutron.list_networks(name=net_name)
503 data = networks
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000504 return self.search_value(data, net_name)
Thangavelu K Saea3c672017-03-15 18:57:05 +0000505
506 def neutron_network_deletion(self, net_name):
507 creds = self.get_neutron_credentials()
508 neutron = neutronclient.Client(**creds)
509 networks = neutron.list_networks(name=net_name)
510 net_id = self.get_key_value(d=networks, key = 'id')
511 net = neutron.delete_network(net_id[2])
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000512 return self.get_key_value(d=networks, value = net_name)
Thangavelu K Saea3c672017-03-15 18:57:05 +0000513
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000514 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 +0000515 creds = self.get_neutron_credentials()
516 neutron = neutronclient.Client(**creds)
517 networks = neutron.list_networks(name=net_name)
518 net_id = self.get_key_value(d=networks, key = 'id')
519 cidr = sub_cird
520 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"}]}}
521 neutron_sub = neutron.create_subnet(body_subnet_example)
522 networks = neutron.list_networks(name=net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000523 return self.get_key_value(d=networks, key = 'subnets')
524
525 def neutron_subnet_creation_and_validation(self,net_name,sub_cird):
526 creds = self.get_neutron_credentials()
527 neutron = neutronclient.Client(**creds)
528 networks = neutron.list_networks(name=net_name)
529 net_id = self.get_key_value(d=networks, key = 'id')
530 if sub_cird[0] == 'management':
531 cidr = sub_cird[1]
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000532 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 +0000533 elif sub_cird[0] == 'public':
534 cidr = sub_cird[1]
535 gate_way = sub_cird[2]
536 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}}
537 elif sub_cird[0] == 'private':
538 cidr = sub_cird[1]
539 gate_way = sub_cird[2]
540 body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}}
541
542 neutron_sub = neutron.create_subnet(body_subnet_example)
543 networks = neutron.list_networks(name=net_name)
544 return self.get_key_value(d=networks, key = 'subnets')
545
546 def sub_network_type_post_to_onos(self,net_name,sub_net_type):
547
548 creds = self.get_neutron_credentials()
549 neutron = neutronclient.Client(**creds)
550 networks = neutron.list_networks(name=net_name)
551 net_id = self.get_key_value(d=networks, key = 'id')
552 vtn_util = vtn_validation_utils('')
553
554 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
555 auth = ('karaf','karaf')
556 network_data = {"ServiceNetwork":{"id": net_id[2],"type":sub_net_type, "providerNetworks":[]}}
557 json_network_type_data = json.dumps(network_data)
558 resp = requests.post(url=url, auth=auth, data =json_network_type_data)
559 return resp
560
561 def nova_instance_creation_and_validation(self,net_name,nova_obj,instance_name,image_name, flavor_id):
562 image = nova_obj.images.find(name=image_name)
563 flavor = nova_obj.flavors.find(name=flavor_id)
564 network = nova_obj.networks.find(label=net_name)
A R Karthick76a497a2017-04-12 10:59:39 -0700565 print(network.id)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000566
567 server = nova_obj.servers.create(name = instance_name,
568 image = image.id,
569 flavor = flavor.id,
570 nics = [{'net-id':network.id}])
571 server_details = nova_obj.servers.find(id=server.id)
572 print('Server is launched and status is %s' %server_details.status)
573 if server_details.status == 'BUILD':
574 time.sleep(20)
575 server_details = nova_obj.servers.find(id=server.id)
576 print('After delay server status is %s state'%server_details.status)
577 if server_details.status == 'ERROR':
578 print('Server status is still in %s state'%server_details.status)
579 return server_details
580
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000581 def create_net_subnet_nova_instance(self,net_name, subnet_name, instance_vm_details,management_type):
582 result = self.neutron_network_creation_and_validation(net_name)
583 assert_equal(result, True)
584 neutron_creds = self.get_neutron_credentials()
585 neutron = neutronclient.Client(**neutron_creds)
586 networks = neutron.list_networks(name=net_name)
587 network_id = self.get_key_value(d=networks, key = 'id')
588 sub_result = self.neutron_subnet_creation_and_validation(net_name,subnet_name)# sub_net_start = subnet_name[2], sub_net_end =subnet_name[3])
589 assert_equal(sub_result[0], True)
590 net_type_post = self.sub_network_type_post_to_onos(net_name, management_type)
591 creds = get_nova_credentials()
592 nova = nova_client.Client('2', **creds)
593 new_instance_details = self.nova_instance_creation_and_validation(net_name,nova,instance_vm_details[0],instance_vm_details[1],instance_vm_details[2])
594 #assert_equal(new_instance_details.status, 'ACTIVE')
595 return [nova, new_instance_details]
596
597 def nova_instance_tenants_access_check(self, target_tenants_details, compute_details = None, source_tenants_details = None , check_type = 'Ping_from_compute'):
598 source_tenant_ip = ''
599 target_tenant_ip = ''
600 cmd = ''
601 status = ''
602 output = ''
603
604 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
605 if compute_details is None:
606 compute_ip = '10.1.0.17'
607 else:
608 compute_ip = compute_details.ip
609
610 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
611 if target_tenants_details.addresses == {}:
612 target_tenants_details.addresses = '10.1.0.1'
613
614 ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node
615 if source_tenants_details is not None:
616 if source_tenants_details.addresses == {}:
617 source_tenants_details.addresses = '10.1.0.1'
618
619 if check_type == "Ping_from_compute":
620 cmd = "ping -c 3 {0}".format(target_tenants_details.addresses)
621 ssh_agent = SSHTestAgent(host = compute_ip)
622 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
623
624 if source_tenants_details is not None:
625 if check_type == "Ping_from_source_tenant":
626 cmd = "ping -c 3 {0}".format(target_tenants_details.addresses)
627 ssh_cmd = 'ssh {} {}'.format(source_tenants_details.addresses, cmd)
A R Karthick76a497a2017-04-12 10:59:39 -0700628 print(ssh_cmd)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000629 ssh_agent = SSHTestAgent(host = compute_ip)
630 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
631
632 if check_type == "Ping_to_external":
633 cmd = "ping -c 3 google.com"
634 ssh_agent = SSHTestAgent(host = compute_ip)
635 status, output = ssh_agent.run_cmd(cmd, timeout = 5)
636
637 if status == True and output:
A R Karthick76a497a2017-04-12 10:59:39 -0700638 print("Ping is successful")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000639 output = output.strip()
640 else:
A R Karthick76a497a2017-04-12 10:59:39 -0700641 print("Ping is not successful")
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000642 output = None
643 return [status, output]
644
645
Thangavelu K S3698fad2017-03-24 17:50:14 +0000646 def nova_instance_deletion(self, nova_obj, server_details):
647 results_nova_instance_deletion=nova_obj.servers.delete(server_details.id)
648 if results_nova_instance_deletion == None:
A R Karthick76a497a2017-04-12 10:59:39 -0700649 print("Nova instance is deleted")
Thangavelu K S3698fad2017-03-24 17:50:14 +0000650 else:
A R Karthick76a497a2017-04-12 10:59:39 -0700651 print("Nova instance is not deleted")
Thangavelu K S3698fad2017-03-24 17:50:14 +0000652 return results_nova_instance_deletion
Thangavelu K Saea3c672017-03-15 18:57:05 +0000653
654 def test_cordvtn_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
655 """
656 Algo:
657 0. Create vtn_test_1_net.
658 1. Do GET Rest API and validate creation of network.
659 2. Validate network on neutron openstack.
660 """
661 result = self.neutron_network_creation_and_validation('vtn_test_1_net')
662 if result is True:
663 self.neutron_network_deletion('vtn_test_1_net')
664 assert_equal(result, True)
665
666 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
667 """
668 Algo:
669 0. Create Test-Net,
670 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
671 2. Run sync command for cordvtn
672 3. Do GET Rest API and validate creation of network
673 4. Validate network synch with created network in cord-onos
674 """
675 creds = self.get_neutron_credentials()
676 neutron = neutronclient.Client(**creds)
677 body_example = {"network":{"name": "vtn_test_2_net","admin_state_up":True}}
678 net = neutron.create_network(body=body_example)
679 vtn_util = vtn_validation_utils('')
680 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
681 auth = ('karaf','karaf')
682
683 resp = requests.get(url=url, auth=auth)
684 data = json.loads(resp.text)
685 result = self.search_value(data, "vtn_test_2_net")
686 self.neutron_network_deletion('vtn_test_2_net')
687 assert_equal(result, True)
688
689 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_head_node_with_neutron_service(self):
690 """
691 Algo:
692 0. Create Test-Net,
693 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
694 2. Run sync command for cordvtn
695 3. Do GET Rest API and validate creation of network
696 4. Validate network synch with created network in cord-onos
697 """
698 result = self.neutron_network_creation_and_validation('vtn_test_3_net')
699 if result is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000700 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000701 assert_equal(result, True)
702 result_again = self.neutron_network_creation_and_validation('vtn_test_3_net')
703 if result_again is True:
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000704 self.neutron_network_deletion('vtn_test_3_net')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000705 assert_equal(result, True)
706
707 def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_onos(self):
708 """
709 Algo:
710 0. Create Test-Net,
711 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
712 2. Run sync command for cordvtn
713 3. Do GET Rest API and validate creation of network
714 4. Validate network synch with created network in cord-onos
715 """
716 creds = self.get_neutron_credentials()
717 neutron = neutronclient.Client(**creds)
718 body_example = {"network":{"name": "vtn_test_4_net","admin_state_up":True}}
719 net = neutron.create_network(body=body_example)
720 vtn_util = vtn_validation_utils('')
721 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
722 auth = ('karaf','karaf')
723
724 resp = requests.get(url=url, auth=auth)
725 data = json.loads(resp.text)
726 result = self.search_value(data, "vtn_test_4_net")
727 assert_equal(result, True)
728 self.neutron_network_deletion('vtn_test_4_net')
729 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
730 auth = ('karaf','karaf')
731
732 resp = requests.get(url=url, auth=auth)
733 data = json.loads(resp.text)
734 result = self.search_value(data, "vtn_test_4_net")
735 assert_equal(result, False)
736 net = neutron.create_network(body=body_example)
737 vtn_util = vtn_validation_utils('')
738 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
739 auth = ('karaf','karaf')
740
741 resp = requests.get(url=url, auth=auth)
742 data = json.loads(resp.text)
743 result = self.search_value(data, "vtn_test_4_net")
744 self.neutron_network_deletion('vtn_test_4_net')
745 assert_equal(result, True)
746
747 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_head_node_with_neutron_service(self):
748 test_net_name = 'vtn_test_5_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000749 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 +0000750 result = self.neutron_network_creation_and_validation('vtn_test_5_net_management')
751 assert_equal(result, True)
752 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
753 if sub_result[0] is True:
754 self.neutron_network_deletion('vtn_test_5_net_management')
755 assert_equal(sub_result[0], True)
756
757 def test_cordvtn_with_neutron_management_network_creation_and_validation_on_onos(self):
758 self.neutron_network_creation_and_validation('vtn_test_6_net_management')
759 creds = self.get_neutron_credentials()
760 neutron = neutronclient.Client(**creds)
761 networks = neutron.list_networks(name='vtn_test_6_net_management')
762 net_id = self.get_key_value(d=networks, key = 'id')
763 cidr = "172.27.0.0/24"
764 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"}]}}
765 neutron_sub = neutron.create_subnet(body_subnet_example)
766
767 vtn_util = vtn_validation_utils('')
768 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
769 auth = ('karaf','karaf')
770
771 resp = requests.get(url=url, auth=auth)
772 data = json.loads(resp.text)
773 for i in range(len(data['ServiceNetworks'])):
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000774 if data['ServiceNetworks'][i]['name'] == 'vtn_test_6_net_management':
Thangavelu K Saea3c672017-03-15 18:57:05 +0000775 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
776 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700777 log_test.info('Sub network is not successful')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000778 self.neutron_network_deletion('vtn_test_6_net_management')
779 assert_equal(False, True)
780 break
781 elif sub_net_id[2] == cidr:
A R Karthick76a497a2017-04-12 10:59:39 -0700782 log_test.info('Sub network is successful')
Thangavelu K Saea3c672017-03-15 18:57:05 +0000783 self.neutron_network_deletion('vtn_test_6_net_management')
784 assert_equal(sub_net_id[0], True)
785 break
786
Thangavelu K S3698fad2017-03-24 17:50:14 +0000787 def test_cordvtn_neutron_management_network_creation_and_post_network_type_management_local_to_onos(self):
788 """
789 Algo:
790 0. Create Test-Net,
791 1. Cretae subnetwork whose ip is under management network
792 2. Run sync command for cordvtn
793 3. Do GET Rest API and validate creation of network
794 4. Pushed the network type as management local to onos
795 5. Verified that onos is having under management network
796 """
797 test_net_name = 'vtn_test_7_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000798 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 +0000799 test_management_type = "management_local"
800 result = self.neutron_network_creation_and_validation(test_net_name)
801 assert_equal(result, True)
802 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
803
804 vtn_util = vtn_validation_utils('')
805 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
806 auth = ('karaf','karaf')
807
808 resp = requests.get(url=url, auth=auth)
809 data = json.loads(resp.text)
810 for i in range(len(data['ServiceNetworks'])):
811 if data['ServiceNetworks'][i]['name'] == test_net_name:
812 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
813 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700814 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000815 assert_equal(False, True)
816 break
817 elif sub_net_id[2] == test_sub_net_cidr[1]:
A R Karthick76a497a2017-04-12 10:59:39 -0700818 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000819 assert_equal(sub_net_id[0], True)
820 break
821
822 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
823 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
824 net_type_json = json.loads(net_type_post.text)
Thangavelu K S3698fad2017-03-24 17:50:14 +0000825 self.neutron_network_deletion(test_net_name)
826 assert_equal(net_type_json['message'], 'null already exists')
827
Thangavelu K S3698fad2017-03-24 17:50:14 +0000828 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 +0000829 """
830 Algo:
831 0. Create Test-Net,
832 1. Cretae subnetwork whose ip is under management network
833 3. Do GET Rest API and validate creation of network
834 4. Create new nova instance under management network
835 5. Validate new nova instance is created on nova service
836 """
837 test_net_name = 'vtn_test_8_net_management'
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000838 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 +0000839 test_management_type = "management_local"
840 instance_vm_name = 'vtn_test_8_nova_instance_management_net'
841 image_name = "vsg-1.1"
842 flavor_id = 'm1.small'
843 result = self.neutron_network_creation_and_validation(test_net_name)
844 assert_equal(result, True)
845 neutron_creds = self.get_neutron_credentials()
846 neutron = neutronclient.Client(**neutron_creds)
847 networks = neutron.list_networks(name=test_net_name)
848 network_id = self.get_key_value(d=networks, key = 'id')
849 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
850 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000851 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000852 nova = nova_client.Client('2', **creds)
853 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
854 self.neutron_network_deletion(test_net_name)
855 self.nova_instance_deletion(nova, new_instance_details)
856 assert_equal(new_instance_details.status, 'ACTIVE')
857
Thangavelu K S3698fad2017-03-24 17:50:14 +0000858 def test_cordvtn_neutron_public_network_creation_and_validation_on_head_node_with_neutron_service(self):
859 """
860 Algo:
861 0. Create Test-Net,
862 1. Cretae subnetwork who ip is under management network
863 2. Run sync command for cordvtn
864 3. Do GET Rest API and validate creation of network
865 4. Validate network synch with created network in cord-onos
866 """
867 test_net_name = 'vtn_test_9_net_public'
868 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
869 result = self.neutron_network_creation_and_validation(test_net_name)
870 assert_equal(result, True)
871 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
872 if sub_result[0] is True:
873 self.neutron_network_deletion(test_net_name)
874 assert_equal(sub_result[0], True)
875
876 def test_cordvtn_neutron_public_network_creation_and_validation_on_onos(self):
877 """
878 Algo:
879 0. Create Test-Net,
880 1. Cretae subnetwork whoes ip is under management network
881 2. Run sync command for cordvtn
882 3. Do GET Rest API and validate creation of network
883 """
884 test_net_name = 'vtn_test_10_net_public'
885 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
886 result = self.neutron_network_creation_and_validation(test_net_name)
887 assert_equal(result, True)
888 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
889
890 vtn_util = vtn_validation_utils('')
891 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
892 auth = ('karaf','karaf')
893
894 resp = requests.get(url=url, auth=auth)
895 data = json.loads(resp.text)
896 for i in range(len(data['ServiceNetworks'])):
897 if data['ServiceNetworks'][i]['name'] == test_net_name:
898 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
899 if sub_net_id[2] == " ":
900 print('Sub network is not successful')
901 self.neutron_network_deletion(test_net_name)
902 assert_equal(False, True)
903 break
904 elif sub_net_id[2] == test_sub_net_cidr[1]:
905 print('Sub network is successful')
906 self.neutron_network_deletion(test_net_name)
907 assert_equal(sub_net_id[0], True)
908 break
909
910 def test_cordvtn_neutron_public_network_creation_and_post_network_type_as_public_to_onos(self):
911 """
912 Algo:
913 0. Create Test-Net,
914 1. Cretae subnetwork whose ip is under management network
915 2. Run sync command for cordvtn
916 3. Do GET Rest API and validate creation of network
917 4. Pushed the network type as management local to onos
918 5. Verified that onos is having under management network
919 """
920 test_net_name = 'vtn_test_11_net_public'
921 test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193']
922 test_management_type = "public"
923 result = self.neutron_network_creation_and_validation(test_net_name)
924 assert_equal(result, True)
925 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
926
927 vtn_util = vtn_validation_utils('')
928 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
929 auth = ('karaf','karaf')
930
931 resp = requests.get(url=url, auth=auth)
932 data = json.loads(resp.text)
933 for i in range(len(data['ServiceNetworks'])):
934 if data['ServiceNetworks'][i]['name'] == test_net_name:
935 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
936 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -0700937 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000938 assert_equal(False, True)
939 break
940 elif sub_net_id[2] == test_sub_net_cidr[1]:
A R Karthick76a497a2017-04-12 10:59:39 -0700941 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +0000942 assert_equal(sub_net_id[0], True)
943 break
944
945 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
946 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
947 net_type_json = json.loads(net_type_post.text)
948
949 self.neutron_network_deletion(test_net_name)
950 assert_equal(net_type_json['message'], 'null already exists')
951
952 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 +0000953 """
954 Algo:
955 0. Create Test-Net,
956 1. Cretae subnetwork whose ip is under public network
957 3. Do GET Rest API and validate creation of network
958 4. Create new nova instance under public network
959 5. Validate new nova instance is created on nova service
960 """
961 test_net_name = 'vtn_test_12_net_public'
962 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
963 instance_vm_name = 'vtn_test_12_nova_instance_public_net'
964 image_name = "vsg-1.1"
965 flavor_id = 'm1.small'
966 result = self.neutron_network_creation_and_validation(test_net_name)
967 assert_equal(result, True)
968 neutron_creds = self.get_neutron_credentials()
969 neutron = neutronclient.Client(**neutron_creds)
970 networks = neutron.list_networks(name=test_net_name)
971 network_id = self.get_key_value(d=networks, key = 'id')
972 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
973 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +0000974 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +0000975 nova = nova_client.Client('2', **creds)
976 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
977 self.neutron_network_deletion(test_net_name)
978 self.nova_instance_deletion(nova, new_instance_details)
979 assert_equal(new_instance_details.status, 'ACTIVE')
980
981 def test_cordvtn_neutron_private_network_creation_and_validation_on_head_node_with_neutron_service(self):
982 """
983 Algo:
984 0. Create Test-Net,
985 1. Cretae subnetwork who ip is under private network
986 2. Run sync command for cordvtn
987 3. Do GET Rest API and validate creation of network
988 4. Validate network synch with created network in cord-onos
989 """
990 test_net_name = 'vtn_test_13_net_private'
991 test_sub_net_cidr = ["private","10.160.160.160/24",'10.160.160.1']
992 result = self.neutron_network_creation_and_validation(test_net_name)
993 assert_equal(result, True)
994 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
995 if sub_result[0] is True:
996 self.neutron_network_deletion(test_net_name)
997 assert_equal(sub_result[0], True)
998
999 def test_cordvtn_neutron_private_network_creation_and_validation_on_onos(self):
1000 """
1001 Algo:
1002 0. Create Test-Net,
1003 1. Cretae subnetwork whoes ip is under management network
1004 2. Run sync command for cordvtn
1005 3. Do GET Rest API and validate creation of network
1006 """
1007 test_net_name = 'vtn_test_14_net_private'
1008 test_sub_net_cidr = ["private","10.160.160.160/24", '10.160.160.1']
1009 result = self.neutron_network_creation_and_validation(test_net_name)
1010 assert_equal(result, True)
1011 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1012
1013 vtn_util = vtn_validation_utils('')
1014 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1015 auth = ('karaf','karaf')
1016
1017 resp = requests.get(url=url, auth=auth)
1018 data = json.loads(resp.text)
1019 for i in range(len(data['ServiceNetworks'])):
1020 if data['ServiceNetworks'][i]['name'] == test_net_name:
1021 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1022 if sub_net_id[2] == " ":
1023 print('Sub network is not successful')
1024 self.neutron_network_deletion(test_net_name)
1025 assert_equal(False, True)
1026 break
1027 elif sub_net_id[2] == '10.160.160.0/24':
1028 #elif sub_net_id[2] == test_sub_net_cidr[1]:
1029 print('Sub network is successful')
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001030 self.neutron_network_deletion(test_net_name)
Thangavelu K S3698fad2017-03-24 17:50:14 +00001031 assert_equal(sub_net_id[0], True)
1032 break
1033
1034 def test_cordvtn_neutron_private_network_creation_and_post_network_type_as_private_to_onos(self):
1035 """
1036 Algo:
1037 0. Create Test-Net,
1038 1. Cretae subnetwork whose ip is under management network
1039 2. Run sync command for cordvtn
1040 3. Do GET Rest API and validate creation of network
1041 4. Pushed the network type as management local to onos
1042 5. Verified that onos is having under management network
1043 """
1044 test_net_name = 'vtn_test_15_net_private'
1045 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
1046 test_management_type = "private"
1047 result = self.neutron_network_creation_and_validation(test_net_name)
1048 assert_equal(result, True)
1049 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1050
1051 vtn_util = vtn_validation_utils('')
1052 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1053 auth = ('karaf','karaf')
1054
1055 resp = requests.get(url=url, auth=auth)
1056 data = json.loads(resp.text)
1057 for i in range(len(data['ServiceNetworks'])):
1058 if data['ServiceNetworks'][i]['name'] == test_net_name:
1059 sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet')
1060 if sub_net_id[2] == " ":
A R Karthick76a497a2017-04-12 10:59:39 -07001061 log_test.info('Sub network is not successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001062 assert_equal(False, True)
1063 break
1064 elif sub_net_id[2] == "192.168.160.0/24":
A R Karthick76a497a2017-04-12 10:59:39 -07001065 log_test.info('Sub network is successful')
Thangavelu K S3698fad2017-03-24 17:50:14 +00001066 assert_equal(sub_net_id[0], True)
1067 break
1068
1069 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1070 print("Response from onos to change network service type as management local = %s" %net_type_post.text)
1071 net_type_json = json.loads(net_type_post.text)
1072
1073 self.neutron_network_deletion(test_net_name)
1074 assert_equal(net_type_json['message'], 'null already exists')
1075
1076 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 +00001077 """
1078 Algo:
1079 0. Create Test-Net,
1080 1. Cretae subnetwork whose ip is under private network
1081 3. Do GET Rest API and validate creation of network
1082 4. Create new nova instance under private network
1083 5. Validate new nova instance is created on nova service
1084 """
1085 test_net_name = 'vtn_test_16_net_private'
1086 test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1']
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001087 instance_vm_name = 'vtn_test_16_nova_instance_private_net'
Thangavelu K S3698fad2017-03-24 17:50:14 +00001088 image_name = "vsg-1.1"
1089 flavor_id = 'm1.small'
1090 result = self.neutron_network_creation_and_validation(test_net_name)
1091 assert_equal(result, True)
1092 neutron_creds = self.get_neutron_credentials()
1093 neutron = neutronclient.Client(**neutron_creds)
1094 networks = neutron.list_networks(name=test_net_name)
1095 network_id = self.get_key_value(d=networks, key = 'id')
1096 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1097 assert_equal(sub_result[0], True)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001098 creds = get_nova_credentials()
Thangavelu K S3698fad2017-03-24 17:50:14 +00001099 nova = nova_client.Client('2', **creds)
1100 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1101 self.neutron_network_deletion(test_net_name)
1102 self.nova_instance_deletion(nova, new_instance_details)
1103 assert_equal(new_instance_details.status, 'ACTIVE')
1104
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001105 def test_cordvtn_management_network_instance_ping_form_host_machine_or_compute_node(self):
1106 """
1107 Algo:
1108 0. Create Test-Net,
1109 1. Cretae subnetwork whose ip is under management network
1110 3. Do GET Rest API and validate creation of network
1111 4. Create new nova instance under management network
1112 5. Validate new nova instance is created on nova service
1113 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1114 """
1115 test_net_name = 'vtn_test_17_net_management'
1116 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1117 test_management_type = "management_local"
1118 instance_vm_name = 'vtn_test_17_nova_instance_management_net'
1119 image_name = "vsg-1.1"
1120 flavor_id = 'm1.small'
1121 result = self.neutron_network_creation_and_validation(test_net_name)
1122 assert_equal(result, True)
1123 neutron_creds = self.get_neutron_credentials()
1124 neutron = neutronclient.Client(**neutron_creds)
1125 networks = neutron.list_networks(name=test_net_name)
1126 network_id = self.get_key_value(d=networks, key = 'id')
1127 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1128 assert_equal(sub_result[0], True)
1129 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1130 creds = get_nova_credentials()
1131 nova = nova_client.Client('2', **creds)
1132 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1133 #assert_equal(new_instance_details.status, 'ACTIVE')
1134 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001135 print(new_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001136 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1137 self.neutron_network_deletion(test_net_name)
1138 self.nova_instance_deletion(nova, new_instance_details)
1139 assert_equal(status, True)
1140
1141 def test_cordvtn_management_network_instance_ping_to_external_network(self):
1142 """
1143 Algo:
1144 0. Create Test-Net,
1145 1. Cretae subnetwork whose ip is under management network
1146 3. Do GET Rest API and validate creation of network
1147 4. Create new nova instance under management network
1148 5. Validate new nova instance is created on nova service
1149 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1150 """
1151 test_net_name = 'vtn_test_18_net_management'
1152 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"]
1153 test_management_type = "management_local"
1154 instance_vm_name = 'vtn_test_18_nova_instance_management_net'
1155 image_name = "vsg-1.1"
1156 flavor_id = 'm1.small'
1157 result = self.neutron_network_creation_and_validation(test_net_name)
1158 assert_equal(result, True)
1159 neutron_creds = self.get_neutron_credentials()
1160 neutron = neutronclient.Client(**neutron_creds)
1161 networks = neutron.list_networks(name=test_net_name)
1162 network_id = self.get_key_value(d=networks, key = 'id')
1163 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1164 assert_equal(sub_result[0], True)
1165 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1166 creds = get_nova_credentials()
1167 nova = nova_client.Client('2', **creds)
1168 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1169 #assert_equal(new_instance_details.status, 'ACTIVE')
1170 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001171 print(new_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001172 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1173 self.neutron_network_deletion(test_net_name)
1174 self.nova_instance_deletion(nova, new_instance_details)
1175 assert_equal(status, False)
1176
1177 def test_cordvtn_management_network_two_instance_ping_between_two_instances(self):
1178 """
1179 Algo:
1180 0. Create Test-Net,
1181 1. Cretae subnetwork whose ip is under management network
1182 3. Do GET Rest API and validate creation of network
1183 4. Create first nova instance under management network
1184 5. Validate first nova instance is created on nova service
1185 6. Create second nova instance under management network
1186 7. Validate second nova instance is created on nova service
1187 8. Now try to ping from one nova instance to other instance, should not success
1188 """
1189 test_net_name = 'vtn_test_19_net_management'
1190 test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.2", "172.27.0.200"]
1191 test_management_type = "management_local"
1192 first_instance_vm_name = 'vtn_test_19_nova_1st_instance_management_net'
1193 second_instance_vm_name = 'vtn_test_19_nova_2nd_instance_management_net'
1194 image_name = "vsg-1.1"
1195 flavor_id = 'm1.small'
1196 result = self.neutron_network_creation_and_validation(test_net_name)
1197 assert_equal(result, True)
1198 neutron_creds = self.get_neutron_credentials()
1199 neutron = neutronclient.Client(**neutron_creds)
1200 networks = neutron.list_networks(name=test_net_name)
1201 network_id = self.get_key_value(d=networks, key = 'id')
1202 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1203 assert_equal(sub_result[0], True)
1204 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1205 creds = get_nova_credentials()
1206 nova = nova_client.Client('2', **creds)
1207 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1208 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
1209 #assert_equal(first_instance_details.status, 'ACTIVE')
1210 #assert_equal(second_instance_details.status, 'ACTIVE')
1211 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001212 print('New nova instance ip addresses are ')
1213 print(first_nova_instance_details.addresses)
1214 print(second_nova_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001215 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")
1216 self.neutron_network_deletion(test_net_name)
1217 self.nova_instance_deletion(nova, first_nova_instance_details)
1218 self.nova_instance_deletion(nova, second_nova_instance_details)
1219 assert_equal(status, False)
1220
1221 def test_cordvtn_two_management_network_instances_ping_between_two_networks_via_management_network(self):
1222 """
1223 Algo:
1224 0. Create Test-Net,
1225 1. Cretae subnetwork whose ip is under management network
1226 3. Do GET Rest API and validate creation of network
1227 4. Create new nova instance under management network
1228 5. Validate new nova instance is created on nova service
1229 """
1230 test_netA_name = 'vtn_test_20_netA_management'
1231 test_sub_netA_cidr = ["management","172.27.0.0/24","172.27.0.2", "172.27.0.200"]
1232 netA_instance_vm_name = 'vtn_test_20_nova_netA_instance_management_net'
1233 test_netB_name = 'vtn_test_20_netB_management'
1234 test_sub_netB_cidr = ["management","172.28.0.0/24","172.28.0.2", "172.28.0.200"]
1235 netB_instance_vm_name = 'vtn_test_20_nova_netB_instance_management_net'
1236 test_management_type = "management_local"
1237 image_name = "vsg-1.1"
1238 flavor_id = 'm1.small'
1239 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1240 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1241
1242 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)
1243 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)
1244
1245 #assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1246 #assert_equal(nova_instance_details_netB.status, 'ACTIVE')
1247 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001248 print('New nova instance ip addresses are ')
1249 print(nova_instance_details_netA.addresses)
1250 print(nova_instance_details_netB.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001251 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")
1252 self.neutron_network_deletion(test_netA_name)
1253 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1254 self.neutron_network_deletion(test_netB_name)
1255 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1256 assert_equal(status, False)
1257
1258 def test_cordvtn_public_network_instance_ping_form_host_machine_or_compute_node(self):
1259
1260 """
1261 Algo:
1262 0. Create Test-Net,
1263 1. Cretae subnetwork whose ip is under public network
1264 3. Do GET Rest API and validate creation of network
1265 4. Create new nova instance under public network
1266 5. Validate new nova instance is created on nova service
1267 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1268 """
1269 test_net_name = 'vtn_test_21_net_public'
1270 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1271 test_management_type = "public"
1272 instance_vm_name = 'vtn_test_21_nova_instance_pulic_net'
1273 image_name = "vsg-1.1"
1274 flavor_id = 'm1.small'
1275 result = self.neutron_network_creation_and_validation(test_net_name)
1276 assert_equal(result, True)
1277 neutron_creds = self.get_neutron_credentials()
1278 neutron = neutronclient.Client(**neutron_creds)
1279 networks = neutron.list_networks(name=test_net_name)
1280 network_id = self.get_key_value(d=networks, key = 'id')
1281 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1282 assert_equal(sub_result[0], True)
1283 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1284 creds = get_nova_credentials()
1285 nova = nova_client.Client('2', **creds)
1286 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1287 #assert_equal(new_instance_details.status, 'ACTIVE')
1288 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001289 print(new_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001290 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1291 self.neutron_network_deletion(test_net_name)
1292 self.nova_instance_deletion(nova, new_instance_details)
1293 assert_equal(status, False)
1294
1295 def test_cordvtn_public_network_instance_ping_to_external_network(self):
1296 """
1297 Algo:
1298 0. Create Test-Net,
1299 1. Cretae subnetwork whose ip is under public network
1300 3. Do GET Rest API and validate creation of network
1301 4. Create new nova instance under public network
1302 5. Validate new nova instance is created on nova service
1303 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1304 """
1305 test_net_name = 'vtn_test_22_net_public'
1306 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1307 test_management_type = "public"
1308 instance_vm_name = 'vtn_test_22_nova_instance_public_net'
1309 image_name = "vsg-1.1"
1310 flavor_id = 'm1.small'
1311 result = self.neutron_network_creation_and_validation(test_net_name)
1312 assert_equal(result, True)
1313 neutron_creds = self.get_neutron_credentials()
1314 neutron = neutronclient.Client(**neutron_creds)
1315 networks = neutron.list_networks(name=test_net_name)
1316 network_id = self.get_key_value(d=networks, key = 'id')
1317 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1318 assert_equal(sub_result[0], True)
1319 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1320 creds = get_nova_credentials()
1321 nova = nova_client.Client('2', **creds)
1322 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1323 #assert_equal(new_instance_details.status, 'ACTIVE')
1324 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001325 print(new_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001326 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1327 self.neutron_network_deletion(test_net_name)
1328 self.nova_instance_deletion(nova, new_instance_details)
1329 assert_equal(status, True)
1330
1331
1332 def test_cordvtn_public_network_two_instance_ping_between_two_instances(self):
1333 """
1334 Algo:
1335 0. Create Test-Net,
1336 1. Cretae subnetwork whose ip is under public network
1337 3. Do GET Rest API and validate creation of network
1338 4. Create first nova instance under public network
1339 5. Validate first nova instance is created on nova service
1340 6. Create second nova instance under public network
1341 7. Validate second nova instance is created on nova service
1342 8. Now try to ping from one nova instance to other instance, should not success
1343 """
1344 test_net_name = 'vtn_test_23_net_public'
1345 test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1346 test_management_type = "public"
1347 first_instance_vm_name = 'vtn_test_23_nova_1st_instance_public_net'
1348 second_instance_vm_name = 'vtn_test_23_nova_2nd_instance_public_net'
1349 image_name = "vsg-1.1"
1350 flavor_id = 'm1.small'
1351 result = self.neutron_network_creation_and_validation(test_net_name)
1352 assert_equal(result, True)
1353 neutron_creds = self.get_neutron_credentials()
1354 neutron = neutronclient.Client(**neutron_creds)
1355 networks = neutron.list_networks(name=test_net_name)
1356 network_id = self.get_key_value(d=networks, key = 'id')
1357 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1358 assert_equal(sub_result[0], True)
1359 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1360 creds = get_nova_credentials()
1361 nova = nova_client.Client('2', **creds)
1362 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1363 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
1364 #assert_equal(first_instance_details.status, 'ACTIVE')
1365 #assert_equal(second_instance_details.status, 'ACTIVE')
1366 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001367 print('New nova instance ip addresses are ')
1368 print(first_nova_instance_details.addresses)
1369 print(second_nova_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001370 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")
1371 self.neutron_network_deletion(test_net_name)
1372 self.nova_instance_deletion(nova, first_nova_instance_details)
1373 self.nova_instance_deletion(nova, second_nova_instance_details)
1374 assert_equal(status, False)
1375
1376 def test_cordvtn_two_public_network_instances_ping_between_two_networks_via_public_network(self):
1377 """
1378 Algo:
1379 0. Create Test-Net,
1380 1. Cretae subnetwork whose ip is under public network
1381 3. Do GET Rest API and validate creation of network
1382 4. Create new nova instance under public network
1383 5. Validate new nova instance is created on nova service
1384 """
1385 test_netA_name = 'vtn_test_24_netA_public'
1386 test_sub_netA_cidr = ["public","10.6.1.192/26",'10.6.1.193']
1387 netA_instance_vm_name = 'vtn_test_24_nova_netA_instance_public_net'
1388 test_netB_name = 'vtn_test_24_netB_public'
1389 test_sub_netB_cidr = ["public","10.6.2.192/26",'10.6.2.193']
1390 netB_instance_vm_name = 'vtn_test_24_nova_netB_instance_public_net'
1391 test_management_type = "public"
1392 image_name = "vsg-1.1"
1393 flavor_id = 'm1.small'
1394 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1395 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1396
1397 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)
1398 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)
1399
1400 #assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1401 #assert_equal(nova_instance_details_netB.status, 'ACTIVE')
1402 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001403 print('New nova instance ip addresses are ')
1404 print(nova_instance_details_netA.addresses)
1405 print(nova_instance_details_netB.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001406 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")
1407 self.neutron_network_deletion(test_netA_name)
1408 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1409 self.neutron_network_deletion(test_netB_name)
1410 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1411 assert_equal(status, False)
1412
1413 def test_cordvtn_private_network_instance_ping_form_host_machine_or_compute_node(self):
1414 """
1415 Algo:
1416 0. Create Test-Net,
1417 1. Cretae subnetwork whose ip is under private network
1418 3. Do GET Rest API and validate creation of network
1419 4. Create new nova instance under private network
1420 5. Validate new nova instance is created on nova service
1421 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4.
1422 """
1423 test_net_name = 'vtn_test_25_net_private'
1424 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1425 test_management_type = "private"
1426 instance_vm_name = 'vtn_test_25_nova_instance_private_net'
1427 image_name = "vsg-1.1"
1428 flavor_id = 'm1.small'
1429 result = self.neutron_network_creation_and_validation(test_net_name)
1430 assert_equal(result, True)
1431 neutron_creds = self.get_neutron_credentials()
1432 neutron = neutronclient.Client(**neutron_creds)
1433 networks = neutron.list_networks(name=test_net_name)
1434 network_id = self.get_key_value(d=networks, key = 'id')
1435 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1436 assert_equal(sub_result[0], True)
1437 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1438 creds = get_nova_credentials()
1439 nova = nova_client.Client('2', **creds)
1440 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1441 #assert_equal(new_instance_details.status, 'ACTIVE')
1442 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001443 print(new_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001444 status, output = self.nova_instance_tenants_access_check(new_instance_details)
1445 self.neutron_network_deletion(test_net_name)
1446 self.nova_instance_deletion(nova, new_instance_details)
1447 assert_equal(status, False)
1448
1449 def test_cordvtn_private_network_instance_ping_to_external_network(self):
1450 """
1451 Algo:
1452 0. Create Test-Net,
1453 1. Cretae subnetwork whose ip is under private network
1454 3. Do GET Rest API and validate creation of network
1455 4. Create new nova instance under private network
1456 5. Validate new nova instance is created on nova service
1457 6. Verify ping is getting successful from compute node to nova instance which is created in step 4.
1458 """
1459 test_net_name = 'vtn_test_26_net_private'
1460 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1461 test_management_type = "private"
1462 instance_vm_name = 'vtn_test_26_nova_instance_private_net'
1463 image_name = "vsg-1.1"
1464 flavor_id = 'm1.small'
1465 result = self.neutron_network_creation_and_validation(test_net_name)
1466 assert_equal(result, True)
1467 neutron_creds = self.get_neutron_credentials()
1468 neutron = neutronclient.Client(**neutron_creds)
1469 networks = neutron.list_networks(name=test_net_name)
1470 network_id = self.get_key_value(d=networks, key = 'id')
1471 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1472 assert_equal(sub_result[0], True)
1473 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1474 creds = get_nova_credentials()
1475 nova = nova_client.Client('2', **creds)
1476 new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id)
1477 #assert_equal(new_instance_details.status, 'ACTIVE')
1478 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001479 print(new_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001480 status, output = self.nova_instance_tenants_access_check(new_instance_details, check_type = "Ping_to_external")
1481 self.neutron_network_deletion(test_net_name)
1482 self.nova_instance_deletion(nova, new_instance_details)
1483 assert_equal(status, False)
1484
1485 def test_cordvtn_private_network_two_instance_ping_between_two_instances(self):
1486 """
1487 Algo:
1488 0. Create Test-Net,
1489 1. Cretae subnetwork whose ip is under private network
1490 3. Do GET Rest API and validate creation of network
1491 4. Create first nova instance under private network
1492 5. Validate first nova instance is created on nova service
1493 6. Create second nova instance under public network
1494 7. Validate second nova instance is created on nova service
1495 8. Now try to ping from one nova instance to other instance, should not success
1496 """
1497 test_net_name = 'vtn_test_27_net_private'
1498 test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1499 test_management_type = "private"
1500 first_instance_vm_name = 'vtn_test_27_nova_1st_instance_private_net'
1501 second_instance_vm_name = 'vtn_test_27_nova_2nd_instance_private_net'
1502 image_name = "vsg-1.1"
1503 flavor_id = 'm1.small'
1504 result = self.neutron_network_creation_and_validation(test_net_name)
1505 assert_equal(result, True)
1506 neutron_creds = self.get_neutron_credentials()
1507 neutron = neutronclient.Client(**neutron_creds)
1508 networks = neutron.list_networks(name=test_net_name)
1509 network_id = self.get_key_value(d=networks, key = 'id')
1510 sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr)
1511 assert_equal(sub_result[0], True)
1512 net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type)
1513 creds = get_nova_credentials()
1514 nova = nova_client.Client('2', **creds)
1515 first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id)
1516 second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id)
1517 #assert_equal(first_instance_details.status, 'ACTIVE')
1518 #assert_equal(second_instance_details.status, 'ACTIVE')
1519 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001520 print('New nova instance ip addresses are ')
1521 print(first_nova_instance_details.addresses)
1522 print(second_nova_instance_details.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001523 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")
1524 self.neutron_network_deletion(test_net_name)
1525 self.nova_instance_deletion(nova, first_nova_instance_details)
1526 self.nova_instance_deletion(nova, second_nova_instance_details)
1527 assert_equal(status, True)
1528
1529 def test_cordvtn_two_private_network_instances_ping_between_two_networks_via_private_network(self):
1530 """
1531 Algo:
1532 0. Create Test-Net,
1533 1. Cretae subnetwork whose ip is under private network
1534 3. Do GET Rest API and validate creation of network
1535 4. Create new nova instance under private network
1536 5. Validate new nova instance is created on nova service
1537 """
1538 test_netA_name = 'vtn_test_28_netA_private'
1539 test_sub_netA_cidr = ["private","10.160.160.192/26",'10.160.160.193']
1540 netA_instance_vm_name = 'vtn_test_28_nova_netA_instance_private_net'
1541 test_netB_name = 'vtn_test_28_netB_private'
1542 test_sub_netB_cidr = ["private","10.160.161.192/26",'10.160.161.193']
1543 netB_instance_vm_name = 'vtn_test_28_nova_netB_instance_private_net'
1544 test_management_type = "private"
1545 image_name = "vsg-1.1"
1546 flavor_id = 'm1.small'
1547 netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id]
1548 netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id]
1549
1550 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)
1551 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)
1552
1553 #assert_equal(nova_instance_details_netA.status, 'ACTIVE')
1554 #assert_equal(nova_instance_details_netB.status, 'ACTIVE')
1555 compute_details = self.get_compute_nodes()
A R Karthick76a497a2017-04-12 10:59:39 -07001556 print('New nova instance ip addresses are ')
1557 print(nova_instance_details_netA.addresses)
1558 print(nova_instance_details_netB.addresses)
Thangavelu K Sb8a7b872017-03-31 18:10:53 +00001559 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")
1560 self.neutron_network_deletion(test_netA_name)
1561 self.nova_instance_deletion(nova_netA, nova_instance_details_netA)
1562 self.neutron_network_deletion(test_netB_name)
1563 self.nova_instance_deletion(nova_netB, nova_instance_details_netB)
1564 assert_equal(status, False)
1565
Thangavelu K Saea3c672017-03-15 18:57:05 +00001566 def test_cordvtn_with_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00001567 """
1568 Algo:
1569 0. Create Test-Net,
1570 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1571 2. Run sync command for cordvtn
1572 3. Do GET Rest API and validate creation of network
1573 4. Validate network synch with created network in cord-onos
1574 """
1575 creds = self.get_neutron_credentials()
1576 neutron = neutronclient.Client(**creds)
1577 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
1578 net = neutron.create_network(body=body_example)
1579 networks = neutron.list_networks(name='Net-1')
1580 vtn_util = vtn_validation_utils('')
1581 data = networks
1582 result = self.search_value(data, "Net-1")
1583 assert_equal(result, True)
1584
1585 def test_cordvtn_neutron_network_creation_and_validation_on_onos(self):
1586 """
1587 Algo:
1588 0. Create Test-Net,
1589 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1590 2. Run sync command for cordvtn
1591 3. Do GET Rest API and validate creation of network
1592 4. Validate network synch with created network in cord-onos
1593 """
1594 creds = self.get_neutron_credentials()
1595 neutron = neutronclient.Client(**creds)
1596 body_example = {"network":{"name": "Net-1","admin_state_up":True}}
1597 net = neutron.create_network(body=body_example)
1598 networks = neutron.list_networks(name='Net-1')
1599 vtn_util = vtn_validation_utils('')
1600 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1601 auth = ('karaf','karaf')
1602
1603 resp = requests.get(url=url, auth=auth)
1604 data = json.loads(resp.text)
1605 result = self.search_value(data, "Net-1")
1606 assert_equal(result, True)
1607
Thangavelu K S3698fad2017-03-24 17:50:14 +00001608 def test_cordvtn_neutron_network_deletion_and_validation_on_neutron_openstack(self):
Thangavelu K Sa2f5ac02017-03-13 18:29:00 +00001609 """
1610 Algo:
1611 0. Create Test-Net,
1612 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1613 2. Run sync command for cordvtn
1614 3. Do GET Rest API and validate creation of network
1615 4. Validate network synch with created network in cord-onos
1616 """
1617 creds = self.get_neutron_credentials()
1618 neutron = neutronclient.Client(**creds)
1619 body_example = {"network":{"name": "Net-1","admin_state_up":False}}
1620 net = neutron.delete_network("Net-1")
1621 networks = neutron.list_networks(name='Net-1')
1622 vtn_util = vtn_validation_utils('')
1623 data = networks
1624 result = self.search_value(data, "Net-1")
1625 assert_equal(result, True)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001626
1627 def test_cordvtn_neutron_network_sync(self):
1628 """
1629 Algo:
1630 0. Create Test-Net,
1631 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1632 2. Run sync command for cordvtn
1633 3. Do GET Rest API and validate creation of network
1634 4. Validate network synch with created network in cord-onos
1635 """
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00001636 creds = self.get_neutron_credentials()
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001637 neutron = neutronclient.Client(**creds)
Chetan Gaonker09b77ae2017-03-08 01:44:25 +00001638 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001639 net = neutron.create_network(body=body_example)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00001640 url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint)
1641 auth = ('karaf','karaf')
1642 body_create_subnet = {'subnets': [{'cidr': '192.168.199.0/24',
1643 'ip_version': 4, 'network_id': network_id}]}
1644
1645 subnet = neutron.create_subnet(body=body_create_subnet)
1646
1647 resp = requests.get(url=url, auth=auth)
1648 data = json.loads(resp.text)
1649 result = self.search_value(data, "Test-Net-1")
1650 assert_equal(result, True)
1651
1652 def test_cordvtn_neutron_port_sync(self):
1653 """
1654 Algo:
1655 0. Create Test-Net,
1656 1. Load cordvtn config, vtn-cfg-1.json to cord-onos
1657 2. Run sync command for cordvtn
1658 3. Do GET Rest API and validate creation of network
Thangavelu K Saea3c672017-03-15 18:57:05 +00001659 4. Validate network synch with created port in cord-onos
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00001660 """
1661 creds = self.get_neutron_credentials()
1662 neutron = neutronclient.Client(**creds)
1663 body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}}
1664 net = neutron.create_network(body=body_example)
1665 network_id = net['network']['id']
1666 device_id = 'of:{}'.format(get_mac(self.switch))
1667 body_example = {'port': {'admin_state_up': True,'device_id':device_id, 'network_id':network_id}}
1668 response = neutron.create_port(body=body_example)
1669 url = "http://{0}:8181/onos/cordvtn/servicePorts".format(vtn_util.endpoint)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001670 auth = ('karaf','karaf')
1671
1672 resp = requests.get(url=url, auth=auth)
1673 data = json.loads(resp.text)
Chetan Gaonkera6e23a72017-03-14 01:27:49 +00001674 result = self.search_value(data, device_id)
Chetan Gaonker3c8ae682017-02-18 00:50:45 +00001675 assert_equal(result, True)
1676
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001677 def test_cordvtn_basic_tenant(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001678
ChetanGaonker71fe0302016-12-19 17:45:44 -08001679 tenant_1= create_tenant("CORD_Subscriber_Test_Tenant_1")
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001680 if tenant1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001681 print("Creation of CORD Subscriber Test Tenant 1")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001682
ChetanGaonker71fe0302016-12-19 17:45:44 -08001683 tenant_2 = create_tenant("CORD_Subscriber_Test_Tenant_2")
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001684 if tenant2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001685 print("Creation of CORD Subscriber Test Tenant 2")
ChetanGaonker71fe0302016-12-19 17:45:44 -08001686
1687 create_net(tenant_1,"a1")
1688 create_subnet(tenant_1,"a1","as1","10.0.1.0/24")
1689
1690 create_net(tenant_2,"a2")
1691 create_subnet(tenant_2,"a2","as1","10.0.2.0/24")
1692
1693 netid_1 = get_id(tenant_1,"net","a1")
1694 netid_2 = get_id(tenant_2,"net","a2")
1695
1696 nova_boot(tenant_1,"vm1",netid=netid)
1697 nova_boot(tenant_2,"vm1",netid=netid)
1698
1699 nova_wait_boot(tenant_1,"vm1", "ACTIVE")
1700 nova_wait_boot(tenant_2,"vm1", "ACTIVE")
1701
1702 router_create(tenant_1,"r1")
1703 router_interface_add(tenant_1,"r1","as1")
1704 router_create(tenant_2,"r1")
1705 router_interface_add(tenant_2,"r1","as1")
1706
1707 create_net(tenant_1,"x1","","--router:external=True")
1708 create_net(tenant_2,"x1","","--router:external=True")
1709
1710 router_gateway_set(tenant_1,"r1","x1")
1711 router_gateway_set(tenant_2,"r1","x1")
1712
1713 subnetid_1 = get_id(tenant_1,"subnet","as1")
1714 subnetid_2 = get_id(tenant_2,"subnet","as1")
1715 port_create(tenant_1,"p1","a1","10.0.1.100",subnetid_1)
1716 port_create(tenant_2,"p1","a1","10.0.1.100",subnetid_2)
1717
1718 port_id_1 = get_id(tenant_1,"port","p1")
1719 port_id_2 = get_id(tenant_2,"port","p1")
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001720 status = validate_vtn_flows()
1721 assert_equal(status, True)
ChetanGaonker71fe0302016-12-19 17:45:44 -08001722
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001723 def test_cordvtn_for_creation_of_network(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001724
1725 ret1 = create_tenant(netA)
1726 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001727 print("Creation of Tenant netA Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001728
1729 ret2 = create_tenant(netB)
1730 if ret2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001731 print("Creation of Tenant netB Failed")
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001732 network = {'name': self.network_name, 'admin_state_up': True}
1733 self.neutron.create_network({'network':network})
A R Karthick76a497a2017-04-12 10:59:39 -07001734 log_test.info("Created network:{0}".format(self.network_name))
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001735 status = validate_vtn_flows()
1736 assert_equal(status, True)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001737
1738 def test_cordvtn_to_create_net_work_with_subnet(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001739 ret1 = create_tenant(netA)
1740 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001741 print("Creation of Tenant netA Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001742
1743 ret2 = create_tenant(netB)
1744 if ret2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001745 print("Creation of Tenant netB Failed")
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001746 network_name = self.network_name
1747 network = {'name': network_name, 'admin_state_up': True}
1748 network_info = self.neutron.create_network({'network':network})
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001749 network_id = network_info['network']['id']
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001750
A R Karthick76a497a2017-04-12 10:59:39 -07001751 log_test.info("Created network:{0}".format(network_id))
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001752 self.network_ids.append(network_id)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001753 subnet_count = 1
1754 for cidr in self.subnet_cidrs:
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001755 gateway_ip = str(list(cidr)[1])
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001756 subnet = {"network_id": network_id, "ip_version":4,
1757 "cidr":str(cidr), "enable_dhcp":True,
1758 "host_routes":[{"destination":"0.0.0.0/0", "nexthop":gateway_ip}]
1759 }
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001760 subnet = {"name":"subnet-"+str(subnet_count), "network_id": network_id, "ip_version":4, "cidr":str(cidr), "enable_dhcp":True}
A R Karthick76a497a2017-04-12 10:59:39 -07001761 print(subnet)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001762 self.neutron.create_subnet({'subnet':subnet})
A R Karthick76a497a2017-04-12 10:59:39 -07001763 log_test.info("Created subnet:{0}".format(str(cidr)))
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001764 if not self.number_of_subnet - 1:
1765 break
1766 self.number_of_subnet -= 1
1767 subnet_count += 1
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001768 status = validate_vtn_flows()
1769 assert_equal(status, True)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001770
1771 def test_cordvtn_subnet_limit(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001772 ret1 = create_tenant(netA)
1773 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001774 print("Creation of Tenant netA Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001775
1776 ret2 = create_tenant(netB)
1777 if ret2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001778 print("Creation of Tenant netB Failed")
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001779 network_name = uuid.uuid4().get_hex()
1780 network = {'name': network_name, 'admin_state_up': True}
1781 network_info = self.neutron.create_network({'network':network})
A R Karthick76a497a2017-04-12 10:59:39 -07001782 log_test.info("Created network:{0}".format(network_name))
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001783 network_id = network_info['network']['id']
1784 self.network_ids.append(network_id)
1785 subnet_cidrs = ['11.2.2.0/29', '11.2.2.8/29']
1786 for cidr in subnet_cidrs:
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001787 subnet = {"network_id": network_id, "ip_version":4, "cidr": cidr}
1788 subnet_info = self.neutron.create_subnet({'subnet':subnet})
1789 subnet_id = subnet_info['subnet']['id']
A R Karthick76a497a2017-04-12 10:59:39 -07001790 log_test.info("Created subnet:{0}".format(cidr))
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001791 while True:
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001792 port = {"network_id": network_id, "admin_state_up": True}
1793 port_info = self.neutron.create_port({'port':port})
1794 port_id = port_info['port']['id']
1795 self.port_ids.append(port_id)
A R Karthick76a497a2017-04-12 10:59:39 -07001796 log_test.info("Created Port:{0}".format(port_info['port']['id']))
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001797 if not self.quota_limit:
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001798 break
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001799 self.quota_limit -= 1
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001800 status = validate_vtn_flows()
1801 assert_equal(status, True)
ChetanGaonkerd65b7612016-12-07 01:01:20 -08001802
1803 def test_cordvtn_floatingip_limit(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001804 ret1 = create_tenant(netA)
1805 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001806 print("Creation of Tenant netA Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001807
1808 ret2 = create_tenant(netB)
1809 if ret2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001810 print("Creation of Tenant netB Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001811 while True:
1812 floatingip = {"floating_network_id": self.floating_nw_id}
1813 fip_info = self.neutron.create_floatingip({'floatingip':floatingip})
1814 fip_id = fip_info['floatingip']['id']
A R Karthick76a497a2017-04-12 10:59:39 -07001815 log_test.info("Created Floating IP:{0}".format(fip_id))
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001816 self.fip_ids.append(fip_id)
1817 if not self.quota_limit:
1818 break
1819 self.quota_limit -= 1
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001820 status = validate_vtn_flows()
1821 assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001822
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001823 def test_cordvtn_for_10_neutron_networks(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001824 ret1 = create_tenant(netA)
1825 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001826 print("Creation of Tenant netA Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001827
1828 ret2 = create_tenant(netB)
1829 if ret2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001830 print("Creation of Tenant netB Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001831 pool = Pool(processes=10)
1832 ret = os.system("neutron quote-update --network 15")
1833 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001834 print("Neutron network install failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001835 for i in range(1, 11):
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001836 pool.apply_async(create_network, (i, ))
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001837
1838 pool.close()
1839 pool.join()
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001840 status = validate_vtn_flows()
1841 assert_equal(status, True)
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001842
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001843 def test_cordvtn_for_100_neutron_networks(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001844 ret1 = create_tenant(netA)
1845 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001846 print("Creation of Tenant netA Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001847
1848 ret2 = create_tenant(netB)
1849 if ret2 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001850 print("Creation of Tenant netB Failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001851 pool = Pool(processes=10)
1852
1853 ret = os.system("neutron quote-update --network 105")
1854 if ret1 != 0:
A R Karthick76a497a2017-04-12 10:59:39 -07001855 print("Neutron network install failed")
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001856 for i in range(1, 101):
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001857 pool.apply_async(create_network, (i, ))
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08001858
1859 pool.close()
1860 pool.join()
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001861 status = validate_vtn_flows()
1862 assert_equal(status, True)
1863
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001864 def test_cordvtn_creating_virtual_private_network(self):
1865 """
1866 Algo:
1867 1) Validate that required openstack service is up and running.
1868 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1869 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
1870 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
1871 4) Verify that NetA is being created and validate IP in nova list command.
1872 5) Verify that flow is being added in ovs-switch in compute-node.
1873 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1874 """
1875 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001876
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001877 def test_cordvtn_creating_virtual_local_management_network(self):
1878 """
1879 Algo:
1880 1) Validate that required openstack service is up and running.
1881 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1882 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
1883 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
1884 4) Verify that NetA is being created and validate IP in nova list command.
1885 5) Verify that flow is being added in ovs-switch in compute-node.
1886 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1887 """
1888 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001889
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001890 def test_cordvtn_creating_virtual_vlan_connectivity_network(self):
1891 """
1892 Algo:
1893 1) Validate that required openstack service is up and running.
1894 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1895 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
1896 (neutron port-create net-A-private --name stag-100).
1897 4) Verify that NetA is being created and validate IP in nova list command.
1898 5) Verify that flow is being added in ovs-switch in compute-node.
1899 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1900 """
1901 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001902
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001903 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network(self):
1904 """
1905 Algo:
1906 1) Validate that required openstack service is up and running.
1907 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1908 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
1909 (neutron port-create net-A-private --name stag-500).
1910 4) Verify that NetA is being created and validate IP in nova list command.
1911 5) Verify that flow is being added in ovs-switch in compute-node.
1912 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1913 """
1914 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001915
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001916 def test_cordvtn_creating_virtual_private_network_and_boot_image(self):
1917 """
1918 Algo:
1919 1) Validate that required openstack service is up and running.
1920 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1921 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
1922 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
1923 4) Now boot image in the same created network using nova boot image command (example given below :-
1924 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
1925 5) Wait till VM boots up and starts running.
1926 6) Verify that a VM is launched and running by using novaclient python API.
1927 7) Verify that flow is being added in ovs-switch in compute-node.
1928 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1929 9) Verify that cord-onos pushed flows to OVS switch.
1930 """
1931 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001932
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001933 def test_cordvtn_creating_virtual_public_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001934
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001935 """
1936 Algo:
1937 1) Validate that required openstack service is up and running.
1938 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1939 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
1940 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
1941 4) Now boot image in the same created network using nova boot image command (example given below :-
1942 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
1943 5) Wait till VM boots up and starts running.
1944 6) Verify that a VM is launched and running by using novaclient python API.
1945 7) Verify that flow is being added in ovs-switch in compute-node.
1946 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1947 9) Verify that cord-onos pushed flows to OVS switch.
1948 """
1949 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001950
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001951 def test_cordvtn_creating_virtual_local_management_network_and_boot_image(self):
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001952
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001953 """
1954 Algo:
1955 1) Validate that required openstack service is up and running.
1956 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1957 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
1958 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
1959 4) Now boot image in the same created network using nova boot image command (example given below :-
1960 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
1961 5) Wait till VM boots up and starts running.
1962 6) Verify that a VM is launched and running by using novaclient python API.
1963 7) Verify that flow is being added in ovs-switch in compute-node.
1964 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1965 9) Verify that cord-onos pushed flows to OVS switch.
1966 """
1967 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001968
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001969 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image(self):
1970 """
1971 Algo:
1972 1) Validate that required openstack service is up and running.
1973 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1974 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
1975 (neutron port-create net-A-private --name stag-100).
1976 4) Now boot image in the same created network using nova boot image command (example given below :-
1977 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
1978 5) Wait till VM boots up and starts running.
1979 6) Verify that a VM is launched and running by using novaclient python API.
1980 7) Verify that flow is being added in ovs-switch in compute-node.
1981 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1982 9) Verify that cord-onos pushed flows to OVS switch.
1983 """
1984 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00001985
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00001986 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image(self):
1987 """
1988 Algo:
1989 1) Validate that required openstack service is up and running.
1990 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
1991 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
1992 (neutron port-create net-A-private --name stag-500).
1993 4) Now boot image in the same created network using nova boot image command (example given below :-
1994 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
1995 5) Wait till VM boots up and starts running.
1996 6) Verify that a VM is launched and running by using novaclient python API.
1997 7) Verify that flow is being added in ovs-switch in compute-node.
1998 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
1999 9) Verify that cord-onos pushed flows to OVS switch.
2000 """
2001 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002002
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002003 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service(self):
2004 """
2005 Algo:
2006 1) Validate that required openstack service is up and running.
2007 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2008 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2009 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2010 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2011 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2012 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2013 5) Wait till VMs boot up and running.
2014 6) Verify that two VMs are launched and running by using novaclient python API.
2015 7) Verify that flow is being added in ovs-switch in compute-node.
2016 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2017 9) Verify that cord-onos pushed flows to OVS switch.
2018 """
2019 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002020
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002021 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service(self):
2022 """
2023 Algo:
2024 1) Validate that required openstack service is up and running.
2025 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2026 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2027 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2028 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2029 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2030 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2031 5) Wait till VMs boot up and running.
2032 6) Verify that two VMs are launched and running by using novaclient python API.
2033 7) Verify that flow is being added in ovs-switch in compute-node.
2034 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2035 9) Verify that cord-onos pushed flows to OVS switch.
2036 """
2037 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002038
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002039 def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service(self):
2040 """
2041 Algo:
2042 1) Validate that required openstack service is up and running.
2043 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2044 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2045 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2046 4) Now boot two images in the same created network using nova boot image command (example given below :-
2047 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
2048 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
2049 5) Wait till VMs boot up and running.
2050 6) Verify that two VMs are launched and running by using novaclient python API.
2051 7) Verify that flow is being added in ovs-switch in compute-node.
2052 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2053 9) Verify that cord-onos pushed flows to OVS switch.
2054 """
2055 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002056
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002057 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
2058 """
2059 Algo:
2060 1) Validate that required openstack service is up and running.
2061 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2062 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2063 (neutron port-create net-A-private --name stag-100).
2064 4) Now boot two images in the same created network using nova boot image command (example given below :-
2065 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2066 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2067 5) Wait till VMs boot up and running.
2068 6) Verify that two VMs are launched and running by using novaclient python API.
2069 7) Verify that flow is being added in ovs-switch in compute-node.
2070 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2071 9) Verify that cord-onos pushed flows to OVS switch.
2072 """
2073 pass
Chetan Gaonker0fb91c92017-02-07 01:52:18 +00002074
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002075 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service(self):
2076 """
2077 Algo:
2078 1) Validate that required openstack service is up and running.
2079 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2080 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2081 (neutron port-create net-A-private --name stag-500).
2082 4) Now boot two images in the same created network using nova boot image command (example given below :-
2083 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2084 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2085 5) Wait till VMs boot up and running.
2086 6) Verify that two VMs are launched and running by using novaclient python API.
2087 7) Verify that flow is being added in ovs-switch in compute-node.
2088 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2089 9) Verify that cord-onos pushed flows to OVS switch.
2090 """
2091 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002092
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002093 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity(self):
2094 """
2095 Algo:
2096 1) Validate that required openstack service is up and running.
2097 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2098 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2099 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2100 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2101 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2102 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2103 5) Wait till VMs boot up and running.
2104 6) Verify that two VMs are launched and running by using novaclient python API.
2105 7) Now ping to the VM from other VM which are launched in same network
2106 8) verify that ping is successful
2107 9) Verify that flow is being added in ovs-switch in compute-node.
2108 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2109 11) Verify that cord-onos pushed flows to OVS switch.
2110 """
2111 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002112
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002113 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2114 """
2115 Algo:
2116 1) Validate that required openstack service is up and running.
2117 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2118 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2119 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2120 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2121 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2122 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2123 5) Wait till VMs boot up and running.
2124 6) Verify that two VMs are launched and running by using novaclient python API.
2125 7) Now ping to the VM from other VM which are launched in same network
2126 8) verify that ping is not successful
2127 9) Verify that flow is being added in ovs-switch in compute-node.
2128 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2129 11) Verify that cord-onos pushed flows to OVS switch.
2130 """
2131 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002132
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002133 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 -08002134
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002135 """
2136 Algo:
2137 1) Validate that required openstack service is up and running.
2138 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2139 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2140 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2141 4) Now boot two images in the same created network using nova boot image command (example given below :-
2142 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
2143 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
2144 5) Wait till VMs boot up and running.
2145 6) Verify that two VMs are launched and running by using novaclient python API.
2146 7) Now ping to the VM from other VM which are launched in same network
2147 8) verify that ping is not successful
2148 9) Verify that flow is being added in ovs-switch in compute-node.
2149 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2150 11) Verify that cord-onos pushed flows to OVS switch.
2151 """
2152 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002153
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002154 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 -08002155
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002156 """
2157 Algo:
2158 1) Validate that required openstack service is up and running.
2159 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2160 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2161 (neutron port-create net-A-private --name stag-100).
2162 4) Now boot two images in the same created network using nova boot image command (example given below :-
2163 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2164 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2165 5) Wait till VMs boot up and running.
2166 6) Verify that two VMs are launched and running by using novaclient python API.
2167 7) Now ping to the VM from other VM which are launched in same network
2168 8) verify that ping is not successful
2169 9) Verify that flow is being added in ovs-switch in compute-node.
2170 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2171 11) Verify that cord-onos pushed flows to OVS switch.
2172 """
2173 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002174
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002175 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2176 """
2177 Algo:
2178 1) Validate that required openstack service is up and running.
2179 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2180 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2181 (neutron port-create net-A-private --name stag-500).
2182 4) Now boot two images in the same created network using nova boot image command (example given below :-
2183 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2184 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2185 5) Wait till VMs boot up and running.
2186 6) Verify that two VMs are launched and running by using novaclient python API.
2187 7) Now ping to the VM from other VM which are launched in same network
2188 8) verify that ping is not successful
2189 9) Verify that flow is being added in ovs-switch in compute-node.
2190 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2191 11) Verify that cord-onos pushed flows to OVS switch.
2192 """
2193 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002194
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002195 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
2196 """
2197 Algo:
2198 1) Validate that required openstack service is up and running.
2199 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2200 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2201 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2202 4) Now boot image in the same created network using nova boot image command (example given below :-
2203 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2204 5) Wait till VM boots up and starts running.
2205 6) Verify that a VM is launched and running by using novaclient python API.
2206 7) Now ping to the VM from outside network which are internet network (global ping)
2207 8) verify that ping is not successful
2208 9) Verify that flow is being added in ovs-switch in compute-node.
2209 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2210 11) Verify that cord-onos pushed flows to OVS switch.
2211 """
2212 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002213
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002214 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity(self):
2215 """
2216 Algo:
2217 1) Validate that required openstack service is up and running.
2218 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2219 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2220 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2221 4) Now boot image in the same created network using nova boot image command (example given below :-
2222 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2223 5) Wait till VM boots up and starts running.
2224 6) Verify that a VM is launched and running by using novaclient python API.
2225 7) Now ping to the VM from outside network which are internet network (global ping)
2226 8) verify that ping is successful
2227 9) Verify that flow is being added in ovs-switch in compute-node.
2228 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2229 11) Verify that cord-onos pushed flows to OVS switch.
2230 """
2231 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002232
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002233 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_negative_scenario(self):
2234 """
2235 Algo:
2236 1) Validate that required openstack service is up and running.
2237 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2238 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2239 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2240 4) Now boot image in the same created network using nova boot image command (example given below :-
2241 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
2242 5) Wait till VM boots up and starts running.
2243 6) Verify that a VM is launched and running by using novaclient python API.
2244 7) Now ping to the VM from outside network which are internet network (global ping)
2245 8) verify that ping is not successful
2246 9) Verify that flow is being added in ovs-switch in compute-node.
2247 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2248 11) Verify that cord-onos pushed flows to OVS switch.
2249 """
2250 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002251
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002252 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2253 """
2254 Algo:
2255 1) Validate that required openstack service is up and running.
2256 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2257 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2258 (neutron port-create net-A-private --name stag-100).
2259 4) Now boot image in the same created network using nova boot image command (example given below :-
2260 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2261 5) Wait till VM boots up and starts running.
2262 6) Verify that a VM is launched and running by using novaclient python API.
2263 7) Now ping to the VM from outside network which are internet network (global ping)
2264 8) verify that ping is not successful
2265 9) Verify that flow is being added in ovs-switch in compute-node.
2266 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2267 11) Verify that cord-onos pushed flows to OVS switch.
2268 """
2269 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002270
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002271 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2272 """
2273 Algo:
2274 1) Validate that required openstack service is up and running.
2275 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2276 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2277 (neutron port-create net-A-private --name stag-500).
2278 4) Now boot image in the same created network using nova boot image command (example given below :-
2279 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2280 5) Wait till VM boots up and starts running.
2281 6) Verify that a VM is launched and running by using novaclient python API.
2282 7) Now ping to the VM from outside network which are internet network (global ping)
2283 8) verify that ping is not successful
2284 9) Verify that flow is being added in ovs-switch in compute-node.
2285 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2286 11) Verify that cord-onos pushed flows to OVS switch.
2287 """
2288 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002289
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002290 def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self):
2291 """
2292 Algo:
2293 1) Validate that required openstack service is up and running.
2294 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2295 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2296 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2297 4) Now boot image in the same created network using nova boot image command (example given below :-
2298 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2299 5) Wait till VM boots up and starts running.
2300 6) Verify that a VM is launched and running by using novaclient python API.
2301 7) Now ping to the VM from compute node network which are launched a VM.
2302 8) verify that ping is not successful
2303 9) Verify that flow is being added in ovs-switch in compute-node.
2304 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2305 11) Verify that cord-onos pushed flows to OVS switch.
2306 """
2307 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002308
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002309 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_negative_scenario(self):
2310 """
2311 Algo:
2312 1) Validate that required openstack service is up and running.
2313 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2314 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2315 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2316 4) Now boot image in the same created network using nova boot image command (example given below :-
2317 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2318 5) Wait till VM boots up and starts running.
2319 6) Verify that a VM is launched and running by using novaclient python API.
2320 7) Now ping to the VM from compute node network which are launched a VM.
2321 8) verify that ping is not successful
2322 9) Verify that flow is being added in ovs-switch in compute-node.
2323 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2324 11) Verify that cord-onos pushed flows to OVS switch.
2325 """
2326 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002327
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002328 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity(self):
2329 """
2330 Algo:
2331 1) Validate that required openstack service is up and running.
2332 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2333 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2334 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2335 4) Now boot image in the same created network using nova boot image command (example given below :-
2336 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
2337 5) Wait till VM boots up and starts running.
2338 6) Verify that a VM is launched and running by using novaclient python API.
2339 7) Now ping to the VM from compute node network which are launched a VM.
2340 8) verify that ping is successful
2341 9) Verify that flow is being added in ovs-switch in compute-node.
2342 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2343 11) Verify that cord-onos pushed flows to OVS switch.
2344 """
2345 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002346
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002347 def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2348 """
2349 Algo:
2350 1) Validate that required openstack service is up and running.
2351 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2352 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2353 (neutron port-create net-A-private --name stag-100).
2354 4) Now boot image in the same created network using nova boot image command (example given below :-
2355 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2356 5) Wait till VM boots up and starts running.
2357 6) Verify that a VM is launched and running by using novaclient python API.
2358 7) Now ping to the VM from compute node network which are launched a VM.
2359 8) verify that ping is not successful
2360 9) Verify that flow is being added in ovs-switch in compute-node.
2361 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2362 11) Verify that cord-onos pushed flows to OVS switch.
2363 """
2364 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002365
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002366 def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self):
2367 """
2368 Algo:
2369 1) Validate that required openstack service is up and running.
2370 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2371 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2372 (neutron port-create net-A-private --name stag-500).
2373 4) Now boot image in the same created network using nova boot image command (example given below :-
2374 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2375 5) Wait till VM boots up and starts running.
2376 6) Verify that a VM is launched and running by using novaclient python API.
2377 7) Now ping to the VM from compute node network which are launched a VM.
2378 8) verify that ping is not successful
2379 9) Verify that flow is being added in ovs-switch in compute-node.
2380 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2381 11) Verify that cord-onos pushed flows to OVS switch.
2382 """
2383 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002384
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002385 def test_cordvtn_creating_virtual_vlan_interface_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002386
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002387 """
2388 Algo:
2389 1) Validate that required openstack service is up and running.
2390 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2391 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2392 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2393 4) Now boot image in the same created network using nova boot image command (example given below :-
2394 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2395 5) Wait till VM boots up and starts running.
2396 6) Verify that a VM is launched and running by using novaclient python API.
2397 7) Create a virtual interface with vlan tag and private ip on VM.
2398 8) Create a same virtual interface with valn tag and private ip on head node.
2399 9) Now ping to the VM from head node network which are launched a openstack service.
2400 10) verify that ping is successful
2401 11) Verify that flow is being added in ovs-switch in compute-node.
2402 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2403 13) Verify that cord-onos pushed flows to OVS switch.
2404 """
2405 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002406
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002407 def test_cordvtn_creating_virtual_vlan_interface_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002408
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002409 """
2410 Algo:
2411 1) Validate that required openstack service is up and running.
2412 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2413 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2414 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2415 4) Now boot image in the same created network using nova boot image command (example given below :-
2416 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2417 5) Wait till VM boots up and starts running.
2418 6) Verify that a VM is launched and running by using novaclient python API.
2419 7) Create a virtual interface with vlan tag and public ip on VM.
2420 8) Create a same virtual interface with valn tag and any pulic ip on head node.
2421 9) Now ping to the VM from head node network which are launched a openstack service.
2422 10) verify that ping is successful
2423 11) Verify that flow is being added in ovs-switch in compute-node.
2424 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2425 13) Verify that cord-onos pushed flows to OVS switch.
2426 """
2427 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002428
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002429 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002430
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002431 """
2432 Algo:
2433 1) Validate that required openstack service is up and running.
2434 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2435 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2436 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2437 4) Now boot image in the same created network using nova boot image command (example given below :-
2438 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
2439 5) Wait till VM boots up and starts running.
2440 6) Verify that a VM is launched and running by using novaclient python API.
2441 7) Create a virtual interface with vlan tag and local management ip on VM.
2442 8) Create a same virtual interface with valn tag and any local management ip on head node.
2443 9) Now ping to the VM from head node network which are launched a openstack service.
2444 10) verify that ping is successful
2445 11) Verify that flow is being added in ovs-switch in compute-node.
2446 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2447 13) Verify that cord-onos pushed flows to OVS switch.
2448 """
2449 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002450
ChetanGaonker901727c2016-11-29 14:05:03 -08002451
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002452 def test_cordvtn_creating_virtual_vlan_interface_floating_private_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002453
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002454 """
2455 Algo:
2456 1) Validate that required openstack service is up and running.
2457 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2458 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2459 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2460 4) Now boot image in the same created network using nova boot image command (example given below :-
2461 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2462 5) Wait till VM boots up and starts running.
2463 6) Verify that a VM is launched and running by using novaclient python API.
2464 7) Create a virtual interface with vlan tag and private floating ip on VM.
2465 8) Create a same virtual interface with valn tag and private floating ip on head node.
2466 9) Now ping to the VM from head node network which are launched a openstack service.
2467 10) verify that ping is successful
2468 11) Verify that flow is being added in ovs-switch in compute-node.
2469 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2470 13) Verify that cord-onos pushed flows to OVS switch.
2471 """
2472 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002473
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002474 def test_cordvtn_creating_virtual_vlan_interface_floating_public_network_and_boot_image_connectivity_negative_scenario(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002475
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002476 """
2477 Algo:
2478 1) Validate that required openstack service is up and running.
2479 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2480 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2481 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2482 4) Now boot image in the same created network using nova boot image command (example given below :-
2483 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2484 5) Wait till VM boots up and starts running.
2485 6) Verify that a VM is launched and running by using novaclient python API.
2486 7) Create a virtual interface with vlan tag and public floating ip on VM.
2487 8) Create a same virtual interface with valn tag and any pulic floating ip on head node.
2488 9) Now ping to the VM from head node network which are launched a openstack service.
2489 10) verify that ping is successful
2490 11) Verify that flow is being added in ovs-switch in compute-node.
2491 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2492 13) Verify that cord-onos pushed flows to OVS switch.
2493 """
2494 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002495
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002496 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity(self):
ChetanGaonker901727c2016-11-29 14:05:03 -08002497
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002498 """
2499 Algo:
2500 1) Validate that required openstack service is up and running.
2501 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2502 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2503 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2504 4) Now boot image in the same created network using nova boot image command (example given below :-
2505 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
2506 5) Wait till VM boots up and starts running.
2507 6) Verify that a VM is launched and running by using novaclient python API.
2508 7) Create a virtual interface with vlan tag and local management floating ip on VM.
2509 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
2510 9) Now ping to the VM from head node network which are launched a openstack service.
2511 10) verify that ping is successful
2512 11) Verify that flow is being added in ovs-switch in compute-node.
2513 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2514 13) Verify that cord-onos pushed flows to OVS switch.
2515 """
2516 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002517
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002518 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 -08002519
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002520 """
2521 Algo:
2522 1) Validate that required openstack service is up and running.
2523 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2524 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2525 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2526 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2527 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2528 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2529 5) Wait till VMs boot up and running.
2530 6) Verify that two VMs are launched and running by using novaclient python API.
2531 7) Now ping to the VM from other VM which are launched in the private network
2532 8) verify that ping is not successful
2533 9) Verify that flow is being added in ovs-switch in compute-node.
2534 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2535 11) Verify that cord-onos pushed flows to OVS switch.
2536 """
2537 pass
ChetanGaonker901727c2016-11-29 14:05:03 -08002538
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002539 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 -08002540
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002541 """
2542 Algo:
2543 1) Validate that required openstack service is up and running.
2544 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2545 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2546 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2547 4) Now boot two images in the same created network using nova boot image command (example given below :-
2548 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
2549 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
2550 5) Wait till VMs boot up and running.
2551 6) Verify that two VMs are launched and running by using novaclient python API.
2552 7) Now ping to the VM from other VM which are launched in the private network
2553 8) verify that ping is not successful
2554 9) Verify that flow is being added in ovs-switch in compute-node.
2555 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2556 11) Verify that cord-onos pushed flows to OVS switch.
2557 """
2558 pass
ChetanGaonkeraaea6b62016-12-16 17:06:39 -08002559
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002560 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 -08002561
Thangavelu K Sbdb1ec42017-02-23 19:51:42 +00002562 """
2563 Algo:
2564 1) Validate that required openstack service is up and running.
2565 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2566 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2567 (neutron port-create net-A-private --name stag-100).
2568 4) Now boot two images in the same created network using nova boot image command (example given below :-
2569 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2570 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2571 5) Wait till VMs boot up and running.
2572 6) Verify that two VMs are launched and running by using novaclient python API.
2573 7) Now ping to the VM from other VM which are launched in the private network
2574 8) verify that ping is not successful
2575 9) Verify that flow is being added in ovs-switch in compute-node.
2576 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2577 11) Verify that cord-onos pushed flows to OVS switch.
2578 """
2579 pass
2580
2581 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):
2582
2583 """
2584 Algo:
2585 1) Validate that required openstack service is up and running.
2586 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2587 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2588 (neutron port-create net-A-private --name stag-500).
2589 4) Now boot two images in the same created network using nova boot image command (example given below :-
2590 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2591 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2592 5) Wait till VMs boot up and running.
2593 6) Verify that two VMs are launched and running by using novaclient python API.
2594 7) Now ping to the VM from other VM which are launched in the private network
2595 8) verify that ping is not successful
2596 9) Verify that flow is being added in ovs-switch in compute-node.
2597 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2598 11) Verify that cord-onos pushed flows to OVS switch.
2599 """
2600 pass
2601
2602 def test_cordvtn_creating_one_virtual_local_management_other_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2603
2604 """
2605 Algo:
2606 1) Validate that required openstack service is up and running.
2607 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2608 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2609 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2610 4) Now boot two images in the same created network using nova boot image command (example given below :-
2611 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
2612 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
2613 5) Wait till VMs boot up and running.
2614 6) Verify that two VMs are launched and running by using novaclient python API.
2615 7) Now ping to the VM from other VM which are launched in the public network
2616 8) verify that ping is not successful
2617 9) Verify that flow is being added in ovs-switch in compute-node.
2618 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2619 11) Verify that cord-onos pushed flows to OVS switch.
2620 """
2621 pass
2622
2623 def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2624
2625 """
2626 Algo:
2627 1) Validate that required openstack service is up and running.
2628 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2629 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2630 (neutron port-create net-A-private --name stag-100).
2631 4) Now boot two images in the same created network using nova boot image command (example given below :-
2632 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2633 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2634 5) Wait till VMs boot up and running.
2635 6) Verify that two VMs are launched and running by using novaclient python API.
2636 7) Now ping to the VM from other VM which are launched in the public network
2637 8) verify that ping is not successful
2638 9) Verify that flow is being added in ovs-switch in compute-node.
2639 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2640 11) Verify that cord-onos pushed flows to OVS switch.
2641 """
2642 pass
2643
2644 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):
2645
2646 """
2647 Algo:
2648 1) Validate that required openstack service is up and running.
2649 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2650 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2651 (neutron port-create net-A-private --name stag-500).
2652 4) Now boot two images in the same created network using nova boot image command (example given below :-
2653 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2654 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2655 5) Wait till VMs boot up and running.
2656 6) Verify that two VMs are launched and running by using novaclient python API.
2657 7) Now ping to the VM from other VM which are launched in the public network
2658 8) verify that ping is not successful
2659 9) Verify that flow is being added in ovs-switch in compute-node.
2660 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2661 11) Verify that cord-onos pushed flows to OVS switch.
2662 """
2663 pass
2664
2665 def test_cordvtn_creating_one_virtual_vlan_connectivity_other_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self):
2666
2667 """
2668 Algo:
2669 1) Validate that required openstack service is up and running.
2670 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2671 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create.
2672 (neutron port-create net-A-private --name stag-100).
2673 4) Now boot two images in the same created network using nova boot image command (example given below :-
2674 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2675 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2676 5) Wait till VMs boot up and running.
2677 6) Verify that two VMs are launched and running by using novaclient python API.
2678 7) Now ping to the VM from other VM which are launched in the public network
2679 8) verify that ping is not successful
2680 9) Verify that flow is being added in ovs-switch in compute-node.
2681 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2682 11) Verify that cord-onos pushed flows to OVS switch.
2683 """
2684 pass
2685
2686 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):
2687
2688 """
2689 Algo:
2690 1) Validate that required openstack service is up and running.
2691 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2692 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2693 (neutron port-create net-A-private --name stag-500).
2694 4) Now boot two images in the same created network using nova boot image command (example given below :-
2695 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2696 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2697 5) Wait till VMs boot up and running.
2698 6) Verify that two VMs are launched and running by using novaclient python API.
2699 7) Now ping to the VM from other VM which are launched in the public network
2700 8) verify that ping is not successful
2701 9) Verify that flow is being added in ovs-switch in compute-node.
2702 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2703 11) Verify that cord-onos pushed flows to OVS switch.
2704 """
2705 pass
2706
2707 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):
2708
2709 """
2710 Algo:
2711 1) Validate that required openstack service is up and running.
2712 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2713 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create.
2714 (neutron port-create net-A-private --name stag-500).
2715 4) Now boot two images in the same created network using nova boot image command (example given below :-
2716 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2717 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2718 5) Wait till VMs boot up and running.
2719 6) Verify that two VMs are launched and running by using novaclient python API.
2720 7) Now ping to the VM from other VM which are launched in the public network
2721 8) verify that ping is not successful
2722 9) Verify that flow is being added in ovs-switch in compute-node.
2723 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2724 11) Verify that cord-onos pushed flows to OVS switch.
2725 """
2726 pass
2727
2728 def test_cordvtn_creating_virtual_public_network_and_boot_2_images_with_invalid_public_field_of_onos_network_cfg_json_in_same_service(self):
2729 """
2730 Algo:
2731 1) Validate that required openstack service is up and running.
2732 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2733 3) Push network_cfg.json config file to onos with an invalid public gateway ip in network_cfg.json file.
2734 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
2735 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2736 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2737 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2738 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
2739 6) Wait till VMs boot up and running.
2740 7) Verify that two VMs are launched and running by using novaclient python API.
2741 8) Verify that flow is being added in ovs-switch in compute-node.
2742 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2743 10) Verify that cord-onos pushed flows to OVS switch.
2744 11) Verify ping from VM to public gateway which is send to ONOS through rest API in network_cfg.json file.
2745 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.
2746 13) Now ping one VM to other VM it should not ping again even it in the same service.
2747 """
2748 pass
2749
2750 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_with_invalid_localManagementIp_field_of_onos_network_cfg_json(self):
2751
2752 """
2753 Algo:
2754 1) Validate that required openstack service is up and running.
2755 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2756 3) Push network_cfg.json config file to onos with an invalid localManagement ip in network_cfg.json file.
2757 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
2758 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2759 5) Now boot image in the same created network using nova boot image command (example given below :-
2760 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
2761 6) Wait till VM boots up and starts running.
2762 7) Verify that a VM is launched and running by using novaclient python API.
2763 8) Verify that flow is being added in ovs-switch in compute-node.
2764 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2765 10) Verify that cord-onos pushed flows to OVS switch.
2766 11) Verify ping from VM to local management ip which is send to ONOS through rest API in network_cfg.json file.
2767 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.
2768 """
2769 pass
2770
2771 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OVSDB_port_field_of_onos_network_cfg_json(self):
2772 """
2773 Algo:
2774 1) Validate that required openstack service is up and running.
2775 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2776 3) Push network_cfg.json config file to onos with an invalid ovsdb port in network_cfg.json file.
2777 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2778 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2779 4) Now boot image in the same created network using nova boot image command (example given below :-
2780 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2781 5) Wait till VM boots up and starts running.
2782 6) Verify that a VM is launched and running by using novaclient python API.
2783 7) Verify that flows are being added in ovs-switch in compute-node.
2784 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2785 9) Verify that cord-onos did not push any flows to OVS switch.
2786 """
2787 pass
2788
2789 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OpenStack_details_in_onos_network_cfg_json(self):
2790 """
2791 Algo:
2792 1) Validate that required openstack service is up and running.
2793 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2794 3) Push network_cfg.json config file to onos with an invalid openstack in network_cfg.json file.
2795 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2796 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2797 4) Now boot image in the same created network using nova boot image command (example given below :-
2798 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2799 5) Wait till VM boots up and starts running.
2800 6) Verify that a VM is launched and running by using novaclient python API.
2801 7) Verify that no flows are being added in ovs-switch in compute-node.
2802 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
2803 9) Verify that cord-onos did not push any flows to OVS switch.
2804 """
2805 pass
2806
2807 def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_compute_node_details_in_onos_network_cfg_json(self):
2808 """
2809 Algo:
2810 1) Validate that required openstack service is up and running.
2811 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2812 3) Push network_cfg.json config file to onos with an invalid compute node details in network_cfg.json file.
2813 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
2814 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2815 4) Now boot image in the same created network using nova boot image command (example given below :-
2816 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2817 5) Wait till VM boots up and starts running.
2818 6) Verify that a VM is launched and running by using novaclient python API.
2819 7) Verify that no flows are being added in ovs-switch in compute-node.
2820 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron.
2821 9) Verify that cord-onos did not push any flows to OVS switch.
2822 """
2823 pass
2824
2825
2826 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_in_different_services_connectivity(self):
2827 """
2828 Algo:
2829 1) Validate that required openstack service is up and running.
2830 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2831 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as private network.
2832 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2833 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2834 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2835 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2836 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2837 5) Wait till VMs boot up and running.
2838 6) Verify that two VMs are launched and running by using novaclient python API.
2839 7) Verify that flow is being added in ovs-switch in compute-node.
2840 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2841 9) Verify that cord-onos pushed flows to OVS switch.
2842 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2843 11) Verify that no flows are being added in the OVS switch.
2844 """
2845 pass
2846
2847 def test_cordvtn_creating_two_virtual_public_networks_and_boot_images_in_different_service_connectivity(self):
2848 """
2849 Algo:
2850 1) Validate that required openstack service is up and running.
2851 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2852 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as public network.
2853 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
2854 (neutron net-create net-A-public, neutron subnet-create net-B-public 198.1.0.0/24).
2855 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
2856 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2857 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2858 5) Wait till VMs boot up and running.
2859 6) Verify that two VMs are launched and running by using novaclient python API.
2860 7) Verify that flow is being added in ovs-switch in compute-node.
2861 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2862 9) Verify that cord-onos pushed flows to OVS switch.
2863 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2864 11) Verify that no flows are being added in the OVS switch.
2865 """
2866 pass
2867
2868 def test_cordvtn_creating_two_virtual_local_management_networks_and_boot_images_in_different_service_connectivity(self):
2869 """
2870 Algo:
2871 1) Validate that required openstack service is up and running.
2872 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2873 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.
2874 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
2875 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.28.0.0/24 -gateway 172.28.0.1).
2876 4) Now boot two images in the same created network using nova boot image command (example given below :-
2877 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
2878 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
2879 5) Wait till VMs boot up and running.
2880 6) Verify that two VMs are launched and running by using novaclient python API.
2881 7) Verify that flow is being added in ovs-switch in compute-node.
2882 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2883 9) Verify that cord-onos pushed flows to OVS switch.
2884 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2885 11) Verify that no flows are being added in the OVS switch.
2886 """
2887 pass
2888
2889 def test_cordvtn_creating_two_virtual_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
2890 """
2891 Algo:
2892 1) Validate that required openstack service is up and running.
2893 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2894 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with a vlan port-create.
2895 (neutron port-create net-A-private --name stag-100).
2896 (neutron port-create net-B-private --name stag-200).
2897 4) Now boot two images in the same created network using nova boot image command (example given below :-
2898 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2899 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg1-01
2900 5) Wait till VMs boot up and running.
2901 6) Verify that two VMs are launched and running by using novaclient python API.
2902 7) Verify that flow is being added in ovs-switch in compute-node.
2903 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2904 9) Verify that cord-onos pushed flows to OVS switch.
2905 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2906 11) Verify that no flows are being added in the OVS switch.
2907 """
2908 pass
2909 def test_cordvtn_creating_two_virtual_floating_IP_with_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self):
2910 """
2911 Algo:
2912 1) Validate that required openstack service is up and running.
2913 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2914 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.
2915 (neutron port-create net-A-private --name stag-500).
2916 (neutron port-create net-B-private --name stag-500).
2917 4) Now boot two images in the same created network using nova boot image command (example given below :-
2918 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01
2919 nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02
2920 5) Wait till VMs boot up and running.
2921 6) Verify that two VMs are launched and running by using novaclient python API.
2922 7) Verify that flow is being added in ovs-switch in compute-node.
2923 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2924 9) Verify that cord-onos pushed flows to OVS switch.
2925 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2926 11) Verify that no flows are being added in the OVS switch.
2927 """
2928 pass
2929
2930 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_direct_access(self):
2931 """
2932 Algo:
2933 1) Validate that required openstack service is up and running.
2934 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2935 3) Push service dependency data.json file to onos to subscriber of other service.
2936 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
2937 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
2938 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2939 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2940 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2941 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2942 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2943 6) Wait till VMs boot up and running.
2944 7) Verify that two VMs are launched and running by using novaclient python API.
2945 8) Verify that flow is being added in ovs-switch in compute-node.
2946 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2947 10) Verify that cord-onos pushed flows to OVS switch.
2948 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
2949 12) Verify that flows are being added in the OVS switch.
2950 """
2951 pass
2952
2953 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_indirect_access(self):
2954 """
2955 Algo:
2956 1) Validate that required openstack service is up and running.
2957 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2958 3) Push service dependency data.json file to onos to subscriber of other service.
2959 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
2960 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
2961 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2962 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2963 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2964 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2965 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2966 6) Wait till VMs boot up and running.
2967 7) Verify that two VMs are launched and running by using novaclient python API.
2968 8) Verify that flow is being added in ovs-switch in compute-node.
2969 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2970 10) Verify that cord-onos pushed flows to OVS switch.
2971 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.
2972 12) Verify that flows are being added in the OVS switch.
2973 """
2974 pass
2975
2976 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_direct_access(self):
2977 """
2978 Algo:
2979 1) Validate that required openstack service is up and running.
2980 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
2981 3) Push service dependency data.json file to onos to subscriber of other service.
2982 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
2983 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
2984 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
2985 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
2986 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
2987 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
2988 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
2989 6) Wait till VMs boot up and running.
2990 7) Verify that two VMs are launched and running by using novaclient python API.
2991 8) Verify that flow is being added in ovs-switch in compute-node.
2992 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
2993 10) Verify that cord-onos pushed flows to OVS switch.
2994 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
2995 12) Verify that flows are being added in the OVS switch.
2996 13) Push config data with outservice dependency in data.json file to onos to subscriber of other service.
2997 14) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping.
2998 15) Verify that no flows are being added in the OVS switch.
2999 """
3000 pass
3001
3002 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_indirect_access(self):
3003 """
3004 Algo:
3005 1) Validate that required openstack service is up and running.
3006 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3007 3) Push service dependency data.json file to onos to subscriber of other service.
3008 $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks
3009 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3010 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3011 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3012 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3013 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3014 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3015 6) Wait till VMs boot up and running.
3016 7) Verify that two VMs are launched and running by using novaclient python API.
3017 8) Verify that flow is being added in ovs-switch in compute-node.
3018 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3019 10) Verify that cord-onos pushed flows to OVS switch.
3020 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.
3021 12) Verify that flows are being added in the OVS switch.
3022 13) Push config data with out service dependency in data.json file to onos to subscriber of other service.
3023 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.
3024 15) Verify that no flows are being added in the OVS switch.
3025 """
3026 pass
3027
3028 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_direct_access(self):
3029 """
3030 Algo:
3031 1) Validate that required openstack service is up and running.
3032 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3033 3) Validate that XOS is up and running.
3034 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3035 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3036 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3037 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3038 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3039 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3040 6) Wait till VMs boot up and running.
3041 7) Verify that two VMs are launched and running by using novaclient python API.
3042 8) Verify that flow is being added in ovs-switch in compute-node.
3043 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3044 10) Verify that cord-onos pushed flows to OVS switch.
3045 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping.
3046 12) Verify that flows are being added in the OVS switch.
3047 """
3048 pass
3049
3050 def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_indirect_access(self):
3051 """
3052 Algo:
3053 1) Validate that required openstack service is up and running.
3054 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3055 3) Validate that XOS is up and running.
3056 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network.
3057 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3058 (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24).
3059 5) Now boot 2 images in the same created network using nova boot image command (example given below :-
3060 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3061 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01
3062 6) Wait till VMs boot up and running.
3063 7) Verify that two VMs are launched and running by using novaclient python API.
3064 8) Verify that flow is being added in ovs-switch in compute-node.
3065 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3066 10) Verify that cord-onos pushed flows to OVS switch.
3067 11) Now ping from VM which is Net-B to other VM which is in Net-A, should ping.
3068 12) Verify that flows are being added in the OVS switch.
3069 """
3070 pass
3071
3072 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_network_cfg_connectivity_to_access_device(self):
3073 """
3074 Algo:
3075 1) Validate that required openstack service is up and running.
3076 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3077 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
3078 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3079 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3080 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3081 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3082 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3083 6) We ahve to stop ONOS service to test this
3084 onos-service stop
3085 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3086 7) Now attach to access-agent container and ping to access-device
3087 8) Verify that ping should be success and flows are being added in br-int.
3088 """
3089 pass
3090
3091 def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
3092 """
3093 Algo:
3094 1) Validate that required openstack service is up and running.
3095 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3096 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container.
3097 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3098 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3099 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3100 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3101 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3102 6) We ahve to stop ONOS service to test this
3103 onos-service stop
3104 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3105 7) Now attach to access-agent container and ping to head node
3106 8) Verify that ping should be success and flows are being added in br-int.
3107 """
3108 pass
3109
3110 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_network_cfg_connectivity_to_access_device(self):
3111 """
3112 Algo:
3113 1) Validate that required openstack service is up and running.
3114 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3115 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
3116 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3117 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3118 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3119 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3120 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3121 6) We ahve to stop ONOS service to test this
3122 onos-service stop
3123 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3124 7) Now attach to access-agent container and ping to access-device
3125 8) Verify that ping should not be success and no flows are being added in br-int.
3126 """
3127 pass
3128
3129 def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_in_network_cfg_connectivity_to_head_node(self):
3130 """
3131 Algo:
3132 1) Validate that required openstack service is up and running.
3133 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3134 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container.
3135 4) Launch the access-agent and access-device containers and then restart openstack compute node.
3136 $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash
3137 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers
3138 $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24
3139 $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11
3140 6) We ahve to stop ONOS service to test this
3141 onos-service stop
3142 sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp"
3143 7) Now attach to access-agent container and ping to head node
3144 8) Verify that ping should not be success and no flows are being added in br-int.
3145 """
3146 pass
3147
3148 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_VMs(self):
3149 """
3150 Algo:
3151 1) Validate that required openstack service is up and running.
3152 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3153 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3154 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3155 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3156 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3157 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3158 5) Wait till VMs boot up and running.
3159 6) Verify that two VMs are launched and running by using novaclient python API.
3160 7) Now ping to the VM from other VM which are launched in same network
3161 8) verify that ping is successful
3162 9) Verify that flow is being added in ovs-switch in compute-node.
3163 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3164 11) Verify that cord-onos pushed flows to OVS switch.
3165 12) Restart both VMs in same service and repeat steps 7 to 11.
3166 """
3167 pass
3168
3169 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_cord_onos(self):
3170 """
3171 Algo:
3172 1) Validate that required openstack service is up and running.
3173 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3174 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3175 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3176 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3177 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3178 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3179 5) Wait till VMs boot up and running.
3180 6) Verify that two VMs are launched and running by using novaclient python API.
3181 7) Now ping to the VM from other VM which are launched in same network
3182 8) verify that ping is successful
3183 9) Verify that flow is being added in ovs-switch in compute-node.
3184 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3185 11) Verify that cord-onos pushed flows to OVS switch.
3186 12) Restart ONOS service and repeat steps 7 to 11.
3187 """
3188 pass
3189
3190 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_any_VM_recreating_it(self):
3191 """
3192 Algo:
3193 1) Validate that required openstack service is up and running.
3194 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3195 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3196 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3197 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3198 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3199 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3200 5) Wait till VMs boot up and running.
3201 6) Verify that two VMs are launched and running by using novaclient python API.
3202 7) Now ping to the VM from other VM which are launched in same network
3203 8) verify that ping is successful
3204 9) Verify that flow is being added in ovs-switch in compute-node.
3205 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3206 11) Verify that cord-onos pushed flows to OVS switch.
3207 12) Delete a VM which was created earlier and repeat steps 4 to 11.
3208 """
3209 pass
3210
3211 def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_and_add_br_int_bridge(self):
3212 """
3213 Algo:
3214 1) Validate that required openstack service is up and running.
3215 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3216 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network.
3217 (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24).
3218 4) Now boot 2 images in the same created network using nova boot image command (example given below :-
3219 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3220 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02
3221 5) Wait till VMs boot up and running.
3222 6) Verify that two VMs are launched and running by using novaclient python API.
3223 7) Now ping to the VM from other VM which are launched in same network
3224 8) verify that ping is successful
3225 9) Verify that flow is being added in ovs-switch in compute-node.
3226 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3227 11) Verify that cord-onos pushed flows to OVS switch.
3228 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3229 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3230 """
3231 pass
3232
3233 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_VM(self):
3234
3235 """
3236 Algo:
3237 1) Validate that required openstack service is up and running.
3238 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3239 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3240 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3241 4) Now boot image in the same created network using nova boot image command (example given below :-
3242 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3243 5) Wait till VM boots up and starts running.
3244 6) Verify that a VM is launched and running by using novaclient python API.
3245 7) Now ping to the VM from outside network which are internet network (global ping)
3246 8) verify that ping is successful
3247 9) Verify that flow is being added in ovs-switch in compute-node.
3248 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3249 11) Verify that cord-onos pushed flows to OVS switch.
3250 12) Restart the VM in service and repeat steps 7 to 11.
3251
3252 """
3253 pass
3254
3255 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3256
3257 """
3258 Algo:
3259 1) Validate that required openstack service is up and running.
3260 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3261 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3262 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3263 4) Now boot image in the same created network using nova boot image command (example given below :-
3264 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3265 5) Wait till VM boots up and starts running.
3266 6) Verify that a VM is launched and running by using novaclient python API.
3267 7) Now ping to the VM from outside network which are internet network (global ping)
3268 8) verify that ping is successful
3269 9) Verify that flow is being added in ovs-switch in compute-node.
3270 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3271 11) Verify that cord-onos pushed flows to OVS switch.
3272 12) Restart onos service container and repeat steps 7 to 11.
3273
3274 """
3275 pass
3276
3277 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3278
3279 """
3280 Algo:
3281 1) Validate that required openstack service is up and running.
3282 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3283 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3284 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3285 4) Now boot image in the same created network using nova boot image command (example given below :-
3286 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3287 5) Wait till VM boots up and starts running.
3288 6) Verify that a VM is launched and running by using novaclient python API.
3289 7) Now ping to the VM from outside network which are internet network (global ping)
3290 8) verify that ping is successful
3291 9) Verify that flow is being added in ovs-switch in compute-node.
3292 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3293 11) Verify that cord-onos pushed flows to OVS switch.
3294 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
3295
3296 """
3297 pass
3298
3299 def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3300
3301 """
3302 Algo:
3303 1) Validate that required openstack service is up and running.
3304 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3305 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network.
3306 (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24).
3307 4) Now boot image in the same created network using nova boot image command (example given below :-
3308 $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3309 5) Wait till VM boots up and starts running.
3310 6) Verify that a VM is launched and running by using novaclient python API.
3311 7) Now ping to the VM from outside network which are internet network (global ping)
3312 8) verify that ping is successful
3313 9) Verify that flow is being added in ovs-switch in compute-node.
3314 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3315 11) Verify that cord-onos pushed flows to OVS switch.
3316 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3317 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3318
3319 """
3320 pass
3321
3322 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3323
3324 """
3325 Algo:
3326 1) Validate that required openstack service is up and running.
3327 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3328 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3329 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3330 4) Now boot image in the same created network using nova boot image command (example given below :-
3331 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
3332 5) Wait till VM boots up and starts running.
3333 6) Verify that a VM is launched and running by using novaclient python API.
3334 7) Now ping to the VM from compute node network which are launched a VM.
3335 8) verify that ping is successful
3336 9) Verify that flow is being added in ovs-switch in compute-node.
3337 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3338 11) Verify that cord-onos pushed flows to OVS switch.
3339 12) Restart the VM in service and repeat steps 7 to 11.
3340 """
3341 pass
3342
3343 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3344
3345 """
3346 Algo:
3347 1) Validate that required openstack service is up and running.
3348 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3349 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3350 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3351 4) Now boot image in the same created network using nova boot image command (example given below :-
3352 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
3353 5) Wait till VM boots up and starts running.
3354 6) Verify that a VM is launched and running by using novaclient python API.
3355 7) Now ping to the VM from compute node network which are launched a VM.
3356 8) verify that ping is successful
3357 9) Verify that flow is being added in ovs-switch in compute-node.
3358 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3359 11) Verify that cord-onos pushed flows to OVS switch.
3360 12) Restart the onos service and repeat steps 7 to 11.
3361 """
3362 pass
3363
3364 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3365
3366 """
3367 Algo:
3368 1) Validate that required openstack service is up and running.
3369 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3370 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3371 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3372 4) Now boot image in the same created network using nova boot image command (example given below :-
3373 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
3374 5) Wait till VM boots up and starts running.
3375 6) Verify that a VM is launched and running by using novaclient python API.
3376 7) Now ping to the VM from compute node network which are launched a VM.
3377 8) verify that ping is successful
3378 9) Verify that flow is being added in ovs-switch in compute-node.
3379 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3380 11) Verify that cord-onos pushed flows to OVS switch.
3381 12) Delete and re-create a VM in the same service and repeat steps 7 to 11.
3382 """
3383 pass
3384
3385 def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3386
3387 """
3388 Algo:
3389 1) Validate that required openstack service is up and running.
3390 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3391 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3392 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3393 4) Now boot image in the same created network using nova boot image command (example given below :-
3394 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
3395 5) Wait till VM boots up and starts running.
3396 6) Verify that a VM is launched and running by using novaclient python API.
3397 7) Now ping to the VM from compute node network which are launched a VM.
3398 8) verify that ping is successful
3399 9) Verify that flow is being added in ovs-switch in compute-node.
3400 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3401 11) Verify that cord-onos pushed flows to OVS switch.
3402 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping)
3403 13) Add br_int bridge and repeat steps 7 to 11, (it should ping)
3404 """
3405 pass
3406
3407 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3408
3409 """
3410 Algo:
3411 1) Validate that required openstack service is up and running.
3412 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3413 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3414 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3415 4) Now boot image in the same created network using nova boot image command (example given below :-
3416 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
3417 5) Wait till VM boots up and starts running.
3418 6) Verify that a VM is launched and running by using novaclient python API.
3419 7) Create a virtual interface with vlan tag and local management ip on VM.
3420 8) Create a same virtual interface with valn tag and any local management ip on head node.
3421 9) Now ping to the VM from head node network which are launched a openstack service.
3422 10) verify that ping is successful
3423 11) Verify that flow is being added in ovs-switch in compute-node.
3424 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3425 13) Verify that cord-onos pushed flows to OVS switch.
3426 14) Restart the VM in service and repeat steps 9 to 13.
3427
3428 """
3429 pass
3430
3431 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3432
3433 """
3434 Algo:
3435 1) Validate that required openstack service is up and running.
3436 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3437 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3438 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3439 4) Now boot image in the same created network using nova boot image command (example given below :-
3440 nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01
3441 5) Wait till VM boots up and starts running.
3442 6) Verify that a VM is launched and running by using novaclient python API.
3443 7) Create a virtual interface with vlan tag and local management ip on VM.
3444 8) Create a same virtual interface with valn tag and any local management ip on head node.
3445 9) Now ping to the VM from head node network which are launched a openstack service.
3446 10) verify that ping is successful
3447 11) Verify that flow is being added in ovs-switch in compute-node.
3448 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3449 13) Verify that cord-onos pushed flows to OVS switch.
3450 14) Restart the ONOS service and repeat steps 9 to 13.
3451
3452 """
3453 pass
3454
3455 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3456
3457 """
3458 Algo:
3459 1) Validate that required openstack service is up and running.
3460 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3461 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3462 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3463 4) Now boot image in the same created network using nova boot image command (example given below :-
3464 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
3465 5) Wait till VM boots up and starts running.
3466 6) Verify that a VM is launched and running by using novaclient python API.
3467 7) Create a virtual interface with vlan tag and local management ip on VM.
3468 8) Create a same virtual interface with valn tag and any local management ip on head node.
3469 9) Now ping to the VM from head node network which are launched a openstack service.
3470 10) verify that ping is successful
3471 11) Verify that flow is being added in ovs-switch in compute-node.
3472 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3473 13) Verify that cord-onos pushed flows to OVS switch.
3474 14) Delete and re-create a VM in service and repeat steps 9 to 13.
3475
3476 """
3477 pass
3478
3479 def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3480
3481 """
3482 Algo:
3483 1) Validate that required openstack service is up and running.
3484 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3485 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3486 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3487 4) Now boot image in the same created network using nova boot image command (example given below :-
3488 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
3489 5) Wait till VM boots up and starts running.
3490 6) Verify that a VM is launched and running by using novaclient python API.
3491 7) Create a virtual interface with vlan tag and local management ip on VM.
3492 8) Create a same virtual interface with valn tag and any local management ip on head node.
3493 9) Now ping to the VM from head node network which are launched a openstack service.
3494 10) verify that ping is successful
3495 11) Verify that flow is being added in ovs-switch in compute-node.
3496 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3497 13) Verify that cord-onos pushed flows to OVS switch.
3498 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
3499 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
3500
3501 """
3502 pass
3503
3504 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_VM(self):
3505
3506 """
3507 Algo:
3508 1) Validate that required openstack service is up and running.
3509 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3510 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3511 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3512 4) Now boot image in the same created network using nova boot image command (example given below :-
3513 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
3514 5) Wait till VM boots up and starts running.
3515 6) Verify that a VM is launched and running by using novaclient python API.
3516 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3517 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3518 9) Now ping to the VM from head node network which are launched a openstack service.
3519 10) verify that ping is successful
3520 11) Verify that flow is being added in ovs-switch in compute-node.
3521 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3522 13) Verify that cord-onos pushed flows to OVS switch.
3523 14) Restart the VM in service and repeat steps 9 to 13.
3524 """
3525 pass
3526
3527 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self):
3528
3529 """
3530 Algo:
3531 1) Validate that required openstack service is up and running.
3532 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3533 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3534 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3535 4) Now boot image in the same created network using nova boot image command (example given below :-
3536 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
3537 5) Wait till VM boots up and starts running.
3538 6) Verify that a VM is launched and running by using novaclient python API.
3539 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3540 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3541 9) Now ping to the VM from head node network which are launched a openstack service.
3542 10) verify that ping is successful
3543 11) Verify that flow is being added in ovs-switch in compute-node.
3544 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3545 13) Verify that cord-onos pushed flows to OVS switch.
3546 14) Restart the ONOS service and repeat steps 9 to 13.
3547 """
3548 pass
3549
3550 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self):
3551 """
3552 Algo:
3553 1) Validate that required openstack service is up and running.
3554 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3555 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3556 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3557 4) Now boot image in the same created network using nova boot image command (example given below :-
3558 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
3559 5) Wait till VM boots up and starts running.
3560 6) Verify that a VM is launched and running by using novaclient python API.
3561 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3562 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3563 9) Now ping to the VM from head node network which are launched a openstack service.
3564 10) verify that ping is successful
3565 11) Verify that flow is being added in ovs-switch in compute-node.
3566 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3567 13) Verify that cord-onos pushed flows to OVS switch.
3568 14) Delete and re-create a VM in service and repeat steps 9 to 13.
3569 """
3570 pass
3571
3572 def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self):
3573
3574 """
3575 Algo:
3576 1) Validate that required openstack service is up and running.
3577 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list".
3578 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network.
3579 (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1).
3580 4) Now boot image in the same created network using nova boot image command (example given below :-
3581 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
3582 5) Wait till VM boots up and starts running.
3583 6) Verify that a VM is launched and running by using novaclient python API.
3584 7) Create a virtual interface with vlan tag and local management floating ip on VM.
3585 8) Create a same virtual interface with valn tag and any local management floating ip on head node.
3586 9) Now ping to the VM from head node network which are launched a openstack service.
3587 10) verify that ping is successful
3588 11) Verify that flow is being added in ovs-switch in compute-node.
3589 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron.
3590 13) Verify that cord-onos pushed flows to OVS switch.
3591 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping)
3592 15) Add br_int bridge and repeat steps 9 to 13, (it should ping)
3593 """
3594 pass