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 | # |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 15 | import time |
| 16 | import os |
A.R Karthick | 282f0d3 | 2017-03-28 16:43:59 -0700 | [diff] [blame^] | 17 | import sys |
| 18 | import json |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 19 | from nose.tools import * |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 20 | from CordTestUtils import * |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 21 | from OltConfig import OltConfig |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 22 | from onosclidriver import OnosCliDriver |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame] | 23 | from SSHTestAgent import SSHTestAgent |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 24 | from CordLogger import CordLogger |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 25 | from VSGAccess import VSGAccess |
A R Karthick | 933f5b5 | 2017-03-27 15:27:16 -0700 | [diff] [blame] | 26 | from CordTestUtils import log_test as log |
A.R Karthick | 282f0d3 | 2017-03-28 16:43:59 -0700 | [diff] [blame^] | 27 | |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 28 | log.setLevel('INFO') |
| 29 | |
| 30 | class vsg_exchange(CordLogger): |
| 31 | ONOS_INSTANCES = 3 |
| 32 | V_INF1 = 'veth0' |
| 33 | device_id = 'of:' + get_mac() |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 34 | TEST_IP = '8.8.8.8' |
| 35 | HOST = "10.1.0.1" |
| 36 | USER = "vagrant" |
| 37 | PASS = "vagrant" |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 38 | head_node = os.getenv('HEAD_NODE', 'prod') |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame] | 39 | HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 40 | test_path = os.path.dirname(os.path.realpath(__file__)) |
| 41 | olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json') |
A.R Karthick | 282f0d3 | 2017-03-28 16:43:59 -0700 | [diff] [blame^] | 42 | restApiXos = None |
| 43 | subscriber_account_num_base = 200 |
| 44 | |
| 45 | @classmethod |
| 46 | def setUpCordApi(cls): |
| 47 | our_path = os.path.dirname(os.path.realpath(__file__)) |
| 48 | cord_api_path = os.path.join(our_path, '..', 'cord-api') |
| 49 | framework_path = os.path.join(cord_api_path, 'Framework') |
| 50 | utils_path = os.path.join(framework_path, 'utils') |
| 51 | data_path = os.path.join(cord_api_path, 'Tests', 'data') |
| 52 | subscriber_cfg = os.path.join(data_path, 'Subscriber.json') |
| 53 | volt_tenant_cfg = os.path.join(data_path, 'VoltTenant.json') |
| 54 | |
| 55 | with open(subscriber_cfg) as f: |
| 56 | subscriber_data = json.load(f) |
| 57 | subscriber_info = subscriber_data['SubscriberInfo'] |
| 58 | account_num = cls.subscriber_account_num_base |
| 59 | for subscriber in subscriber_info: |
| 60 | subscriber['identity']['account_num'] = str(account_num) |
| 61 | account_num += 1 |
| 62 | cls.subscriber_info = subscriber_info |
| 63 | |
| 64 | with open(volt_tenant_cfg) as f: |
| 65 | volt_tenant_data = json.load(f) |
| 66 | volt_subscriber_info = volt_tenant_data['voltSubscriberInfo'] |
| 67 | assert_equal(len(volt_subscriber_info), len(cls.subscriber_info)) |
| 68 | account_num = cls.subscriber_account_num_base |
| 69 | for volt_subscriber in volt_subscriber_info: |
| 70 | volt_subscriber['account_num'] = account_num |
| 71 | account_num += 1 |
| 72 | cls.volt_subscriber_info = volt_subscriber_info |
| 73 | |
| 74 | sys.path.append(utils_path) |
| 75 | sys.path.append(framework_path) |
| 76 | from restApi import restApi |
| 77 | restApiXos = restApi() |
| 78 | restApiXos.controllerIP = cls.HEAD_NODE |
| 79 | cls.restApiXos = restApiXos |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 80 | |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 81 | @classmethod |
| 82 | def setUpClass(cls): |
| 83 | cls.controllers = get_controllers() |
| 84 | cls.controller = cls.controllers[0] |
| 85 | cls.cli = None |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 86 | cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file) |
| 87 | cls.vcpes = cls.olt.get_vcpes() |
| 88 | cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp') |
| 89 | vcpe_dhcp = None |
| 90 | vcpe_dhcp_stag = None |
| 91 | vcpe_container = None |
| 92 | #cache the first dhcp vcpe in the class for quick testing |
| 93 | if cls.vcpes_dhcp: |
| 94 | vcpe_container = 'vcpe-{}-{}'.format(cls.vcpes_dhcp[0]['s_tag'], cls.vcpes_dhcp[0]['c_tag']) |
| 95 | vcpe_dhcp = 'vcpe0.{}.{}'.format(cls.vcpes_dhcp[0]['s_tag'], cls.vcpes_dhcp[0]['c_tag']) |
| 96 | vcpe_dhcp_stag = 'vcpe0.{}'.format(cls.vcpes_dhcp[0]['s_tag']) |
| 97 | cls.vcpe_container = vcpe_container |
| 98 | cls.vcpe_dhcp = vcpe_dhcp |
| 99 | cls.vcpe_dhcp_stag = vcpe_dhcp_stag |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 100 | VSGAccess.setUp() |
A.R Karthick | 282f0d3 | 2017-03-28 16:43:59 -0700 | [diff] [blame^] | 101 | cls.setUpCordApi() |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 102 | |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 103 | @classmethod |
| 104 | def tearDownClass(cls): |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 105 | VSGAccess.tearDown() |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 106 | |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 107 | def cliEnter(self, controller = None): |
| 108 | retries = 0 |
| 109 | while retries < 30: |
| 110 | self.cli = OnosCliDriver(controller = controller, connect = True) |
| 111 | if self.cli.handle: |
| 112 | break |
| 113 | else: |
| 114 | retries += 1 |
| 115 | time.sleep(2) |
| 116 | |
| 117 | def cliExit(self): |
| 118 | self.cli.disconnect() |
| 119 | |
| 120 | def onos_shutdown(self, controller = None): |
| 121 | status = True |
| 122 | self.cliEnter(controller = controller) |
| 123 | try: |
| 124 | self.cli.shutdown(timeout = 10) |
| 125 | except: |
| 126 | log.info('Graceful shutdown of ONOS failed for controller: %s' %controller) |
| 127 | status = False |
| 128 | |
| 129 | self.cliExit() |
| 130 | return status |
| 131 | |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame] | 132 | def log_set(self, level = None, app = 'org.onosproject'): |
| 133 | CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 134 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 135 | def test_vsg_health(self): |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 136 | status = VSGAccess.health_check() |
| 137 | assert_equal(status, True) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 138 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 139 | def test_vsg_for_vcpe(self): |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 140 | vsgs = VSGAccess.get_vsgs() |
| 141 | compute_nodes = VSGAccess.get_compute_nodes() |
A.R Karthick | 9ccd0d0 | 2017-03-16 17:11:08 -0700 | [diff] [blame] | 142 | assert_not_equal(len(vsgs), 0) |
| 143 | assert_not_equal(len(compute_nodes), 0) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 144 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 145 | def test_vsg_for_login(self): |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 146 | vsgs = VSGAccess.get_vsgs() |
| 147 | vsg_access_status = map(lambda vsg: vsg.check_access(), vsgs) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 148 | status = filter(lambda st: st == False, vsg_access_status) |
| 149 | assert_equal(len(status), 0) |
| 150 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 151 | def test_vsg_for_default_route_through_testclient(self): |
| 152 | ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS) |
| 153 | cmd = "sudo lxc exec testclient -- route | grep default" |
| 154 | status, output = ssh_agent.run_cmd(cmd) |
| 155 | assert_equal(status, True) |
| 156 | |
| 157 | def test_vsg_for_external_connectivity_through_testclient(self): |
| 158 | ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS) |
| 159 | cmd = "lxc exec testclient -- ping -c 3 8.8.8.8" |
| 160 | status, output = ssh_agent.run_cmd(cmd) |
| 161 | assert_equal( status, True) |
| 162 | |
| 163 | def test_vsg_for_external_connectivity(self): |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 164 | vcpe = self.vcpe_dhcp |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 165 | mgmt = 'eth0' |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 166 | host = '8.8.8.8' |
| 167 | self.success = False |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 168 | assert_not_equal(vcpe, None) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 169 | vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 170 | assert_not_equal(vcpe_ip, None) |
| 171 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe)) |
| 172 | log.info('Sending icmp echo requests to external network 8.8.8.8') |
| 173 | st, _ = getstatusoutput('ping -c 3 8.8.8.8') |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 174 | VSGAccess.restore_interface_config(mgmt, vcpe = vcpe) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 175 | assert_equal(st, 0) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 176 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 177 | def test_vsg_for_external_connectivity_to_google(self): |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 178 | host = 'www.google.com' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 179 | vcpe = self.vcpe_dhcp |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 180 | mgmt = 'eth0' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 181 | assert_not_equal(vcpe, None) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 182 | vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 183 | assert_not_equal(vcpe_ip, None) |
| 184 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe)) |
| 185 | log.info('Sending icmp ping requests to %s' %host) |
| 186 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 187 | VSGAccess.restore_interface_config(mgmt, vcpe = vcpe) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 188 | assert_equal(st, 0) |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 189 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 190 | def test_vsg_for_external_connectivity_to_invalid_host(self): |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 191 | host = 'www.goglee.com' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 192 | vcpe = self.vcpe_dhcp |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 193 | mgmt = 'eth0' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 194 | assert_not_equal(vcpe, None) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 195 | vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 196 | assert_not_equal(vcpe_ip, None) |
| 197 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe)) |
| 198 | log.info('Sending icmp ping requests to non existent host %s' %host) |
| 199 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 200 | VSGAccess.restore_interface_config(mgmt, vcpe = vcpe) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 201 | assert_not_equal(st, 0) |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 202 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 203 | def test_vsg_for_external_connectivity_with_ttl_1(self): |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 204 | host = '8.8.8.8' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 205 | vcpe = self.vcpe_dhcp |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 206 | mgmt = 'eth0' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 207 | assert_not_equal(vcpe, None) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 208 | vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 209 | assert_not_equal(vcpe_ip, None) |
| 210 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe)) |
| 211 | log.info('Sending icmp ping requests to host %s with ttl 1' %host) |
| 212 | st, _ = getstatusoutput('ping -c 1 -t 1 {}'.format(host)) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 213 | VSGAccess.restore_interface_config(mgmt, vcpe = vcpe) |
A.R Karthick | 33cfdbe | 2017-03-17 18:03:48 -0700 | [diff] [blame] | 214 | assert_not_equal(st, 0) |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 215 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 216 | def test_vsg_for_external_connectivity_with_wan_interface_toggle_in_vcpe(self): |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 217 | host = '8.8.8.8' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 218 | mgmt = 'eth0' |
| 219 | vcpe = self.vcpe_container |
| 220 | assert_not_equal(vcpe, None) |
| 221 | assert_not_equal(self.vcpe_dhcp, None) |
| 222 | #first get dhcp on the vcpe interface |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 223 | vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 224 | assert_not_equal(vcpe_ip, None) |
| 225 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp)) |
| 226 | log.info('Sending ICMP pings to host %s' %(host)) |
| 227 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
| 228 | if st != 0: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 229 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 230 | assert_equal(st, 0) |
| 231 | #bring down the wan interface and check again |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 232 | st = VSGAccess.vcpe_wan_down(vcpe) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 233 | if st is False: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 234 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 235 | assert_equal(st, True) |
| 236 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
| 237 | if st == 0: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 238 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 239 | assert_not_equal(st, 0) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 240 | st = VSGAccess.vcpe_wan_up(vcpe) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 241 | if st is False: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 242 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 243 | assert_equal(st, True) |
| 244 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 245 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 246 | assert_equal(st, 0) |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 247 | |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 248 | def test_vsg_for_external_connectivity_with_lan_interface_toggle_in_vcpe(self): |
Anil Kumar Sanka | 87115b0 | 2017-03-14 17:46:47 +0000 | [diff] [blame] | 249 | host = '8.8.8.8' |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 250 | mgmt = 'eth0' |
| 251 | vcpe = self.vcpe_container |
| 252 | assert_not_equal(vcpe, None) |
| 253 | assert_not_equal(self.vcpe_dhcp, None) |
| 254 | #first get dhcp on the vcpe interface |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 255 | vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 256 | assert_not_equal(vcpe_ip, None) |
| 257 | log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp)) |
| 258 | log.info('Sending ICMP pings to host %s' %(host)) |
| 259 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
| 260 | if st != 0: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 261 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 262 | assert_equal(st, 0) |
| 263 | #bring down the lan interface and check again |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 264 | st = VSGAccess.vcpe_lan_down(vcpe) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 265 | if st is False: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 266 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 267 | assert_equal(st, True) |
| 268 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
| 269 | if st == 0: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 270 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 271 | assert_not_equal(st, 0) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 272 | st = VSGAccess.vcpe_lan_up(vcpe) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 273 | if st is False: |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 274 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 275 | assert_equal(st, True) |
| 276 | st, _ = getstatusoutput('ping -c 1 {}'.format(host)) |
A R Karthick | d0fdf3b | 2017-03-21 16:54:22 -0700 | [diff] [blame] | 277 | VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp) |
A R Karthick | 03f40aa | 2017-03-20 19:33:55 -0700 | [diff] [blame] | 278 | assert_equal(st, 0) |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 279 | |
A.R Karthick | 282f0d3 | 2017-03-28 16:43:59 -0700 | [diff] [blame^] | 280 | def test_vsg_xos_subscriber(self): |
| 281 | subscriber_info = self.subscriber_info[0] |
| 282 | volt_subscriber_info = self.volt_subscriber_info[0] |
| 283 | result = self.restApiXos.ApiPost('TENANT_SUBSCRIBER', subscriber_info) |
| 284 | assert_equal(result, True) |
| 285 | result = self.restApiXos.ApiGet('TENANT_SUBSCRIBER') |
| 286 | assert_not_equal(result, None) |
| 287 | subId = self.restApiXos.getSubscriberId(result, volt_subscriber_info['account_num']) |
| 288 | assert_not_equal(subId, '0') |
| 289 | log.info('Subscriber ID for account num %d = %s' %(volt_subscriber_info['account_num'], subId)) |
| 290 | volt_tenant = volt_subscriber_info['voltTenant'] |
| 291 | #update the subscriber id in the tenant info before making the rest |
| 292 | volt_tenant['subscriber'] = subId |
| 293 | result = self.restApiXos.ApiPost('TENANT_VOLT', volt_tenant) |
| 294 | assert_equal(result, True) |
| 295 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 296 | def test_vsg_for_ping_from_vsg_to_external_network(self): |
| 297 | """ |
| 298 | Algo: |
| 299 | 1.Create a vSG VM in compute node |
| 300 | 2.Ensure VM created properly |
| 301 | 3.Verify login to VM success |
| 302 | 4.Do ping to external network from vSG VM |
| 303 | 5.Verify that ping gets success |
| 304 | 6.Verify ping success flows added in OvS |
| 305 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 306 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 307 | def test_vsg_for_ping_from_vcpe_to_external_network(self): |
| 308 | """ |
| 309 | Algo: |
| 310 | 1.Create a vSG VM in compute node |
| 311 | 2.Create a vCPE container inside VM |
| 312 | 3.Verify both VM and Container created properly |
| 313 | 4.Verify login to vCPE container success |
| 314 | 5.Do ping to external network from vCPE container |
| 315 | 6.Verify that ping gets success |
| 316 | 7.Verify ping success flows added in OvS |
| 317 | """ |
| 318 | |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 319 | def test_vsg_for_dns_service(self): |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 320 | """ |
| 321 | Algo: |
| 322 | 1. Create a test client in Prod VM |
| 323 | 2. Create a vCPE container in vSG VM inside compute Node |
| 324 | 3. Ensure vSG VM and vCPE container created properly |
| 325 | 4. Enable dns service in vCPE ( if not by default ) |
| 326 | 5. Send ping request from test client to valid domain address say, 'www.google'com |
| 327 | 6. Verify that dns should resolve ping should success |
| 328 | 7. Now send ping request to invalid domain address say 'www.invalidaddress'.com' |
| 329 | 8. Verify that dns resolve should fail and hence ping |
| 330 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 331 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 332 | def test_vsg_for_10_subscribers_for_same_service(self): |
| 333 | """ |
| 334 | Algo: |
| 335 | 1.Create a vSG VM in compute node |
| 336 | 2.Create 10 vCPE containers for 10 subscribers, in vSG VM |
| 337 | 3.Ensure vSG VM and vCPE container created properly |
| 338 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP |
| 339 | 5.Verify that ping success for all 10 subscribers |
| 340 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 341 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 342 | def test_vsg_for_10_subscribers_for_same_service_ping_invalid_ip(self): |
| 343 | """ |
| 344 | Algo: |
| 345 | 1.Create a vSG VM in compute Node |
| 346 | 2.Create 10 vCPE containers for 10 subscribers, in vSG VM |
| 347 | 3.Ensure vSG VM and vCPE container created properly |
| 348 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP |
| 349 | 5.Verify that ping fails for all 10 subscribers |
| 350 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 351 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 352 | def test_vsg_for_10_subscribers_for_same_service_ping_valid_and_invalid_ip(self): |
| 353 | """ |
| 354 | Algo: |
| 355 | 1.Create a vSG VM in VM |
| 356 | 2.Create 10 vCPE containers for 10 subscribers, in vSG VM |
| 357 | 3.Ensure vSG VM and vCPE container created properly |
| 358 | 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP |
| 359 | 5.Verify that ping success for all 5 subscribers |
| 360 | 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP |
| 361 | 7.Verify that ping fails for all 5 subscribers |
| 362 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 363 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 364 | def test_vsg_for_100_subscribers_for_same_service(self): |
| 365 | """ |
| 366 | Algo: |
| 367 | 1.Create a vSG VM in compute node |
| 368 | 2.Create 100 vCPE containers for 100 subscribers, in vSG VM |
| 369 | 3.Ensure vSG VM and vCPE container created properly |
| 370 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP |
| 371 | 5.Verify that ping success for all 100 subscribers |
| 372 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 373 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 374 | def test_vsg_for_100_subscribers_for_same_service_ping_invalid_ip(self): |
| 375 | """ |
| 376 | Algo: |
| 377 | 1.Create a vSG VM in compute Node |
| 378 | 2.Create 10 vCPE containers for 100 subscribers, in vSG VM |
| 379 | 3.Ensure vSG VM and vCPE container created properly |
| 380 | 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP |
| 381 | 5.Verify that ping fails for all 100 subscribers |
| 382 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 383 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 384 | def test_vsg_for_100_subscribers_for_same_service_ping_valid_and_invalid_ip(self): |
| 385 | """ |
| 386 | Algo: |
| 387 | 1.Create a vSG VM in VM |
| 388 | 2.Create 10 vCPE containers for 100 subscribers, in vSG VM |
| 389 | 3.Ensure vSG VM and vCPE container created properly |
| 390 | 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP |
| 391 | 5.Verify that ping success for all 5 subscribers |
| 392 | 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP |
| 393 | 7.Verify that ping fails for all 5 subscribers |
| 394 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 395 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 396 | def test_vsg_for_packet_received_with_invalid_ip_fields(self): |
| 397 | """ |
| 398 | Algo: |
| 399 | 1.Create a vSG VM in compute node |
| 400 | 2.Create a vCPE container in vSG VM |
| 401 | 3.Ensure vSG VM and vCPE container created properly |
| 402 | 4.From subscriber, send a ping packet with invalid ip fields |
| 403 | 5.Verify that vSG drops the packet |
| 404 | 6.Verify ping fails |
| 405 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 406 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 407 | def test_vsg_for_packet_received_with_invalid_mac_fields(self): |
| 408 | """ |
| 409 | Algo: |
| 410 | 1.Create a vSG VM in compute node |
| 411 | 2.Create a vCPE container in vSG VM |
| 412 | 3.Ensure vSG VM and vCPE container created properly |
| 413 | 4.From subscriber, send a ping packet with invalid mac fields |
| 414 | 5.Verify that vSG drops the packet |
| 415 | 6.Verify ping fails |
| 416 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 417 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 418 | def test_vsg_for_vlan_id_mismatch_in_stag(self): |
| 419 | """ |
| 420 | Algo: |
| 421 | 1.Create a vSG VM in compute Node |
| 422 | 2.Create a vCPE container in vSG VM |
| 423 | 3.Ensure vSG VM and vCPE container created properly |
| 424 | 4.Send a ping request to external valid IP from subscriber, with incorrect vlan id in s-tag and valid c-tag |
| 425 | 5.Verify that ping fails as the packet drops at VM entry |
| 426 | 6.Repeat step 4 with correct s-tag |
| 427 | 7.Verify that ping success |
| 428 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 429 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 430 | def test_vsg_for_vlan_id_mismatch_in_ctag(self): |
| 431 | """ |
| 432 | Algo: |
| 433 | 1.Create a vSG VM in compute node |
| 434 | 2.Create a vCPE container in vSG VM |
| 435 | 3.Ensure vSG VM and vCPE container created properly |
| 436 | 4.Send a ping request to external valid IP from subscriber, with valid s-tag and incorrect vlan id in c-tag |
| 437 | 5.Verify that ping fails as the packet drops at vCPE container entry |
| 438 | 6.Repeat step 4 with valid s-tag and c-tag |
| 439 | 7.Verify that ping success |
| 440 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 441 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 442 | def test_vsg_for_matching_and_mismatching_vlan_id_in_stag(self): |
| 443 | """ |
| 444 | Algo: |
| 445 | 1.Create two vSG VMs in compute node |
| 446 | 2.Create a vCPE container in each vSG VM |
| 447 | 3.Ensure vSG VM and vCPE container created properly |
| 448 | 4.From subscriber one, send ping request with valid s and c tags |
| 449 | 5.From subscriber two, send ping request with vlan id mismatch in s-tag and valid c tags |
| 450 | 6.Verify that ping success for only subscriber one and fails for two. |
| 451 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 452 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 453 | def test_vsg_for_matching_and_mismatching_vlan_id_in_ctag(self): |
| 454 | """ |
| 455 | Algo: |
| 456 | 1.Create a vSG VM in compute node |
| 457 | 2.Create two vCPE containers in vSG VM |
| 458 | 3.Ensure vSG VM and vCPE container created properly |
| 459 | 4.From subscriber one, send ping request with valid s and c tags |
| 460 | 5.From subscriber two, send ping request with valid s-tag and vlan id mismatch in c-tag |
| 461 | 6.Verify that ping success for only subscriber one and fails for two |
| 462 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 463 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 464 | def test_vsg_for_out_of_range_vlanid_in_ctag(self): |
| 465 | """ |
| 466 | Algo: |
| 467 | 1.Create a vSG VM in compute node |
| 468 | 2.Create a vCPE container in vSG VM |
| 469 | 3.Ensure vSG VM and vCPE container created properly |
| 470 | 4.From subscriber, send ping request with valid stag and vlan id in c-tag is an out of range value ( like 0,4097 ) |
| 471 | 4.Verify that ping fails as the ping packets drops at vCPE container entry |
| 472 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 473 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 474 | def test_vsg_for_out_of_range_vlanid_in_stag(self): |
| 475 | """ |
| 476 | Algo: |
| 477 | 1.Create a vSG VM in compute node |
| 478 | 2.Create a vCPE container in vSG VM |
| 479 | 3.Ensure vSG VM and vCPE container created properly |
| 480 | 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 |
| 481 | 4.Verify that ping fails as the ping packets drops at vSG VM entry |
| 482 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 483 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 484 | def test_vsg_without_creating_vcpe_instance(self): |
| 485 | """ |
| 486 | Algo: |
| 487 | 1.Create a vSG VM in compute Node |
| 488 | 2.Ensure vSG VM created properly |
| 489 | 3.Do not create vCPE container inside vSG VM |
| 490 | 4.From a subscriber, send ping to external valid IP |
| 491 | 5.Verify that ping fails as the ping packet drops at vSG VM entry itself. |
| 492 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 493 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 494 | def test_vsg_for_remove_vcpe_instance(self): |
| 495 | """ |
| 496 | Algo: |
| 497 | 1.Create a vSG VM in compute node |
| 498 | 2.Create a vCPE container in vSG VM |
| 499 | 3.Ensure vSG VM and vCPE container created properly |
| 500 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 501 | 5.Verify that ping success |
| 502 | 6.Verify ping success flows in OvS switch in compute node |
| 503 | 7.Now remove the vCPE container in vSG VM |
| 504 | 8.Ensure that the container removed properly |
| 505 | 9.Repeat step 4 |
| 506 | 10.Verify that now, ping fails |
| 507 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 508 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 509 | def test_vsg_for_restart_vcpe_instance(self): |
| 510 | """ |
| 511 | Algo: |
| 512 | 1.Create a vSG VM in compute node |
| 513 | 2.Create a vCPE container in vSG VM |
| 514 | 3.Ensure vSG VM and vCPE container created properly |
| 515 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 516 | 5.Verify that ping success |
| 517 | 6.Verify ping success flows in OvS switch in compute node |
| 518 | 7.Now restart the vCPE container in vSG VM |
| 519 | 8.Ensure that the container came up after restart |
| 520 | 9.Repeat step 4 |
| 521 | 10.Verify that now,ping gets success and flows added in OvS |
| 522 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 523 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 524 | def test_vsg_for_restart_vsg_vm(self): |
| 525 | """ |
| 526 | Algo: |
| 527 | 1.Create a vSG VM in compute node |
| 528 | 2.Create a vCPE container in vSG VM |
| 529 | 3.Ensure vSG VM and vCPE container created properly |
| 530 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 531 | 5.Verify that ping success |
| 532 | 6.Verify ping success flows in OvS switch in compute node |
| 533 | 7.Now restart the vSG VM |
| 534 | 8.Ensure that the vSG comes up properly after restart |
| 535 | 9.Verify that vCPE container comes up after vSG restart |
| 536 | 10.Repeat step 4 |
| 537 | 11.Verify that now,ping gets success and flows added in OvS |
| 538 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 539 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 540 | def test_vsg_for_pause_vcpe_instance(self): |
| 541 | """ |
| 542 | Algo: |
| 543 | 1.Create a vSG VM in compute node |
| 544 | 2.Create a vCPE container in vSG VM |
| 545 | 3.Ensure vSG VM and vCPE container created properly |
| 546 | 4.From subscriber, send ping request with valid s-tag and c-tag |
| 547 | 5.Verify that ping success |
| 548 | 6.Verify ping success flows in OvS switch in compute node |
| 549 | 7.Now pause vCPE container in vSG VM for a while |
| 550 | 8.Ensure that the container state is pause |
| 551 | 9.Repeat step 4 |
| 552 | 10.Verify that now,ping fails now and verify flows in OvS |
| 553 | 11.Now resume the container |
| 554 | 12.Now repeat step 4 again |
| 555 | 13.Verify that now, ping gets success |
| 556 | 14.Verify ping success flows in OvS |
| 557 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 558 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 559 | def test_vsg_for_extract_all_compute_stats_from_all_vcpe_containers(self): |
| 560 | """ |
| 561 | Algo: |
| 562 | 1.Create a vSG VM in compute node |
| 563 | 2.Create 10 vCPE containers in VM |
| 564 | 3.Ensure vSG VM and vCPE containers created properly |
| 565 | 4.Login to all vCPE containers |
| 566 | 4.Get all compute stats from all vCPE containers |
| 567 | 5.Verify the stats # verification method need to add |
| 568 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 569 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 570 | def test_vsg_for_extract_dns_stats_from_all_vcpe_containers(self): |
| 571 | """ |
| 572 | Algo: |
| 573 | 1.Create a vSG VM in compute node |
| 574 | 2.Create 10 vCPE containers in VM |
| 575 | 3.Ensure vSG VM and vCPE containers created properly |
| 576 | 4.From 10 subscribers, send ping to valid and invalid dns hosts |
| 577 | 5.Verify dns resolves and ping success for valid dns hosts |
| 578 | 6.Verify ping fails for invalid dns hosts |
| 579 | 7.Verify dns host name resolve flows in OvS |
| 580 | 8.Login to all 10 vCPE containers |
| 581 | 9.Extract all dns stats |
| 582 | 10.Verify dns stats for queries sent, queries received for dns host resolve success and failed scenarios |
| 583 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 584 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 585 | def test_vsg_for_subscriber_access_two_vsg_services(self): |
| 586 | """ |
| 587 | # Intention is to verify if subscriber can reach internet via two vSG VMs |
| 588 | Algo: |
| 589 | 1.Create two vSG VMs for two services in compute node |
| 590 | 2.Create one vCPE container in each VM for one subscriber |
| 591 | 3.Ensure VMs and containers created properly |
| 592 | 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag |
| 593 | 5.Verify ping gets success |
| 594 | 6.Verify ping success flows in OvS |
| 595 | 7.Now repeat step 4 with stag corresponds to vSG-2 VM |
| 596 | 8.Verify that ping again success |
| 597 | 9.Verify ping success flows in OvS |
| 598 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 599 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 600 | def test_vsg_for_subscriber_access_service2_if_service1_goes_down(self): |
| 601 | """ |
| 602 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down |
| 603 | Algo: |
| 604 | 1.Create two vSG VMs for two services in compute node |
| 605 | 2.Create one vCPE container in each VM for one subscriber |
| 606 | 3.Ensure VMs and containers created properly |
| 607 | 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag |
| 608 | 5.Verify ping gets success |
| 609 | 6.Verify ping success flows in OvS |
| 610 | 7.Down the vSG-1 VM |
| 611 | 8.Now repeat step 4 |
| 612 | 9.Verify that ping fails as vSG-1 is down |
| 613 | 10.Repeat step 4 with stag corresponding to vSG-2 |
| 614 | 9.Verify ping success and flows added in OvS |
| 615 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 616 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 617 | def test_vsg_for_subscriber_access_service2_if_service1_goes_restart(self): |
| 618 | """ |
| 619 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts |
| 620 | Algo: |
| 621 | 1.Create two vSG VMs for two services in compute node |
| 622 | 2.Create one vCPE container in each VM for one subscriber |
| 623 | 3.Ensure VMs and containers created properly |
| 624 | 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag |
| 625 | 5.Verify ping gets success |
| 626 | 6.Verify ping success flows added in OvS |
| 627 | 7.Now restart vSG-1 VM |
| 628 | 8.Now repeat step 4 while vSG-1 VM restarts |
| 629 | 9.Verify that ping fails as vSG-1 is restarting |
| 630 | 10.Repeat step 4 with stag corresponding to vSG-2 while vSG-1 VM restarts |
| 631 | 11.Verify ping success and flows added in OvS |
| 632 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 633 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 634 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_goes_down(self): |
| 635 | """ |
| 636 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down |
| 637 | Algo: |
| 638 | 1.Create a vSG VM in compute node |
| 639 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 640 | 3.Ensure VM and containers created properly |
| 641 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 642 | 5.Verify ping gets success |
| 643 | 6.Verify ping success flows added in OvS |
| 644 | 7.Now stop vCPE-1 container |
| 645 | 8.Now repeat step 4 |
| 646 | 9.Verify that ping fails as vCPE-1 container is down |
| 647 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container |
| 648 | 11.Verify ping success and flows added in OvS |
| 649 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 650 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 651 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_restart(self): |
| 652 | """ |
| 653 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts |
| 654 | Algo: |
| 655 | 1.Create a vSG VM in compute node |
| 656 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 657 | 3.Ensure VM and containers created properly |
| 658 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 659 | 5.Verify ping gets success |
| 660 | 6.Verify ping success flows added in OvS |
| 661 | 7.Now restart vCPE-1 container |
| 662 | 8.Now repeat step 4 while vCPE-1 restarts |
| 663 | 9.Verify that ping fails as vCPE-1 container is restarts |
| 664 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 restarts |
| 665 | 11..Verify ping success and flows added in OvS |
| 666 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 667 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 668 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_pause(self): |
| 669 | """ |
| 670 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 paused |
| 671 | Algo: |
| 672 | 1.Create a vSG VM in compute node |
| 673 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 674 | 3.Ensure VM and containers created properly |
| 675 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 676 | 5.Verify ping gets success |
| 677 | 6.Verify ping success flows added in OvS |
| 678 | 7.Now pause vCPE-1 container |
| 679 | 8.Now repeat step 4 while vCPE-1 in pause state |
| 680 | 9.Verify that ping fails as vCPE-1 container in pause state |
| 681 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 in pause state |
| 682 | 11.Verify ping success and flows added in OvS |
| 683 | """ |
| 684 | def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_removed(self): |
| 685 | """ |
| 686 | # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 removed |
| 687 | Algo: |
| 688 | 1.Create a vSG VM in compute node |
| 689 | 2.Create two vCPE containers corresponds to two subscribers in vSG VM |
| 690 | 3.Ensure VM and containers created properly |
| 691 | 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag |
| 692 | 5.Verify ping gets success |
| 693 | 6.Verify ping success flows added in OvS |
| 694 | 7.Now remove vCPE-1 container |
| 695 | 8.Now repeat step 4 |
| 696 | 9.Verify that ping fails as vCPE-1 container removed |
| 697 | 10.Repeat step 4 with ctag corresponding to vCPE-2 container |
| 698 | 11.Verify ping success and flows added in OvS |
| 699 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 700 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 701 | def test_vsg_for_vcpe_instance_removed_and_added_again(self): |
| 702 | """ |
| 703 | Algo: |
| 704 | 1.Create a vSG VM in compute node |
| 705 | 2.Create a vCPE container in vSG VM |
| 706 | 3.Ensure VM and containers created properly |
| 707 | 4.From subscriber end, send ping to public IP |
| 708 | 5.Verify ping gets success |
| 709 | 6.Verify ping success flows added in OvS |
| 710 | 7.Now remove vCPE container in vSG VM |
| 711 | 8.Now repeat step 4 |
| 712 | 9.Verify that ping fails as vCPE container removed |
| 713 | 10.Create the vCPE container again for the same subscriber |
| 714 | 11.Ensure that vCPE created now |
| 715 | 12.Now repeat step 4 |
| 716 | 13.Verify ping success and flows added in OvS |
| 717 | """ |
A R Karthick | 6375149 | 2017-03-22 09:28:01 -0700 | [diff] [blame] | 718 | |
Anil Kumar Sanka | 1213d4c | 2017-02-23 22:50:48 +0000 | [diff] [blame] | 719 | def test_vsg_for_vsg_vm_removed_and_added_again(self): |
| 720 | """ |
| 721 | Algo: |
| 722 | 1.Create a vSG VM in compute node |
| 723 | 2.Create a vCPE container in vSG VM |
| 724 | 3.Ensure VM and containers created properly |
| 725 | 4.From subscriber end, send ping to public IP |
| 726 | 5.Verify ping gets success |
| 727 | 6.Verify ping success flows added in OvS |
| 728 | 7.Now remove vSG VM |
| 729 | 8.Now repeat step 4 |
| 730 | 9.Verify that ping fails as vSG VM not exists |
| 731 | 10.Create the vSG VM and vCPE container in VM again |
| 732 | 11.Ensure that vSG and vCPE created |
| 733 | 12.Now repeat step 4 |
| 734 | 13.Verify ping success and flows added in OvS |
| 735 | """ |
| 736 | |
| 737 | #Test vSG - Subscriber Configuration |
| 738 | def test_vsg_for_configuring_new_subscriber_in_vcpe(self): |
| 739 | """ |
| 740 | Algo: |
| 741 | 1.Create a vSG VM in compute node |
| 742 | 2.Create a vCPE container in vSG VM |
| 743 | 3.Ensure VM and containers created properly |
| 744 | 4.Configure a subscriber in XOS and assign a service id |
| 745 | 5.Set the admin privileges to the subscriber |
| 746 | 6.Verify subscriber configuration is success |
| 747 | """ |
| 748 | def test_vsg_for_adding_subscriber_devices_in_vcpe(self): |
| 749 | """ |
| 750 | Algo: |
| 751 | 1.Create a vSG VM in compute node |
| 752 | 2.Create a vCPE container in vSG VM |
| 753 | 3.Ensure VM and containers created properly |
| 754 | 4.Configure a subscriber in XOS and assign a service id |
| 755 | 5.Verify subscriber successfully configured in vCPE |
| 756 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 757 | 7.Verify all devices ( Macs ) added successfully |
| 758 | """ |
| 759 | def test_vsg_for_removing_subscriber_devices_in_vcpe(self): |
| 760 | """ |
| 761 | Algo: |
| 762 | 1.Create a vSG VM in compute node |
| 763 | 2.Create a vCPE container in vSG VM |
| 764 | 3.Ensure VM and containers created properly |
| 765 | 4.Configure a subscriber in XOS and assign a service id |
| 766 | 5.Verify subscriber successfully configured |
| 767 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 768 | 7.Verify all devices ( Macs ) added successfully |
| 769 | 8.Now remove All the added devices in XOS |
| 770 | 9.Verify all the devices removed |
| 771 | """ |
| 772 | def test_vsg_for_modify_subscriber_devices_in_vcpe(self): |
| 773 | """ |
| 774 | Algo: |
| 775 | 1.Create a vSG VM in compute node |
| 776 | 2.Create a vCPE container in vSG VM |
| 777 | 3.Ensure VM and containers created properly |
| 778 | 4.Configure a user in XOS and assign a service id |
| 779 | 5.Verify subscriber successfully configured in vCPE. |
| 780 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 781 | 7.Verify all devices ( Macs ) added successfully |
| 782 | 8.Now remove few devices in XOS |
| 783 | 9.Verify devices removed successfully |
| 784 | 10.Now add few additional devices in XOS under the same subscriber admin group |
| 785 | 11.Verify newly added devices successfully added |
| 786 | """ |
| 787 | def test_vsg_for_vcpe_login_fails_with_incorrect_subscriber_credentials(self): |
| 788 | """ |
| 789 | Algo: |
| 790 | 1.Create a vSG VM in compute node |
| 791 | 2.Create a vCPE container in vSG VM |
| 792 | 3.Ensure VM and containers created properly |
| 793 | 4.Configure a subscriber in XOS and assign a service id |
| 794 | 5.Verify subscriber successfully configured |
| 795 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 796 | 7.Verify all devices ( Macs ) added successfully |
| 797 | 8.Login vCPE with credentials with which subscriber configured |
| 798 | 9.Verify subscriber successfully logged in |
| 799 | 10.Logout and login again with incorrect credentials ( either user name or password ) |
| 800 | 11.Verify login attempt to vCPE fails wtih incorrect credentials |
| 801 | """ |
| 802 | def test_vsg_for_subscriber_configuration_in_vcpe_retain_after_vcpe_restart(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.Verify subscriber successfully configured |
| 810 | 6.Now add devices( Mac addresses ) under the subscriber admin group |
| 811 | 7.Verify all devices ( Macs ) added successfully |
| 812 | 8.Restart vCPE ( locate backup config path while restart ) |
| 813 | 9.Verify subscriber details in vCPE after restart should be same as before the restart |
| 814 | """ |
| 815 | def test_vsg_for_create_multiple_vcpe_instances_and_configure_subscriber_in_each_instance(self): |
| 816 | """ |
| 817 | Algo: |
| 818 | 1.Create a vSG VM in compute node |
| 819 | 2.Create 2 vCPE containers in vSG VM |
| 820 | 3.Ensure VM and containers created properly |
| 821 | 4.Configure a subscriber in XOS for each vCPE instance and assign a service id |
| 822 | 5.Verify subscribers successfully configured |
| 823 | 6.Now login vCPE-2 with subscriber-1 credentials |
| 824 | 7.Verify login fails |
| 825 | 8.Now login vCPE-1 with subscriber-2 credentials |
| 826 | 9.Verify login fails |
| 827 | 10.Now login vCPE-1 with subscriber-1 and vCPE-2 with subscriber-2 credentials |
| 828 | 11.Verify that both the subscribers able to login to their respective vCPE containers |
| 829 | """ |
| 830 | def test_vsg_for_same_subscriber_can_be_configured_for_multiple_services(self): |
| 831 | """ |
| 832 | Algo: |
| 833 | 1.Create 2 vSG VMs in compute node |
| 834 | 2.Create a vCPE container in each vSG VM |
| 835 | 3.Ensure VMs and containers created properly |
| 836 | 4.Configure same subscriber in XOS for each vCPE instance and assign a service id |
| 837 | 5.Verify subscriber successfully configured |
| 838 | 6.Now login vCPE-1 with subscriber credentials |
| 839 | 7.Verify login success |
| 840 | 8.Now login vCPE-2 with the same subscriber credentials |
| 841 | 9.Verify login success |
| 842 | """ |
| 843 | |
| 844 | #Test Example Service |
| 845 | def test_vsg_for_subcriber_avail_example_service_running_in_apache_server(self): |
| 846 | """ |
| 847 | Algo: |
| 848 | 1.Create a vSG VM in compute node |
| 849 | 2.Create a vCPE container in each vSG VM |
| 850 | 3.Ensure VM and container created properly |
| 851 | 4.Configure a subscriber in XOS for the vCPE instance and assign a service id |
| 852 | 5.On-board an example service into cord pod |
| 853 | 6.Create a VM in compute node and run the example service ( Apache server ) |
| 854 | 7.Configure the example service with service specific and subscriber specific messages |
| 855 | 8.Verify example service on-boarded successfully |
| 856 | 9.Verify example service running in VM |
| 857 | 10.Run a curl command from subscriber to reach example service |
| 858 | 11.Verify subscriber can successfully reach example service via vSG |
| 859 | 12.Verify that service specific and subscriber specific messages |
| 860 | """ |
| 861 | def test_vsg_for_subcriber_avail_example_service_running_in_apache_server_after_service_restart(self): |
| 862 | """ |
| 863 | Algo: |
| 864 | 1.Create a vSG VM in compute node |
| 865 | 2.Create a vCPE container in each vSG VM |
| 866 | 3.Ensure VM and container created properly |
| 867 | 4.Configure a subscriber in XOS for the vCPE instance and assign a service id |
| 868 | 5.On-board an example service into cord pod |
| 869 | 6.Create a VM in compute node and run the example service ( Apache server ) |
| 870 | 7.Configure the example service with service specific and subscriber specific messages |
| 871 | 8.Verify example service on-boarded successfully |
| 872 | 9.Verify example service running in VM |
| 873 | 10.Run a curl command from subscriber to reach example service |
| 874 | 11.Verify subscriber can successfully reach example service via vSG |
| 875 | 12.Verify that service specific and subscriber specific messages |
| 876 | 13.Restart example service running in VM |
| 877 | 14.Repeat step 10 |
| 878 | 15.Verify the same results as mentioned in steps 11, 12 |
| 879 | """ |
| 880 | |
| 881 | #vCPE Firewall Functionality |
| 882 | def test_vsg_firewall_for_creating_acl_rule_based_on_source_ip(self): |
| 883 | """ |
| 884 | Algo: |
| 885 | 1.Create a vSG VM in compute node |
| 886 | 2.Create vCPE container in the VM |
| 887 | 3.Ensure vSG VM and vCPE container created properly |
| 888 | 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP |
| 889 | 5.Bound the acl rule to WAN interface of vCPE |
| 890 | 6.Verify configuration in vCPE is success |
| 891 | 8.Verify flows added in OvS |
| 892 | """ |
| 893 | def test_vsg_firewall_for_creating_acl_rule_based_on_destination_ip(self): |
| 894 | """ |
| 895 | Algo: |
| 896 | 1.Create a vSG VM in compute node |
| 897 | 2.Create vCPE container in the VM |
| 898 | 3.Ensure vSG VM and vCPE container created properly |
| 899 | 4.Configure ac acl rule in vCPE to deny IP traffic to a destination ip |
| 900 | 5.Bound the acl rule to WAN interface of vCPE |
| 901 | 6.Verify configuration in vCPE is success |
| 902 | 8.Verify flows added in OvS |
| 903 | """ |
| 904 | def test_vsg_firewall_for_acl_deny_rule_based_on_source_ip_traffic(self): |
| 905 | """ |
| 906 | Algo: |
| 907 | 1.Create a vSG VM in compute node |
| 908 | 2.Create vCPE container in the VM |
| 909 | 3.Ensure vSG VM and vCPE container created properly |
| 910 | 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP |
| 911 | 5.Bound the acl rule to WAN interface of vCPE |
| 912 | 6.From subscriber, send ping to the denied IP address |
| 913 | 7.Verify that ping fails as vCPE denies ping response |
| 914 | 8.Verify flows added in OvS |
| 915 | """ |
| 916 | def test_vsg_firewall_for_acl_deny_rule_based_on_destination_ip_traffic(self): |
| 917 | """ |
| 918 | Algo: |
| 919 | 1.Create a vSG VM in compute node |
| 920 | 2.Create vCPE container in the VM |
| 921 | 3.Ensure vSG VM and vCPE container created properly |
| 922 | 4.Configure ac acl rule in vCPE to deny IP traffic to a destination IP |
| 923 | 5.Bound the acl rule to WAN interface of vCPE |
| 924 | 6.From subscriber, send ping to the denied IP address |
| 925 | 7.Verify that ping fails as vCPE drops the ping request at WAN interface |
| 926 | 8.Verify flows added in OvS |
| 927 | """ |
Chetan Gaonker | 5241883 | 2017-01-26 23:03:13 +0000 | [diff] [blame] | 928 | |
| 929 | def test_vsg_dnsmasq(self): |
| 930 | pass |
| 931 | |
| 932 | def test_vsg_with_external_parental_control_family_shield_for_filter(self): |
| 933 | pass |
| 934 | |
| 935 | def test_vsg_with_external_parental_control_with_answerx(self): |
| 936 | pass |
| 937 | |
| 938 | def test_vsg_for_subscriber_upstream_bandwidth(self): |
| 939 | pass |
| 940 | |
| 941 | def test_vsg_for_subscriber_downstream_bandwidth(self): |
| 942 | pass |
| 943 | |
| 944 | def test_vsg_for_diagnostic_run_of_traceroute(self): |
| 945 | pass |
| 946 | |
| 947 | def test_vsg_for_diagnostic_run_of_tcpdump(self): |
| 948 | pass |
| 949 | |
| 950 | def test_vsg_for_iptable_rules(self): |
| 951 | pass |
| 952 | |
| 953 | def test_vsg_for_iptables_with_neutron(self): |
| 954 | pass |