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