Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 1 | #copyright 2016-present Ciena Corporation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # |
| 15 | import unittest |
| 16 | from nose.tools import * |
| 17 | from scapy.all import * |
| 18 | from OnosCtrl import OnosCtrl, get_mac |
| 19 | from OltConfig import OltConfig |
| 20 | from socket import socket |
| 21 | from OnosFlowCtrl import OnosFlowCtrl |
| 22 | from nose.twistedtools import reactor, deferred |
| 23 | from twisted.internet import defer |
| 24 | from onosclidriver import OnosCliDriver |
| 25 | from CordContainer import Container, Onos, Quagga |
| 26 | from CordTestServer import cord_test_onos_restart, cord_test_onos_shutdown |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 27 | from SSHTestAgent import SSHTestAgent |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 28 | from portmaps import g_subscriber_port_map |
| 29 | from scapy.all import * |
| 30 | import time, monotonic |
| 31 | from OnosLog import OnosLog |
| 32 | from CordLogger import CordLogger |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 33 | import os |
| 34 | import json |
| 35 | import random |
| 36 | import collections |
| 37 | import paramiko |
| 38 | from paramiko import SSHClient |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 39 | from neutronclient.v2_0 import client as neutron_client |
| 40 | from novaclient import client as nova_client |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 41 | log.setLevel('INFO') |
| 42 | |
| 43 | class vsg_exchange(CordLogger): |
| 44 | ONOS_INSTANCES = 3 |
| 45 | V_INF1 = 'veth0' |
| 46 | device_id = 'of:' + get_mac() |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 47 | TEST_IP = '8.8.8.8' |
| 48 | HOST = "10.1.0.1" |
| 49 | USER = "vagrant" |
| 50 | PASS = "vagrant" |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 51 | head_node = os.environ['HEAD_NODE'] |
| 52 | HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 53 | |
| 54 | def setUp(self): |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 55 | super(vsg_exchange, self).setUp() |
| 56 | self.controllers = self.get_controllers() |
| 57 | self.controller = self.controllers[0] |
| 58 | self.cli = None |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 59 | |
| 60 | def tearDown(self): |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 61 | super(vsg_exchange, self).tearDown() |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 62 | |
| 63 | @classmethod |
| 64 | def get_controllers(cls): |
| 65 | controllers = os.getenv('ONOS_CONTROLLER_IP') or '' |
| 66 | return controllers.split(',') |
| 67 | |
| 68 | def cliEnter(self, controller = None): |
| 69 | retries = 0 |
| 70 | while retries < 30: |
| 71 | self.cli = OnosCliDriver(controller = controller, connect = True) |
| 72 | if self.cli.handle: |
| 73 | break |
| 74 | else: |
| 75 | retries += 1 |
| 76 | time.sleep(2) |
| 77 | |
| 78 | def cliExit(self): |
| 79 | self.cli.disconnect() |
| 80 | |
| 81 | def onos_shutdown(self, controller = None): |
| 82 | status = True |
| 83 | self.cliEnter(controller = controller) |
| 84 | try: |
| 85 | self.cli.shutdown(timeout = 10) |
| 86 | except: |
| 87 | log.info('Graceful shutdown of ONOS failed for controller: %s' %controller) |
| 88 | status = False |
| 89 | |
| 90 | self.cliExit() |
| 91 | return status |
| 92 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 93 | def log_set(self, level = None, app = 'org.onosproject'): |
| 94 | CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 95 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 96 | def get_nova_credentials_v2(self): |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 97 | credential = {} |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 98 | credential['username'] = os.environ['OS_USERNAME'] |
| 99 | credential['api_key'] = os.environ['OS_PASSWORD'] |
| 100 | credential['auth_url'] = os.environ['OS_AUTH_URL'] |
| 101 | credential['project_id'] = os.environ['OS_TENANT_NAME'] |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 102 | return credential |
| 103 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 104 | def get_compute_nodes(self): |
| 105 | credentials = self.get_nova_credentials_v2() |
| 106 | nvclient = nova_client.Client('2', **credentials) |
| 107 | return nvclient.hypervisors.list() |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 108 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 109 | def get_vsgs(self, active = True): |
| 110 | credentials = self.get_nova_credentials_v2() |
| 111 | nvclient = nova_client.Client('2', **credentials) |
| 112 | vsgs = nvclient.servers.list(search_opts = {'all_tenants': 1}) |
| 113 | if active is True: |
| 114 | return filter(lambda vsg: vsg.status == True, vsgs) |
| 115 | return vsgs |
| 116 | |
| 117 | def get_vsg_ip(self, vm_name): |
| 118 | vsgs = self.get_vsgs() |
| 119 | vm = filter(lambda vsg: vsg.name == vm_name, vsgs) |
| 120 | if vm: |
| 121 | if vm.networks.has_key('management'): |
| 122 | ips = vm.networks['management'] |
| 123 | if len(ips) > 0: |
| 124 | return ips[0] |
| 125 | return None |
| 126 | |
| 127 | def get_compute_node(self, vsg): |
| 128 | return vsg._info['OS-EXT-SRV-ATTR:hypervisor_hostname'] |
| 129 | |
| 130 | #ping the vsg through the compute node. |
| 131 | #the ssh key is already used by SSHTestAgent in cord-tester |
| 132 | def get_vsg_health(self, vsg): |
| 133 | compute_node = self.get_compute_node(vsg) |
| 134 | vsg_ip = self.get_vsg_ip(vsg.name) |
| 135 | if vsg_ip is None: |
| 136 | return False |
| 137 | ssh_agent = SSHTestAgent(compute_node) |
| 138 | st, _ = ssh_agent.run_cmd('ping -c 1 {}'.format(vsg_ip)) |
| 139 | return st |
| 140 | |
| 141 | #returns 0 if all active vsgs are reachable through the compute node |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 142 | def health_check(self): |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 143 | vsgs = self.get_vsgs() |
| 144 | vsg_status = [] |
| 145 | for vsg in vsgs: |
| 146 | vsg_status.append(self.get_vsg_health(vsg)) |
| 147 | unreachable = filter(lambda st: st == False, vsg_status) |
| 148 | return len(unreachable) == 0 |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 149 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 150 | #use SSHTestAgent to talk to the vsg through the compute node like in get_vsg_health |
| 151 | # def connect_ssh(vsg_ip, private_key_file=None, user='ubuntu'): |
| 152 | # key = ssh.RSAKey.from_private_key_file(private_key_file) |
| 153 | # client = ssh.SSHClient() |
| 154 | # client.set_missing_host_key_policy(ssh.WarningPolicy()) |
| 155 | # client.connect(ip, username=user, pkey=key, timeout=5) |
| 156 | # return client |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 157 | |
| 158 | def test_vsg_vm(self): |
| 159 | status = self.health_check() |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 160 | assert_equal( status, True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 161 | |
| 162 | def test_vsg_for_default_route_to_vsg_vm(self): |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 163 | ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 164 | cmd = "sudo lxc exec testclient -- route | grep default" |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 165 | status, output = ssh_agent.run_cmd(cmd) |
| 166 | assert_equal(status, True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 167 | |
| 168 | def test_vsg_vm_for_vcpe(self): |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 169 | vsgs = self.get_vsgs() |
| 170 | compute_nodes = self.get_compute_nodes() |
| 171 | assert_not_equal(len(vsgs), 0) |
| 172 | assert_not_equal(len(compute_nodes), 0) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 173 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 174 | #TODO: use cord-test container itself to dhclient on vcpe interfaces |
| 175 | #using the info from OltConfig().get_vcpes() |
| 176 | #deleting default through eth0, fetching ip through dhclient on vcpe, |
| 177 | #and testing for dhcp ip on vcpe0 and default route on vcpe0 before pinging 8.8.8.8 |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 178 | def test_vsg_for_external_connectivity(self): |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 179 | ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 180 | cmd = "lxc exec testclient -- ping -c 3 8.8.8.8" |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 181 | status, output = ssh_agent.run_cmd(cmd) |
| 182 | assert_equal( status, True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 183 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 184 | #below tests need to be changed to login to vsg through the compute node as in health check |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 185 | def test_vsg_vm_for_login_to_vsg(self): |
| 186 | client = SSHClient() |
| 187 | client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
| 188 | keyfile = open('/root/id_rsa','r') |
| 189 | key = str(keyfile.read()) |
| 190 | keyfile.close() |
| 191 | log.info('read key is %s'%key) |
| 192 | key = paramiko.RSAKey.from_private_key(StringIO(key), password=None) |
| 193 | client.connect( '10.1.0.17', username = 'ubuntu', pkey=key, password=None) |
| 194 | cmd = "ls" |
| 195 | stdin, stdout, stderr = client.exec_command(cmd) |
| 196 | status = stdout.channel.recv_exit_status() |
| 197 | assert_equal( status, False) |
| 198 | log.info('ls output at compute node is %s'%stdout.read()) |
| 199 | client.connect( '172.27.0.2', username = 'ubuntu', pkey=key, password=None) |
| 200 | cmd = "pwd" |
| 201 | stdin, stdout, stderr = client.exec_command(cmd) |
| 202 | status = stdout.channel.recv_exit_status() |
| 203 | assert_equal( status, False) |
| 204 | log.info('ls output at compute node is %s'%stdout.read()) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 205 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame^] | 206 | #these need to first get dhcp through dhclient on vcpe interfaces (using OltConfig get_vcpes()) |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 207 | def test_vsg_external_connectivity_with_sending_icmp_echo_requests(self): |
| 208 | host = '8.8.8.8' |
| 209 | self.success = False |
| 210 | def mac_recv_task(): |
| 211 | def recv_cb(pkt): |
| 212 | log.info('Recieved icmp echo reply as expected') |
| 213 | self.success = True |
| 214 | sniff(count=1, timeout=5, |
| 215 | lfilter = lambda p: IP in p and p[ICMP].type==0, #p[IP].src == host, |
| 216 | prn = recv_cb, iface = 'vcpe0.222.111') |
| 217 | t = threading.Thread(target = mac_recv_task) |
| 218 | t.start() |
| 219 | L3 = IP(dst = host) |
| 220 | pkt = L3/ICMP() |
| 221 | log.info('Sending icmp echo requests to external network') |
| 222 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 223 | t.join() |
| 224 | assert_equal(self.success, True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 225 | |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 226 | def test_vsg_external_connectivity_sending_icmp_ping_on_different_interface(self): |
| 227 | host = '8.8.8.8' |
| 228 | self.success = False |
| 229 | def mac_recv_task(): |
| 230 | def recv_cb(pkt): |
| 231 | log.info('Recieved icmp echo reply which is not expected') |
| 232 | self.success = True |
| 233 | sniff(count=1, timeout=5, |
| 234 | lfilter = lambda p: IP in p and p[ICMP].type == 0, |
| 235 | prn = recv_cb, iface = 'vcpe0.222.112') |
| 236 | t = threading.Thread(target = mac_recv_task) |
| 237 | t.start() |
| 238 | L3 = IP(dst = host) |
| 239 | pkt = L3/ICMP() |
| 240 | log.info('Sending icmp echo requests to external network') |
| 241 | send(pkt, count=3, iface = 'vcpe0.222.112') |
| 242 | t.join() |
| 243 | assert_equal(self.success, False) |
| 244 | |
| 245 | def test_vsg_external_connectivity_pinging_with_single_tag_negative_scenario(self): |
| 246 | host = '8.8.8.8' |
| 247 | self.success = False |
| 248 | def mac_recv_task(): |
| 249 | def recv_cb(pkt): |
| 250 | log.info('Recieved icmp echo reply which is not expected') |
| 251 | self.success = True |
| 252 | sniff(count=1, timeout=5, |
| 253 | lfilter = lambda p: IP in p and p[ICMP].type == 0, |
| 254 | prn = recv_cb, iface = 'vcpe0.222') |
| 255 | t = threading.Thread(target = mac_recv_task) |
| 256 | t.start() |
| 257 | L3 = IP(dst = host) |
| 258 | pkt = L3/ICMP() |
| 259 | log.info('Sending icmp echo requests to external network') |
| 260 | send(pkt, count=3, iface = 'vcpe0.222') |
| 261 | t.join() |
| 262 | assert_equal(self.success, False) |
| 263 | |
| 264 | def test_vsg_external_connectivity_pinging_to_google(self): |
| 265 | host = 'www.google.com' |
| 266 | self.success = False |
| 267 | def mac_recv_task(): |
| 268 | def recv_cb(pkt): |
| 269 | log.info('Recieved icmp echo reply as expected') |
| 270 | self.success = True |
| 271 | sniff(count=3, timeout=5, |
| 272 | lfilter = lambda p: IP in p and p[ICMP].type== 0, |
| 273 | prn = recv_cb, iface = 'vcpe0.222.111') |
| 274 | t = threading.Thread(target = mac_recv_task) |
| 275 | t.start() |
| 276 | L3 = IP(dst = host) |
| 277 | pkt = L3/ICMP() |
| 278 | log.info('Sending icmp ping requests to google.com') |
| 279 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 280 | t.join() |
| 281 | assert_equal(self.success, True) |
| 282 | |
| 283 | def test_vsg_external_connectivity_pinging_to_non_existing_website(self): |
| 284 | host = 'www.goglee.com' |
| 285 | self.success = False |
| 286 | def mac_recv_task(): |
| 287 | def recv_cb(pkt): |
| 288 | log.info('Recieved icmp echo reply which is not expected') |
| 289 | self.success = True |
| 290 | sniff(count=1, timeout=5, |
| 291 | lfilter = lambda p: IP in p and p[ICMP].type == 0, |
| 292 | prn = recv_cb, iface = 'vcpe0.222.111') |
| 293 | t = threading.Thread(target = mac_recv_task) |
| 294 | t.start() |
| 295 | L3 = IP(dst = host) |
| 296 | pkt = L3/ICMP() |
| 297 | log.info('Sending icmp ping requests to non existing website') |
| 298 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 299 | t.join() |
| 300 | assert_equal(self.success, False) |
| 301 | |
| 302 | def test_vsg_external_connectivity_ping_to_google_with_ttl_1(self): |
| 303 | host = '8.8.8.8' |
| 304 | self.success = False |
| 305 | def mac_recv_task(): |
| 306 | def recv_cb(pkt): |
| 307 | log.info('icmp ping reply received Pkt is %s' %pkt.show()) |
| 308 | #log.info('icmp ping reply received Pkt is %s' %pkt[ICMP]) |
| 309 | self.success = True |
| 310 | sniff(count=1, timeout=5, |
| 311 | lfilter = lambda p: IP in p and p[ICMP].type == 0, |
| 312 | prn = recv_cb, iface = 'vcpe0.222.111') |
| 313 | t = threading.Thread(target = mac_recv_task) |
| 314 | t.start() |
| 315 | L3 = IP(dst = host, ttl=1) |
| 316 | pkt = L3/ICMP() |
| 317 | log.info('Sending icmp ping requests to external network with ip ttl value set to 1') |
| 318 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 319 | t.join() |
| 320 | assert_equal(self.success, False) |
| 321 | |
| 322 | def test_vsg_for_external_connectivity_with_wan_interface_down_and_making_up_in_vcpe_container(self): |
| 323 | host = '8.8.8.8' |
| 324 | self.success = False |
| 325 | def mac_recv_task(): |
| 326 | def recv_cb(pkt): |
| 327 | log.info('icmp ping reply received') |
| 328 | self.success = True |
| 329 | sniff(count=1, timeout=5, |
| 330 | lfilter = lambda p: ICMP in p and p[ICMP].type == 0, |
| 331 | prn = recv_cb, iface = 'vcpe0.222.111') |
| 332 | t1 = threading.Thread(target = mac_recv_task) |
| 333 | t2 = threading.Thread(target = mac_recv_task) |
| 334 | t3 = threading.Thread(target = mac_recv_task) |
| 335 | t1.start() |
| 336 | L3 = IP(dst = host) |
| 337 | pkt = L3/ICMP() |
| 338 | log.info('Sending icmp ping requests to external network before wan interface on vpce container does down') |
| 339 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 340 | t1.join() |
| 341 | assert_equal(self.success, True) |
| 342 | #logging into vcpe and down wan interface |
| 343 | self.success = False |
| 344 | t2.start() |
| 345 | log.info('Sending icmp ping requests to external network after wan interface on vpce container does down') |
| 346 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 347 | t2.join() |
| 348 | assert_equal(self.success, False) |
| 349 | #logging into vcpe and bringing up wan interface |
| 350 | t3.start() |
| 351 | log.info('Sending icmp ping requests to external network after wan interface on vpce container comes up') |
| 352 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 353 | t3.join() |
| 354 | assert_equal(self.success, True) |
| 355 | |
| 356 | def test_vsg_for_external_connectivity_with_lan_interface_down_and_up_in_vcpe_container(self): |
| 357 | host = '8.8.8.8' |
| 358 | self.success = False |
| 359 | def mac_recv_task(): |
| 360 | def recv_cb(pkt): |
| 361 | log.info('icmp ping reply received Pkt is %s' %pkt.show()) |
| 362 | self.success = True |
| 363 | sniff(count=1, timeout=5, |
| 364 | lfilter = lambda p: ICMP in p and p[ICMP].type == 1, |
| 365 | prn = recv_cb, iface = 'vcpe0.222.111') |
| 366 | t1 = threading.Thread(target = mac_recv_task) |
| 367 | t2 = threading.Thread(target = mac_recv_task) |
| 368 | t3 = threading.Thread(target = mac_recv_task) |
| 369 | t1.start() |
| 370 | L3 = IP(dst = host) |
| 371 | pkt = L3/ICMP() |
| 372 | log.info('Sending icmp ping requests to external network before lan interface on vpce container does down') |
| 373 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 374 | t1.join() |
| 375 | assert_equal(self.success, True) |
| 376 | #logging into vcpe and down lan interface |
| 377 | self.success = False |
| 378 | t2.start() |
| 379 | log.info('Sending icmp ping requests to external network after lan interface on vpce container does down') |
| 380 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 381 | t2.join() |
| 382 | assert_equal(self.success, False) |
| 383 | #logging into vcpe and bringing up lan interface |
| 384 | t3.start() |
| 385 | log.info('Sending icmp ping requests to external network after lan interface on vpce container comes up') |
| 386 | send(pkt, count=3, iface = 'vcpe0.222.111') |
| 387 | t3.join() |
| 388 | assert_equal(self.success, True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 389 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 390 | def test_vsg_for_ping_from_vsg_to_external_network(self): |
| 391 | """ |
| 392 | Algo: |
| 393 | 1.Create a vSG VM in compute node |
| 394 | 2.Ensure VM created properly |
| 395 | 3.Verify login to VM success |
| 396 | 4.Do ping to external network from vSG VM |
| 397 | 5.Verify that ping gets success |
| 398 | 6.Verify ping success flows added in OvS |
| 399 | """ |
| 400 | def test_vsg_for_ping_from_vcpe_to_external_network(self): |
| 401 | """ |
| 402 | Algo: |
| 403 | 1.Create a vSG VM in compute node |
| 404 | 2.Create a vCPE container inside VM |
| 405 | 3.Verify both VM and Container created properly |
| 406 | 4.Verify login to vCPE container success |
| 407 | 5.Do ping to external network from vCPE container |
| 408 | 6.Verify that ping gets success |
| 409 | 7.Verify ping success flows added in OvS |
| 410 | """ |
| 411 | |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 412 | def test_vsg_for_dns_service(self): |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 413 | """ |
| 414 | Algo: |
| 415 | 1. Create a test client in Prod VM |
| 416 | 2. Create a vCPE container in vSG VM inside compute Node |
| 417 | 3. Ensure vSG VM and vCPE container created properly |
| 418 | 4. Enable dns service in vCPE ( if not by default ) |
| 419 | 5. Send ping request from test client to valid domain address say, 'www.google'com |
| 420 | 6. Verify that dns should resolve ping should success |
| 421 | 7. Now send ping request to invalid domain address say 'www.invalidaddress'.com' |
| 422 | 8. Verify that dns resolve should fail and hence ping |
| 423 | """ |
| 424 | def test_vsg_for_10_subscribers_for_same_service(self): |
| 425 | """ |
| 426 | Algo: |
| 427 | 1.Create a vSG VM in compute node |
| 428 | 2.Create 10 vCPE containers for 10 subscribers, in vSG VM |
| 429 | 3.Ensure vSG VM and vCPE container created properly |
| 430 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP |
| 431 | 5.Verify that ping success for all 10 subscribers |
| 432 | """ |
| 433 | def test_vsg_for_10_subscribers_for_same_service_ping_invalid_ip(self): |
| 434 | """ |
| 435 | Algo: |
| 436 | 1.Create a vSG VM in compute Node |
| 437 | 2.Create 10 vCPE containers for 10 subscribers, in vSG VM |
| 438 | 3.Ensure vSG VM and vCPE container created properly |
| 439 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP |
| 440 | 5.Verify that ping fails for all 10 subscribers |
| 441 | """ |
| 442 | def test_vsg_for_10_subscribers_for_same_service_ping_valid_and_invalid_ip(self): |
| 443 | """ |
| 444 | Algo: |
| 445 | 1.Create a vSG VM in VM |
| 446 | 2.Create 10 vCPE containers for 10 subscribers, in vSG VM |
| 447 | 3.Ensure vSG VM and vCPE container created properly |
| 448 | 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP |
| 449 | 5.Verify that ping success for all 5 subscribers |
| 450 | 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP |
| 451 | 7.Verify that ping fails for all 5 subscribers |
| 452 | """ |
| 453 | def test_vsg_for_100_subscribers_for_same_service(self): |
| 454 | """ |
| 455 | Algo: |
| 456 | 1.Create a vSG VM in compute node |
| 457 | 2.Create 100 vCPE containers for 100 subscribers, in vSG VM |
| 458 | 3.Ensure vSG VM and vCPE container created properly |
| 459 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP |
| 460 | 5.Verify that ping success for all 100 subscribers |
| 461 | """ |
| 462 | def test_vsg_for_100_subscribers_for_same_service_ping_invalid_ip(self): |
| 463 | """ |
| 464 | Algo: |
| 465 | 1.Create a vSG VM in compute Node |
| 466 | 2.Create 10 vCPE containers for 100 subscribers, in vSG VM |
| 467 | 3.Ensure vSG VM and vCPE container created properly |
| 468 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP |
| 469 | 5.Verify that ping fails for all 100 subscribers |
| 470 | """ |
| 471 | def test_vsg_for_100_subscribers_for_same_service_ping_valid_and_invalid_ip(self): |
| 472 | """ |
| 473 | Algo: |
| 474 | 1.Create a vSG VM in VM |
| 475 | 2.Create 10 vCPE containers for 100 subscribers, in vSG VM |
| 476 | 3.Ensure vSG VM and vCPE container created properly |
| 477 | 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP |
| 478 | 5.Verify that ping success for all 5 subscribers |
| 479 | 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP |
| 480 | 7.Verify that ping fails for all 5 subscribers |
| 481 | """ |
| 482 | def test_vsg_for_packet_received_with_invalid_ip_fields(self): |
| 483 | """ |
| 484 | Algo: |
| 485 | 1.Create a vSG VM in compute node |
| 486 | 2.Create a vCPE container in vSG VM |
| 487 | 3.Ensure vSG VM and vCPE container created properly |
| 488 | 4.From subscriber, send a ping packet with invalid ip fields |
| 489 | 5.Verify that vSG drops the packet |
| 490 | 6.Verify ping fails |
| 491 | """ |
| 492 | def test_vsg_for_packet_received_with_invalid_mac_fields(self): |
| 493 | """ |
| 494 | Algo: |
| 495 | 1.Create a vSG VM in compute node |
| 496 | 2.Create a vCPE container in vSG VM |
| 497 | 3.Ensure vSG VM and vCPE container created properly |
| 498 | 4.From subscriber, send a ping packet with invalid mac fields |
| 499 | 5.Verify that vSG drops the packet |
| 500 | 6.Verify ping fails |
| 501 | """ |
| 502 | def test_vsg_for_vlan_id_mismatch_in_stag(self): |
| 503 | """ |
| 504 | Algo: |
| 505 | 1.Create a vSG VM in compute Node |
| 506 | 2.Create a vCPE container in vSG VM |
| 507 | 3.Ensure vSG VM and vCPE container created properly |
| 508 | 4.Send a ping request to external valid IP from subscriber, with incorrect vlan id in s-tag and valid c-tag |
| 509 | 5.Verify that ping fails as the packet drops at VM entry |
| 510 | 6.Repeat step 4 with correct s-tag |
| 511 | 7.Verify that ping success |
| 512 | """ |
| 513 | def test_vsg_for_vlan_id_mismatch_in_ctag(self): |
| 514 | """ |
| 515 | Algo: |
| 516 | 1.Create a vSG VM in compute node |
| 517 | 2.Create a vCPE container in vSG VM |
| 518 | 3.Ensure vSG VM and vCPE container created properly |
| 519 | 4.Send a ping request to external valid IP from subscriber, with valid s-tag and incorrect vlan id in c-tag |
| 520 | 5.Verify that ping fails as the packet drops at vCPE container entry |
| 521 | 6.Repeat step 4 with valid s-tag and c-tag |
| 522 | 7.Verify that ping success |
| 523 | """ |
| 524 | def test_vsg_for_matching_and_mismatching_vlan_id_in_stag(self): |
| 525 | """ |
| 526 | Algo: |
| 527 | 1.Create two vSG VMs in compute node |
| 528 | 2.Create a vCPE container in each vSG VM |
| 529 | 3.Ensure vSG VM and vCPE container created properly |
| 530 | 4.From subscriber one, send ping request with valid s and c tags |
| 531 | 5.From subscriber two, send ping request with vlan id mismatch in s-tag and valid c tags |
| 532 | 6.Verify that ping success for only subscriber one and fails for two. |
| 533 | """ |
| 534 | def test_vsg_for_matching_and_mismatching_vlan_id_in_ctag(self): |
| 535 | """ |
| 536 | Algo: |
| 537 | 1.Create a vSG VM in compute node |
| 538 | 2.Create two vCPE containers in vSG VM |
| 539 | 3.Ensure vSG VM and vCPE container created properly |
| 540 | 4.From subscriber one, send ping request with valid s and c tags |
| 541 | 5.From subscriber two, send ping request with valid s-tag and vlan id mismatch in c-tag |
| 542 | 6.Verify that ping success for only subscriber one and fails for two |
| 543 | """ |
| 544 | def test_vsg_for_out_of_range_vlanid_in_ctag(self): |
| 545 | """ |
| 546 | Algo: |
| 547 | 1.Create a vSG VM in compute node |
| 548 | 2.Create a vCPE container in vSG VM |
| 549 | 3.Ensure vSG VM and vCPE container created properly |
| 550 | 4.From subscriber, send ping request with valid stag and vlan id in c-tag is an out of range value ( like 0,4097 ) |
| 551 | 4.Verify that ping fails as the ping packets drops at vCPE container entry |
| 552 | """ |
| 553 | def test_vsg_for_out_of_range_vlanid_in_stag(self): |
| 554 | """ |
| 555 | Algo: |
| 556 | 1.Create a vSG VM in compute node |
| 557 | 2.Create a vCPE container in vSG VM |
| 558 | 3.Ensure vSG VM and vCPE container created properly |
| 559 | 2.From subscriber, send ping request with vlan id in s-tag is an out of range value ( like 0,4097 ), with valid c-tag |
| 560 | 4.Verify that ping fails as the ping packets drops at vSG VM entry |
| 561 | """ |
| 562 | def test_vsg_without_creating_vcpe_instance(self): |
| 563 | """ |
| 564 | Algo: |
| 565 | 1.Create a vSG VM in compute Node |
| 566 | 2.Ensure vSG VM created properly |
| 567 | 3.Do not create vCPE container inside vSG VM |
| 568 | 4.From a subscriber, send ping to external valid IP |
| 569 | 5.Verify that ping fails as the ping packet drops at vSG VM entry itself. |
| 570 | """ |
| 571 | def test_vsg_for_remove_vcpe_instance(self): |
| 572 | """ |
| 573 | Algo: |
| 574 | 1.Create a vSG VM in compute node |
| 575 | 2.Create a vCPE container in vSG VM |
| 576 | 3.Ensure vSG VM and vCPE container created properly |
| 577 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 578 | 5.Verify that ping success |
| 579 | 6.Verify ping success flows in OvS switch in compute node |
| 580 | 7.Now remove the vCPE container in vSG VM |
| 581 | 8.Ensure that the container removed properly |
| 582 | 9.Repeat step 4 |
| 583 | 10.Verify that now, ping fails |
| 584 | """ |
| 585 | def test_vsg_for_restart_vcpe_instance(self): |
| 586 | """ |
| 587 | Algo: |
| 588 | 1.Create a vSG VM in compute node |
| 589 | 2.Create a vCPE container in vSG VM |
| 590 | 3.Ensure vSG VM and vCPE container created properly |
| 591 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 592 | 5.Verify that ping success |
| 593 | 6.Verify ping success flows in OvS switch in compute node |
| 594 | 7.Now restart the vCPE container in vSG VM |
| 595 | 8.Ensure that the container came up after restart |
| 596 | 9.Repeat step 4 |
| 597 | 10.Verify that now,ping gets success and flows added in OvS |
| 598 | """ |
| 599 | def test_vsg_for_restart_vsg_vm(self): |
| 600 | """ |
| 601 | Algo: |
| 602 | 1.Create a vSG VM in compute node |
| 603 | 2.Create a vCPE container in vSG VM |
| 604 | 3.Ensure vSG VM and vCPE container created properly |
| 605 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 606 | 5.Verify that ping success |
| 607 | 6.Verify ping success flows in OvS switch in compute node |
| 608 | 7.Now restart the vSG VM |
| 609 | 8.Ensure that the vSG comes up properly after restart |
| 610 | 9.Verify that vCPE container comes up after vSG restart |
| 611 | 10.Repeat step 4 |
| 612 | 11.Verify that now,ping gets success and flows added in OvS |
| 613 | """ |
| 614 | def test_vsg_for_pause_vcpe_instance(self): |
| 615 | """ |
| 616 | Algo: |
| 617 | 1.Create a vSG VM in compute node |
| 618 | 2.Create a vCPE container in vSG VM |
| 619 | 3.Ensure vSG VM and vCPE container created properly |
| 620 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 621 | 5.Verify that ping success |
| 622 | 6.Verify ping success flows in OvS switch in compute node |
| 623 | 7.Now pause vCPE container in vSG VM for a while |
| 624 | 8.Ensure that the container state is pause |
| 625 | 9.Repeat step 4 |
| 626 | 10.Verify that now,ping fails now and verify flows in OvS |
| 627 | 11.Now resume the container |
| 628 | 12.Now repeat step 4 again |
| 629 | 13.Verify that now, ping gets success |
| 630 | 14.Verify ping success flows in OvS |
| 631 | """ |
| 632 | def test_vsg_for_extract_all_compute_stats_from_all_vcpe_containers(self): |
| 633 | """ |
| 634 | Algo: |
| 635 | 1.Create a vSG VM in compute node |
| 636 | 2.Create 10 vCPE containers in VM |
| 637 | 3.Ensure vSG VM and vCPE containers created properly |
| 638 | 4.Login to all vCPE containers |
| 639 | 4.Get all compute stats from all vCPE containers |
| 640 | 5.Verify the stats # verification method need to add |
| 641 | """ |
| 642 | def test_vsg_for_extract_dns_stats_from_all_vcpe_containers(self): |
| 643 | """ |
| 644 | Algo: |
| 645 | 1.Create a vSG VM in compute node |
| 646 | 2.Create 10 vCPE containers in VM |
| 647 | 3.Ensure vSG VM and vCPE containers created properly |
| 648 | 4.From 10 subscribers, send ping to valid and invalid dns hosts |
| 649 | 5.Verify dns resolves and ping success for valid dns hosts |
| 650 | 6.Verify ping fails for invalid dns hosts |
| 651 | 7.Verify dns host name resolve flows in OvS |
| 652 | 8.Login to all 10 vCPE containers |
| 653 | 9.Extract all dns stats |
| 654 | 10.Verify dns stats for queries sent, queries received for dns host resolve success and failed scenarios |
| 655 | """ |
| 656 | def test_vsg_for_subscriber_access_two_vsg_services(self): |
| 657 | """ |
| 658 | # Intention is to verify if subscriber can reach internet via two vSG VMs |
| 659 | Algo: |
| 660 | 1.Create two vSG VMs for two services in compute node |
| 661 | 2.Create one vCPE container in each VM for one subscriber |
| 662 | 3.Ensure VMs and containers created properly |
| 663 | 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag |
| 664 | 5.Verify ping gets success |
| 665 | 6.Verify ping success flows in OvS |
| 666 | 7.Now repeat step 4 with stag corresponds to vSG-2 VM |
| 667 | 8.Verify that ping again success |
| 668 | 9.Verify ping success flows in OvS |
| 669 | """ |
| 670 | def test_vsg_for_subscriber_access_service2_if_service1_goes_down(self): |
| 671 | """ |
| 672 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down |
| 673 | Algo: |
| 674 | 1.Create two vSG VMs for two services in compute node |
| 675 | 2.Create one vCPE container in each VM for one subscriber |
| 676 | 3.Ensure VMs and containers created properly |
| 677 | 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag |
| 678 | 5.Verify ping gets success |
| 679 | 6.Verify ping success flows in OvS |
| 680 | 7.Down the vSG-1 VM |
| 681 | 8.Now repeat step 4 |
| 682 | 9.Verify that ping fails as vSG-1 is down |
| 683 | 10.Repeat step 4 with stag corresponding to vSG-2 |
| 684 | 9.Verify ping success and flows added in OvS |
| 685 | """ |
| 686 | def test_vsg_for_subscriber_access_service2_if_service1_goes_restart(self): |
| 687 | """ |
| 688 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts |
| 689 | Algo: |
| 690 | 1.Create two vSG VMs for two services in compute node |
| 691 | 2.Create one vCPE container in each VM for one subscriber |
| 692 | 3.Ensure VMs and containers created properly |
| 693 | 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag |
| 694 | 5.Verify ping gets success |
| 695 | 6.Verify ping success flows added in OvS |
| 696 | 7.Now restart vSG-1 VM |
| 697 | 8.Now repeat step 4 while vSG-1 VM restarts |
| 698 | 9.Verify that ping fails as vSG-1 is restarting |
| 699 | 10.Repeat step 4 with stag corresponding to vSG-2 while vSG-1 VM restarts |
| 700 | 11.Verify ping success and flows added in OvS |
| 701 | """ |
| 702 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_goes_down(self): |
| 703 | """ |
| 704 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down |
| 705 | Algo: |
| 706 | 1.Create a vSG VM in compute node |
| 707 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 708 | 3.Ensure VM and containers created properly |
| 709 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 710 | 5.Verify ping gets success |
| 711 | 6.Verify ping success flows added in OvS |
| 712 | 7.Now stop vCPE-1 container |
| 713 | 8.Now repeat step 4 |
| 714 | 9.Verify that ping fails as vCPE-1 container is down |
| 715 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container |
| 716 | 11.Verify ping success and flows added in OvS |
| 717 | """ |
| 718 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_restart(self): |
| 719 | """ |
| 720 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts |
| 721 | Algo: |
| 722 | 1.Create a vSG VM in compute node |
| 723 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 724 | 3.Ensure VM and containers created properly |
| 725 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 726 | 5.Verify ping gets success |
| 727 | 6.Verify ping success flows added in OvS |
| 728 | 7.Now restart vCPE-1 container |
| 729 | 8.Now repeat step 4 while vCPE-1 restarts |
| 730 | 9.Verify that ping fails as vCPE-1 container is restarts |
| 731 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 restarts |
| 732 | 11..Verify ping success and flows added in OvS |
| 733 | """ |
| 734 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_pause(self): |
| 735 | """ |
| 736 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 paused |
| 737 | Algo: |
| 738 | 1.Create a vSG VM in compute node |
| 739 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 740 | 3.Ensure VM and containers created properly |
| 741 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 742 | 5.Verify ping gets success |
| 743 | 6.Verify ping success flows added in OvS |
| 744 | 7.Now pause vCPE-1 container |
| 745 | 8.Now repeat step 4 while vCPE-1 in pause state |
| 746 | 9.Verify that ping fails as vCPE-1 container in pause state |
| 747 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 in pause state |
| 748 | 11.Verify ping success and flows added in OvS |
| 749 | """ |
| 750 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_removed(self): |
| 751 | """ |
| 752 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 removed |
| 753 | Algo: |
| 754 | 1.Create a vSG VM in compute node |
| 755 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 756 | 3.Ensure VM and containers created properly |
| 757 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 758 | 5.Verify ping gets success |
| 759 | 6.Verify ping success flows added in OvS |
| 760 | 7.Now remove vCPE-1 container |
| 761 | 8.Now repeat step 4 |
| 762 | 9.Verify that ping fails as vCPE-1 container removed |
| 763 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container |
| 764 | 11.Verify ping success and flows added in OvS |
| 765 | """ |
| 766 | def test_vsg_for_vcpe_instance_removed_and_added_again(self): |
| 767 | """ |
| 768 | Algo: |
| 769 | 1.Create a vSG VM in compute node |
| 770 | 2.Create a vCPE container in vSG VM |
| 771 | 3.Ensure VM and containers created properly |
| 772 | 4.From subscriber end, send ping to public IP |
| 773 | 5.Verify ping gets success |
| 774 | 6.Verify ping success flows added in OvS |
| 775 | 7.Now remove vCPE container in vSG VM |
| 776 | 8.Now repeat step 4 |
| 777 | 9.Verify that ping fails as vCPE container removed |
| 778 | 10.Create the vCPE container again for the same subscriber |
| 779 | 11.Ensure that vCPE created now |
| 780 | 12.Now repeat step 4 |
| 781 | 13.Verify ping success and flows added in OvS |
| 782 | """ |
| 783 | def test_vsg_for_vsg_vm_removed_and_added_again(self): |
| 784 | """ |
| 785 | Algo: |
| 786 | 1.Create a vSG VM in compute node |
| 787 | 2.Create a vCPE container in vSG VM |
| 788 | 3.Ensure VM and containers created properly |
| 789 | 4.From subscriber end, send ping to public IP |
| 790 | 5.Verify ping gets success |
| 791 | 6.Verify ping success flows added in OvS |
| 792 | 7.Now remove vSG VM |
| 793 | 8.Now repeat step 4 |
| 794 | 9.Verify that ping fails as vSG VM not exists |
| 795 | 10.Create the vSG VM and vCPE container in VM again |
| 796 | 11.Ensure that vSG and vCPE created |
| 797 | 12.Now repeat step 4 |
| 798 | 13.Verify ping success and flows added in OvS |
| 799 | """ |
| 800 | |
| 801 | #Test vSG - Subscriber Configuration |
| 802 | def test_vsg_for_configuring_new_subscriber_in_vcpe(self): |
| 803 | """ |
| 804 | Algo: |
| 805 | 1.Create a vSG VM in compute node |
| 806 | 2.Create a vCPE container in vSG VM |
| 807 | 3.Ensure VM and containers created properly |
| 808 | 4.Configure a subscriber in XOS and assign a service id |
| 809 | 5.Set the admin privileges to the subscriber |
| 810 | 6.Verify subscriber configuration is success |
| 811 | """ |
| 812 | def test_vsg_for_adding_subscriber_devices_in_vcpe(self): |
| 813 | """ |
| 814 | Algo: |
| 815 | 1.Create a vSG VM in compute node |
| 816 | 2.Create a vCPE container in vSG VM |
| 817 | 3.Ensure VM and containers created properly |
| 818 | 4.Configure a subscriber in XOS and assign a service id |
| 819 | 5.Verify subscriber successfully configured in vCPE |
| 820 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 821 | 7.Verify all devices ( Macs ) added successfully |
| 822 | """ |
| 823 | def test_vsg_for_removing_subscriber_devices_in_vcpe(self): |
| 824 | """ |
| 825 | Algo: |
| 826 | 1.Create a vSG VM in compute node |
| 827 | 2.Create a vCPE container in vSG VM |
| 828 | 3.Ensure VM and containers created properly |
| 829 | 4.Configure a subscriber in XOS and assign a service id |
| 830 | 5.Verify subscriber successfully configured |
| 831 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 832 | 7.Verify all devices ( Macs ) added successfully |
| 833 | 8.Now remove All the added devices in XOS |
| 834 | 9.Verify all the devices removed |
| 835 | """ |
| 836 | def test_vsg_for_modify_subscriber_devices_in_vcpe(self): |
| 837 | """ |
| 838 | Algo: |
| 839 | 1.Create a vSG VM in compute node |
| 840 | 2.Create a vCPE container in vSG VM |
| 841 | 3.Ensure VM and containers created properly |
| 842 | 4.Configure a user in XOS and assign a service id |
| 843 | 5.Verify subscriber successfully configured in vCPE. |
| 844 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 845 | 7.Verify all devices ( Macs ) added successfully |
| 846 | 8.Now remove few devices in XOS |
| 847 | 9.Verify devices removed successfully |
| 848 | 10.Now add few additional devices in XOS under the same subscriber admin group |
| 849 | 11.Verify newly added devices successfully added |
| 850 | """ |
| 851 | def test_vsg_for_vcpe_login_fails_with_incorrect_subscriber_credentials(self): |
| 852 | """ |
| 853 | Algo: |
| 854 | 1.Create a vSG VM in compute node |
| 855 | 2.Create a vCPE container in vSG VM |
| 856 | 3.Ensure VM and containers created properly |
| 857 | 4.Configure a subscriber in XOS and assign a service id |
| 858 | 5.Verify subscriber successfully configured |
| 859 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 860 | 7.Verify all devices ( Macs ) added successfully |
| 861 | 8.Login vCPE with credentials with which subscriber configured |
| 862 | 9.Verify subscriber successfully logged in |
| 863 | 10.Logout and login again with incorrect credentials ( either user name or password ) |
| 864 | 11.Verify login attempt to vCPE fails wtih incorrect credentials |
| 865 | """ |
| 866 | def test_vsg_for_subscriber_configuration_in_vcpe_retain_after_vcpe_restart(self): |
| 867 | """ |
| 868 | Algo: |
| 869 | 1.Create a vSG VM in compute node |
| 870 | 2.Create a vCPE container in vSG VM |
| 871 | 3.Ensure VM and containers created properly |
| 872 | 4.Configure a subscriber in XOS and assign a service id |
| 873 | 5.Verify subscriber successfully configured |
| 874 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 875 | 7.Verify all devices ( Macs ) added successfully |
| 876 | 8.Restart vCPE ( locate backup config path while restart ) |
| 877 | 9.Verify subscriber details in vCPE after restart should be same as before the restart |
| 878 | """ |
| 879 | def test_vsg_for_create_multiple_vcpe_instances_and_configure_subscriber_in_each_instance(self): |
| 880 | """ |
| 881 | Algo: |
| 882 | 1.Create a vSG VM in compute node |
| 883 | 2.Create 2 vCPE containers in vSG VM |
| 884 | 3.Ensure VM and containers created properly |
| 885 | 4.Configure a subscriber in XOS for each vCPE instance and assign a service id |
| 886 | 5.Verify subscribers successfully configured |
| 887 | 6.Now login vCPE-2 with subscriber-1 credentials |
| 888 | 7.Verify login fails |
| 889 | 8.Now login vCPE-1 with subscriber-2 credentials |
| 890 | 9.Verify login fails |
| 891 | 10.Now login vCPE-1 with subscriber-1 and vCPE-2 with subscriber-2 credentials |
| 892 | 11.Verify that both the subscribers able to login to their respective vCPE containers |
| 893 | """ |
| 894 | def test_vsg_for_same_subscriber_can_be_configured_for_multiple_services(self): |
| 895 | """ |
| 896 | Algo: |
| 897 | 1.Create 2 vSG VMs in compute node |
| 898 | 2.Create a vCPE container in each vSG VM |
| 899 | 3.Ensure VMs and containers created properly |
| 900 | 4.Configure same subscriber in XOS for each vCPE instance and assign a service id |
| 901 | 5.Verify subscriber successfully configured |
| 902 | 6.Now login vCPE-1 with subscriber credentials |
| 903 | 7.Verify login success |
| 904 | 8.Now login vCPE-2 with the same subscriber credentials |
| 905 | 9.Verify login success |
| 906 | """ |
| 907 | |
| 908 | #Test Example Service |
| 909 | def test_vsg_for_subcriber_avail_example_service_running_in_apache_server(self): |
| 910 | """ |
| 911 | Algo: |
| 912 | 1.Create a vSG VM in compute node |
| 913 | 2.Create a vCPE container in each vSG VM |
| 914 | 3.Ensure VM and container created properly |
| 915 | 4.Configure a subscriber in XOS for the vCPE instance and assign a service id |
| 916 | 5.On-board an example service into cord pod |
| 917 | 6.Create a VM in compute node and run the example service ( Apache server ) |
| 918 | 7.Configure the example service with service specific and subscriber specific messages |
| 919 | 8.Verify example service on-boarded successfully |
| 920 | 9.Verify example service running in VM |
| 921 | 10.Run a curl command from subscriber to reach example service |
| 922 | 11.Verify subscriber can successfully reach example service via vSG |
| 923 | 12.Verify that service specific and subscriber specific messages |
| 924 | """ |
| 925 | def test_vsg_for_subcriber_avail_example_service_running_in_apache_server_after_service_restart(self): |
| 926 | """ |
| 927 | Algo: |
| 928 | 1.Create a vSG VM in compute node |
| 929 | 2.Create a vCPE container in each vSG VM |
| 930 | 3.Ensure VM and container created properly |
| 931 | 4.Configure a subscriber in XOS for the vCPE instance and assign a service id |
| 932 | 5.On-board an example service into cord pod |
| 933 | 6.Create a VM in compute node and run the example service ( Apache server ) |
| 934 | 7.Configure the example service with service specific and subscriber specific messages |
| 935 | 8.Verify example service on-boarded successfully |
| 936 | 9.Verify example service running in VM |
| 937 | 10.Run a curl command from subscriber to reach example service |
| 938 | 11.Verify subscriber can successfully reach example service via vSG |
| 939 | 12.Verify that service specific and subscriber specific messages |
| 940 | 13.Restart example service running in VM |
| 941 | 14.Repeat step 10 |
| 942 | 15.Verify the same results as mentioned in steps 11, 12 |
| 943 | """ |
| 944 | |
| 945 | #vCPE Firewall Functionality |
| 946 | def test_vsg_firewall_for_creating_acl_rule_based_on_source_ip(self): |
| 947 | """ |
| 948 | Algo: |
| 949 | 1.Create a vSG VM in compute node |
| 950 | 2.Create vCPE container in the VM |
| 951 | 3.Ensure vSG VM and vCPE container created properly |
| 952 | 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP |
| 953 | 5.Bound the acl rule to WAN interface of vCPE |
| 954 | 6.Verify configuration in vCPE is success |
| 955 | 8.Verify flows added in OvS |
| 956 | """ |
| 957 | def test_vsg_firewall_for_creating_acl_rule_based_on_destination_ip(self): |
| 958 | """ |
| 959 | Algo: |
| 960 | 1.Create a vSG VM in compute node |
| 961 | 2.Create vCPE container in the VM |
| 962 | 3.Ensure vSG VM and vCPE container created properly |
| 963 | 4.Configure ac acl rule in vCPE to deny IP traffic to a destination ip |
| 964 | 5.Bound the acl rule to WAN interface of vCPE |
| 965 | 6.Verify configuration in vCPE is success |
| 966 | 8.Verify flows added in OvS |
| 967 | """ |
| 968 | def test_vsg_firewall_for_acl_deny_rule_based_on_source_ip_traffic(self): |
| 969 | """ |
| 970 | Algo: |
| 971 | 1.Create a vSG VM in compute node |
| 972 | 2.Create vCPE container in the VM |
| 973 | 3.Ensure vSG VM and vCPE container created properly |
| 974 | 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP |
| 975 | 5.Bound the acl rule to WAN interface of vCPE |
| 976 | 6.From subscriber, send ping to the denied IP address |
| 977 | 7.Verify that ping fails as vCPE denies ping response |
| 978 | 8.Verify flows added in OvS |
| 979 | """ |
| 980 | def test_vsg_firewall_for_acl_deny_rule_based_on_destination_ip_traffic(self): |
| 981 | """ |
| 982 | Algo: |
| 983 | 1.Create a vSG VM in compute node |
| 984 | 2.Create vCPE container in the VM |
| 985 | 3.Ensure vSG VM and vCPE container created properly |
| 986 | 4.Configure ac acl rule in vCPE to deny IP traffic to a destination IP |
| 987 | 5.Bound the acl rule to WAN interface of vCPE |
| 988 | 6.From subscriber, send ping to the denied IP address |
| 989 | 7.Verify that ping fails as vCPE drops the ping request at WAN interface |
| 990 | 8.Verify flows added in OvS |
| 991 | """ |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 992 | |
| 993 | def test_vsg_dnsmasq(self): |
| 994 | pass |
| 995 | |
| 996 | def test_vsg_with_external_parental_control_family_shield_for_filter(self): |
| 997 | pass |
| 998 | |
| 999 | def test_vsg_with_external_parental_control_with_answerx(self): |
| 1000 | pass |
| 1001 | |
| 1002 | def test_vsg_for_subscriber_upstream_bandwidth(self): |
| 1003 | pass |
| 1004 | |
| 1005 | def test_vsg_for_subscriber_downstream_bandwidth(self): |
| 1006 | pass |
| 1007 | |
| 1008 | def test_vsg_for_diagnostic_run_of_traceroute(self): |
| 1009 | pass |
| 1010 | |
| 1011 | def test_vsg_for_diagnostic_run_of_tcpdump(self): |
| 1012 | pass |
| 1013 | |
| 1014 | def test_vsg_for_iptable_rules(self): |
| 1015 | pass |
| 1016 | |
| 1017 | def test_vsg_for_iptables_with_neutron(self): |
| 1018 | pass |