ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 1 | # |
| 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 | # |
| 16 | import unittest |
| 17 | import os,sys |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 18 | import keystoneclient.v2_0.client as ksclient |
| 19 | import keystoneclient.apiclient.exceptions |
| 20 | import neutronclient.v2_0.client as nclient |
| 21 | import neutronclient.common.exceptions |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 22 | import novaclient.v1_1.client as novaclient |
Chetan Gaonker | ea4d990 | 2017-04-05 18:25:43 -0500 | [diff] [blame] | 23 | from novaclient import client as nova_client |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 24 | from multiprocessing import Pool |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 25 | from neutronclient.v2_0 import client as neutron_client |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 26 | import neutronclient.v2_0.client as neutronclient |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 27 | from nose.tools import assert_equal |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 28 | from CordTestUtils import get_mac, log_test |
A.R Karthick | be7768c | 2017-03-17 11:39:41 -0700 | [diff] [blame] | 29 | from OnosCtrl import OnosCtrl |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 30 | from CordLogger import CordLogger |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 31 | from TestManifest import TestManifest |
Chetan Gaonker | a6e23a7 | 2017-03-14 01:27:49 +0000 | [diff] [blame] | 32 | from OnosFlowCtrl import OnosFlowCtrl |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 33 | from scapy.all import * |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 34 | from credentials import * |
| 35 | from VSGAccess import VSGAccess |
| 36 | from SSHTestAgent import SSHTestAgent |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 37 | import requests |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 38 | import time |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 39 | import py_compile |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 40 | import json |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 41 | |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 42 | PROTO_NAME_TCP = 'tcp' |
| 43 | PROTO_NAME_ICMP = 'icmp' |
| 44 | IPv4 = 'IPv4' |
| 45 | |
| 46 | OS_USERNAME = 'admin' |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 47 | OS_PASSWORD = 'VeryLongKeystoneAdminPassword' |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 48 | OS_TENANT = 'admin' |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 49 | OS_AUTH_URL = 'https://keystone.cord.lab:5000/v2.0' |
| 50 | OS_SERVICE_ENDPOINT = 'https://keystone.cord.lab:5000/v2.0/' |
Chetan Gaonker | 1f422af | 2017-01-13 21:59:16 +0000 | [diff] [blame] | 51 | VM_BOOT_TIMEOUT = 100 |
| 52 | VM_DELETE_TIMEOUT = 100 |
| 53 | |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 54 | |
| 55 | #VM SSH CREDENTIALS |
| 56 | VM_USERNAME = 'ubuntu' |
| 57 | VM_PASSWORD = 'ubuntu' |
| 58 | |
| 59 | TENANT_PREFIX = 'test-' |
| 60 | VM_PREFIX = 'test-' |
| 61 | NETWORK_PREFIX = 'test-' |
| 62 | CIDR_PREFIX = '192.168' |
| 63 | |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 64 | class vtn_validation_utils: |
| 65 | |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 66 | endpoint = '172.17.0.5' |
| 67 | version = '' |
| 68 | vtn_app = 'org.opencord.vtn' |
| 69 | |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 70 | def __init__(self, version): |
| 71 | self.version = version |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 72 | self.manifest = None |
| 73 | self.vtn_enabled = False |
| 74 | manifest = os.getenv('MANIFEST', None) |
| 75 | if manifest: |
| 76 | self.manifest = TestManifest(manifest = manifest) |
| 77 | self.endpoint = self.manifest.onos_ip |
| 78 | self.vtn_enabled = self.manifest.synchronizer == 'vtn' |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 79 | |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 80 | self.app_ctrl = OnosCtrl(self.vtn_app, controller = self.endpoint) |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 81 | |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 82 | def getDevices(self): |
| 83 | return OnosCtrl.get_devices(controller = self.endpoint) |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 84 | |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 85 | def getLinks(self): |
| 86 | return OnosCtrl.get_links(controller = self.endpoint) |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 87 | |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 88 | def getDevicePorts(self, switch_id): |
| 89 | return OnosCtrl.get_ports_device(switch_id, controller = self.endpoint) |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 90 | |
A.R Karthick | d4eed64 | 2017-03-09 14:40:52 -0800 | [diff] [blame] | 91 | def activateVTNApp(self): |
| 92 | return self.app_ctrl.activate() |
| 93 | |
| 94 | def deactivateVTNApp(self): |
| 95 | return self.app_ctrl.deactivate() |
Chetan Gaonker | 1c387cf | 2017-02-22 02:21:43 +0000 | [diff] [blame] | 96 | |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 97 | class cordvtn_exchange(CordLogger): |
| 98 | |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 99 | app_cordvtn = 'org.opencord.vtn' |
| 100 | test_path = os.path.dirname(os.path.realpath(__file__)) |
| 101 | cordvtn_dir = os.path.join(test_path, '..', 'setup') |
| 102 | cordvtn_conf_file = os.path.join(test_path, '..', '../cordvtn/network_cfg.json') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 103 | head_node_user = 'vagrant' |
| 104 | head_node_pass = 'vagrant' |
| 105 | head_node = os.getenv('HEAD_NODE', 'prod') |
| 106 | head_node_ip = '10.1.0.1' |
| 107 | HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node |
| 108 | |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 109 | |
| 110 | @classmethod |
| 111 | def setUpClass(cls): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 112 | ''' Activate the cordvtn app''' |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 113 | time.sleep(3) |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 114 | cls.onos_ctrl = OnosCtrl(cls.app_cordvtn) |
| 115 | status, _ = cls.onos_ctrl.activate() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 116 | #assert_equal(status, True) |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 117 | time.sleep(3) |
| 118 | cls.cordvtn_setup() |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 119 | |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 120 | @classmethod |
| 121 | def tearDownClass(cls): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 122 | '''Deactivate the cord vtn app''' |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 123 | #cls.onos_ctrl.deactivate() |
| 124 | #cls.cord_vtn_cleanup() |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 125 | |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 126 | @classmethod |
| 127 | def cordvtn_setup(cls): |
| 128 | pass |
| 129 | |
| 130 | @classmethod |
| 131 | def cord_vtn_cleanup(cls): |
| 132 | ##reset the ONOS port configuration back to default |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 133 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 134 | |
| 135 | @classmethod |
| 136 | def onos_load_config(cls, cordvtn_conf_file): |
| 137 | status, code = OnosCtrl.config(cordvtn_conf_file) |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 138 | if status is False: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 139 | log_test.info('JSON request returned status %d' %code) |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 140 | assert_equal(status, True) |
| 141 | time.sleep(3) |
| 142 | |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 143 | def get_neutron_credentials(self): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 144 | n = {} |
| 145 | n['username'] = os.environ['OS_USERNAME'] |
| 146 | n['password'] = os.environ['OS_PASSWORD'] |
| 147 | n['auth_url'] = os.environ['OS_AUTH_URL'] |
| 148 | n['tenant_name'] = os.environ['OS_TENANT_NAME'] |
Chetan Gaonker | 80e0615 | 2017-03-07 01:07:19 +0000 | [diff] [blame] | 149 | n['ca_cert'] = os.environ['REQUESTS_CA_BUNDLE'] |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 150 | return n |
| 151 | |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 152 | @classmethod |
| 153 | def get_compute_nodes(cls): |
| 154 | credentials = get_nova_credentials_v2() |
| 155 | novaclient = nova_client.Client('2', **credentials) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 156 | print novaclient.hypervisors.list() |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 157 | return novaclient.hypervisors.list() |
| 158 | |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 159 | def create_network(i): |
| 160 | neutron_credentials = get_neutron_credentials() |
| 161 | neutron = neutron_client.Client(**neutron_credentials) |
| 162 | json = {'network': {'name': 'network-' + str(i), |
| 163 | 'admin_state_up': True}} |
| 164 | while True: |
| 165 | try: |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 166 | net = neutron.create_network(body=json) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 167 | print '\nnetwork-' + str(i) + ' created' |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 168 | return net |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 169 | except Exception as e: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 170 | print e |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 171 | continue |
| 172 | |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 173 | def create_tenant(tenant_name): |
| 174 | new_tenant = keystone.tenants.create(tenant_name=tenant_name, |
| 175 | description="CORD Tenant \ |
| 176 | created", |
| 177 | enabled=True) |
| 178 | tenant_id = new_tenant.id |
| 179 | tenant_status = True |
| 180 | user_data = [] |
| 181 | for j in range(2): |
| 182 | j += 1 |
| 183 | user_name = tenant_name + '-user-' + str(j) |
| 184 | user_data.append(create_user(user_name, tenant_id)) |
| 185 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 186 | print " Tenant and User Created" |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 187 | |
| 188 | tenant_data = {'tenant_name': tenant_name, |
| 189 | 'tenant_id': tenant_id, |
| 190 | 'status': tenant_status} |
| 191 | return tenant_data |
| 192 | |
| 193 | def create_user(user_name, tenant_id): |
| 194 | new_user = keystone.users.create(name=user_name, |
| 195 | password="ubuntu", |
| 196 | tenant_id=tenant_id) |
| 197 | print(' - Created User %s' % user_name) |
| 198 | keystone.roles.add_user_role(new_user, member_role, tenant_id) |
| 199 | if assign_admin: |
| 200 | admin_user = keystone.users.find(name='admin') |
| 201 | admin_role = keystone.roles.find(name='admin') |
| 202 | keystone.roles.add_user_role(admin_user, admin_role, tenant_id) |
| 203 | user_data = {'name': new_user.name, |
| 204 | 'id': new_user.id} |
| 205 | return user_data |
| 206 | |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 207 | def create_port( router_id, network_id): |
| 208 | credentials = get_credentials() |
| 209 | neutron = client.Client(**credentials) |
| 210 | router = neutron.show_router(router_id) |
| 211 | |
| 212 | value = {'port':{ |
| 213 | 'admin_state_up':True, |
| 214 | 'device_id': router_id, |
| 215 | 'name': 'port1', |
| 216 | 'network_id':network_id, |
| 217 | }} |
| 218 | response = neutron.create_port(body=value) |
| 219 | |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 220 | def router_create(self, name): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 221 | external_network = None |
| 222 | for network in self.neutron.list_networks()["networks"]: |
| 223 | if network.get("router:external"): |
| 224 | external_network = network |
| 225 | break |
| 226 | |
| 227 | if not external_network: |
| 228 | raise Exception("Alarm! Can not to find external network") |
| 229 | |
| 230 | gw_info = { |
| 231 | "network_id": external_network["id"], |
| 232 | "enable_snat": True |
| 233 | } |
| 234 | router_info = { |
| 235 | "router": { |
| 236 | "name": name, |
| 237 | "external_gateway_info": gw_info, |
| 238 | "tenant_id": self.tenant_id |
| 239 | } |
| 240 | } |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 241 | router = self.neutron.router_create(router_info)['router'] |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 242 | return router |
| 243 | |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 244 | def delete_tenant(tenant_name): |
| 245 | tenant = keystone.tenants.find(name=tenant_name) |
| 246 | for j in range(2): |
| 247 | j += 1 |
| 248 | user_name = tenant_name + '-user-' + str(j) |
| 249 | delete_user(user_name, tenant.id) |
| 250 | tenant.delete() |
| 251 | print(' - Deleted Tenant %s ' % tenant_name) |
| 252 | return True |
| 253 | |
| 254 | def delete_user(user_name, tenant_id): |
| 255 | user = keystone.users.find(name=user_name) |
| 256 | user.delete() |
| 257 | |
| 258 | print(' - Deleted User %s' % user_name) |
| 259 | return True |
| 260 | |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 261 | def set_environment(tenants_num=0, networks_per_tenant=1, vms_per_network=2): |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 262 | octet = 115 |
| 263 | vm_inc = 11 |
| 264 | image = nova_connection.images.get(IMAGE_ID) |
| 265 | flavor = nova_connection.flavors.get(FLAVOR_ID) |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 266 | |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 267 | admin_user_id = keystone_connection.users.find(name=OS_USERNAME).id |
| 268 | member_role_id = keystone_connection.roles.find(name='Member').id |
| 269 | for num_tenant in range(1, tenants_num+1): |
| 270 | tenant = keystone_connection.tenants.create('%stenant%s' % (TENANT_PREFIX, num_tenant)) |
| 271 | keystone_connection.roles.add_user_role(admin_user_id, member_role_id, tenant=tenant.id) |
| 272 | for num_network in range(networks_per_tenant): |
| 273 | network_json = {'name': '%snet%s' % (NETWORK_PREFIX, num_tenant*10+num_network), |
| 274 | 'admin_state_up': True, |
| 275 | 'tenant_id': tenant.id} |
| 276 | network = neutron_connection.create_network({'network': network_json}) |
| 277 | subnet_json = {'name': '%ssubnet%s' % (NETWORK_PREFIX, num_tenant*10+num_network), |
| 278 | 'network_id': network['network']['id'], |
| 279 | 'tenant_id': tenant.id, |
| 280 | 'enable_dhcp': True, |
| 281 | 'cidr': '%s.%s.0/24' % (CIDR_PREFIX, octet), 'ip_version': 4} |
| 282 | octet += 1 |
| 283 | subnet = neutron_connection.create_subnet({'subnet': subnet_json}) |
| 284 | router_json = {'name': '%srouter%s' % (NETWORK_PREFIX, num_tenant*10+num_network), |
| 285 | 'tenant_id': tenant.id} |
| 286 | router = neutron_connection.router_create({'router': router_json}) |
| 287 | port = neutron_connection.add_interface_router(router['router']['id'], {'subnet_id': subnet['subnet']['id']}) |
| 288 | for num_vm in range(vms_per_network): |
| 289 | tenant_nova_connection = novacli.Client(OS_USERNAME, OS_PASSWORD, tenant.name, OS_AUTH_URL) |
| 290 | m = tenant_nova_connection.servers.create('%svm%s' % (VM_PREFIX, vm_inc), image, flavor, nics=[{'net-id': network['network']['id']}, {'net-id': MGMT_NET}]) |
| 291 | vm_inc += 1 |
ChetanGaonker | 71fe030 | 2016-12-19 17:45:44 -0800 | [diff] [blame] | 292 | |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 293 | def verify_neutron_crud(): |
| 294 | x = os.system("neutron_test.sh") |
| 295 | return x |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 296 | |
Author Name | 91eaeba | 2017-01-05 13:41:45 -0800 | [diff] [blame] | 297 | def list_floatingips( **kwargs): |
| 298 | creds = get_neutron_credentials() |
| 299 | neutron = client.Client(**creds) |
| 300 | return neutron.list_floatingips(**kwargs)['floatingips'] |
| 301 | |
| 302 | def list_security_groups( **kwargs): |
| 303 | creds = get_neutron_credentials() |
| 304 | neutron = client.Client(**creds) |
| 305 | return neutron.list_security_groups(**kwargs)['security_groups'] |
| 306 | |
| 307 | def list_subnets( **kwargs): |
| 308 | creds = get_neutron_credentials() |
| 309 | neutron = client.Client(**creds) |
| 310 | return neutron.list_subnets(**kwargs)['subnets'] |
| 311 | |
| 312 | def list_networks( **kwargs): |
| 313 | creds = get_neutron_credentials() |
| 314 | neutron = client.Client(**creds) |
| 315 | return neutron.list_networks(**kwargs)['networks'] |
| 316 | |
| 317 | def list_ports( **kwargs): |
| 318 | creds = get_neutron_credentials() |
| 319 | neutron = client.Client(**creds) |
| 320 | return neutron.list_ports(**kwargs)['ports'] |
| 321 | |
| 322 | def list_routers( **kwargs): |
| 323 | creds = get_neutron_credentials() |
| 324 | neutron = client.Client(**creds) |
| 325 | return neutron.list_routers(**kwargs)['routers'] |
| 326 | |
| 327 | def update_floatingip( fip, port_id=None): |
| 328 | creds = get_neutron_credentials() |
| 329 | neutron = client.Client(**creds) |
| 330 | neutron.update_floatingip(fip, {"floatingip": |
| 331 | {"port_id": port_id}}) |
| 332 | |
| 333 | def update_subnet( subnet_id, **subnet_params): |
| 334 | creds = get_neutron_credentials() |
| 335 | neutron = client.Client(**creds) |
| 336 | neutron.update_subnet(subnet_id, {'subnet': subnet_params}) |
| 337 | |
| 338 | def update_router( router_id, **router_params): |
| 339 | creds = get_neutron_credentials() |
| 340 | neutron = client.Client(**creds) |
| 341 | neutron.update_router(router_id, {'router': router_params}) |
| 342 | |
| 343 | def router_gateway_set( router_id, external_gateway): |
| 344 | creds = get_neutron_credentials() |
| 345 | neutron = client.Client(**creds) |
| 346 | neutron.update_router( |
| 347 | router_id, {'router': {'external_gateway_info': |
| 348 | {'network_id': external_gateway}}}) |
| 349 | |
| 350 | def router_gateway_clear( router_id): |
| 351 | creds = get_neutron_credentials() |
| 352 | neutron = client.Client(**creds) |
| 353 | neutron.update_router( |
| 354 | router_id, {'router': {'external_gateway_info': None}}) |
| 355 | |
| 356 | def router_add_interface( router_id, subnet_id): |
| 357 | creds = get_neutron_credentials() |
| 358 | neutron = client.Client(**creds) |
| 359 | neutron.add_interface_router(router_id, {'subnet_id': subnet_id}) |
| 360 | |
| 361 | def router_rem_interface( router_id, subnet_id): |
| 362 | creds = get_neutron_credentials() |
| 363 | neutron = client.Client(**creds) |
| 364 | neutron.remove_interface_router( |
| 365 | router_id, {'subnet_id': subnet_id}) |
| 366 | |
| 367 | def create_floatingip( **floatingip_params): |
| 368 | creds = get_neutron_credentials() |
| 369 | neutron = client.Client(**creds) |
| 370 | response = neutron.create_floatingip( |
| 371 | {'floatingip': floatingip_params}) |
| 372 | if 'floatingip' in response and 'id' in response['floatingip']: |
| 373 | return response['floatingip']['id'] |
| 374 | |
Chetan Gaonker | 1f422af | 2017-01-13 21:59:16 +0000 | [diff] [blame] | 375 | def make_iperf_pair(server, client, **kwargs): |
| 376 | ssh = SSHClient() |
| 377 | ssh.set_missing_host_key_policy(MissingHostKeyPolicy()) |
| 378 | |
| 379 | ssh.connect(server, username=VM_USERNAME, password=VM_PASSWORD) |
| 380 | ssh.exec_command('/usr/local/bin/iperf3 -s -D') |
| 381 | |
| 382 | ssh.connect(client, username=VM_USERNAME, password=VM_PASSWORD) |
| 383 | stdin, stdout, stderr = ssh.exec_command('/usr/local/bin/iperf3 -c %s -J' % server) |
| 384 | |
| 385 | rawdata = stdout.read() |
| 386 | data = json.loads(rawdata.translate(None,'\t').translate(None,'\n')) |
| 387 | |
| 388 | return data |
| 389 | |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 390 | def connect_ssh(os_ip, private_key_file=None, user='ubuntu'): |
| 391 | key = ssh.RSAKey.from_private_key_file(private_key_file) |
| 392 | client = ssh.SSHClient() |
| 393 | client.set_missing_host_key_policy(ssh.WarningPolicy()) |
| 394 | client.connect(ip, username=user, pkey=key, timeout=5) |
| 395 | return client |
Chetan Gaonker | 1f422af | 2017-01-13 21:59:16 +0000 | [diff] [blame] | 396 | |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 397 | def validate_vtn_flows(switch): |
| 398 | egress = 1 |
| 399 | ingress = 2 |
| 400 | egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1' } |
| 401 | ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1' } |
| 402 | device_id = 'of:{}'.format(get_mac(switch)) |
Chetan Gaonker | a6e23a7 | 2017-03-14 01:27:49 +0000 | [diff] [blame] | 403 | ctlr = self.ctlr_ip.split(',')[0] |
| 404 | flow = OnosFlowCtrl(deviceId = device_id, |
| 405 | egressPort = egress, |
| 406 | ingressPort = ingress, |
| 407 | ethType = '0x800', |
| 408 | ipSrc = ('IPV4_SRC', ingress_map['ip']+'/32'), |
| 409 | ipDst = ('IPV4_DST', egress_map['ip']+'/32'), |
| 410 | controller = ctlr |
| 411 | ) |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 412 | flow_id = flow.findFlow(device_id, IN_PORT = ('port', ingress), |
| 413 | ETH_TYPE = ('ethType','0x800'), IPV4_SRC = ('ip', ingress_map['ip']+'/32'), |
| 414 | IPV4_DST = ('ip', egress_map['ip']+'/32')) |
| 415 | if flow_id: |
| 416 | return True |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 417 | |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 418 | def cordvtn_config_load(self, config = None): |
| 419 | if config: |
| 420 | for k in config.keys(): |
| 421 | if cordvtn_config.has_key(k): |
| 422 | cordvtn_config[k] = config[k] |
| 423 | self.onos_load_config(self.cordvtn_dict) |
| 424 | |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 425 | def search_value(self, d, pat): |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 426 | match = False |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 427 | for k, v in d.items(): |
| 428 | if isinstance(v, dict): |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 429 | match = self.search_value(v, pat) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 430 | if match is True: |
| 431 | break |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 432 | elif type(v) is list: |
| 433 | for i in range(len(v)): |
| 434 | if type(v[i]) is dict: |
| 435 | match = self.search_value(v[i], pat) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 436 | if match is True: |
| 437 | break |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 438 | else: |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 439 | if v[i] == pat: |
| 440 | match = True |
| 441 | return match |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 442 | elif v == pat: |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 443 | match = True |
| 444 | return match |
| 445 | if match is True: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 446 | print"Network search is successful" |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 447 | return match |
| 448 | |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 449 | def get_key_value(self, d, key = None, value = None,): |
| 450 | match = False |
| 451 | ret_k = "" |
| 452 | ret_v = "" |
| 453 | if type(d) is not dict: |
| 454 | if type(d) is not list: |
| 455 | match = 'NOT_FOUND' |
| 456 | return [match, ret_k, ret_v] |
| 457 | else: |
| 458 | for i in range(len(d)): |
| 459 | if type(d[i]) is dict: |
| 460 | match,ret_k,ret_v = self.get_key_value(d[i], key, value) |
| 461 | if match is True: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 462 | print "Network creation is successful" |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 463 | break |
| 464 | else: |
| 465 | for k, v in d.items(): |
| 466 | if isinstance(v, dict): |
| 467 | match,ret_k,ret_v = self.get_key_value(v, key, value) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 468 | if match is True: |
| 469 | break |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 470 | elif type(v) is list: |
| 471 | for i in range(len(v)): |
| 472 | if type(v[i]) is dict: |
| 473 | match,ret_k,ret_v = self.get_key_value(v[i], key, value) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 474 | if match is True: |
| 475 | break |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 476 | else: |
| 477 | if key: |
| 478 | if k == key: |
| 479 | match = True |
| 480 | return [match, key, v] |
| 481 | elif value: |
| 482 | if v == value: |
| 483 | match = True |
| 484 | return [match, k, value] |
| 485 | else: |
| 486 | if key: |
| 487 | if k == key: |
| 488 | match = True |
| 489 | return [match, key, v] |
| 490 | elif value: |
| 491 | if v == value: |
| 492 | match = True |
| 493 | return [match, k, value] |
| 494 | if match == False: |
| 495 | match = 'NOT_FOUND' |
| 496 | return [match, ret_k, ret_v] |
| 497 | |
| 498 | def neutron_network_creation_and_validation(self, net_name): |
| 499 | creds = self.get_neutron_credentials() |
| 500 | neutron = neutronclient.Client(**creds) |
| 501 | body_example = {"network":{"name": net_name,"admin_state_up":True}} |
| 502 | net = neutron.create_network(body=body_example) |
| 503 | networks = neutron.list_networks(name=net_name) |
| 504 | data = networks |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 505 | return self.search_value(data, net_name) |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 506 | |
| 507 | def neutron_network_deletion(self, net_name): |
| 508 | creds = self.get_neutron_credentials() |
| 509 | neutron = neutronclient.Client(**creds) |
| 510 | networks = neutron.list_networks(name=net_name) |
| 511 | net_id = self.get_key_value(d=networks, key = 'id') |
| 512 | net = neutron.delete_network(net_id[2]) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 513 | return self.get_key_value(d=networks, value = net_name) |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 514 | |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 515 | 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 S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 516 | creds = self.get_neutron_credentials() |
| 517 | neutron = neutronclient.Client(**creds) |
| 518 | networks = neutron.list_networks(name=net_name) |
| 519 | net_id = self.get_key_value(d=networks, key = 'id') |
| 520 | cidr = sub_cird |
| 521 | body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "allocation_pools": [{"start": "172.27.0.20", "end": "172.27.0.21"}]}} |
| 522 | neutron_sub = neutron.create_subnet(body_subnet_example) |
| 523 | networks = neutron.list_networks(name=net_name) |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 524 | return self.get_key_value(d=networks, key = 'subnets') |
| 525 | |
| 526 | def neutron_subnet_creation_and_validation(self,net_name,sub_cird): |
| 527 | creds = self.get_neutron_credentials() |
| 528 | neutron = neutronclient.Client(**creds) |
| 529 | networks = neutron.list_networks(name=net_name) |
| 530 | net_id = self.get_key_value(d=networks, key = 'id') |
| 531 | if sub_cird[0] == 'management': |
| 532 | cidr = sub_cird[1] |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 533 | 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 S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 534 | elif sub_cird[0] == 'public': |
| 535 | cidr = sub_cird[1] |
| 536 | gate_way = sub_cird[2] |
| 537 | body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}} |
| 538 | elif sub_cird[0] == 'private': |
| 539 | cidr = sub_cird[1] |
| 540 | gate_way = sub_cird[2] |
| 541 | body_subnet_example = {"subnet":{"network_id": net_id[2],"ip_version":4, "cidr":str(cidr), "gateway_ip":str(gate_way)}} |
| 542 | |
| 543 | neutron_sub = neutron.create_subnet(body_subnet_example) |
| 544 | networks = neutron.list_networks(name=net_name) |
| 545 | return self.get_key_value(d=networks, key = 'subnets') |
| 546 | |
| 547 | def sub_network_type_post_to_onos(self,net_name,sub_net_type): |
| 548 | |
| 549 | creds = self.get_neutron_credentials() |
| 550 | neutron = neutronclient.Client(**creds) |
| 551 | networks = neutron.list_networks(name=net_name) |
| 552 | net_id = self.get_key_value(d=networks, key = 'id') |
| 553 | vtn_util = vtn_validation_utils('') |
| 554 | |
| 555 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 556 | auth = ('karaf','karaf') |
| 557 | network_data = {"ServiceNetwork":{"id": net_id[2],"type":sub_net_type, "providerNetworks":[]}} |
| 558 | json_network_type_data = json.dumps(network_data) |
| 559 | resp = requests.post(url=url, auth=auth, data =json_network_type_data) |
| 560 | return resp |
| 561 | |
| 562 | def nova_instance_creation_and_validation(self,net_name,nova_obj,instance_name,image_name, flavor_id): |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 563 | print nova_obj.images.list() |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 564 | image = nova_obj.images.find(name=image_name) |
| 565 | flavor = nova_obj.flavors.find(name=flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 566 | |
| 567 | nics_list = "" |
| 568 | if len(net_name) == 2: |
| 569 | network_1 = nova_obj.networks.find(label=net_name[0]) |
| 570 | network_2 = nova_obj.networks.find(label=net_name[1]) |
| 571 | print network_1.id |
| 572 | print network_2.id |
| 573 | nics_list = [{'net-id':network_1.id},{'net-id':network_2.id}] |
| 574 | else: |
| 575 | network_1 = nova_obj.networks.find(label=net_name) |
| 576 | print network_1.id |
| 577 | nics_list = [{'net-id':network_1.id}] |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 578 | |
| 579 | server = nova_obj.servers.create(name = instance_name, |
| 580 | image = image.id, |
| 581 | flavor = flavor.id, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 582 | nics = nics_list, |
| 583 | userdata = "#cloud-config \n password: ubuntu \n chpasswd: { expire: False }\n ssh_pwauth: True") |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 584 | # key_name = 'id_rsa') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 585 | server_details = nova_obj.servers.find(id=server.id) |
| 586 | print('Server is launched and status is %s' %server_details.status) |
| 587 | if server_details.status == 'BUILD': |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 588 | time.sleep(120) |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 589 | server_details = nova_obj.servers.find(id=server.id) |
| 590 | print('After delay server status is %s state'%server_details.status) |
| 591 | if server_details.status == 'ERROR': |
| 592 | print('Server status is still in %s state'%server_details.status) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 593 | server_boot_up_log = nova_obj.servers.get_console_output(server.id) |
| 594 | print 'Server boot Up console log \n%s'%server_boot_up_log |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 595 | return server_details |
| 596 | |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 597 | def create_net_subnet_nova_instance(self,net_name, subnet_name, instance_vm_details,management_type): |
| 598 | result = self.neutron_network_creation_and_validation(net_name) |
| 599 | assert_equal(result, True) |
| 600 | neutron_creds = self.get_neutron_credentials() |
| 601 | neutron = neutronclient.Client(**neutron_creds) |
| 602 | networks = neutron.list_networks(name=net_name) |
| 603 | network_id = self.get_key_value(d=networks, key = 'id') |
| 604 | sub_result = self.neutron_subnet_creation_and_validation(net_name,subnet_name)# sub_net_start = subnet_name[2], sub_net_end =subnet_name[3]) |
| 605 | assert_equal(sub_result[0], True) |
| 606 | net_type_post = self.sub_network_type_post_to_onos(net_name, management_type) |
| 607 | creds = get_nova_credentials() |
| 608 | nova = nova_client.Client('2', **creds) |
| 609 | new_instance_details = self.nova_instance_creation_and_validation(net_name,nova,instance_vm_details[0],instance_vm_details[1],instance_vm_details[2]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 610 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 611 | return [nova, new_instance_details] |
| 612 | |
| 613 | def nova_instance_tenants_access_check(self, target_tenants_details, compute_details = None, source_tenants_details = None , check_type = 'Ping_from_compute'): |
| 614 | source_tenant_ip = '' |
| 615 | target_tenant_ip = '' |
| 616 | cmd = '' |
| 617 | status = '' |
| 618 | output = '' |
| 619 | |
| 620 | ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node |
| 621 | if compute_details is None: |
| 622 | compute_ip = '10.1.0.17' |
| 623 | else: |
| 624 | compute_ip = compute_details.ip |
| 625 | |
| 626 | ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 627 | if target_tenants_details == {}: |
| 628 | target_tenants_details = '10.1.0.1' |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 629 | |
| 630 | ## TO DO New instance is not getting subnet ip, hence checking only mysite-vsg1 vm from compute node |
| 631 | if source_tenants_details is not None: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 632 | if source_tenants_details == {}: |
| 633 | source_tenants_details = '10.1.0.1' |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 634 | |
| 635 | if check_type == "Ping_from_compute": |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 636 | cmd2 = "ping -c 3 {0}".format(target_tenants_details) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 637 | ssh_agent = SSHTestAgent(host = compute_ip) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 638 | status, output = ssh_agent.run_cmd(cmd2, timeout = 5) |
| 639 | print output |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 640 | |
| 641 | if source_tenants_details is not None: |
| 642 | if check_type == "Ping_from_source_tenant": |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 643 | cmd = "ping -c 3 {0}".format(target_tenants_details) |
| 644 | ssh_cmd = 'ssh {} {}'.format(source_tenants_details, cmd) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 645 | print 'Executing ssh command on compute node %s'%ssh_cmd |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 646 | ssh_agent = SSHTestAgent(host = compute_ip) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 647 | status, output = ssh_agent.run_cmd(ssh_cmd, timeout = 5) |
| 648 | print output |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 649 | |
| 650 | if check_type == "Ping_to_external": |
| 651 | cmd = "ping -c 3 google.com" |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 652 | ssh_cmd = 'ssh {} {}'.format(target_tenants_details, cmd) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 653 | ssh_agent = SSHTestAgent(host = compute_ip) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 654 | status, output = ssh_agent.run_cmd(ssh_cmd, timeout = 5) |
| 655 | print output |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 656 | |
| 657 | if status == True and output: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 658 | print "Ping is successful" |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 659 | output = output.strip() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 660 | elif status == False: |
| 661 | print "Ping is not successful" |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 662 | output = None |
| 663 | return [status, output] |
| 664 | |
| 665 | |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 666 | def nova_instance_deletion(self, nova_obj, server_details): |
| 667 | results_nova_instance_deletion=nova_obj.servers.delete(server_details.id) |
| 668 | if results_nova_instance_deletion == None: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 669 | print"Nova instance is deleted" |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 670 | else: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 671 | print"Nova instance is not deleted" |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 672 | return results_nova_instance_deletion |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 673 | |
| 674 | def test_cordvtn_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self): |
| 675 | """ |
| 676 | Algo: |
| 677 | 0. Create vtn_test_1_net. |
| 678 | 1. Do GET Rest API and validate creation of network. |
| 679 | 2. Validate network on neutron openstack. |
| 680 | """ |
| 681 | result = self.neutron_network_creation_and_validation('vtn_test_1_net') |
| 682 | if result is True: |
| 683 | self.neutron_network_deletion('vtn_test_1_net') |
| 684 | assert_equal(result, True) |
| 685 | |
| 686 | def test_cordvtn_neutron_network_creation_and_validation_on_onos(self): |
| 687 | """ |
| 688 | Algo: |
| 689 | 0. Create Test-Net, |
| 690 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 691 | 2. Run sync command for cordvtn |
| 692 | 3. Do GET Rest API and validate creation of network |
| 693 | 4. Validate network synch with created network in cord-onos |
| 694 | """ |
| 695 | creds = self.get_neutron_credentials() |
| 696 | neutron = neutronclient.Client(**creds) |
| 697 | body_example = {"network":{"name": "vtn_test_2_net","admin_state_up":True}} |
| 698 | net = neutron.create_network(body=body_example) |
| 699 | vtn_util = vtn_validation_utils('') |
| 700 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 701 | auth = ('karaf','karaf') |
| 702 | |
| 703 | resp = requests.get(url=url, auth=auth) |
| 704 | data = json.loads(resp.text) |
| 705 | result = self.search_value(data, "vtn_test_2_net") |
| 706 | self.neutron_network_deletion('vtn_test_2_net') |
| 707 | assert_equal(result, True) |
| 708 | |
| 709 | def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_head_node_with_neutron_service(self): |
| 710 | """ |
| 711 | Algo: |
| 712 | 0. Create Test-Net, |
| 713 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 714 | 2. Run sync command for cordvtn |
| 715 | 3. Do GET Rest API and validate creation of network |
| 716 | 4. Validate network synch with created network in cord-onos |
| 717 | """ |
| 718 | result = self.neutron_network_creation_and_validation('vtn_test_3_net') |
| 719 | if result is True: |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 720 | self.neutron_network_deletion('vtn_test_3_net') |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 721 | assert_equal(result, True) |
| 722 | result_again = self.neutron_network_creation_and_validation('vtn_test_3_net') |
| 723 | if result_again is True: |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 724 | self.neutron_network_deletion('vtn_test_3_net') |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 725 | assert_equal(result, True) |
| 726 | |
| 727 | def test_cordvtn_with_neutron_network_deletion_recreation_and_validation_on_onos(self): |
| 728 | """ |
| 729 | Algo: |
| 730 | 0. Create Test-Net, |
| 731 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 732 | 2. Run sync command for cordvtn |
| 733 | 3. Do GET Rest API and validate creation of network |
| 734 | 4. Validate network synch with created network in cord-onos |
| 735 | """ |
| 736 | creds = self.get_neutron_credentials() |
| 737 | neutron = neutronclient.Client(**creds) |
| 738 | body_example = {"network":{"name": "vtn_test_4_net","admin_state_up":True}} |
| 739 | net = neutron.create_network(body=body_example) |
| 740 | vtn_util = vtn_validation_utils('') |
| 741 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 742 | auth = ('karaf','karaf') |
| 743 | |
| 744 | resp = requests.get(url=url, auth=auth) |
| 745 | data = json.loads(resp.text) |
| 746 | result = self.search_value(data, "vtn_test_4_net") |
| 747 | assert_equal(result, True) |
| 748 | self.neutron_network_deletion('vtn_test_4_net') |
| 749 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 750 | auth = ('karaf','karaf') |
| 751 | |
| 752 | resp = requests.get(url=url, auth=auth) |
| 753 | data = json.loads(resp.text) |
| 754 | result = self.search_value(data, "vtn_test_4_net") |
| 755 | assert_equal(result, False) |
| 756 | net = neutron.create_network(body=body_example) |
| 757 | vtn_util = vtn_validation_utils('') |
| 758 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 759 | auth = ('karaf','karaf') |
| 760 | |
| 761 | resp = requests.get(url=url, auth=auth) |
| 762 | data = json.loads(resp.text) |
| 763 | result = self.search_value(data, "vtn_test_4_net") |
| 764 | self.neutron_network_deletion('vtn_test_4_net') |
| 765 | assert_equal(result, True) |
| 766 | |
| 767 | def test_cordvtn_with_neutron_management_network_creation_and_validation_on_head_node_with_neutron_service(self): |
| 768 | test_net_name = 'vtn_test_5_net_management' |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 769 | test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"] |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 770 | result = self.neutron_network_creation_and_validation('vtn_test_5_net_management') |
| 771 | assert_equal(result, True) |
| 772 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 773 | if sub_result[0] is True: |
| 774 | self.neutron_network_deletion('vtn_test_5_net_management') |
| 775 | assert_equal(sub_result[0], True) |
| 776 | |
| 777 | def test_cordvtn_with_neutron_management_network_creation_and_validation_on_onos(self): |
| 778 | self.neutron_network_creation_and_validation('vtn_test_6_net_management') |
| 779 | creds = self.get_neutron_credentials() |
| 780 | neutron = neutronclient.Client(**creds) |
| 781 | networks = neutron.list_networks(name='vtn_test_6_net_management') |
| 782 | net_id = self.get_key_value(d=networks, key = 'id') |
| 783 | cidr = "172.27.0.0/24" |
| 784 | 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"}]}} |
| 785 | neutron_sub = neutron.create_subnet(body_subnet_example) |
| 786 | |
| 787 | vtn_util = vtn_validation_utils('') |
| 788 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 789 | auth = ('karaf','karaf') |
| 790 | |
| 791 | resp = requests.get(url=url, auth=auth) |
| 792 | data = json.loads(resp.text) |
| 793 | for i in range(len(data['ServiceNetworks'])): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 794 | if data['ServiceNetworks'][i]['name'] == 'vtn_test_6_net_management': |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 795 | sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet') |
| 796 | if sub_net_id[2] == " ": |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 797 | log_test.info('Sub network is not successful') |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 798 | self.neutron_network_deletion('vtn_test_6_net_management') |
| 799 | assert_equal(False, True) |
| 800 | break |
| 801 | elif sub_net_id[2] == cidr: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 802 | log_test.info('Sub network is successful') |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 803 | self.neutron_network_deletion('vtn_test_6_net_management') |
| 804 | assert_equal(sub_net_id[0], True) |
| 805 | break |
| 806 | |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 807 | def test_cordvtn_neutron_management_network_creation_and_post_network_type_management_local_to_onos(self): |
| 808 | """ |
| 809 | Algo: |
| 810 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 811 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 812 | 2. Run sync command for cordvtn |
| 813 | 3. Do GET Rest API and validate creation of network |
| 814 | 4. Pushed the network type as management local to onos |
| 815 | 5. Verified that onos is having under management network |
| 816 | """ |
| 817 | test_net_name = 'vtn_test_7_net_management' |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 818 | test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"] |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 819 | test_management_type = "management_local" |
| 820 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 821 | assert_equal(result, True) |
| 822 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 823 | |
| 824 | vtn_util = vtn_validation_utils('') |
| 825 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 826 | auth = ('karaf','karaf') |
| 827 | |
| 828 | resp = requests.get(url=url, auth=auth) |
| 829 | data = json.loads(resp.text) |
| 830 | for i in range(len(data['ServiceNetworks'])): |
| 831 | if data['ServiceNetworks'][i]['name'] == test_net_name: |
| 832 | sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet') |
| 833 | if sub_net_id[2] == " ": |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 834 | log_test.info('Sub network is not successful') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 835 | assert_equal(False, True) |
| 836 | break |
| 837 | elif sub_net_id[2] == test_sub_net_cidr[1]: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 838 | log_test.info('Sub network is successful') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 839 | assert_equal(sub_net_id[0], True) |
| 840 | break |
| 841 | |
| 842 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 843 | print("Response from onos to change network service type as management local = %s" %net_type_post.text) |
| 844 | net_type_json = json.loads(net_type_post.text) |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 845 | self.neutron_network_deletion(test_net_name) |
| 846 | assert_equal(net_type_json['message'], 'null already exists') |
| 847 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 848 | def test_cordvtn_with_management_network_creation_launching_nova_instance_and_validation_on_head_node_with_nova_service(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 849 | """ |
| 850 | Algo: |
| 851 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 852 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 853 | 3. Do GET Rest API and validate creation of network |
| 854 | 4. Create new nova instance under management network |
| 855 | 5. Validate new nova instance is created on nova service |
| 856 | """ |
| 857 | test_net_name = 'vtn_test_8_net_management' |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 858 | test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"] |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 859 | test_management_type = "management_local" |
| 860 | instance_vm_name = 'vtn_test_8_nova_instance_management_net' |
| 861 | image_name = "vsg-1.1" |
| 862 | flavor_id = 'm1.small' |
| 863 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 864 | assert_equal(result, True) |
| 865 | neutron_creds = self.get_neutron_credentials() |
| 866 | neutron = neutronclient.Client(**neutron_creds) |
| 867 | networks = neutron.list_networks(name=test_net_name) |
| 868 | network_id = self.get_key_value(d=networks, key = 'id') |
| 869 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 870 | assert_equal(sub_result[0], True) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 871 | creds = get_nova_credentials() |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 872 | nova = nova_client.Client('2', **creds) |
| 873 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
| 874 | self.neutron_network_deletion(test_net_name) |
| 875 | self.nova_instance_deletion(nova, new_instance_details) |
| 876 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 877 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 878 | def test_cordvtn_with_public_network_creation_and_validation_on_head_node_with_neutron_service(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 879 | """ |
| 880 | Algo: |
| 881 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 882 | 1. Create subnetwork who ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 883 | 2. Run sync command for cordvtn |
| 884 | 3. Do GET Rest API and validate creation of network |
| 885 | 4. Validate network synch with created network in cord-onos |
| 886 | """ |
| 887 | test_net_name = 'vtn_test_9_net_public' |
| 888 | test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193'] |
| 889 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 890 | assert_equal(result, True) |
| 891 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 892 | if sub_result[0] is True: |
| 893 | self.neutron_network_deletion(test_net_name) |
| 894 | assert_equal(sub_result[0], True) |
| 895 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 896 | def test_cordvtn_with_public_network_creation_and_validation_on_onos(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 897 | """ |
| 898 | Algo: |
| 899 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 900 | 1. Create subnetwork whoes ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 901 | 2. Run sync command for cordvtn |
| 902 | 3. Do GET Rest API and validate creation of network |
| 903 | """ |
| 904 | test_net_name = 'vtn_test_10_net_public' |
| 905 | test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193'] |
| 906 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 907 | assert_equal(result, True) |
| 908 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 909 | |
| 910 | vtn_util = vtn_validation_utils('') |
| 911 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 912 | auth = ('karaf','karaf') |
| 913 | |
| 914 | resp = requests.get(url=url, auth=auth) |
| 915 | data = json.loads(resp.text) |
| 916 | for i in range(len(data['ServiceNetworks'])): |
| 917 | if data['ServiceNetworks'][i]['name'] == test_net_name: |
| 918 | sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet') |
| 919 | if sub_net_id[2] == " ": |
| 920 | print('Sub network is not successful') |
| 921 | self.neutron_network_deletion(test_net_name) |
| 922 | assert_equal(False, True) |
| 923 | break |
| 924 | elif sub_net_id[2] == test_sub_net_cidr[1]: |
| 925 | print('Sub network is successful') |
| 926 | self.neutron_network_deletion(test_net_name) |
| 927 | assert_equal(sub_net_id[0], True) |
| 928 | break |
| 929 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 930 | def test_cordvtn_with_public_network_creation_and_post_network_type_as_public_to_onos(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 931 | """ |
| 932 | Algo: |
| 933 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 934 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 935 | 2. Run sync command for cordvtn |
| 936 | 3. Do GET Rest API and validate creation of network |
| 937 | 4. Pushed the network type as management local to onos |
| 938 | 5. Verified that onos is having under management network |
| 939 | """ |
| 940 | test_net_name = 'vtn_test_11_net_public' |
| 941 | test_sub_net_cidr = ["public","10.6.1.192/26", '10.6.1.193'] |
| 942 | test_management_type = "public" |
| 943 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 944 | assert_equal(result, True) |
| 945 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 946 | |
| 947 | vtn_util = vtn_validation_utils('') |
| 948 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 949 | auth = ('karaf','karaf') |
| 950 | |
| 951 | resp = requests.get(url=url, auth=auth) |
| 952 | data = json.loads(resp.text) |
| 953 | for i in range(len(data['ServiceNetworks'])): |
| 954 | if data['ServiceNetworks'][i]['name'] == test_net_name: |
| 955 | sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet') |
| 956 | if sub_net_id[2] == " ": |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 957 | log_test.info('Sub network is not successful') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 958 | assert_equal(False, True) |
| 959 | break |
| 960 | elif sub_net_id[2] == test_sub_net_cidr[1]: |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 961 | log_test.info('Sub network is successful') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 962 | assert_equal(sub_net_id[0], True) |
| 963 | break |
| 964 | |
| 965 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 966 | print("Response from onos to change network service type as management local = %s" %net_type_post.text) |
| 967 | net_type_json = json.loads(net_type_post.text) |
| 968 | |
| 969 | self.neutron_network_deletion(test_net_name) |
| 970 | assert_equal(net_type_json['message'], 'null already exists') |
| 971 | |
| 972 | def test_cordvtn_public_network_creation_with_launching_nova_instance_and_validation_on_head_node_with_nova_service(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 973 | """ |
| 974 | Algo: |
| 975 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 976 | 1. Create subnetwork whose ip is under public network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 977 | 3. Do GET Rest API and validate creation of network |
| 978 | 4. Create new nova instance under public network |
| 979 | 5. Validate new nova instance is created on nova service |
| 980 | """ |
| 981 | test_net_name = 'vtn_test_12_net_public' |
| 982 | test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193'] |
| 983 | instance_vm_name = 'vtn_test_12_nova_instance_public_net' |
| 984 | image_name = "vsg-1.1" |
| 985 | flavor_id = 'm1.small' |
| 986 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 987 | assert_equal(result, True) |
| 988 | neutron_creds = self.get_neutron_credentials() |
| 989 | neutron = neutronclient.Client(**neutron_creds) |
| 990 | networks = neutron.list_networks(name=test_net_name) |
| 991 | network_id = self.get_key_value(d=networks, key = 'id') |
| 992 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 993 | assert_equal(sub_result[0], True) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 994 | creds = get_nova_credentials() |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 995 | nova = nova_client.Client('2', **creds) |
| 996 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
| 997 | self.neutron_network_deletion(test_net_name) |
| 998 | self.nova_instance_deletion(nova, new_instance_details) |
| 999 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 1000 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1001 | def test_cordvtn_with_private_network_creation_and_validation_on_head_node_with_neutron_service(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1002 | """ |
| 1003 | Algo: |
| 1004 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1005 | 1. Create subnetwork who ip is under private network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1006 | 2. Run sync command for cordvtn |
| 1007 | 3. Do GET Rest API and validate creation of network |
| 1008 | 4. Validate network synch with created network in cord-onos |
| 1009 | """ |
| 1010 | test_net_name = 'vtn_test_13_net_private' |
| 1011 | test_sub_net_cidr = ["private","10.160.160.160/24",'10.160.160.1'] |
| 1012 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1013 | assert_equal(result, True) |
| 1014 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1015 | if sub_result[0] is True: |
| 1016 | self.neutron_network_deletion(test_net_name) |
| 1017 | assert_equal(sub_result[0], True) |
| 1018 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1019 | def test_cordvtn_with_private_network_creation_and_validation_on_onos(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1020 | """ |
| 1021 | Algo: |
| 1022 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1023 | 1. Create subnetwork whoes ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1024 | 2. Run sync command for cordvtn |
| 1025 | 3. Do GET Rest API and validate creation of network |
| 1026 | """ |
| 1027 | test_net_name = 'vtn_test_14_net_private' |
| 1028 | test_sub_net_cidr = ["private","10.160.160.160/24", '10.160.160.1'] |
| 1029 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1030 | assert_equal(result, True) |
| 1031 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1032 | |
| 1033 | vtn_util = vtn_validation_utils('') |
| 1034 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 1035 | auth = ('karaf','karaf') |
| 1036 | |
| 1037 | resp = requests.get(url=url, auth=auth) |
| 1038 | data = json.loads(resp.text) |
| 1039 | for i in range(len(data['ServiceNetworks'])): |
| 1040 | if data['ServiceNetworks'][i]['name'] == test_net_name: |
| 1041 | sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet') |
| 1042 | if sub_net_id[2] == " ": |
| 1043 | print('Sub network is not successful') |
| 1044 | self.neutron_network_deletion(test_net_name) |
| 1045 | assert_equal(False, True) |
| 1046 | break |
| 1047 | elif sub_net_id[2] == '10.160.160.0/24': |
| 1048 | #elif sub_net_id[2] == test_sub_net_cidr[1]: |
| 1049 | print('Sub network is successful') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1050 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1051 | assert_equal(sub_net_id[0], True) |
| 1052 | break |
| 1053 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1054 | def test_cordvtn_with_private_network_creation_and_post_network_type_as_private_to_onos(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1055 | """ |
| 1056 | Algo: |
| 1057 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1058 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1059 | 2. Run sync command for cordvtn |
| 1060 | 3. Do GET Rest API and validate creation of network |
| 1061 | 4. Pushed the network type as management local to onos |
| 1062 | 5. Verified that onos is having under management network |
| 1063 | """ |
| 1064 | test_net_name = 'vtn_test_15_net_private' |
| 1065 | test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1'] |
| 1066 | test_management_type = "private" |
| 1067 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1068 | assert_equal(result, True) |
| 1069 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1070 | |
| 1071 | vtn_util = vtn_validation_utils('') |
| 1072 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 1073 | auth = ('karaf','karaf') |
| 1074 | |
| 1075 | resp = requests.get(url=url, auth=auth) |
| 1076 | data = json.loads(resp.text) |
| 1077 | for i in range(len(data['ServiceNetworks'])): |
| 1078 | if data['ServiceNetworks'][i]['name'] == test_net_name: |
| 1079 | sub_net_id = self.get_key_value(d=data['ServiceNetworks'][i], key = 'subnet') |
| 1080 | if sub_net_id[2] == " ": |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 1081 | log_test.info('Sub network is not successful') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1082 | assert_equal(False, True) |
| 1083 | break |
| 1084 | elif sub_net_id[2] == "192.168.160.0/24": |
A R Karthick | 76a497a | 2017-04-12 10:59:39 -0700 | [diff] [blame] | 1085 | log_test.info('Sub network is successful') |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1086 | assert_equal(sub_net_id[0], True) |
| 1087 | break |
| 1088 | |
| 1089 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1090 | print("Response from onos to change network service type as management local = %s" %net_type_post.text) |
| 1091 | net_type_json = json.loads(net_type_post.text) |
| 1092 | |
| 1093 | self.neutron_network_deletion(test_net_name) |
| 1094 | assert_equal(net_type_json['message'], 'null already exists') |
| 1095 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1096 | def test_cordvtn_with_private_network_creation_launching_nova_instance_and_validating_on_head_node_with_nova_service(self): |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1097 | """ |
| 1098 | Algo: |
| 1099 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1100 | 1. Create subnetwork whose ip is under private network |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1101 | 3. Do GET Rest API and validate creation of network |
| 1102 | 4. Create new nova instance under private network |
| 1103 | 5. Validate new nova instance is created on nova service |
| 1104 | """ |
| 1105 | test_net_name = 'vtn_test_16_net_private' |
| 1106 | test_sub_net_cidr = ["private","192.168.160.160/24", '192.168.160.1'] |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1107 | instance_vm_name = 'vtn_test_16_nova_instance_private_net' |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1108 | image_name = "vsg-1.1" |
| 1109 | flavor_id = 'm1.small' |
| 1110 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1111 | assert_equal(result, True) |
| 1112 | neutron_creds = self.get_neutron_credentials() |
| 1113 | neutron = neutronclient.Client(**neutron_creds) |
| 1114 | networks = neutron.list_networks(name=test_net_name) |
| 1115 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1116 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1117 | assert_equal(sub_result[0], True) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1118 | creds = get_nova_credentials() |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 1119 | nova = nova_client.Client('2', **creds) |
| 1120 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
| 1121 | self.neutron_network_deletion(test_net_name) |
| 1122 | self.nova_instance_deletion(nova, new_instance_details) |
| 1123 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 1124 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1125 | def test_cordvtn_management_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1126 | """ |
| 1127 | Algo: |
| 1128 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1129 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1130 | 3. Do GET Rest API and validate creation of network |
| 1131 | 4. Create new nova instance under management network |
| 1132 | 5. Validate new nova instance is created on nova service |
| 1133 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1134 | """ |
| 1135 | test_net_name = 'vtn_test_17_net_management' |
| 1136 | test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"] |
| 1137 | test_management_type = "management_local" |
| 1138 | instance_vm_name = 'vtn_test_17_nova_instance_management_net' |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1139 | #image_name = "vsg-1.1" |
| 1140 | image_name = "trusty-server-multi-nic" |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1141 | flavor_id = 'm1.small' |
| 1142 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1143 | assert_equal(result, True) |
| 1144 | neutron_creds = self.get_neutron_credentials() |
| 1145 | neutron = neutronclient.Client(**neutron_creds) |
| 1146 | networks = neutron.list_networks(name=test_net_name) |
| 1147 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1148 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1149 | assert_equal(sub_result[0], True) |
| 1150 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1151 | creds = get_nova_credentials() |
| 1152 | nova = nova_client.Client('2', **creds) |
| 1153 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1154 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1155 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1156 | print new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1157 | address = new_instance_details.addresses |
| 1158 | print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr']) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1159 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1160 | status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr']) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1161 | self.nova_instance_deletion(nova, new_instance_details) |
| 1162 | time.sleep(5) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1163 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1164 | assert_equal(status, True) |
| 1165 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1166 | def test_cordvtn_for_management_network_instance_and_validate_connectivity_to_external_network(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1167 | """ |
| 1168 | Algo: |
| 1169 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1170 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1171 | 3. Do GET Rest API and validate creation of network |
| 1172 | 4. Create new nova instance under management network |
| 1173 | 5. Validate new nova instance is created on nova service |
| 1174 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1175 | """ |
| 1176 | test_net_name = 'vtn_test_18_net_management' |
| 1177 | test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"] |
| 1178 | test_management_type = "management_local" |
| 1179 | instance_vm_name = 'vtn_test_18_nova_instance_management_net' |
| 1180 | image_name = "vsg-1.1" |
| 1181 | flavor_id = 'm1.small' |
| 1182 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1183 | assert_equal(result, True) |
| 1184 | neutron_creds = self.get_neutron_credentials() |
| 1185 | neutron = neutronclient.Client(**neutron_creds) |
| 1186 | networks = neutron.list_networks(name=test_net_name) |
| 1187 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1188 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1189 | assert_equal(sub_result[0], True) |
| 1190 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1191 | creds = get_nova_credentials() |
| 1192 | nova = nova_client.Client('2', **creds) |
| 1193 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1194 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1195 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1196 | print new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1197 | address = new_instance_details.addresses |
| 1198 | print 'Nova instance management ip = %s'%(address[test_net_name][0]['addr']) |
| 1199 | time.sleep(60) |
| 1200 | status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'], check_type = "Ping_to_external") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1201 | self.nova_instance_deletion(nova, new_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1202 | time.sleep(5) |
| 1203 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1204 | assert_equal(status, False) |
| 1205 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1206 | def test_cordvtn_with_management_network_creating_two_instances_and_validate_connectivity_between_two(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1207 | """ |
| 1208 | Algo: |
| 1209 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1210 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1211 | 3. Do GET Rest API and validate creation of network |
| 1212 | 4. Create first nova instance under management network |
| 1213 | 5. Validate first nova instance is created on nova service |
| 1214 | 6. Create second nova instance under management network |
| 1215 | 7. Validate second nova instance is created on nova service |
| 1216 | 8. Now try to ping from one nova instance to other instance, should not success |
| 1217 | """ |
| 1218 | test_net_name = 'vtn_test_19_net_management' |
| 1219 | test_sub_net_cidr = ["management","172.27.0.0/24", "172.27.0.2", "172.27.0.200"] |
| 1220 | test_management_type = "management_local" |
| 1221 | first_instance_vm_name = 'vtn_test_19_nova_1st_instance_management_net' |
| 1222 | second_instance_vm_name = 'vtn_test_19_nova_2nd_instance_management_net' |
| 1223 | image_name = "vsg-1.1" |
| 1224 | flavor_id = 'm1.small' |
| 1225 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1226 | assert_equal(result, True) |
| 1227 | neutron_creds = self.get_neutron_credentials() |
| 1228 | neutron = neutronclient.Client(**neutron_creds) |
| 1229 | networks = neutron.list_networks(name=test_net_name) |
| 1230 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1231 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1232 | assert_equal(sub_result[0], True) |
| 1233 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1234 | creds = get_nova_credentials() |
| 1235 | nova = nova_client.Client('2', **creds) |
| 1236 | first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 1237 | second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1238 | assert_equal(first_instance_details.status, 'ACTIVE') |
| 1239 | assert_equal(second_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1240 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1241 | print 'New nova instance ip addresses are ' |
| 1242 | print first_nova_instance_details.addresses |
| 1243 | print second_nova_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1244 | address_1st_instance = first_nova_instance_details.addresses |
| 1245 | address_2nd_instance = second_nova_instance_details.addresses |
| 1246 | print 'Nova 1st instance management ip = %s'%(address_1st_instance[test_net_name][0]['addr']) |
| 1247 | print 'Nova 2nd instance management ip = %s'%(address_2nd_instance[test_net_name][0]['addr']) |
| 1248 | time.sleep(60) |
| 1249 | status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_net_name][0]['addr'],source_tenants_details =address_2nd_instance[test_net_name][0]['addr'], check_type = "Ping_from_source_tenant") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1250 | self.nova_instance_deletion(nova, first_nova_instance_details) |
| 1251 | self.nova_instance_deletion(nova, second_nova_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1252 | time.sleep(5) |
| 1253 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1254 | assert_equal(status, False) |
| 1255 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1256 | def test_cordvtn_creating_two_management_network_instances_and_validate_connectivity_between_two_networks_via_management_network(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1257 | """ |
| 1258 | Algo: |
| 1259 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1260 | 1. Create subnetwork whose ip is under management network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1261 | 3. Do GET Rest API and validate creation of network |
| 1262 | 4. Create new nova instance under management network |
| 1263 | 5. Validate new nova instance is created on nova service |
| 1264 | """ |
| 1265 | test_netA_name = 'vtn_test_20_netA_management' |
| 1266 | test_sub_netA_cidr = ["management","172.27.0.0/24","172.27.0.2", "172.27.0.200"] |
| 1267 | netA_instance_vm_name = 'vtn_test_20_nova_netA_instance_management_net' |
| 1268 | test_netB_name = 'vtn_test_20_netB_management' |
| 1269 | test_sub_netB_cidr = ["management","172.28.0.0/24","172.28.0.2", "172.28.0.200"] |
| 1270 | netB_instance_vm_name = 'vtn_test_20_nova_netB_instance_management_net' |
| 1271 | test_management_type = "management_local" |
| 1272 | image_name = "vsg-1.1" |
| 1273 | flavor_id = 'm1.small' |
| 1274 | netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id] |
| 1275 | netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id] |
| 1276 | |
| 1277 | 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) |
| 1278 | 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) |
| 1279 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1280 | assert_equal(nova_instance_details_netA.status, 'ACTIVE') |
| 1281 | assert_equal(nova_instance_details_netB.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1282 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1283 | print 'New nova instance ip addresses are ' |
| 1284 | print nova_instance_details_netA.addresses |
| 1285 | print nova_instance_details_netB.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1286 | address_1st_instance = nova_instance_details_netA.addresses |
| 1287 | address_2nd_instance = nova_instance_details_netB.addresses |
| 1288 | print 'Nova 1st instance management ip = %s'%(address_1st_instance[test_netA_name][0]['addr']) |
| 1289 | print 'Nova 2nd instance management ip = %s'%(address_2nd_instance[test_netB_name][0]['addr']) |
| 1290 | time.sleep(60) |
| 1291 | status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_netA_name][0]['addr'],source_tenants_details =address_2nd_instance[test_netB_name][0]['addr'], check_type = "Ping_from_source_tenant") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1292 | self.nova_instance_deletion(nova_netA, nova_instance_details_netA) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1293 | self.nova_instance_deletion(nova_netB, nova_instance_details_netB) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1294 | time.sleep(5) |
| 1295 | self.neutron_network_deletion(test_netA_name) |
| 1296 | self.neutron_network_deletion(test_netB_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1297 | assert_equal(status, False) |
| 1298 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1299 | def test_cordvtn_creating_public_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1300 | """ |
| 1301 | Algo: |
| 1302 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1303 | 1. Create subnetwork whose ip is under public network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1304 | 3. Do GET Rest API and validate creation of network |
| 1305 | 4. Create new nova instance under public network |
| 1306 | 5. Validate new nova instance is created on nova service |
| 1307 | 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4. |
| 1308 | """ |
| 1309 | test_net_name = 'vtn_test_21_net_public' |
| 1310 | test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193'] |
| 1311 | test_management_type = "public" |
| 1312 | instance_vm_name = 'vtn_test_21_nova_instance_pulic_net' |
| 1313 | image_name = "vsg-1.1" |
| 1314 | flavor_id = 'm1.small' |
| 1315 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1316 | assert_equal(result, True) |
| 1317 | neutron_creds = self.get_neutron_credentials() |
| 1318 | neutron = neutronclient.Client(**neutron_creds) |
| 1319 | networks = neutron.list_networks(name=test_net_name) |
| 1320 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1321 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1322 | assert_equal(sub_result[0], True) |
| 1323 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1324 | creds = get_nova_credentials() |
| 1325 | nova = nova_client.Client('2', **creds) |
| 1326 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1327 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1328 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1329 | print new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1330 | address = new_instance_details.addresses |
| 1331 | print 'Nova instance public ip = %s'%(address[test_net_name][0]['addr']) |
| 1332 | time.sleep(60) |
| 1333 | status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr']) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1334 | self.nova_instance_deletion(nova, new_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1335 | time.sleep(5) |
| 1336 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1337 | assert_equal(status, False) |
| 1338 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1339 | def test_cordvtn_creating_public_network_instance_and_validate_connectivity_to_external_network(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1340 | """ |
| 1341 | Algo: |
| 1342 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1343 | 1. Create subnetwork whose ip is under public network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1344 | 3. Do GET Rest API and validate creation of network |
| 1345 | 4. Create new nova instance under public network |
| 1346 | 5. Validate new nova instance is created on nova service |
| 1347 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1348 | """ |
| 1349 | test_net_name = 'vtn_test_22_net_public' |
| 1350 | test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193'] |
| 1351 | test_management_type = "public" |
| 1352 | instance_vm_name = 'vtn_test_22_nova_instance_public_net' |
| 1353 | image_name = "vsg-1.1" |
| 1354 | flavor_id = 'm1.small' |
| 1355 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1356 | assert_equal(result, True) |
| 1357 | neutron_creds = self.get_neutron_credentials() |
| 1358 | neutron = neutronclient.Client(**neutron_creds) |
| 1359 | networks = neutron.list_networks(name=test_net_name) |
| 1360 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1361 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1362 | assert_equal(sub_result[0], True) |
| 1363 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1364 | creds = get_nova_credentials() |
| 1365 | nova = nova_client.Client('2', **creds) |
| 1366 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1367 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1368 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1369 | print new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1370 | address = new_instance_details.addresses |
| 1371 | print 'Nova instance public ip = %s'%(address[test_net_name][0]['addr']) |
| 1372 | time.sleep(60) |
| 1373 | status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'], check_type = "Ping_to_external") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1374 | self.nova_instance_deletion(nova, new_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1375 | time.sleep(5) |
| 1376 | self.neutron_network_deletion(test_net_name) |
| 1377 | assert_equal(status, False) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1378 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1379 | def test_cordvtn_creating_public_network_with_two_instances_and_validate_connectivity_between_two(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1380 | """ |
| 1381 | Algo: |
| 1382 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1383 | 1. Create subnetwork whose ip is under public network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1384 | 3. Do GET Rest API and validate creation of network |
| 1385 | 4. Create first nova instance under public network |
| 1386 | 5. Validate first nova instance is created on nova service |
| 1387 | 6. Create second nova instance under public network |
| 1388 | 7. Validate second nova instance is created on nova service |
| 1389 | 8. Now try to ping from one nova instance to other instance, should not success |
| 1390 | """ |
| 1391 | test_net_name = 'vtn_test_23_net_public' |
| 1392 | test_sub_net_cidr = ["public","10.6.1.192/26",'10.6.1.193'] |
| 1393 | test_management_type = "public" |
| 1394 | first_instance_vm_name = 'vtn_test_23_nova_1st_instance_public_net' |
| 1395 | second_instance_vm_name = 'vtn_test_23_nova_2nd_instance_public_net' |
| 1396 | image_name = "vsg-1.1" |
| 1397 | flavor_id = 'm1.small' |
| 1398 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1399 | assert_equal(result, True) |
| 1400 | neutron_creds = self.get_neutron_credentials() |
| 1401 | neutron = neutronclient.Client(**neutron_creds) |
| 1402 | networks = neutron.list_networks(name=test_net_name) |
| 1403 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1404 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1405 | assert_equal(sub_result[0], True) |
| 1406 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1407 | creds = get_nova_credentials() |
| 1408 | nova = nova_client.Client('2', **creds) |
| 1409 | first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 1410 | second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1411 | assert_equal(first_instance_details.status, 'ACTIVE') |
| 1412 | assert_equal(second_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1413 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1414 | print 'New nova instance ip addresses are ' |
| 1415 | print first_nova_instance_details.addresses |
| 1416 | print second_nova_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1417 | address_1st_instance = first_nova_instance_details.addresses |
| 1418 | address_2nd_instance = second_nova_instance_details.addresses |
| 1419 | print 'Nova 1st instance public ip = %s'%(address_1st_instance[test_net_name][0]['addr']) |
| 1420 | print 'Nova 2nd instance public ip = %s'%(address_2nd_instance[test_net_name][0]['addr']) |
| 1421 | time.sleep(60) |
| 1422 | status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_net_name][0]['addr'],source_tenants_details =address_2nd_instance[test_net_name][0]['addr'], check_type = "Ping_from_source_tenant") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1423 | self.nova_instance_deletion(nova, first_nova_instance_details) |
| 1424 | self.nova_instance_deletion(nova, second_nova_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1425 | time.sleep(5) |
| 1426 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1427 | assert_equal(status, False) |
| 1428 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1429 | def test_cordvtn_creating_two_public_network_instances_and_check_connectvity_between_two_networks_via_public_network(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1430 | """ |
| 1431 | Algo: |
| 1432 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1433 | 1. Create subnetwork whose ip is under public network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1434 | 3. Do GET Rest API and validate creation of network |
| 1435 | 4. Create new nova instance under public network |
| 1436 | 5. Validate new nova instance is created on nova service |
| 1437 | """ |
| 1438 | test_netA_name = 'vtn_test_24_netA_public' |
| 1439 | test_sub_netA_cidr = ["public","10.6.1.192/26",'10.6.1.193'] |
| 1440 | netA_instance_vm_name = 'vtn_test_24_nova_netA_instance_public_net' |
| 1441 | test_netB_name = 'vtn_test_24_netB_public' |
| 1442 | test_sub_netB_cidr = ["public","10.6.2.192/26",'10.6.2.193'] |
| 1443 | netB_instance_vm_name = 'vtn_test_24_nova_netB_instance_public_net' |
| 1444 | test_management_type = "public" |
| 1445 | image_name = "vsg-1.1" |
| 1446 | flavor_id = 'm1.small' |
| 1447 | netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id] |
| 1448 | netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id] |
| 1449 | |
| 1450 | 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) |
| 1451 | 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) |
| 1452 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1453 | assert_equal(nova_instance_details_netA.status, 'ACTIVE') |
| 1454 | assert_equal(nova_instance_details_netB.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1455 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1456 | print 'New nova instance ip addresses are ' |
| 1457 | print nova_instance_details_netA.addresses |
| 1458 | print nova_instance_details_netB.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1459 | address_1st_instance = nova_instance_details_netA.addresses |
| 1460 | address_2nd_instance = nova_instance_details_netB.addresses |
| 1461 | print 'Nova 1st instance public ip = %s'%(address_1st_instance[test_netA_name][0]['addr']) |
| 1462 | print 'Nova 2nd instance public ip = %s'%(address_2nd_instance[test_netB_name][0]['addr']) |
| 1463 | time.sleep(60) |
| 1464 | status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_netA_name][0]['addr'],source_tenants_details =address_2nd_instance[test_netB_name][0]['addr'], check_type = "Ping_from_source_tenant") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1465 | self.nova_instance_deletion(nova_netA, nova_instance_details_netA) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1466 | self.nova_instance_deletion(nova_netB, nova_instance_details_netB) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1467 | time.sleep(5) |
| 1468 | self.neutron_network_deletion(test_netA_name) |
| 1469 | self.neutron_network_deletion(test_netB_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1470 | assert_equal(status, False) |
| 1471 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1472 | def test_cordvtn_creating_private_network_instance_and_validate_connectivity_from_host_machine_or_compute_node(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1473 | """ |
| 1474 | Algo: |
| 1475 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1476 | 1. Create subnetwork whose ip is under private network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1477 | 3. Do GET Rest API and validate creation of network |
| 1478 | 4. Create new nova instance under private network |
| 1479 | 5. Validate new nova instance is created on nova service |
| 1480 | 6. Verify ping is not getting successful from compute node to nova instance which is created in step 4. |
| 1481 | """ |
| 1482 | test_net_name = 'vtn_test_25_net_private' |
| 1483 | test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193'] |
| 1484 | test_management_type = "private" |
| 1485 | instance_vm_name = 'vtn_test_25_nova_instance_private_net' |
| 1486 | image_name = "vsg-1.1" |
| 1487 | flavor_id = 'm1.small' |
| 1488 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1489 | assert_equal(result, True) |
| 1490 | neutron_creds = self.get_neutron_credentials() |
| 1491 | neutron = neutronclient.Client(**neutron_creds) |
| 1492 | networks = neutron.list_networks(name=test_net_name) |
| 1493 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1494 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1495 | assert_equal(sub_result[0], True) |
| 1496 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1497 | creds = get_nova_credentials() |
| 1498 | nova = nova_client.Client('2', **creds) |
| 1499 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1500 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1501 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1502 | print new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1503 | address = new_instance_details.addresses |
| 1504 | print 'Nova instance private ip = %s'%(address[test_net_name][0]['addr']) |
| 1505 | time.sleep(60) |
| 1506 | status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr']) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1507 | self.nova_instance_deletion(nova, new_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1508 | time.sleep(5) |
| 1509 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1510 | assert_equal(status, False) |
| 1511 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1512 | def test_cordvtn_creating_private_network_instance_and_validate_connectivity_to_external_network(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1513 | """ |
| 1514 | Algo: |
| 1515 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1516 | 1. Create subnetwork whose ip is under private network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1517 | 3. Do GET Rest API and validate creation of network |
| 1518 | 4. Create new nova instance under private network |
| 1519 | 5. Validate new nova instance is created on nova service |
| 1520 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1521 | """ |
| 1522 | test_net_name = 'vtn_test_26_net_private' |
| 1523 | test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193'] |
| 1524 | test_management_type = "private" |
| 1525 | instance_vm_name = 'vtn_test_26_nova_instance_private_net' |
| 1526 | image_name = "vsg-1.1" |
| 1527 | flavor_id = 'm1.small' |
| 1528 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1529 | assert_equal(result, True) |
| 1530 | neutron_creds = self.get_neutron_credentials() |
| 1531 | neutron = neutronclient.Client(**neutron_creds) |
| 1532 | networks = neutron.list_networks(name=test_net_name) |
| 1533 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1534 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1535 | assert_equal(sub_result[0], True) |
| 1536 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1537 | creds = get_nova_credentials() |
| 1538 | nova = nova_client.Client('2', **creds) |
| 1539 | new_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1540 | assert_equal(new_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1541 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1542 | print new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1543 | address = new_instance_details.addresses |
| 1544 | print 'Nova instance private ip = %s'%(address[test_net_name][0]['addr']) |
| 1545 | time.sleep(60) |
| 1546 | status, output = self.nova_instance_tenants_access_check(address[test_net_name][0]['addr'], check_type = "Ping_to_external") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1547 | self.nova_instance_deletion(nova, new_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1548 | time.sleep(5) |
| 1549 | self.neutron_network_deletion(test_net_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1550 | assert_equal(status, False) |
| 1551 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1552 | def test_cordvtn_creating_private_network_with_two_instances_and_check_connectvity_between_two_instances(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1553 | """ |
| 1554 | Algo: |
| 1555 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1556 | 1. Create subnetwork whose ip is under private network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1557 | 3. Do GET Rest API and validate creation of network |
| 1558 | 4. Create first nova instance under private network |
| 1559 | 5. Validate first nova instance is created on nova service |
| 1560 | 6. Create second nova instance under public network |
| 1561 | 7. Validate second nova instance is created on nova service |
| 1562 | 8. Now try to ping from one nova instance to other instance, should not success |
| 1563 | """ |
| 1564 | test_net_name = 'vtn_test_27_net_private' |
| 1565 | test_sub_net_cidr = ["private","10.160.160.192/26",'10.160.160.193'] |
| 1566 | test_management_type = "private" |
| 1567 | first_instance_vm_name = 'vtn_test_27_nova_1st_instance_private_net' |
| 1568 | second_instance_vm_name = 'vtn_test_27_nova_2nd_instance_private_net' |
| 1569 | image_name = "vsg-1.1" |
| 1570 | flavor_id = 'm1.small' |
| 1571 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1572 | assert_equal(result, True) |
| 1573 | neutron_creds = self.get_neutron_credentials() |
| 1574 | neutron = neutronclient.Client(**neutron_creds) |
| 1575 | networks = neutron.list_networks(name=test_net_name) |
| 1576 | network_id = self.get_key_value(d=networks, key = 'id') |
| 1577 | sub_result = self.neutron_subnet_creation_and_validation(test_net_name,test_sub_net_cidr) |
| 1578 | assert_equal(sub_result[0], True) |
| 1579 | net_type_post = self.sub_network_type_post_to_onos(test_net_name, test_management_type) |
| 1580 | creds = get_nova_credentials() |
| 1581 | nova = nova_client.Client('2', **creds) |
| 1582 | first_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 1583 | second_nova_instance_details = self.nova_instance_creation_and_validation(test_net_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1584 | assert_equal(first_instance_details.status, 'ACTIVE') |
| 1585 | assert_equal(second_instance_details.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1586 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1587 | print 'New nova instance ip addresses are ' |
| 1588 | print first_nova_instance_details.addresses |
| 1589 | print second_nova_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1590 | address_1st_instance = first_nova_instance_details.addresses |
| 1591 | address_2nd_instance = second_nova_instance_details.addresses |
| 1592 | print 'Nova 1st instance private ip = %s'%(address_1st_instance[test_net_name][0]['addr']) |
| 1593 | print 'Nova 2nd instance private ip = %s'%(address_2nd_instance[test_net_name][0]['addr']) |
| 1594 | time.sleep(60) |
| 1595 | status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_net_name][0]['addr'],source_tenants_details =address_2nd_instance[test_net_name][0]['addr'], check_type = "Ping_from_source_tenant") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1596 | self.nova_instance_deletion(nova, first_nova_instance_details) |
| 1597 | self.nova_instance_deletion(nova, second_nova_instance_details) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1598 | time.sleep(5) |
| 1599 | self.neutron_network_deletion(test_net_name) |
| 1600 | assert_equal(status, False) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1601 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1602 | def test_cordvtn_creating_two_private_network_instances_and_validate_connectivity_between_two_networks_via_private_network(self): |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1603 | """ |
| 1604 | Algo: |
| 1605 | 0. Create Test-Net, |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1606 | 1. Create subnetwork whose ip is under private network |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1607 | 3. Do GET Rest API and validate creation of network |
| 1608 | 4. Create new nova instance under private network |
| 1609 | 5. Validate new nova instance is created on nova service |
| 1610 | """ |
| 1611 | test_netA_name = 'vtn_test_28_netA_private' |
| 1612 | test_sub_netA_cidr = ["private","10.160.160.192/26",'10.160.160.193'] |
| 1613 | netA_instance_vm_name = 'vtn_test_28_nova_netA_instance_private_net' |
| 1614 | test_netB_name = 'vtn_test_28_netB_private' |
| 1615 | test_sub_netB_cidr = ["private","10.160.161.192/26",'10.160.161.193'] |
| 1616 | netB_instance_vm_name = 'vtn_test_28_nova_netB_instance_private_net' |
| 1617 | test_management_type = "private" |
| 1618 | image_name = "vsg-1.1" |
| 1619 | flavor_id = 'm1.small' |
| 1620 | netA_instance_vm_details = [netA_instance_vm_name, image_name, flavor_id] |
| 1621 | netB_instance_vm_details = [netB_instance_vm_name, image_name, flavor_id] |
| 1622 | |
| 1623 | 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) |
| 1624 | 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) |
| 1625 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1626 | assert_equal(nova_instance_details_netA.status, 'ACTIVE') |
| 1627 | assert_equal(nova_instance_details_netB.status, 'ACTIVE') |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1628 | compute_details = self.get_compute_nodes() |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1629 | print 'New nova instance ip addresses are ' |
| 1630 | print nova_instance_details_netA.addresses |
| 1631 | print nova_instance_details_netB.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1632 | address_1st_instance = nova_instance_details_netA.addresses |
| 1633 | address_2nd_instance = nova_instance_details_netB.addresses |
| 1634 | print 'Nova 1st instance private ip = %s'%(address_1st_instance[test_netA_name][0]['addr']) |
| 1635 | print 'Nova 2nd instance private ip = %s'%(address_2nd_instance[test_netB_name][0]['addr']) |
| 1636 | time.sleep(60) |
| 1637 | status, output = self.nova_instance_tenants_access_check(address_1st_instance[test_netA_name][0]['addr'],source_tenants_details =address_2nd_instance[test_netB_name][0]['addr'], check_type = "Ping_from_source_tenant") |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1638 | self.nova_instance_deletion(nova_netA, nova_instance_details_netA) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1639 | self.nova_instance_deletion(nova_netB, nova_instance_details_netB) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1640 | time.sleep(5) |
| 1641 | self.neutron_network_deletion(test_netA_name) |
| 1642 | self.neutron_network_deletion(test_netB_name) |
Thangavelu K S | b8a7b87 | 2017-03-31 18:10:53 +0000 | [diff] [blame] | 1643 | assert_equal(status, False) |
| 1644 | |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1645 | def test_cordvtn_creating_management_and_public_network_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self): |
| 1646 | """ |
| 1647 | Algo: |
| 1648 | 0. Create Test-Net, |
| 1649 | 1. Create subnetwork whose ip is under management network |
| 1650 | 3. Do GET Rest API and validate creation of network |
| 1651 | 4. Create new nova instance under management network |
| 1652 | 5. Validate new nova instance is created on nova service |
| 1653 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1654 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1655 | test_two_networks_name = ['vtn_test_29_net_management','vtn_test_29_net_public'] |
| 1656 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1657 | test_management_type = ["management_local", 'public'] |
| 1658 | instance_vm_name = 'vtn_test_29_nova_instance_management_net' |
| 1659 | # image_name = "vsg-1.1" |
| 1660 | image_name = "trusty-server-multi-nic" |
| 1661 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1662 | for test_net_name in test_two_network_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1663 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1664 | assert_equal(result, True) |
| 1665 | neutron_creds = self.get_neutron_credentials() |
| 1666 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1667 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1668 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1669 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1670 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1671 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1672 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1673 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1674 | creds = get_nova_credentials() |
| 1675 | nova = nova_client.Client('2', **creds) |
| 1676 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1677 | new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1678 | time.sleep(60) |
| 1679 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 1680 | compute_details = self.get_compute_nodes() |
| 1681 | print new_instance_details.addresses |
| 1682 | address = new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1683 | print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr']) |
| 1684 | print address[test_two_networks_name[0]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1685 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1686 | print address[test_two_networks_name[1]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1687 | print nova.security_groups.list() |
| 1688 | secgroup = nova.security_groups.find(name="default") |
| 1689 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 1690 | #from_port="22", |
| 1691 | #to_port="22", |
| 1692 | # cidr="0.0.0.0/0",) |
| 1693 | |
| 1694 | # nova.security_group_rules.create(secgroup.id, |
| 1695 | # ip_protocol="icmp", |
| 1696 | # from_port=-1, |
| 1697 | # cidr="0.0.0.0/0", |
| 1698 | # to_port=-1) |
| 1699 | print nova.security_groups.list() |
| 1700 | |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1701 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1702 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1703 | self.nova_instance_deletion(nova, new_instance_details) |
| 1704 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1705 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1706 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1707 | assert_equal(status_1, True) |
| 1708 | assert_equal(status_2, True) |
| 1709 | |
| 1710 | def test_cordvtn_creating_management_and_public_network_instance_with_and_without_pause_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self): |
| 1711 | """ |
| 1712 | Algo: |
| 1713 | 0. Create Test-Net, |
| 1714 | 1. Create subnetwork whose ip is under management network |
| 1715 | 3. Do GET Rest API and validate creation of network |
| 1716 | 4. Create new nova instance under management network |
| 1717 | 5. Validate new nova instance is created on nova service |
| 1718 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1719 | 7. Now pause the nova instance and check connectivity |
| 1720 | 8. Now unpause the nova instance and check connectivity |
| 1721 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1722 | test_two_networks_name = ['vtn_test_30_net_management','vtn_test_30_net_public'] |
| 1723 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1724 | test_management_type = ["management_local", 'public'] |
| 1725 | instance_vm_name = 'vtn_test_30_nova_instance_management_net' |
| 1726 | # image_name = "vsg-1.1" |
| 1727 | image_name = "trusty-server-multi-nic" |
| 1728 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1729 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1730 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1731 | assert_equal(result, True) |
| 1732 | neutron_creds = self.get_neutron_credentials() |
| 1733 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1734 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1735 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1736 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1737 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1738 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1739 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1740 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1741 | creds = get_nova_credentials() |
| 1742 | nova = nova_client.Client('2', **creds) |
| 1743 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1744 | new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1745 | time.sleep(60) |
| 1746 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 1747 | compute_details = self.get_compute_nodes() |
| 1748 | print new_instance_details.addresses |
| 1749 | address = new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1750 | print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr']) |
| 1751 | print address[test_two_networks_name[0]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1752 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1753 | print address[test_two_networks_name[1]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1754 | print nova.security_groups.list() |
| 1755 | secgroup = nova.security_groups.find(name="default") |
| 1756 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 1757 | #from_port="22", |
| 1758 | #to_port="22", |
| 1759 | # cidr="0.0.0.0/0",) |
| 1760 | |
| 1761 | # nova.security_group_rules.create(secgroup.id, |
| 1762 | # ip_protocol="icmp", |
| 1763 | # from_port=-1, |
| 1764 | # cidr="0.0.0.0/0", |
| 1765 | # to_port=-1) |
| 1766 | print nova.security_groups.list() |
| 1767 | |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1768 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1769 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1770 | if status_1 is False or status_2 is False: |
| 1771 | self.nova_instance_deletion(nova, new_instance_details) |
| 1772 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1773 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1774 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1775 | assert_equal(status_1, True) |
| 1776 | assert_equal(status_2, True) |
| 1777 | new_instance_details.pause() |
| 1778 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1779 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1780 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1781 | if status_1 is True or status_2 is True: |
| 1782 | self.nova_instance_deletion(nova, new_instance_details) |
| 1783 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1784 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1785 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1786 | assert_equal(status_1, False) |
| 1787 | assert_equal(status_2, False) |
| 1788 | new_instance_details.unpause() |
| 1789 | print 'Nova instance is paused and unpasued now checking connectivity' |
| 1790 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1791 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1792 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1793 | self.nova_instance_deletion(nova, new_instance_details) |
| 1794 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1795 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1796 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1797 | assert_equal(status_1, True) |
| 1798 | assert_equal(status_2, True) |
| 1799 | |
| 1800 | def test_cordvtn_creating_management_and_public_network_instance_doing_suspend_and_resume_validating_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self): |
| 1801 | """ |
| 1802 | Algo: |
| 1803 | 0. Create Test-Net, |
| 1804 | 1. Create subnetwork whose ip is under management network |
| 1805 | 3. Do GET Rest API and validate creation of network |
| 1806 | 4. Create new nova instance under management network |
| 1807 | 5. Validate new nova instance is created on nova service |
| 1808 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1809 | 7. Now suspend the nova instance and check connectivity |
| 1810 | 8. Now resume the nova instance and check connectivity |
| 1811 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1812 | test_two_networks_name = ['vtn_test_31_net_management','vtn_test_31_net_public'] |
| 1813 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1814 | test_management_type = ["management_local", 'public'] |
| 1815 | instance_vm_name = 'vtn_test_31_nova_instance_management_net' |
| 1816 | # image_name = "vsg-1.1" |
| 1817 | image_name = "trusty-server-multi-nic" |
| 1818 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1819 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1820 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1821 | assert_equal(result, True) |
| 1822 | neutron_creds = self.get_neutron_credentials() |
| 1823 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1824 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1825 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1826 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1827 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1828 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1829 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1830 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1831 | creds = get_nova_credentials() |
| 1832 | nova = nova_client.Client('2', **creds) |
| 1833 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1834 | new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1835 | time.sleep(60) |
| 1836 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 1837 | compute_details = self.get_compute_nodes() |
| 1838 | print new_instance_details.addresses |
| 1839 | address = new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1840 | print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr']) |
| 1841 | print address[test_two_networks_name[0]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1842 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1843 | print address[test_two_networks_name[1]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1844 | print nova.security_groups.list() |
| 1845 | secgroup = nova.security_groups.find(name="default") |
| 1846 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 1847 | #from_port="22", |
| 1848 | #to_port="22", |
| 1849 | # cidr="0.0.0.0/0",) |
| 1850 | |
| 1851 | # nova.security_group_rules.create(secgroup.id, |
| 1852 | # ip_protocol="icmp", |
| 1853 | # from_port=-1, |
| 1854 | # cidr="0.0.0.0/0", |
| 1855 | # to_port=-1) |
| 1856 | print nova.security_groups.list() |
| 1857 | |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1858 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1859 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1860 | if status_1 is False or status_2 is False: |
| 1861 | self.nova_instance_deletion(nova, new_instance_details) |
| 1862 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1863 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1864 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1865 | assert_equal(status_1, True) |
| 1866 | assert_equal(status_2, True) |
| 1867 | new_instance_details.suspend() |
| 1868 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1869 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1870 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1871 | if status_1 is True or status_2 is True: |
| 1872 | self.nova_instance_deletion(nova, new_instance_details) |
| 1873 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1874 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1875 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1876 | assert_equal(status_1, False) |
| 1877 | assert_equal(status_2, False) |
| 1878 | new_instance_details.resume() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1879 | print 'Nova instance is suspend and resumed now checking connectivity' |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1880 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1881 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1882 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1883 | self.nova_instance_deletion(nova, new_instance_details) |
| 1884 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1885 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1886 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1887 | assert_equal(status_1, True) |
| 1888 | assert_equal(status_2, True) |
| 1889 | |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1890 | def test_cordvtn_creating_mgmt_and_public_network_instance_with_stopping_and_starting_instances_and_checking_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self): |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1891 | """ |
| 1892 | Algo: |
| 1893 | 0. Create Test-Net, |
| 1894 | 1. Create subnetwork whose ip is under management network |
| 1895 | 3. Do GET Rest API and validate creation of network |
| 1896 | 4. Create new nova instance under management network |
| 1897 | 5. Validate new nova instance is created on nova service |
| 1898 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1899 | 7. Now stop the nova instance and check connectivity |
| 1900 | 8. Now start the nova instance and check connectivity |
| 1901 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1902 | test_two_networks_name = ['vtn_test_32_net_management','vtn_test_32_net_public'] |
| 1903 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["public","10.6.1.192/26",'10.6.1.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1904 | test_management_type = ["management_local", 'public'] |
| 1905 | instance_vm_name = 'vtn_test_32_nova_instance_management_net' |
| 1906 | # image_name = "vsg-1.1" |
| 1907 | image_name = "trusty-server-multi-nic" |
| 1908 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1909 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1910 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 1911 | assert_equal(result, True) |
| 1912 | neutron_creds = self.get_neutron_credentials() |
| 1913 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1914 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1915 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1916 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1917 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1918 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1919 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1920 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1921 | creds = get_nova_credentials() |
| 1922 | nova = nova_client.Client('2', **creds) |
| 1923 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1924 | new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1925 | time.sleep(60) |
| 1926 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 1927 | compute_details = self.get_compute_nodes() |
| 1928 | print new_instance_details.addresses |
| 1929 | address = new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1930 | print 'Nova instance management ip = %s and public ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr']) |
| 1931 | print address[test_two_networks_name[0]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1932 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1933 | print address[test_two_networks_name[1]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1934 | print nova.security_groups.list() |
| 1935 | secgroup = nova.security_groups.find(name="default") |
| 1936 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 1937 | #from_port="22", |
| 1938 | #to_port="22", |
| 1939 | # cidr="0.0.0.0/0",) |
| 1940 | |
| 1941 | # nova.security_group_rules.create(secgroup.id, |
| 1942 | # ip_protocol="icmp", |
| 1943 | # from_port=-1, |
| 1944 | # cidr="0.0.0.0/0", |
| 1945 | # to_port=-1) |
| 1946 | print nova.security_groups.list() |
| 1947 | |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1948 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1949 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1950 | if status_1 is False or status_2 is False: |
| 1951 | self.nova_instance_deletion(nova, new_instance_details) |
| 1952 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1953 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1954 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1955 | assert_equal(status_1, True) |
| 1956 | assert_equal(status_2, True) |
| 1957 | new_instance_details.stop() |
| 1958 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1959 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1960 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1961 | if status_1 is True or status_2 is True: |
| 1962 | self.nova_instance_deletion(nova, new_instance_details) |
| 1963 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1964 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1965 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1966 | assert_equal(status_1, False) |
| 1967 | assert_equal(status_2, False) |
| 1968 | new_instance_details.start() |
| 1969 | print 'Nova instance is stopped and started now checking connectivity' |
| 1970 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1971 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 1972 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1973 | self.nova_instance_deletion(nova, new_instance_details) |
| 1974 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1975 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 1976 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1977 | assert_equal(status_1, True) |
| 1978 | assert_equal(status_2, True) |
| 1979 | |
| 1980 | |
| 1981 | def test_cordvtn_creating_mgmt_and_private_network_instance_and_validate_connectivity_from_host_machine_or_compute_node_and_validate_connectivity_to_internet(self): |
| 1982 | """ |
| 1983 | Algo: |
| 1984 | 0. Create Test-Net, |
| 1985 | 1. Create subnetwork whose ip is under management network |
| 1986 | 3. Do GET Rest API and validate creation of network |
| 1987 | 4. Create new nova instance under management network |
| 1988 | 5. Validate new nova instance is created on nova service |
| 1989 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 1990 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1991 | test_two_networks_name = ['vtn_test_33_net_management','vtn_test_33_net_private'] |
| 1992 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1993 | test_management_type = ["management_local", 'private'] |
| 1994 | instance_vm_name = 'vtn_test_33_nova_instance_management_net' |
| 1995 | # image_name = "vsg-1.1" |
| 1996 | image_name = "trusty-server-multi-nic" |
| 1997 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 1998 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 1999 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2000 | assert_equal(result, True) |
| 2001 | neutron_creds = self.get_neutron_credentials() |
| 2002 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2003 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2004 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2005 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2006 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2007 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2008 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2009 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2010 | creds = get_nova_credentials() |
| 2011 | nova = nova_client.Client('2', **creds) |
| 2012 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2013 | new_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2014 | time.sleep(60) |
| 2015 | assert_equal(new_instance_details.status, 'ACTIVE') |
| 2016 | compute_details = self.get_compute_nodes() |
| 2017 | print new_instance_details.addresses |
| 2018 | address = new_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2019 | print 'Nova instance management ip = %s and private ip %s'%(address[test_two_networks_name[0]][0]['addr'],address[test_two_networks_name[1]][0]['addr']) |
| 2020 | print address[test_two_networks_name[0]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2021 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2022 | print address[test_two_networks_name[1]][0]['addr'] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2023 | print nova.security_groups.list() |
| 2024 | secgroup = nova.security_groups.find(name="default") |
| 2025 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 2026 | #from_port="22", |
| 2027 | #to_port="22", |
| 2028 | # cidr="0.0.0.0/0",) |
| 2029 | |
| 2030 | # nova.security_group_rules.create(secgroup.id, |
| 2031 | # ip_protocol="icmp", |
| 2032 | # from_port=-1, |
| 2033 | # cidr="0.0.0.0/0", |
| 2034 | # to_port=-1) |
| 2035 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2036 | status_1, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr']) |
| 2037 | status_2, output = self.nova_instance_tenants_access_check(address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_to_external") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2038 | self.nova_instance_deletion(nova, new_instance_details) |
| 2039 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2040 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2041 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2042 | assert_equal(status_1, True) |
| 2043 | assert_equal(status_2, False) |
| 2044 | |
| 2045 | def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_check_connectivity_to_other_instance(self): |
| 2046 | """ |
| 2047 | Algo: |
| 2048 | 0. Create Test-Net, |
| 2049 | 1. Create subnetwork whose ip is under management network |
| 2050 | 3. Do GET Rest API and validate creation of network |
| 2051 | 4. Create new nova instance under management network |
| 2052 | 5. Validate new nova instance is created on nova service |
| 2053 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 2054 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2055 | test_two_networks_name = ['vtn_test_34_net_management','vtn_test_34_net_private'] |
| 2056 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2057 | test_management_type = ["management_local", 'private'] |
| 2058 | first_instance_vm_name = 'vtn_test_34_nova_first_instance_management_net' |
| 2059 | second_instance_vm_name = 'vtn_test_34_nova_second_instance_management_net' |
| 2060 | # image_name = "vsg-1.1" |
| 2061 | image_name = "trusty-server-multi-nic" |
| 2062 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2063 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2064 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2065 | assert_equal(result, True) |
| 2066 | neutron_creds = self.get_neutron_credentials() |
| 2067 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2068 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2069 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2070 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2071 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2072 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2073 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2074 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2075 | creds = get_nova_credentials() |
| 2076 | nova = nova_client.Client('2', **creds) |
| 2077 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2078 | new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 2079 | new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2080 | time.sleep(60) |
| 2081 | assert_equal(new_first_instance_details.status, 'ACTIVE') |
| 2082 | assert_equal(new_second_instance_details.status, 'ACTIVE') |
| 2083 | compute_details = self.get_compute_nodes() |
| 2084 | first_instance_address = new_first_instance_details.addresses |
| 2085 | second_instance_address = new_second_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2086 | print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2087 | print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr']) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2088 | secgroup = nova.security_groups.find(name="default") |
| 2089 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 2090 | #from_port="22", |
| 2091 | #to_port="22", |
| 2092 | # cidr="0.0.0.0/0",) |
| 2093 | |
| 2094 | # nova.security_group_rules.create(secgroup.id, |
| 2095 | # ip_protocol="icmp", |
| 2096 | # from_port=-1, |
| 2097 | # cidr="0.0.0.0/0", |
| 2098 | # to_port=-1) |
| 2099 | print nova.security_groups.list() |
| 2100 | |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2101 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2102 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
| 2103 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2104 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2105 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2106 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2107 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2108 | assert_equal(status_1, True) |
| 2109 | assert_equal(status_2, True) |
| 2110 | |
| 2111 | def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_with_and_without_pause_validating_connectivity_from_host_machine_or_compute_node_and_validating_connectivity_to_other_instance(self): |
| 2112 | """ |
| 2113 | Algo: |
| 2114 | 0. Create Test-Net, |
| 2115 | 1. Create subnetwork whose ip is under management network |
| 2116 | 3. Do GET Rest API and validate creation of network |
| 2117 | 4. Create new nova instance under management network |
| 2118 | 5. Validate new nova instance is created on nova service |
| 2119 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 2120 | 7. Now pause one of the nova instance and check connectivity |
| 2121 | 8. Now start the same nova instance and check connectivity |
| 2122 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2123 | test_two_networks_name = ['vtn_test_35_net_management','vtn_test_35_net_private'] |
| 2124 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2125 | test_management_type = ["management_local", 'private'] |
| 2126 | first_instance_vm_name = 'vtn_test_35_nova_first_instance_management_net' |
| 2127 | second_instance_vm_name = 'vtn_test_35_nova_second_instance_management_net' |
| 2128 | # image_name = "vsg-1.1" |
| 2129 | image_name = "trusty-server-multi-nic" |
| 2130 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2131 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2132 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2133 | assert_equal(result, True) |
| 2134 | neutron_creds = self.get_neutron_credentials() |
| 2135 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2136 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2137 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2138 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2139 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2140 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2141 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2142 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2143 | creds = get_nova_credentials() |
| 2144 | nova = nova_client.Client('2', **creds) |
| 2145 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2146 | new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 2147 | new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2148 | time.sleep(60) |
| 2149 | assert_equal(new_first_instance_details.status, 'ACTIVE') |
| 2150 | assert_equal(new_second_instance_details.status, 'ACTIVE') |
| 2151 | compute_details = self.get_compute_nodes() |
| 2152 | first_instance_address = new_first_instance_details.addresses |
| 2153 | second_instance_address = new_second_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2154 | print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2155 | print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr']) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2156 | secgroup = nova.security_groups.find(name="default") |
| 2157 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 2158 | #from_port="22", |
| 2159 | #to_port="22", |
| 2160 | # cidr="0.0.0.0/0",) |
| 2161 | |
| 2162 | # nova.security_group_rules.create(secgroup.id, |
| 2163 | # ip_protocol="icmp", |
| 2164 | # from_port=-1, |
| 2165 | # cidr="0.0.0.0/0", |
| 2166 | # to_port=-1) |
| 2167 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2168 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2169 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2170 | if status_1 is False or status_2 is False: |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2171 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2172 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2173 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2174 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2175 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2176 | assert_equal(status_1, True) |
| 2177 | assert_equal(status_2, True) |
| 2178 | new_first_instance_details.pause() |
| 2179 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2180 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2181 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2182 | if status_1 is True or status_2 is True: |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2183 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2184 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2185 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2186 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2187 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2188 | assert_equal(status_1, False) |
| 2189 | assert_equal(status_2, False) |
| 2190 | new_first_instance_details.unpause() |
| 2191 | print 'Nova instance is paused and unpased now checking connectivity' |
| 2192 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2193 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2194 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
| 2195 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2196 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2197 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2198 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2199 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2200 | assert_equal(status_1, True) |
| 2201 | assert_equal(status_2, True) |
| 2202 | |
| 2203 | def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_and_doing_suspend_and_resume_validating_connectivity_from_host_machine_or_compute_node_and_validating_connectivity_to_other_instance(self): |
| 2204 | """ |
| 2205 | Algo: |
| 2206 | 0. Create Test-Net, |
| 2207 | 1. Create subnetwork whose ip is under management network |
| 2208 | 3. Do GET Rest API and validate creation of network |
| 2209 | 4. Create new nova instance under management network |
| 2210 | 5. Validate new nova instance is created on nova service |
| 2211 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 2212 | 7. Now suspend one of the nova instance and check connectivity |
| 2213 | 8. Now resume the same nova instance and check connectivity |
| 2214 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2215 | test_two_networks_name = ['vtn_test_36_net_management','vtn_test_36_net_private'] |
| 2216 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2217 | test_management_type = ["management_local", 'private'] |
| 2218 | first_instance_vm_name = 'vtn_test_36_nova_first_instance_management_net' |
| 2219 | second_instance_vm_name = 'vtn_test_36_nova_second_instance_management_net' |
| 2220 | # image_name = "vsg-1.1" |
| 2221 | image_name = "trusty-server-multi-nic" |
| 2222 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2223 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2224 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2225 | assert_equal(result, True) |
| 2226 | neutron_creds = self.get_neutron_credentials() |
| 2227 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2228 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2229 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2230 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2231 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2232 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2233 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2234 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2235 | creds = get_nova_credentials() |
| 2236 | nova = nova_client.Client('2', **creds) |
| 2237 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2238 | new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 2239 | new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2240 | time.sleep(60) |
| 2241 | assert_equal(new_first_instance_details.status, 'ACTIVE') |
| 2242 | assert_equal(new_second_instance_details.status, 'ACTIVE') |
| 2243 | compute_details = self.get_compute_nodes() |
| 2244 | first_instance_address = new_first_instance_details.addresses |
| 2245 | second_instance_address = new_second_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2246 | print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2247 | print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr']) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2248 | secgroup = nova.security_groups.find(name="default") |
| 2249 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 2250 | #from_port="22", |
| 2251 | #to_port="22", |
| 2252 | # cidr="0.0.0.0/0",) |
| 2253 | |
| 2254 | # nova.security_group_rules.create(secgroup.id, |
| 2255 | # ip_protocol="icmp", |
| 2256 | # from_port=-1, |
| 2257 | # cidr="0.0.0.0/0", |
| 2258 | # to_port=-1) |
| 2259 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2260 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2261 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[1]][0]['addr'],check_type = "Ping_from_source_tenant") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2262 | if status_1 is False or status_2 is False: |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2263 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2264 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2265 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2266 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2267 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2268 | assert_equal(status_1, True) |
| 2269 | assert_equal(status_2, True) |
| 2270 | new_first_instance_details.suspend() |
| 2271 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2272 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2273 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2274 | if status_1 is True or status_2 is True: |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2275 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2276 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2277 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2278 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2279 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2280 | assert_equal(status_1, False) |
| 2281 | assert_equal(status_2, False) |
| 2282 | new_first_instance_details.resume() |
| 2283 | print 'Nova instance is suspend and resume now checking connectivity' |
| 2284 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2285 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2286 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
| 2287 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2288 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2289 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2290 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2291 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2292 | assert_equal(status_1, True) |
| 2293 | assert_equal(status_2, True) |
| 2294 | |
| 2295 | def test_cordvtn_creating_mgmt_and_private_network_with_two_instances_applying_stop_and_start_validating_connectivity_from_host_machine_or_compute_node_and_validating_connectivity_to_other_instance(self): |
| 2296 | """ |
| 2297 | Algo: |
| 2298 | 0. Create Test-Net, |
| 2299 | 1. Create subnetwork whose ip is under management network |
| 2300 | 3. Do GET Rest API and validate creation of network |
| 2301 | 4. Create new nova instance under management network |
| 2302 | 5. Validate new nova instance is created on nova service |
| 2303 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 2304 | 7. Now stop one of the nova instance and check connectivity |
| 2305 | 8. Now start the same nova instance and check connectivity |
| 2306 | """ |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2307 | test_two_networks_name = ['vtn_test_37_net_management','vtn_test_37_net_private'] |
| 2308 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193']] |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2309 | test_management_type = ["management_local", 'private'] |
| 2310 | first_instance_vm_name = 'vtn_test_37_nova_first_instance_management_net' |
| 2311 | second_instance_vm_name = 'vtn_test_37_nova_second_instance_management_net' |
| 2312 | # image_name = "vsg-1.1" |
| 2313 | image_name = "trusty-server-multi-nic" |
| 2314 | flavor_id = 'm1.small' |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2315 | for test_net_name in test_two_networks_name: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2316 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2317 | assert_equal(result, True) |
| 2318 | neutron_creds = self.get_neutron_credentials() |
| 2319 | neutron = neutronclient.Client(**neutron_creds) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2320 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2321 | for i in range(0,2): |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2322 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2323 | network_id = self.get_key_value(d=networks, key = 'id') |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2324 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2325 | assert_equal(sub_result[0], True) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2326 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2327 | creds = get_nova_credentials() |
| 2328 | nova = nova_client.Client('2', **creds) |
| 2329 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2330 | new_first_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,first_instance_vm_name,image_name,flavor_id) |
| 2331 | new_second_instance_details = self.nova_instance_creation_and_validation(test_two_networks_name,nova,second_instance_vm_name,image_name,flavor_id) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2332 | time.sleep(60) |
| 2333 | assert_equal(new_first_instance_details.status, 'ACTIVE') |
| 2334 | assert_equal(new_second_instance_details.status, 'ACTIVE') |
| 2335 | compute_details = self.get_compute_nodes() |
| 2336 | first_instance_address = new_first_instance_details.addresses |
| 2337 | second_instance_address = new_second_instance_details.addresses |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2338 | print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2339 | print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr']) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2340 | secgroup = nova.security_groups.find(name="default") |
| 2341 | print nova.security_groups.list() |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2342 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2343 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2344 | if status_1 is False or status_2 is False: |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2345 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2346 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2347 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2348 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2349 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2350 | assert_equal(status_1, True) |
| 2351 | assert_equal(status_2, True) |
| 2352 | new_first_instance_details.stop() |
| 2353 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2354 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2355 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2356 | if status_1 is True or status_2 is True: |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2357 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2358 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2359 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2360 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2361 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2362 | assert_equal(status_1, False) |
| 2363 | assert_equal(status_2, False) |
| 2364 | new_first_instance_details.start() |
| 2365 | print 'Nova instance is stopped and started now checking connectivity' |
| 2366 | time.sleep(60) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2367 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2368 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
| 2369 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2370 | self.nova_instance_deletion(nova, new_second_instance_details) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2371 | time.sleep(3) |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 2372 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2373 | self.neutron_network_deletion(test_two_networks_name[1]) |
| 2374 | assert_equal(status_1, True) |
| 2375 | assert_equal(status_2, True) |
| 2376 | |
| 2377 | def test_cordvtn_creating_mgmt_and_two_private_network_with_each_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_check_connectivity_to_other_instance(self): |
| 2378 | """ |
| 2379 | Algo: |
| 2380 | 0. Create Test-Net, |
| 2381 | 1. Create subnetwork whose ip is under management network |
| 2382 | 3. Do GET Rest API and validate creation of network |
| 2383 | 4. Create new nova instance under management network |
| 2384 | 5. Validate new nova instance is created on nova service |
| 2385 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 2386 | 7. Verify ping is getting successful after ssh toof one instance to other nova instance which is created in step 4. |
| 2387 | """ |
| 2388 | test_two_networks_name = ['vtn_test_39_net_management','vtn_test_39_netA_private','vtn_test_39_netB_private'] |
| 2389 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193'], ["private","10.160.161.192/26",'10.160.161.193']] |
| 2390 | test_management_type = ["management_local", 'private'] |
| 2391 | first_instance_vm_name = 'vtn_test_39_nova_first_instance_management_netA' |
| 2392 | second_instance_vm_name = 'vtn_test_39_nova_second_instance_management_netB' |
| 2393 | # image_name = "vsg-1.1" |
| 2394 | image_name = "trusty-server-multi-nic" |
| 2395 | flavor_id = 'm1.small' |
| 2396 | for test_net_name in test_two_networks_name: |
| 2397 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2398 | assert_equal(result, True) |
| 2399 | neutron_creds = self.get_neutron_credentials() |
| 2400 | neutron = neutronclient.Client(**neutron_creds) |
| 2401 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
| 2402 | for i in range(0,3): |
| 2403 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
| 2404 | network_id = self.get_key_value(d=networks, key = 'id') |
| 2405 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
| 2406 | assert_equal(sub_result[0], True) |
| 2407 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
| 2408 | creds = get_nova_credentials() |
| 2409 | nova = nova_client.Client('2', **creds) |
| 2410 | print nova.security_groups.list() |
| 2411 | new_first_instance_details = self.nova_instance_creation_and_validation(['vtn_test_39_net_management','vtn_test_39_netA_private'],nova,first_instance_vm_name,image_name,flavor_id) |
| 2412 | new_second_instance_details = self.nova_instance_creation_and_validation(['vtn_test_39_net_management','vtn_test_39_netB_private'],nova,second_instance_vm_name,image_name,flavor_id) |
| 2413 | time.sleep(60) |
| 2414 | assert_equal(new_first_instance_details.status, 'ACTIVE') |
| 2415 | assert_equal(new_second_instance_details.status, 'ACTIVE') |
| 2416 | compute_details = self.get_compute_nodes() |
| 2417 | first_instance_address = new_first_instance_details.addresses |
| 2418 | second_instance_address = new_second_instance_details.addresses |
| 2419 | print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2420 | print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2421 | secgroup = nova.security_groups.find(name="default") |
| 2422 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 2423 | #from_port="22", |
| 2424 | #to_port="22", |
| 2425 | # cidr="0.0.0.0/0",) |
| 2426 | |
| 2427 | # nova.security_group_rules.create(secgroup.id, |
| 2428 | # ip_protocol="icmp", |
| 2429 | # from_port=-1, |
| 2430 | # cidr="0.0.0.0/0", |
| 2431 | # to_port=-1) |
| 2432 | print nova.security_groups.list() |
| 2433 | |
| 2434 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2435 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
| 2436 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2437 | self.nova_instance_deletion(nova, new_second_instance_details) |
| 2438 | time.sleep(3) |
| 2439 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2440 | self.neutron_network_deletion(test_two_networks_name[1]) |
| 2441 | assert_equal(status_1, True) |
| 2442 | assert_equal(status_2, False) |
| 2443 | |
| 2444 | def test_cordvtn_service_dependecy_without_xos_creating_mgmt_and_two_private_network_with_each_instances_and_validate_connectivity_from_host_machine_or_compute_node_and_check_connectivity_to_other_instance(self): |
| 2445 | """ |
| 2446 | Algo: |
| 2447 | 0. Create Test-Net, |
| 2448 | 1. Create subnetwork whose ip is under management network |
| 2449 | 3. Do GET Rest API and validate creation of network |
| 2450 | 4. Create new nova instance under management network |
| 2451 | 5. Validate new nova instance is created on nova service |
| 2452 | 6. Verify ping is getting successful from compute node to nova instance which is created in step 4. |
| 2453 | 7. Verify ping is getting successful after ssh toof one instance to other nova instance which is created in step 4. |
| 2454 | """ |
| 2455 | test_two_networks_name = ['vtn_test_40_net_management','vtn_test_40_netA_private','vtn_test_40_netB_private'] |
| 2456 | test_two_sub_networks_cidr = [["management","172.27.0.0/24", "172.27.0.20", "172.27.0.21"], ["private","10.160.160.192/26",'10.160.160.193'], ["private","10.160.161.192/26",'10.160.161.193']] |
| 2457 | test_management_type = ["management_local", 'private'] |
| 2458 | first_instance_vm_name = 'vtn_test_40_nova_first_instance_management_netA' |
| 2459 | second_instance_vm_name = 'vtn_test_40_nova_second_instance_management_netB' |
| 2460 | # image_name = "vsg-1.1" |
| 2461 | image_name = "trusty-server-multi-nic" |
| 2462 | flavor_id = 'm1.small' |
| 2463 | for test_net_name in test_two_networks_name: |
| 2464 | result = self.neutron_network_creation_and_validation(test_net_name) |
| 2465 | assert_equal(result, True) |
| 2466 | neutron_creds = self.get_neutron_credentials() |
| 2467 | neutron = neutronclient.Client(**neutron_creds) |
| 2468 | #for test_net_name,test_sub_net_cidr in test_two_networks_name test_two_sub_networks_cidr: |
| 2469 | for i in range(0,3): |
| 2470 | networks = neutron.list_networks(name=test_two_networks_name[i]) |
| 2471 | network_id = self.get_key_value(d=networks, key = 'id') |
| 2472 | sub_result = self.neutron_subnet_creation_and_validation(test_two_networks_name[i],test_two_sub_networks_cidr[i]) |
| 2473 | assert_equal(sub_result[0], True) |
| 2474 | net_type_post = self.sub_network_type_post_to_onos(test_two_networks_name[i], test_management_type[i]) |
| 2475 | creds = get_nova_credentials() |
| 2476 | nova = nova_client.Client('2', **creds) |
| 2477 | print nova.security_groups.list() |
| 2478 | new_first_instance_details = self.nova_instance_creation_and_validation(['vtn_test_39_net_management','vtn_test_39_netA_private'],nova,first_instance_vm_name,image_name,flavor_id) |
| 2479 | new_second_instance_details = self.nova_instance_creation_and_validation(['vtn_test_39_net_management','vtn_test_39_netB_private'],nova,second_instance_vm_name,image_name,flavor_id) |
| 2480 | time.sleep(60) |
| 2481 | assert_equal(new_first_instance_details.status, 'ACTIVE') |
| 2482 | assert_equal(new_second_instance_details.status, 'ACTIVE') |
| 2483 | |
| 2484 | ### TO-DO Service dependency to be informed to ONOS through Json |
| 2485 | compute_details = self.get_compute_nodes() |
| 2486 | first_instance_address = new_first_instance_details.addresses |
| 2487 | second_instance_address = new_second_instance_details.addresses |
| 2488 | print 'Nova first instance management ip = %s and private ip %s'%(first_instance_address[test_two_networks_name[0]][0]['addr'],first_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2489 | print 'Nova second instance management ip = %s and private ip %s'%(second_instance_address[test_two_networks_name[0]][0]['addr'],second_instance_address[test_two_networks_name[1]][0]['addr']) |
| 2490 | secgroup = nova.security_groups.find(name="default") |
| 2491 | # nova.security_group_rules.create(secgroup.id,ip_protocol="tcp", |
| 2492 | #from_port="22", |
| 2493 | #to_port="22", |
| 2494 | # cidr="0.0.0.0/0",) |
| 2495 | |
| 2496 | # nova.security_group_rules.create(secgroup.id, |
| 2497 | # ip_protocol="icmp", |
| 2498 | # from_port=-1, |
| 2499 | # cidr="0.0.0.0/0", |
| 2500 | # to_port=-1) |
| 2501 | print nova.security_groups.list() |
| 2502 | |
| 2503 | status_1, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[0]][0]['addr']) |
| 2504 | status_2, output = self.nova_instance_tenants_access_check(first_instance_address[test_two_networks_name[1]][0]['addr'],source_tenants_details = second_instance_address[test_two_networks_name[0]][0]['addr'],check_type = "Ping_from_source_tenant") |
| 2505 | self.nova_instance_deletion(nova, new_first_instance_details) |
| 2506 | self.nova_instance_deletion(nova, new_second_instance_details) |
| 2507 | time.sleep(3) |
| 2508 | self.neutron_network_deletion(test_two_networks_name[0]) |
| 2509 | self.neutron_network_deletion(test_two_networks_name[1]) |
Thangavelu K S | 40d2211 | 2017-04-14 00:32:10 +0000 | [diff] [blame] | 2510 | assert_equal(status_1, True) |
| 2511 | assert_equal(status_2, True) |
| 2512 | |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 2513 | def test_cordvtn_with_neutron_network_creation_and_validation_on_head_node_with_neutron_service(self): |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 2514 | """ |
| 2515 | Algo: |
| 2516 | 0. Create Test-Net, |
| 2517 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 2518 | 2. Run sync command for cordvtn |
| 2519 | 3. Do GET Rest API and validate creation of network |
| 2520 | 4. Validate network synch with created network in cord-onos |
| 2521 | """ |
| 2522 | creds = self.get_neutron_credentials() |
| 2523 | neutron = neutronclient.Client(**creds) |
| 2524 | body_example = {"network":{"name": "Net-1","admin_state_up":True}} |
| 2525 | net = neutron.create_network(body=body_example) |
| 2526 | networks = neutron.list_networks(name='Net-1') |
| 2527 | vtn_util = vtn_validation_utils('') |
| 2528 | data = networks |
| 2529 | result = self.search_value(data, "Net-1") |
| 2530 | assert_equal(result, True) |
| 2531 | |
| 2532 | def test_cordvtn_neutron_network_creation_and_validation_on_onos(self): |
| 2533 | """ |
| 2534 | Algo: |
| 2535 | 0. Create Test-Net, |
| 2536 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 2537 | 2. Run sync command for cordvtn |
| 2538 | 3. Do GET Rest API and validate creation of network |
| 2539 | 4. Validate network synch with created network in cord-onos |
| 2540 | """ |
| 2541 | creds = self.get_neutron_credentials() |
| 2542 | neutron = neutronclient.Client(**creds) |
| 2543 | body_example = {"network":{"name": "Net-1","admin_state_up":True}} |
| 2544 | net = neutron.create_network(body=body_example) |
| 2545 | networks = neutron.list_networks(name='Net-1') |
| 2546 | vtn_util = vtn_validation_utils('') |
| 2547 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 2548 | auth = ('karaf','karaf') |
| 2549 | |
| 2550 | resp = requests.get(url=url, auth=auth) |
| 2551 | data = json.loads(resp.text) |
| 2552 | result = self.search_value(data, "Net-1") |
| 2553 | assert_equal(result, True) |
| 2554 | |
Thangavelu K S | 3698fad | 2017-03-24 17:50:14 +0000 | [diff] [blame] | 2555 | def test_cordvtn_neutron_network_deletion_and_validation_on_neutron_openstack(self): |
Thangavelu K S | a2f5ac0 | 2017-03-13 18:29:00 +0000 | [diff] [blame] | 2556 | """ |
| 2557 | Algo: |
| 2558 | 0. Create Test-Net, |
| 2559 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 2560 | 2. Run sync command for cordvtn |
| 2561 | 3. Do GET Rest API and validate creation of network |
| 2562 | 4. Validate network synch with created network in cord-onos |
| 2563 | """ |
| 2564 | creds = self.get_neutron_credentials() |
| 2565 | neutron = neutronclient.Client(**creds) |
| 2566 | body_example = {"network":{"name": "Net-1","admin_state_up":False}} |
| 2567 | net = neutron.delete_network("Net-1") |
| 2568 | networks = neutron.list_networks(name='Net-1') |
| 2569 | vtn_util = vtn_validation_utils('') |
| 2570 | data = networks |
| 2571 | result = self.search_value(data, "Net-1") |
| 2572 | assert_equal(result, True) |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 2573 | |
| 2574 | def test_cordvtn_neutron_network_sync(self): |
| 2575 | """ |
| 2576 | Algo: |
| 2577 | 0. Create Test-Net, |
| 2578 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 2579 | 2. Run sync command for cordvtn |
| 2580 | 3. Do GET Rest API and validate creation of network |
| 2581 | 4. Validate network synch with created network in cord-onos |
| 2582 | """ |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 2583 | creds = self.get_neutron_credentials() |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 2584 | neutron = neutronclient.Client(**creds) |
Chetan Gaonker | 09b77ae | 2017-03-08 01:44:25 +0000 | [diff] [blame] | 2585 | body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}} |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 2586 | net = neutron.create_network(body=body_example) |
Chetan Gaonker | a6e23a7 | 2017-03-14 01:27:49 +0000 | [diff] [blame] | 2587 | url = "http://{0}:8181/onos/cordvtn/serviceNetworks".format(vtn_util.endpoint) |
| 2588 | auth = ('karaf','karaf') |
| 2589 | body_create_subnet = {'subnets': [{'cidr': '192.168.199.0/24', |
| 2590 | 'ip_version': 4, 'network_id': network_id}]} |
| 2591 | |
| 2592 | subnet = neutron.create_subnet(body=body_create_subnet) |
| 2593 | |
| 2594 | resp = requests.get(url=url, auth=auth) |
| 2595 | data = json.loads(resp.text) |
| 2596 | result = self.search_value(data, "Test-Net-1") |
| 2597 | assert_equal(result, True) |
| 2598 | |
| 2599 | def test_cordvtn_neutron_port_sync(self): |
| 2600 | """ |
| 2601 | Algo: |
| 2602 | 0. Create Test-Net, |
| 2603 | 1. Load cordvtn config, vtn-cfg-1.json to cord-onos |
| 2604 | 2. Run sync command for cordvtn |
| 2605 | 3. Do GET Rest API and validate creation of network |
Thangavelu K S | aea3c67 | 2017-03-15 18:57:05 +0000 | [diff] [blame] | 2606 | 4. Validate network synch with created port in cord-onos |
Chetan Gaonker | a6e23a7 | 2017-03-14 01:27:49 +0000 | [diff] [blame] | 2607 | """ |
| 2608 | creds = self.get_neutron_credentials() |
| 2609 | neutron = neutronclient.Client(**creds) |
| 2610 | body_example = {"network":{"name": "Test-Net-1","admin_state_up":True}} |
| 2611 | net = neutron.create_network(body=body_example) |
| 2612 | network_id = net['network']['id'] |
| 2613 | device_id = 'of:{}'.format(get_mac(self.switch)) |
| 2614 | body_example = {'port': {'admin_state_up': True,'device_id':device_id, 'network_id':network_id}} |
| 2615 | response = neutron.create_port(body=body_example) |
| 2616 | url = "http://{0}:8181/onos/cordvtn/servicePorts".format(vtn_util.endpoint) |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 2617 | auth = ('karaf','karaf') |
| 2618 | |
| 2619 | resp = requests.get(url=url, auth=auth) |
| 2620 | data = json.loads(resp.text) |
Chetan Gaonker | a6e23a7 | 2017-03-14 01:27:49 +0000 | [diff] [blame] | 2621 | result = self.search_value(data, device_id) |
Chetan Gaonker | 3c8ae68 | 2017-02-18 00:50:45 +0000 | [diff] [blame] | 2622 | assert_equal(result, True) |
| 2623 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2624 | def test_cordvtn_creating_virtual_private_network(self): |
| 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 an IP as private network. |
| 2630 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 2631 | 4) Verify that NetA is being created and validate IP in nova list command. |
| 2632 | 5) Verify that flow is being added in ovs-switch in compute-node. |
| 2633 | 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2634 | """ |
| 2635 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2636 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2637 | def test_cordvtn_creating_virtual_local_management_network(self): |
| 2638 | """ |
| 2639 | Algo: |
| 2640 | 1) Validate that required openstack service is up and running. |
| 2641 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2642 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 2643 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 2644 | 4) Verify that NetA is being created and validate IP in nova list command. |
| 2645 | 5) Verify that flow is being added in ovs-switch in compute-node. |
| 2646 | 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2647 | """ |
| 2648 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2649 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2650 | def test_cordvtn_creating_virtual_vlan_connectivity_network(self): |
| 2651 | """ |
| 2652 | Algo: |
| 2653 | 1) Validate that required openstack service is up and running. |
| 2654 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2655 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 2656 | (neutron port-create net-A-private --name stag-100). |
| 2657 | 4) Verify that NetA is being created and validate IP in nova list command. |
| 2658 | 5) Verify that flow is being added in ovs-switch in compute-node. |
| 2659 | 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2660 | """ |
| 2661 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2662 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2663 | def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network(self): |
| 2664 | """ |
| 2665 | Algo: |
| 2666 | 1) Validate that required openstack service is up and running. |
| 2667 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2668 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 2669 | (neutron port-create net-A-private --name stag-500). |
| 2670 | 4) Verify that NetA is being created and validate IP in nova list command. |
| 2671 | 5) Verify that flow is being added in ovs-switch in compute-node. |
| 2672 | 6) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2673 | """ |
| 2674 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2675 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2676 | def test_cordvtn_creating_virtual_private_network_and_boot_image(self): |
| 2677 | """ |
| 2678 | Algo: |
| 2679 | 1) Validate that required openstack service is up and running. |
| 2680 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2681 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 2682 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 2683 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2684 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2685 | 5) Wait till VM boots up and starts running. |
| 2686 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2687 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2688 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2689 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2690 | """ |
| 2691 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2692 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2693 | def test_cordvtn_creating_virtual_public_network_and_boot_image(self): |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2694 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2695 | """ |
| 2696 | Algo: |
| 2697 | 1) Validate that required openstack service is up and running. |
| 2698 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2699 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 2700 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 2701 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2702 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2703 | 5) Wait till VM boots up and starts running. |
| 2704 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2705 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2706 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2707 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2708 | """ |
| 2709 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2710 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2711 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image(self): |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2712 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2713 | """ |
| 2714 | Algo: |
| 2715 | 1) Validate that required openstack service is up and running. |
| 2716 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2717 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 2718 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 2719 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2720 | 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 |
| 2721 | 5) Wait till VM boots up and starts running. |
| 2722 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2723 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2724 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2725 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2726 | """ |
| 2727 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2728 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2729 | def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image(self): |
| 2730 | """ |
| 2731 | Algo: |
| 2732 | 1) Validate that required openstack service is up and running. |
| 2733 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2734 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 2735 | (neutron port-create net-A-private --name stag-100). |
| 2736 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2737 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2738 | 5) Wait till VM boots up and starts running. |
| 2739 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2740 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2741 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2742 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2743 | """ |
| 2744 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2745 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2746 | def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image(self): |
| 2747 | """ |
| 2748 | Algo: |
| 2749 | 1) Validate that required openstack service is up and running. |
| 2750 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2751 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 2752 | (neutron port-create net-A-private --name stag-500). |
| 2753 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2754 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2755 | 5) Wait till VM boots up and starts running. |
| 2756 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2757 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2758 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2759 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2760 | """ |
| 2761 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2762 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2763 | def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service(self): |
| 2764 | """ |
| 2765 | Algo: |
| 2766 | 1) Validate that required openstack service is up and running. |
| 2767 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2768 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 2769 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 2770 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 2771 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2772 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 2773 | 5) Wait till VMs boot up and running. |
| 2774 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2775 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2776 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2777 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2778 | """ |
| 2779 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2780 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2781 | def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service(self): |
| 2782 | """ |
| 2783 | Algo: |
| 2784 | 1) Validate that required openstack service is up and running. |
| 2785 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2786 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 2787 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 2788 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 2789 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2790 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 2791 | 5) Wait till VMs boot up and running. |
| 2792 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2793 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2794 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2795 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2796 | """ |
| 2797 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2798 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2799 | def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service(self): |
| 2800 | """ |
| 2801 | Algo: |
| 2802 | 1) Validate that required openstack service is up and running. |
| 2803 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2804 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 2805 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 2806 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 2807 | 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 |
| 2808 | 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 |
| 2809 | 5) Wait till VMs boot up and running. |
| 2810 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2811 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2812 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2813 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2814 | """ |
| 2815 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2816 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2817 | def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service(self): |
| 2818 | """ |
| 2819 | Algo: |
| 2820 | 1) Validate that required openstack service is up and running. |
| 2821 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2822 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 2823 | (neutron port-create net-A-private --name stag-100). |
| 2824 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 2825 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2826 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2827 | 5) Wait till VMs boot up and running. |
| 2828 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2829 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2830 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2831 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2832 | """ |
| 2833 | pass |
Chetan Gaonker | 0fb91c9 | 2017-02-07 01:52:18 +0000 | [diff] [blame] | 2834 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2835 | def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service(self): |
| 2836 | """ |
| 2837 | Algo: |
| 2838 | 1) Validate that required openstack service is up and running. |
| 2839 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2840 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 2841 | (neutron port-create net-A-private --name stag-500). |
| 2842 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 2843 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2844 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 2845 | 5) Wait till VMs boot up and running. |
| 2846 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2847 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 2848 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2849 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 2850 | """ |
| 2851 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2852 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2853 | def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity(self): |
| 2854 | """ |
| 2855 | Algo: |
| 2856 | 1) Validate that required openstack service is up and running. |
| 2857 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2858 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 2859 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 2860 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 2861 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2862 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 2863 | 5) Wait till VMs boot up and running. |
| 2864 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2865 | 7) Now ping to the VM from other VM which are launched in same network |
| 2866 | 8) verify that ping is successful |
| 2867 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2868 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2869 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2870 | """ |
| 2871 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2872 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2873 | def test_cordvtn_creating_virtual_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
| 2874 | """ |
| 2875 | Algo: |
| 2876 | 1) Validate that required openstack service is up and running. |
| 2877 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2878 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 2879 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 2880 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 2881 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2882 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 2883 | 5) Wait till VMs boot up and running. |
| 2884 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2885 | 7) Now ping to the VM from other VM which are launched in same network |
| 2886 | 8) verify that ping is not successful |
| 2887 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2888 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2889 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2890 | """ |
| 2891 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2892 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2893 | def test_cordvtn_creating_virtual_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2894 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2895 | """ |
| 2896 | Algo: |
| 2897 | 1) Validate that required openstack service is up and running. |
| 2898 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2899 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 2900 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 2901 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 2902 | 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 |
| 2903 | 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 |
| 2904 | 5) Wait till VMs boot up and running. |
| 2905 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2906 | 7) Now ping to the VM from other VM which are launched in same network |
| 2907 | 8) verify that ping is not successful |
| 2908 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2909 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2910 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2911 | """ |
| 2912 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2913 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2914 | def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2915 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2916 | """ |
| 2917 | Algo: |
| 2918 | 1) Validate that required openstack service is up and running. |
| 2919 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2920 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 2921 | (neutron port-create net-A-private --name stag-100). |
| 2922 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 2923 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2924 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2925 | 5) Wait till VMs boot up and running. |
| 2926 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2927 | 7) Now ping to the VM from other VM which are launched in same network |
| 2928 | 8) verify that ping is not successful |
| 2929 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2930 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2931 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2932 | """ |
| 2933 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2934 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2935 | def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
| 2936 | """ |
| 2937 | Algo: |
| 2938 | 1) Validate that required openstack service is up and running. |
| 2939 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2940 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 2941 | (neutron port-create net-A-private --name stag-500). |
| 2942 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 2943 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 2944 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 2945 | 5) Wait till VMs boot up and running. |
| 2946 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 2947 | 7) Now ping to the VM from other VM which are launched in same network |
| 2948 | 8) verify that ping is not successful |
| 2949 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2950 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2951 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2952 | """ |
| 2953 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2954 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2955 | def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(self): |
| 2956 | """ |
| 2957 | Algo: |
| 2958 | 1) Validate that required openstack service is up and running. |
| 2959 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2960 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 2961 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 2962 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2963 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2964 | 5) Wait till VM boots up and starts running. |
| 2965 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2966 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 2967 | 8) verify that ping is not successful |
| 2968 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2969 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2970 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2971 | """ |
| 2972 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2973 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2974 | def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity(self): |
| 2975 | """ |
| 2976 | Algo: |
| 2977 | 1) Validate that required openstack service is up and running. |
| 2978 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2979 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 2980 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 2981 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 2982 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 2983 | 5) Wait till VM boots up and starts running. |
| 2984 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 2985 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 2986 | 8) verify that ping is successful |
| 2987 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 2988 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 2989 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 2990 | """ |
| 2991 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 2992 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 2993 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_negative_scenario(self): |
| 2994 | """ |
| 2995 | Algo: |
| 2996 | 1) Validate that required openstack service is up and running. |
| 2997 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 2998 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 2999 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3000 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3001 | 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 |
| 3002 | 5) Wait till VM boots up and starts running. |
| 3003 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3004 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 3005 | 8) verify that ping is not successful |
| 3006 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3007 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3008 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3009 | """ |
| 3010 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3011 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3012 | def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self): |
| 3013 | """ |
| 3014 | Algo: |
| 3015 | 1) Validate that required openstack service is up and running. |
| 3016 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3017 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 3018 | (neutron port-create net-A-private --name stag-100). |
| 3019 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3020 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3021 | 5) Wait till VM boots up and starts running. |
| 3022 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3023 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 3024 | 8) verify that ping is not successful |
| 3025 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3026 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3027 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3028 | """ |
| 3029 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3030 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3031 | def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self): |
| 3032 | """ |
| 3033 | Algo: |
| 3034 | 1) Validate that required openstack service is up and running. |
| 3035 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3036 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 3037 | (neutron port-create net-A-private --name stag-500). |
| 3038 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3039 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3040 | 5) Wait till VM boots up and starts running. |
| 3041 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3042 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 3043 | 8) verify that ping is not successful |
| 3044 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3045 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3046 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3047 | """ |
| 3048 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3049 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3050 | def test_cordvtn_creating_virtual_private_network_and_boot_image_connectivity_negative_scenario(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) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3056 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3057 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3058 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3059 | 5) Wait till VM boots up and starts running. |
| 3060 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3061 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 3062 | 8) verify that ping is not successful |
| 3063 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3064 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3065 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3066 | """ |
| 3067 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3068 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3069 | def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_negative_scenario(self): |
| 3070 | """ |
| 3071 | Algo: |
| 3072 | 1) Validate that required openstack service is up and running. |
| 3073 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3074 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 3075 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 3076 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3077 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3078 | 5) Wait till VM boots up and starts running. |
| 3079 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3080 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 3081 | 8) verify that ping is not successful |
| 3082 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3083 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3084 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3085 | """ |
| 3086 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3087 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3088 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity(self): |
| 3089 | """ |
| 3090 | Algo: |
| 3091 | 1) Validate that required openstack service is up and running. |
| 3092 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3093 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 3094 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3095 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3096 | 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 |
| 3097 | 5) Wait till VM boots up and starts running. |
| 3098 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3099 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 3100 | 8) verify that ping is successful |
| 3101 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3102 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3103 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3104 | """ |
| 3105 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3106 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3107 | def test_cordvtn_creating_virtual_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self): |
| 3108 | """ |
| 3109 | Algo: |
| 3110 | 1) Validate that required openstack service is up and running. |
| 3111 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3112 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 3113 | (neutron port-create net-A-private --name stag-100). |
| 3114 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3115 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3116 | 5) Wait till VM boots up and starts running. |
| 3117 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3118 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 3119 | 8) verify that ping is not successful |
| 3120 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3121 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3122 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3123 | """ |
| 3124 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3125 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3126 | def test_cordvtn_creating_virtual_floating_IP_with_vlan_connectivity_network_and_boot_image_connectivity_negative_scenario(self): |
| 3127 | """ |
| 3128 | Algo: |
| 3129 | 1) Validate that required openstack service is up and running. |
| 3130 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3131 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 3132 | (neutron port-create net-A-private --name stag-500). |
| 3133 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3134 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3135 | 5) Wait till VM boots up and starts running. |
| 3136 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3137 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 3138 | 8) verify that ping is not successful |
| 3139 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3140 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3141 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3142 | """ |
| 3143 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3144 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3145 | def test_cordvtn_creating_virtual_vlan_interface_private_network_and_boot_image_connectivity_negative_scenario(self): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3146 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3147 | """ |
| 3148 | Algo: |
| 3149 | 1) Validate that required openstack service is up and running. |
| 3150 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3151 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3152 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3153 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3154 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3155 | 5) Wait till VM boots up and starts running. |
| 3156 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3157 | 7) Create a virtual interface with vlan tag and private ip on VM. |
| 3158 | 8) Create a same virtual interface with valn tag and private ip on head node. |
| 3159 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 3160 | 10) verify that ping is successful |
| 3161 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 3162 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3163 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 3164 | """ |
| 3165 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3166 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3167 | def test_cordvtn_creating_virtual_vlan_interface_public_network_and_boot_image_connectivity_negative_scenario(self): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3168 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3169 | """ |
| 3170 | Algo: |
| 3171 | 1) Validate that required openstack service is up and running. |
| 3172 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3173 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 3174 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 3175 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3176 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3177 | 5) Wait till VM boots up and starts running. |
| 3178 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3179 | 7) Create a virtual interface with vlan tag and public ip on VM. |
| 3180 | 8) Create a same virtual interface with valn tag and any pulic ip on head node. |
| 3181 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 3182 | 10) verify that ping is successful |
| 3183 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 3184 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3185 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 3186 | """ |
| 3187 | pass |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3188 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3189 | def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity(self): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3190 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 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 local management network. |
| 3196 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3197 | 4) Now boot image 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 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3199 | 5) Wait till VM boots up and starts running. |
| 3200 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3201 | 7) Create a virtual interface with vlan tag and local management ip on VM. |
| 3202 | 8) Create a same virtual interface with valn tag and any local management ip on head node. |
| 3203 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 3204 | 10) verify that ping is successful |
| 3205 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 3206 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3207 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 3208 | """ |
| 3209 | pass |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3210 | |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3211 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3212 | def test_cordvtn_creating_virtual_vlan_interface_floating_private_network_and_boot_image_connectivity_negative_scenario(self): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3213 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3214 | """ |
| 3215 | Algo: |
| 3216 | 1) Validate that required openstack service is up and running. |
| 3217 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3218 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3219 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3220 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3221 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3222 | 5) Wait till VM boots up and starts running. |
| 3223 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3224 | 7) Create a virtual interface with vlan tag and private floating ip on VM. |
| 3225 | 8) Create a same virtual interface with valn tag and private floating ip on head node. |
| 3226 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 3227 | 10) verify that ping is successful |
| 3228 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 3229 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3230 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 3231 | """ |
| 3232 | pass |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3233 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3234 | def test_cordvtn_creating_virtual_vlan_interface_floating_public_network_and_boot_image_connectivity_negative_scenario(self): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3235 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3236 | """ |
| 3237 | Algo: |
| 3238 | 1) Validate that required openstack service is up and running. |
| 3239 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3240 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 3241 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 3242 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3243 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3244 | 5) Wait till VM boots up and starts running. |
| 3245 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3246 | 7) Create a virtual interface with vlan tag and public floating ip on VM. |
| 3247 | 8) Create a same virtual interface with valn tag and any pulic floating ip on head node. |
| 3248 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 3249 | 10) verify that ping is successful |
| 3250 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 3251 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3252 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 3253 | """ |
| 3254 | pass |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3255 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3256 | def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity(self): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3257 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3258 | """ |
| 3259 | Algo: |
| 3260 | 1) Validate that required openstack service is up and running. |
| 3261 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3262 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 3263 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3264 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3265 | 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 |
| 3266 | 5) Wait till VM boots up and starts running. |
| 3267 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3268 | 7) Create a virtual interface with vlan tag and local management floating ip on VM. |
| 3269 | 8) Create a same virtual interface with valn tag and any local management floating ip on head node. |
| 3270 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 3271 | 10) verify that ping is successful |
| 3272 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 3273 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3274 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 3275 | """ |
| 3276 | pass |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3277 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3278 | def test_cordvtn_creating_one_virtual_public_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3279 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3280 | """ |
| 3281 | Algo: |
| 3282 | 1) Validate that required openstack service is up and running. |
| 3283 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3284 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 3285 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 3286 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3287 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3288 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 3289 | 5) Wait till VMs boot up and running. |
| 3290 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3291 | 7) Now ping to the VM from other VM which are launched in the private network |
| 3292 | 8) verify that ping is not successful |
| 3293 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3294 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3295 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3296 | """ |
| 3297 | pass |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3298 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3299 | def test_cordvtn_creating_one_virtual_local_management_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
ChetanGaonker | 901727c | 2016-11-29 14:05:03 -0800 | [diff] [blame] | 3300 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 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 local management network. |
| 3306 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3307 | 4) Now boot two images 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 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3309 | 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 |
| 3310 | 5) Wait till VMs boot up and running. |
| 3311 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3312 | 7) Now ping to the VM from other VM which are launched in the private network |
| 3313 | 8) verify that ping is not successful |
| 3314 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3315 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3316 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3317 | """ |
| 3318 | pass |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3319 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3320 | def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
ChetanGaonker | aaea6b6 | 2016-12-16 17:06:39 -0800 | [diff] [blame] | 3321 | |
Thangavelu K S | bdb1ec4 | 2017-02-23 19:51:42 +0000 | [diff] [blame] | 3322 | """ |
| 3323 | Algo: |
| 3324 | 1) Validate that required openstack service is up and running. |
| 3325 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3326 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 3327 | (neutron port-create net-A-private --name stag-100). |
| 3328 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3329 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3330 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3331 | 5) Wait till VMs boot up and running. |
| 3332 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3333 | 7) Now ping to the VM from other VM which are launched in the private network |
| 3334 | 8) verify that ping is not successful |
| 3335 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3336 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3337 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3338 | """ |
| 3339 | pass |
| 3340 | |
| 3341 | 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): |
| 3342 | |
| 3343 | """ |
| 3344 | Algo: |
| 3345 | 1) Validate that required openstack service is up and running. |
| 3346 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3347 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 3348 | (neutron port-create net-A-private --name stag-500). |
| 3349 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3350 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3351 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 3352 | 5) Wait till VMs boot up and running. |
| 3353 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3354 | 7) Now ping to the VM from other VM which are launched in the private network |
| 3355 | 8) verify that ping is not successful |
| 3356 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3357 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3358 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3359 | """ |
| 3360 | pass |
| 3361 | |
| 3362 | def test_cordvtn_creating_one_virtual_local_management_other_public_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
| 3363 | |
| 3364 | """ |
| 3365 | Algo: |
| 3366 | 1) Validate that required openstack service is up and running. |
| 3367 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3368 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 3369 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3370 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3371 | 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 |
| 3372 | 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 |
| 3373 | 5) Wait till VMs boot up and running. |
| 3374 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3375 | 7) Now ping to the VM from other VM which are launched in the public network |
| 3376 | 8) verify that ping is not successful |
| 3377 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3378 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3379 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3380 | """ |
| 3381 | pass |
| 3382 | |
| 3383 | def test_cordvtn_creating_one_virtual_vlan_connectivity_and_a_private_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
| 3384 | |
| 3385 | """ |
| 3386 | Algo: |
| 3387 | 1) Validate that required openstack service is up and running. |
| 3388 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3389 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 3390 | (neutron port-create net-A-private --name stag-100). |
| 3391 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3392 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3393 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3394 | 5) Wait till VMs boot up and running. |
| 3395 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3396 | 7) Now ping to the VM from other VM which are launched in the public network |
| 3397 | 8) verify that ping is not successful |
| 3398 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3399 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3400 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3401 | """ |
| 3402 | pass |
| 3403 | |
| 3404 | 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): |
| 3405 | |
| 3406 | """ |
| 3407 | Algo: |
| 3408 | 1) Validate that required openstack service is up and running. |
| 3409 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3410 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 3411 | (neutron port-create net-A-private --name stag-500). |
| 3412 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3413 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3414 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 3415 | 5) Wait till VMs boot up and running. |
| 3416 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3417 | 7) Now ping to the VM from other VM which are launched in the public network |
| 3418 | 8) verify that ping is not successful |
| 3419 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3420 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3421 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3422 | """ |
| 3423 | pass |
| 3424 | |
| 3425 | def test_cordvtn_creating_one_virtual_vlan_connectivity_other_local_management_network_and_boot_2_images_in_same_service_connectivity_negative_scenario(self): |
| 3426 | |
| 3427 | """ |
| 3428 | Algo: |
| 3429 | 1) Validate that required openstack service is up and running. |
| 3430 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3431 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a vlan port-create. |
| 3432 | (neutron port-create net-A-private --name stag-100). |
| 3433 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3434 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3435 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3436 | 5) Wait till VMs boot up and running. |
| 3437 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3438 | 7) Now ping to the VM from other VM which are launched in the public network |
| 3439 | 8) verify that ping is not successful |
| 3440 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3441 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3442 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3443 | """ |
| 3444 | pass |
| 3445 | |
| 3446 | 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): |
| 3447 | |
| 3448 | """ |
| 3449 | Algo: |
| 3450 | 1) Validate that required openstack service is up and running. |
| 3451 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3452 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 3453 | (neutron port-create net-A-private --name stag-500). |
| 3454 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3455 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3456 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 3457 | 5) Wait till VMs boot up and running. |
| 3458 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3459 | 7) Now ping to the VM from other VM which are launched in the public network |
| 3460 | 8) verify that ping is not successful |
| 3461 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3462 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3463 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3464 | """ |
| 3465 | pass |
| 3466 | |
| 3467 | 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): |
| 3468 | |
| 3469 | """ |
| 3470 | Algo: |
| 3471 | 1) Validate that required openstack service is up and running. |
| 3472 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3473 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with a floating ip and vlan port-create. |
| 3474 | (neutron port-create net-A-private --name stag-500). |
| 3475 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3476 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3477 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 3478 | 5) Wait till VMs boot up and running. |
| 3479 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3480 | 7) Now ping to the VM from other VM which are launched in the public network |
| 3481 | 8) verify that ping is not successful |
| 3482 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3483 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3484 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3485 | """ |
| 3486 | pass |
| 3487 | |
| 3488 | def test_cordvtn_creating_virtual_public_network_and_boot_2_images_with_invalid_public_field_of_onos_network_cfg_json_in_same_service(self): |
| 3489 | """ |
| 3490 | Algo: |
| 3491 | 1) Validate that required openstack service is up and running. |
| 3492 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3493 | 3) Push network_cfg.json config file to onos with an invalid public gateway ip in network_cfg.json file. |
| 3494 | 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 3495 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 3496 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3497 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3498 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 3499 | 6) Wait till VMs boot up and running. |
| 3500 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3501 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3502 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3503 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3504 | 11) Verify ping from VM to public gateway which is send to ONOS through rest API in network_cfg.json file. |
| 3505 | 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. |
| 3506 | 13) Now ping one VM to other VM it should not ping again even it in the same service. |
| 3507 | """ |
| 3508 | pass |
| 3509 | |
| 3510 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_with_invalid_localManagementIp_field_of_onos_network_cfg_json(self): |
| 3511 | |
| 3512 | """ |
| 3513 | Algo: |
| 3514 | 1) Validate that required openstack service is up and running. |
| 3515 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3516 | 3) Push network_cfg.json config file to onos with an invalid localManagement ip in network_cfg.json file. |
| 3517 | 4) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 3518 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3519 | 5) Now boot image in the same created network using nova boot image command (example given below :- |
| 3520 | nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3521 | 6) Wait till VM boots up and starts running. |
| 3522 | 7) Verify that a VM is launched and running by using novaclient python API. |
| 3523 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3524 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3525 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3526 | 11) Verify ping from VM to local management ip which is send to ONOS through rest API in network_cfg.json file. |
| 3527 | 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. |
| 3528 | """ |
| 3529 | pass |
| 3530 | |
| 3531 | def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OVSDB_port_field_of_onos_network_cfg_json(self): |
| 3532 | """ |
| 3533 | Algo: |
| 3534 | 1) Validate that required openstack service is up and running. |
| 3535 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3536 | 3) Push network_cfg.json config file to onos with an invalid ovsdb port in network_cfg.json file. |
| 3537 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3538 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3539 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3540 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3541 | 5) Wait till VM boots up and starts running. |
| 3542 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3543 | 7) Verify that flows are being added in ovs-switch in compute-node. |
| 3544 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3545 | 9) Verify that cord-onos did not push any flows to OVS switch. |
| 3546 | """ |
| 3547 | pass |
| 3548 | |
| 3549 | def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_OpenStack_details_in_onos_network_cfg_json(self): |
| 3550 | """ |
| 3551 | Algo: |
| 3552 | 1) Validate that required openstack service is up and running. |
| 3553 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3554 | 3) Push network_cfg.json config file to onos with an invalid openstack in network_cfg.json file. |
| 3555 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3556 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 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 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) Verify that no flows are being added in ovs-switch in compute-node. |
| 3562 | 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron. |
| 3563 | 9) Verify that cord-onos did not push any flows to OVS switch. |
| 3564 | """ |
| 3565 | pass |
| 3566 | |
| 3567 | def test_cordvtn_creating_virtual_private_network_and_boot_image_with_invalid_compute_node_details_in_onos_network_cfg_json(self): |
| 3568 | """ |
| 3569 | Algo: |
| 3570 | 1) Validate that required openstack service is up and running. |
| 3571 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3572 | 3) Push network_cfg.json config file to onos with an invalid compute node details in network_cfg.json file. |
| 3573 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3574 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3575 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 3576 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3577 | 5) Wait till VM boots up and starts running. |
| 3578 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 3579 | 7) Verify that no flows are being added in ovs-switch in compute-node. |
| 3580 | 8) Verify that onos-ml2 plugin is not being received a message from openstack service neutron. |
| 3581 | 9) Verify that cord-onos did not push any flows to OVS switch. |
| 3582 | """ |
| 3583 | pass |
| 3584 | |
| 3585 | |
| 3586 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_in_different_services_connectivity(self): |
| 3587 | """ |
| 3588 | Algo: |
| 3589 | 1) Validate that required openstack service is up and running. |
| 3590 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3591 | 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as private network. |
| 3592 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3593 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3594 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3595 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3596 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3597 | 5) Wait till VMs boot up and running. |
| 3598 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3599 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 3600 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3601 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 3602 | 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping. |
| 3603 | 11) Verify that no flows are being added in the OVS switch. |
| 3604 | """ |
| 3605 | pass |
| 3606 | |
| 3607 | def test_cordvtn_creating_two_virtual_public_networks_and_boot_images_in_different_service_connectivity(self): |
| 3608 | """ |
| 3609 | Algo: |
| 3610 | 1) Validate that required openstack service is up and running. |
| 3611 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3612 | 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as public network. |
| 3613 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 3614 | (neutron net-create net-A-public, neutron subnet-create net-B-public 198.1.0.0/24). |
| 3615 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3616 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3617 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3618 | 5) Wait till VMs boot up and running. |
| 3619 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3620 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 3621 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3622 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 3623 | 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping. |
| 3624 | 11) Verify that no flows are being added in the OVS switch. |
| 3625 | """ |
| 3626 | pass |
| 3627 | |
| 3628 | def test_cordvtn_creating_two_virtual_local_management_networks_and_boot_images_in_different_service_connectivity(self): |
| 3629 | """ |
| 3630 | Algo: |
| 3631 | 1) Validate that required openstack service is up and running. |
| 3632 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3633 | 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with an IP as local management network. |
| 3634 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 3635 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.28.0.0/24 -gateway 172.28.0.1). |
| 3636 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3637 | 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 |
| 3638 | 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 |
| 3639 | 5) Wait till VMs boot up and running. |
| 3640 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3641 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 3642 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3643 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 3644 | 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping. |
| 3645 | 11) Verify that no flows are being added in the OVS switch. |
| 3646 | """ |
| 3647 | pass |
| 3648 | |
| 3649 | def test_cordvtn_creating_two_virtual_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self): |
| 3650 | """ |
| 3651 | Algo: |
| 3652 | 1) Validate that required openstack service is up and running. |
| 3653 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3654 | 3) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetB with a vlan port-create. |
| 3655 | (neutron port-create net-A-private --name stag-100). |
| 3656 | (neutron port-create net-B-private --name stag-200). |
| 3657 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3658 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3659 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg1-01 |
| 3660 | 5) Wait till VMs boot up and running. |
| 3661 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3662 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 3663 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3664 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 3665 | 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping. |
| 3666 | 11) Verify that no flows are being added in the OVS switch. |
| 3667 | """ |
| 3668 | pass |
| 3669 | def test_cordvtn_creating_two_virtual_floating_IP_with_vlan_connectivity_networks_and_boot_images_in_different_service_connectivity(self): |
| 3670 | """ |
| 3671 | Algo: |
| 3672 | 1) Validate that required openstack service is up and running. |
| 3673 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3674 | 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. |
| 3675 | (neutron port-create net-A-private --name stag-500). |
| 3676 | (neutron port-create net-B-private --name stag-500). |
| 3677 | 4) Now boot two images in the same created network using nova boot image command (example given below :- |
| 3678 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-01 |
| 3679 | nova boot --image 6ba954df-063f-4379-9e2a-920050879918 --flavor 2 --nic port-id=2c7a397f-949e-4502-aa61-2c9cefe96c74 --user-data passwd.data vsg-02 |
| 3680 | 5) Wait till VMs boot up and running. |
| 3681 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3682 | 7) Verify that flow is being added in ovs-switch in compute-node. |
| 3683 | 8) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3684 | 9) Verify that cord-onos pushed flows to OVS switch. |
| 3685 | 10) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping. |
| 3686 | 11) Verify that no flows are being added in the OVS switch. |
| 3687 | """ |
| 3688 | pass |
| 3689 | |
| 3690 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_direct_access(self): |
| 3691 | """ |
| 3692 | Algo: |
| 3693 | 1) Validate that required openstack service is up and running. |
| 3694 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3695 | 3) Push service dependency data.json file to onos to subscriber of other service. |
| 3696 | $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks |
| 3697 | 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network. |
| 3698 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3699 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3700 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3701 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3702 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3703 | 6) Wait till VMs boot up and running. |
| 3704 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3705 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3706 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3707 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3708 | 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping. |
| 3709 | 12) Verify that flows are being added in the OVS switch. |
| 3710 | """ |
| 3711 | pass |
| 3712 | |
| 3713 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_out_xos_indirect_access(self): |
| 3714 | """ |
| 3715 | Algo: |
| 3716 | 1) Validate that required openstack service is up and running. |
| 3717 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3718 | 3) Push service dependency data.json file to onos to subscriber of other service. |
| 3719 | $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks |
| 3720 | 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network. |
| 3721 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3722 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3723 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3724 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3725 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3726 | 6) Wait till VMs boot up and running. |
| 3727 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3728 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3729 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3730 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3731 | 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. |
| 3732 | 12) Verify that flows are being added in the OVS switch. |
| 3733 | """ |
| 3734 | pass |
| 3735 | |
| 3736 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_direct_access(self): |
| 3737 | """ |
| 3738 | Algo: |
| 3739 | 1) Validate that required openstack service is up and running. |
| 3740 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3741 | 3) Push service dependency data.json file to onos to subscriber of other service. |
| 3742 | $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks |
| 3743 | 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network. |
| 3744 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3745 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3746 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3747 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3748 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3749 | 6) Wait till VMs boot up and running. |
| 3750 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3751 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3752 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3753 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3754 | 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping. |
| 3755 | 12) Verify that flows are being added in the OVS switch. |
| 3756 | 13) Push config data with outservice dependency in data.json file to onos to subscriber of other service. |
| 3757 | 14) Now ping from VM which is Net-A to other VM which is in Net-B, should not ping. |
| 3758 | 15) Verify that no flows are being added in the OVS switch. |
| 3759 | """ |
| 3760 | pass |
| 3761 | |
| 3762 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_remove_services_dependency_with_out_xos_indirect_access(self): |
| 3763 | """ |
| 3764 | Algo: |
| 3765 | 1) Validate that required openstack service is up and running. |
| 3766 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3767 | 3) Push service dependency data.json file to onos to subscriber of other service. |
| 3768 | $ curl -X POST -H "Content-Type: application/json" -u onos:rocks -d @data.json http://$OC1:8181/onos/cordvtn/serviceNetworks |
| 3769 | 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network. |
| 3770 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3771 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3772 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3773 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3774 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3775 | 6) Wait till VMs boot up and running. |
| 3776 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3777 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3778 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3779 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3780 | 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. |
| 3781 | 12) Verify that flows are being added in the OVS switch. |
| 3782 | 13) Push config data with out service dependency in data.json file to onos to subscriber of other service. |
| 3783 | 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. |
| 3784 | 15) Verify that no flows are being added in the OVS switch. |
| 3785 | """ |
| 3786 | pass |
| 3787 | |
| 3788 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_direct_access(self): |
| 3789 | """ |
| 3790 | Algo: |
| 3791 | 1) Validate that required openstack service is up and running. |
| 3792 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3793 | 3) Validate that XOS is up and running. |
| 3794 | 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network. |
| 3795 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3796 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3797 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3798 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3799 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3800 | 6) Wait till VMs boot up and running. |
| 3801 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3802 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3803 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3804 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3805 | 11) Now ping from VM which is Net-A to other VM which is in Net-B, should ping. |
| 3806 | 12) Verify that flows are being added in the OVS switch. |
| 3807 | """ |
| 3808 | pass |
| 3809 | |
| 3810 | def test_cordvtn_creating_two_virtual_private_networks_and_boot_images_for_services_dependency_with_xos_indirect_access(self): |
| 3811 | """ |
| 3812 | Algo: |
| 3813 | 1) Validate that required openstack service is up and running. |
| 3814 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3815 | 3) Validate that XOS is up and running. |
| 3816 | 4) From CORD-Test container, use python-neutron client and create two networks with name - NetA and NetBwith an IP as private network. |
| 3817 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3818 | (neutron net-create net-B-private, neutron subnet-create net-B-private 10.1.0.0/24). |
| 3819 | 5) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3820 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3821 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-B-vm-01 |
| 3822 | 6) Wait till VMs boot up and running. |
| 3823 | 7) Verify that two VMs are launched and running by using novaclient python API. |
| 3824 | 8) Verify that flow is being added in ovs-switch in compute-node. |
| 3825 | 9) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3826 | 10) Verify that cord-onos pushed flows to OVS switch. |
| 3827 | 11) Now ping from VM which is Net-B to other VM which is in Net-A, should ping. |
| 3828 | 12) Verify that flows are being added in the OVS switch. |
| 3829 | """ |
| 3830 | pass |
| 3831 | |
| 3832 | def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_network_cfg_connectivity_to_access_device(self): |
| 3833 | """ |
| 3834 | Algo: |
| 3835 | 1) Validate that required openstack service is up and running. |
| 3836 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3837 | 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container. |
| 3838 | 4) Launch the access-agent and access-device containers and then restart openstack compute node. |
| 3839 | $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash |
| 3840 | 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers |
| 3841 | $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24 |
| 3842 | $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11 |
| 3843 | 6) We ahve to stop ONOS service to test this |
| 3844 | onos-service stop |
| 3845 | sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp" |
| 3846 | 7) Now attach to access-agent container and ping to access-device |
| 3847 | 8) Verify that ping should be success and flows are being added in br-int. |
| 3848 | """ |
| 3849 | pass |
| 3850 | |
| 3851 | def test_cordvtn_with_access_agent_serviceType_and_vtn_location_field_in_network_cfg_connectivity_to_head_node(self): |
| 3852 | """ |
| 3853 | Algo: |
| 3854 | 1) Validate that required openstack service is up and running. |
| 3855 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3856 | 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must be access-agent container. |
| 3857 | 4) Launch the access-agent and access-device containers and then restart openstack compute node. |
| 3858 | $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash |
| 3859 | 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers |
| 3860 | $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24 |
| 3861 | $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11 |
| 3862 | 6) We ahve to stop ONOS service to test this |
| 3863 | onos-service stop |
| 3864 | sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp" |
| 3865 | 7) Now attach to access-agent container and ping to head node |
| 3866 | 8) Verify that ping should be success and flows are being added in br-int. |
| 3867 | """ |
| 3868 | pass |
| 3869 | |
| 3870 | def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_network_cfg_connectivity_to_access_device(self): |
| 3871 | """ |
| 3872 | Algo: |
| 3873 | 1) Validate that required openstack service is up and running. |
| 3874 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3875 | 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container. |
| 3876 | 4) Launch the access-agent and access-device containers and then restart openstack compute node. |
| 3877 | $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash |
| 3878 | 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers |
| 3879 | $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24 |
| 3880 | $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11 |
| 3881 | 6) We ahve to stop ONOS service to test this |
| 3882 | onos-service stop |
| 3883 | sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp" |
| 3884 | 7) Now attach to access-agent container and ping to access-device |
| 3885 | 8) Verify that ping should not be success and no flows are being added in br-int. |
| 3886 | """ |
| 3887 | pass |
| 3888 | |
| 3889 | def test_cordvtn_with_access_agent_serviceType_and_invalid_vtn_location_field_in_network_cfg_connectivity_to_head_node(self): |
| 3890 | """ |
| 3891 | Algo: |
| 3892 | 1) Validate that required openstack service is up and running. |
| 3893 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3894 | 3) Push access-agent additional network_cfg to ONOS and specify vtn-location field info must not be access-agent container. |
| 3895 | 4) Launch the access-agent and access-device containers and then restart openstack compute node. |
| 3896 | $ sudo docker run --privileged --cap-add=ALL -d --name access-agent -t ubuntu:14.04 /bin/bash |
| 3897 | 5) Create each interface on br-int and br-mgmt using pipework on access-agent containers |
| 3898 | $ sudo ./pipework br-mgmt -i eth1 access-agent 10.10.10.20/24 |
| 3899 | $ sudo ./pipework br-int -i eth2 access-agent 10.168.0.100/24 fa:00:00:00:00:11 |
| 3900 | 6) We ahve to stop ONOS service to test this |
| 3901 | onos-service stop |
| 3902 | sudo ovs-ofctl -O OpenFlow13 del-flows br-int "arp" |
| 3903 | 7) Now attach to access-agent container and ping to head node |
| 3904 | 8) Verify that ping should not be success and no flows are being added in br-int. |
| 3905 | """ |
| 3906 | pass |
| 3907 | |
| 3908 | def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_VMs(self): |
| 3909 | """ |
| 3910 | Algo: |
| 3911 | 1) Validate that required openstack service is up and running. |
| 3912 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3913 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3914 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3915 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3916 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3917 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 3918 | 5) Wait till VMs boot up and running. |
| 3919 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3920 | 7) Now ping to the VM from other VM which are launched in same network |
| 3921 | 8) verify that ping is successful |
| 3922 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3923 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3924 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3925 | 12) Restart both VMs in same service and repeat steps 7 to 11. |
| 3926 | """ |
| 3927 | pass |
| 3928 | |
| 3929 | def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_restarting_cord_onos(self): |
| 3930 | """ |
| 3931 | Algo: |
| 3932 | 1) Validate that required openstack service is up and running. |
| 3933 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3934 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3935 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3936 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3937 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3938 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 3939 | 5) Wait till VMs boot up and running. |
| 3940 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3941 | 7) Now ping to the VM from other VM which are launched in same network |
| 3942 | 8) verify that ping is successful |
| 3943 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3944 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3945 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3946 | 12) Restart ONOS service and repeat steps 7 to 11. |
| 3947 | """ |
| 3948 | pass |
| 3949 | |
| 3950 | def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_any_VM_recreating_it(self): |
| 3951 | """ |
| 3952 | Algo: |
| 3953 | 1) Validate that required openstack service is up and running. |
| 3954 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3955 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3956 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3957 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3958 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3959 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 3960 | 5) Wait till VMs boot up and running. |
| 3961 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3962 | 7) Now ping to the VM from other VM which are launched in same network |
| 3963 | 8) verify that ping is successful |
| 3964 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3965 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3966 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3967 | 12) Delete a VM which was created earlier and repeat steps 4 to 11. |
| 3968 | """ |
| 3969 | pass |
| 3970 | |
| 3971 | def test_cordvtn_creating_virtual_private_network_and_boot_2_images_in_same_service_connectivity_after_delete_and_add_br_int_bridge(self): |
| 3972 | """ |
| 3973 | Algo: |
| 3974 | 1) Validate that required openstack service is up and running. |
| 3975 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3976 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as private network. |
| 3977 | (neutron net-create net-A-private, neutron subnet-create net-A-private 10.0.0.0/24). |
| 3978 | 4) Now boot 2 images in the same created network using nova boot image command (example given below :- |
| 3979 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 3980 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-02 |
| 3981 | 5) Wait till VMs boot up and running. |
| 3982 | 6) Verify that two VMs are launched and running by using novaclient python API. |
| 3983 | 7) Now ping to the VM from other VM which are launched in same network |
| 3984 | 8) verify that ping is successful |
| 3985 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 3986 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 3987 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 3988 | 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping) |
| 3989 | 13) Add br_int bridge and repeat steps 7 to 11, (it should ping) |
| 3990 | """ |
| 3991 | pass |
| 3992 | |
| 3993 | def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_VM(self): |
| 3994 | |
| 3995 | """ |
| 3996 | Algo: |
| 3997 | 1) Validate that required openstack service is up and running. |
| 3998 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 3999 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 4000 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 4001 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4002 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 4003 | 5) Wait till VM boots up and starts running. |
| 4004 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4005 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 4006 | 8) verify that ping is successful |
| 4007 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4008 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4009 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4010 | 12) Restart the VM in service and repeat steps 7 to 11. |
| 4011 | |
| 4012 | """ |
| 4013 | pass |
| 4014 | |
| 4015 | def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_restarting_cord_onos(self): |
| 4016 | |
| 4017 | """ |
| 4018 | Algo: |
| 4019 | 1) Validate that required openstack service is up and running. |
| 4020 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4021 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 4022 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 4023 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4024 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 4025 | 5) Wait till VM boots up and starts running. |
| 4026 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4027 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 4028 | 8) verify that ping is successful |
| 4029 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4030 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4031 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4032 | 12) Restart onos service container and repeat steps 7 to 11. |
| 4033 | |
| 4034 | """ |
| 4035 | pass |
| 4036 | |
| 4037 | def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self): |
| 4038 | |
| 4039 | """ |
| 4040 | Algo: |
| 4041 | 1) Validate that required openstack service is up and running. |
| 4042 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4043 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 4044 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 4045 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4046 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 4047 | 5) Wait till VM boots up and starts running. |
| 4048 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4049 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 4050 | 8) verify that ping is successful |
| 4051 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4052 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4053 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4054 | 12) Delete and re-create a VM in the same service and repeat steps 7 to 11. |
| 4055 | |
| 4056 | """ |
| 4057 | pass |
| 4058 | |
| 4059 | def test_cordvtn_creating_virtual_public_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self): |
| 4060 | |
| 4061 | """ |
| 4062 | Algo: |
| 4063 | 1) Validate that required openstack service is up and running. |
| 4064 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4065 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as public network. |
| 4066 | (neutron net-create net-A-public, neutron subnet-create net-A-public 198.0.0.0/24). |
| 4067 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4068 | $ nova boot --image 3e2d7760-774a-4a16-be07-aaccafa779b6 --flavor 1 --nic net-id=8bc19377-f493-4cad-af23-45fb299da9de net-A-vm-01 |
| 4069 | 5) Wait till VM boots up and starts running. |
| 4070 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4071 | 7) Now ping to the VM from outside network which are internet network (global ping) |
| 4072 | 8) verify that ping is successful |
| 4073 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4074 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4075 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4076 | 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping) |
| 4077 | 13) Add br_int bridge and repeat steps 7 to 11, (it should ping) |
| 4078 | |
| 4079 | """ |
| 4080 | pass |
| 4081 | |
| 4082 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_VM(self): |
| 4083 | |
| 4084 | """ |
| 4085 | Algo: |
| 4086 | 1) Validate that required openstack service is up and running. |
| 4087 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4088 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4089 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4090 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4091 | 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 |
| 4092 | 5) Wait till VM boots up and starts running. |
| 4093 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4094 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 4095 | 8) verify that ping is successful |
| 4096 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4097 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4098 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4099 | 12) Restart the VM in service and repeat steps 7 to 11. |
| 4100 | """ |
| 4101 | pass |
| 4102 | |
| 4103 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self): |
| 4104 | |
| 4105 | """ |
| 4106 | Algo: |
| 4107 | 1) Validate that required openstack service is up and running. |
| 4108 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4109 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4110 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4111 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4112 | 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 |
| 4113 | 5) Wait till VM boots up and starts running. |
| 4114 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4115 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 4116 | 8) verify that ping is successful |
| 4117 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4118 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4119 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4120 | 12) Restart the onos service and repeat steps 7 to 11. |
| 4121 | """ |
| 4122 | pass |
| 4123 | |
| 4124 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self): |
| 4125 | |
| 4126 | """ |
| 4127 | Algo: |
| 4128 | 1) Validate that required openstack service is up and running. |
| 4129 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4130 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4131 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4132 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4133 | 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 |
| 4134 | 5) Wait till VM boots up and starts running. |
| 4135 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4136 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 4137 | 8) verify that ping is successful |
| 4138 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4139 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4140 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4141 | 12) Delete and re-create a VM in the same service and repeat steps 7 to 11. |
| 4142 | """ |
| 4143 | pass |
| 4144 | |
| 4145 | def test_cordvtn_creating_virtual_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self): |
| 4146 | |
| 4147 | """ |
| 4148 | Algo: |
| 4149 | 1) Validate that required openstack service is up and running. |
| 4150 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4151 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4152 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4153 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4154 | 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 |
| 4155 | 5) Wait till VM boots up and starts running. |
| 4156 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4157 | 7) Now ping to the VM from compute node network which are launched a VM. |
| 4158 | 8) verify that ping is successful |
| 4159 | 9) Verify that flow is being added in ovs-switch in compute-node. |
| 4160 | 10) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4161 | 11) Verify that cord-onos pushed flows to OVS switch. |
| 4162 | 12) Delete a br_int bridge and repeat steps 7 to 11, (it should not ping) |
| 4163 | 13) Add br_int bridge and repeat steps 7 to 11, (it should ping) |
| 4164 | """ |
| 4165 | pass |
| 4166 | |
| 4167 | def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_VM(self): |
| 4168 | |
| 4169 | """ |
| 4170 | Algo: |
| 4171 | 1) Validate that required openstack service is up and running. |
| 4172 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4173 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4174 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4175 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4176 | 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 |
| 4177 | 5) Wait till VM boots up and starts running. |
| 4178 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4179 | 7) Create a virtual interface with vlan tag and local management ip on VM. |
| 4180 | 8) Create a same virtual interface with valn tag and any local management ip on head node. |
| 4181 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4182 | 10) verify that ping is successful |
| 4183 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4184 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4185 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4186 | 14) Restart the VM in service and repeat steps 9 to 13. |
| 4187 | |
| 4188 | """ |
| 4189 | pass |
| 4190 | |
| 4191 | def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self): |
| 4192 | |
| 4193 | """ |
| 4194 | Algo: |
| 4195 | 1) Validate that required openstack service is up and running. |
| 4196 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4197 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4198 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4199 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4200 | 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 |
| 4201 | 5) Wait till VM boots up and starts running. |
| 4202 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4203 | 7) Create a virtual interface with vlan tag and local management ip on VM. |
| 4204 | 8) Create a same virtual interface with valn tag and any local management ip on head node. |
| 4205 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4206 | 10) verify that ping is successful |
| 4207 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4208 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4209 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4210 | 14) Restart the ONOS service and repeat steps 9 to 13. |
| 4211 | |
| 4212 | """ |
| 4213 | pass |
| 4214 | |
| 4215 | def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self): |
| 4216 | |
| 4217 | """ |
| 4218 | Algo: |
| 4219 | 1) Validate that required openstack service is up and running. |
| 4220 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4221 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4222 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4223 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4224 | 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 |
| 4225 | 5) Wait till VM boots up and starts running. |
| 4226 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4227 | 7) Create a virtual interface with vlan tag and local management ip on VM. |
| 4228 | 8) Create a same virtual interface with valn tag and any local management ip on head node. |
| 4229 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4230 | 10) verify that ping is successful |
| 4231 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4232 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4233 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4234 | 14) Delete and re-create a VM in service and repeat steps 9 to 13. |
| 4235 | |
| 4236 | """ |
| 4237 | pass |
| 4238 | |
| 4239 | def test_cordvtn_creating_virtual_vlan_interface_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self): |
| 4240 | |
| 4241 | """ |
| 4242 | Algo: |
| 4243 | 1) Validate that required openstack service is up and running. |
| 4244 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4245 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4246 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4247 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4248 | 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 |
| 4249 | 5) Wait till VM boots up and starts running. |
| 4250 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4251 | 7) Create a virtual interface with vlan tag and local management ip on VM. |
| 4252 | 8) Create a same virtual interface with valn tag and any local management ip on head node. |
| 4253 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4254 | 10) verify that ping is successful |
| 4255 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4256 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4257 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4258 | 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping) |
| 4259 | 15) Add br_int bridge and repeat steps 9 to 13, (it should ping) |
| 4260 | |
| 4261 | """ |
| 4262 | pass |
| 4263 | |
| 4264 | def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_VM(self): |
| 4265 | |
| 4266 | """ |
| 4267 | Algo: |
| 4268 | 1) Validate that required openstack service is up and running. |
| 4269 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4270 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4271 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4272 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4273 | 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 |
| 4274 | 5) Wait till VM boots up and starts running. |
| 4275 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4276 | 7) Create a virtual interface with vlan tag and local management floating ip on VM. |
| 4277 | 8) Create a same virtual interface with valn tag and any local management floating ip on head node. |
| 4278 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4279 | 10) verify that ping is successful |
| 4280 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4281 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4282 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4283 | 14) Restart the VM in service and repeat steps 9 to 13. |
| 4284 | """ |
| 4285 | pass |
| 4286 | |
| 4287 | def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_restarting_cord_onos(self): |
| 4288 | |
| 4289 | """ |
| 4290 | Algo: |
| 4291 | 1) Validate that required openstack service is up and running. |
| 4292 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4293 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4294 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4295 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4296 | 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 |
| 4297 | 5) Wait till VM boots up and starts running. |
| 4298 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4299 | 7) Create a virtual interface with vlan tag and local management floating ip on VM. |
| 4300 | 8) Create a same virtual interface with valn tag and any local management floating ip on head node. |
| 4301 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4302 | 10) verify that ping is successful |
| 4303 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4304 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4305 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4306 | 14) Restart the ONOS service and repeat steps 9 to 13. |
| 4307 | """ |
| 4308 | pass |
| 4309 | |
| 4310 | def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_recreate_VM(self): |
| 4311 | """ |
| 4312 | Algo: |
| 4313 | 1) Validate that required openstack service is up and running. |
| 4314 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4315 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4316 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4317 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4318 | 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 |
| 4319 | 5) Wait till VM boots up and starts running. |
| 4320 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4321 | 7) Create a virtual interface with vlan tag and local management floating ip on VM. |
| 4322 | 8) Create a same virtual interface with valn tag and any local management floating ip on head node. |
| 4323 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4324 | 10) verify that ping is successful |
| 4325 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4326 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4327 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4328 | 14) Delete and re-create a VM in service and repeat steps 9 to 13. |
| 4329 | """ |
| 4330 | pass |
| 4331 | |
| 4332 | def test_cordvtn_creating_virtual_vlan_interface_floating_local_management_network_and_boot_image_connectivity_after_delete_and_add_br_int_bridge(self): |
| 4333 | |
| 4334 | """ |
| 4335 | Algo: |
| 4336 | 1) Validate that required openstack service is up and running. |
| 4337 | 2) Validate that compute node is being created and get compute node name by using "sudo cord prov list". |
| 4338 | 3) From CORD-Test container, use python-neutron client and create network with name - NetA with an IP as local management network. |
| 4339 | (neutron net-create net-A-management, neutron subnet-create net-A-management 172.27.0.0/24 -gateway 172.27.0.1). |
| 4340 | 4) Now boot image in the same created network using nova boot image command (example given below :- |
| 4341 | 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 |
| 4342 | 5) Wait till VM boots up and starts running. |
| 4343 | 6) Verify that a VM is launched and running by using novaclient python API. |
| 4344 | 7) Create a virtual interface with vlan tag and local management floating ip on VM. |
| 4345 | 8) Create a same virtual interface with valn tag and any local management floating ip on head node. |
| 4346 | 9) Now ping to the VM from head node network which are launched a openstack service. |
| 4347 | 10) verify that ping is successful |
| 4348 | 11) Verify that flow is being added in ovs-switch in compute-node. |
| 4349 | 12) Verify that onos-ml2 plugin syncs through ReST call from openstack service neutron. |
| 4350 | 13) Verify that cord-onos pushed flows to OVS switch. |
| 4351 | 14) Delete a br_int bridge and repeat steps 9 to 13, (it should not ping) |
| 4352 | 15) Add br_int bridge and repeat steps 9 to 13, (it should ping) |
| 4353 | """ |
| 4354 | pass |
Thangavelu K S | 165c0d8 | 2017-04-18 20:50:20 +0000 | [diff] [blame^] | 4355 | |