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