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