blob: 1b1e1ffdf45dedac8764e789e85fbbc522156aa6 [file] [log] [blame]
Chetan Gaonker52418832017-01-26 23:03:13 +00001#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 Karthickd0fdf3b2017-03-21 16:54:22 -070015import time
16import os
A.R Karthick282f0d32017-03-28 16:43:59 -070017import sys
18import json
Chetan Gaonker52418832017-01-26 23:03:13 +000019from nose.tools import *
A.R Karthick33cfdbe2017-03-17 18:03:48 -070020from CordTestUtils import *
Chetan Gaonker52418832017-01-26 23:03:13 +000021from OltConfig import OltConfig
Chetan Gaonker52418832017-01-26 23:03:13 +000022from onosclidriver import OnosCliDriver
A.R Karthick9ccd0d02017-03-16 17:11:08 -070023from SSHTestAgent import SSHTestAgent
Chetan Gaonker52418832017-01-26 23:03:13 +000024from CordLogger import CordLogger
A R Karthickd0fdf3b2017-03-21 16:54:22 -070025from VSGAccess import VSGAccess
A R Karthick933f5b52017-03-27 15:27:16 -070026from CordTestUtils import log_test as log
A.R Karthicka9b594d2017-03-29 16:25:22 -070027from OnosCtrl import OnosCtrl
A.R Karthick282f0d32017-03-28 16:43:59 -070028
Chetan Gaonker52418832017-01-26 23:03:13 +000029log.setLevel('INFO')
30
31class vsg_exchange(CordLogger):
32 ONOS_INSTANCES = 3
33 V_INF1 = 'veth0'
34 device_id = 'of:' + get_mac()
Chetan Gaonker52418832017-01-26 23:03:13 +000035 TEST_IP = '8.8.8.8'
36 HOST = "10.1.0.1"
37 USER = "vagrant"
38 PASS = "vagrant"
A R Karthick63751492017-03-22 09:28:01 -070039 head_node = os.getenv('HEAD_NODE', 'prod')
A.R Karthick9ccd0d02017-03-16 17:11:08 -070040 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
A R Karthick03f40aa2017-03-20 19:33:55 -070041 test_path = os.path.dirname(os.path.realpath(__file__))
42 olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
A.R Karthick282f0d32017-03-28 16:43:59 -070043 restApiXos = None
44 subscriber_account_num_base = 200
45
46 @classmethod
A.R Karthicka9b594d2017-03-29 16:25:22 -070047 def getXosCredentials(cls):
48 onos_cfg = OnosCtrl.get_config()
49 if onos_cfg is None:
50 return None
51 if 'apps' in onos_cfg and \
52 'org.opencord.vtn' in onos_cfg['apps'] and \
53 'cordvtn' in onos_cfg['apps']['org.opencord.vtn'] and \
54 'xos' in onos_cfg['apps']['org.opencord.vtn']['cordvtn']:
55 xos_cfg = onos_cfg['apps']['org.opencord.vtn']['cordvtn']['xos']
56 endpoint = xos_cfg['endpoint']
57 user = xos_cfg['user']
58 password = xos_cfg['password']
59 xos_endpoints = endpoint.split(':')
60 xos_host = xos_endpoints[1][len('//'):]
61 xos_port = xos_endpoints[2][:-1]
62 #log.info('xos_host: %s, port: %s, user: %s, password: %s' %(xos_host, xos_port, user, password))
63 return dict(host = xos_host, port = xos_port, user = user, password = password)
64
65 return None
66
67 @classmethod
A.R Karthick282f0d32017-03-28 16:43:59 -070068 def setUpCordApi(cls):
69 our_path = os.path.dirname(os.path.realpath(__file__))
70 cord_api_path = os.path.join(our_path, '..', 'cord-api')
71 framework_path = os.path.join(cord_api_path, 'Framework')
72 utils_path = os.path.join(framework_path, 'utils')
73 data_path = os.path.join(cord_api_path, 'Tests', 'data')
74 subscriber_cfg = os.path.join(data_path, 'Subscriber.json')
75 volt_tenant_cfg = os.path.join(data_path, 'VoltTenant.json')
76
77 with open(subscriber_cfg) as f:
78 subscriber_data = json.load(f)
79 subscriber_info = subscriber_data['SubscriberInfo']
80 account_num = cls.subscriber_account_num_base
81 for subscriber in subscriber_info:
82 subscriber['identity']['account_num'] = str(account_num)
83 account_num += 1
84 cls.subscriber_info = subscriber_info
85
86 with open(volt_tenant_cfg) as f:
87 volt_tenant_data = json.load(f)
88 volt_subscriber_info = volt_tenant_data['voltSubscriberInfo']
89 assert_equal(len(volt_subscriber_info), len(cls.subscriber_info))
90 account_num = cls.subscriber_account_num_base
91 for volt_subscriber in volt_subscriber_info:
92 volt_subscriber['account_num'] = account_num
93 account_num += 1
94 cls.volt_subscriber_info = volt_subscriber_info
95
96 sys.path.append(utils_path)
97 sys.path.append(framework_path)
98 from restApi import restApi
99 restApiXos = restApi()
A.R Karthicka9b594d2017-03-29 16:25:22 -0700100 xos_credentials = cls.getXosCredentials()
101 if xos_credentials is None:
102 restApiXos.controllerIP = cls.HEAD_NODE
103 restApiXos.controllerPort = '9000'
104 else:
105 restApiXos.controllerIP = xos_credentials['host']
106 restApiXos.controllerPort = xos_credentials['port']
107 restApiXos.user = xos_credentials['user']
108 restApiXos.password = xos_credentials['password']
A.R Karthick282f0d32017-03-28 16:43:59 -0700109 cls.restApiXos = restApiXos
Chetan Gaonker52418832017-01-26 23:03:13 +0000110
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700111 @classmethod
112 def setUpClass(cls):
113 cls.controllers = get_controllers()
114 cls.controller = cls.controllers[0]
115 cls.cli = None
A R Karthick03f40aa2017-03-20 19:33:55 -0700116 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
117 cls.vcpes = cls.olt.get_vcpes()
118 cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp')
119 vcpe_dhcp = None
120 vcpe_dhcp_stag = None
121 vcpe_container = None
122 #cache the first dhcp vcpe in the class for quick testing
123 if cls.vcpes_dhcp:
124 vcpe_container = 'vcpe-{}-{}'.format(cls.vcpes_dhcp[0]['s_tag'], cls.vcpes_dhcp[0]['c_tag'])
125 vcpe_dhcp = 'vcpe0.{}.{}'.format(cls.vcpes_dhcp[0]['s_tag'], cls.vcpes_dhcp[0]['c_tag'])
126 vcpe_dhcp_stag = 'vcpe0.{}'.format(cls.vcpes_dhcp[0]['s_tag'])
127 cls.vcpe_container = vcpe_container
128 cls.vcpe_dhcp = vcpe_dhcp
129 cls.vcpe_dhcp_stag = vcpe_dhcp_stag
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700130 VSGAccess.setUp()
A.R Karthick282f0d32017-03-28 16:43:59 -0700131 cls.setUpCordApi()
Chetan Gaonker52418832017-01-26 23:03:13 +0000132
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700133 @classmethod
134 def tearDownClass(cls):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700135 VSGAccess.tearDown()
Chetan Gaonker52418832017-01-26 23:03:13 +0000136
Chetan Gaonker52418832017-01-26 23:03:13 +0000137 def cliEnter(self, controller = None):
138 retries = 0
139 while retries < 30:
140 self.cli = OnosCliDriver(controller = controller, connect = True)
141 if self.cli.handle:
142 break
143 else:
144 retries += 1
145 time.sleep(2)
146
147 def cliExit(self):
148 self.cli.disconnect()
149
150 def onos_shutdown(self, controller = None):
151 status = True
152 self.cliEnter(controller = controller)
153 try:
154 self.cli.shutdown(timeout = 10)
155 except:
156 log.info('Graceful shutdown of ONOS failed for controller: %s' %controller)
157 status = False
158
159 self.cliExit()
160 return status
161
A.R Karthick9ccd0d02017-03-16 17:11:08 -0700162 def log_set(self, level = None, app = 'org.onosproject'):
163 CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True)
Chetan Gaonker52418832017-01-26 23:03:13 +0000164
A R Karthick63751492017-03-22 09:28:01 -0700165 def test_vsg_health(self):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700166 status = VSGAccess.health_check()
167 assert_equal(status, True)
Chetan Gaonker52418832017-01-26 23:03:13 +0000168
A R Karthick63751492017-03-22 09:28:01 -0700169 def test_vsg_for_vcpe(self):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700170 vsgs = VSGAccess.get_vsgs()
171 compute_nodes = VSGAccess.get_compute_nodes()
A.R Karthick9ccd0d02017-03-16 17:11:08 -0700172 assert_not_equal(len(vsgs), 0)
173 assert_not_equal(len(compute_nodes), 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000174
A R Karthick63751492017-03-22 09:28:01 -0700175 def test_vsg_for_login(self):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700176 vsgs = VSGAccess.get_vsgs()
177 vsg_access_status = map(lambda vsg: vsg.check_access(), vsgs)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700178 status = filter(lambda st: st == False, vsg_access_status)
179 assert_equal(len(status), 0)
180
A R Karthick63751492017-03-22 09:28:01 -0700181 def test_vsg_for_default_route_through_testclient(self):
182 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
183 cmd = "sudo lxc exec testclient -- route | grep default"
184 status, output = ssh_agent.run_cmd(cmd)
185 assert_equal(status, True)
186
187 def test_vsg_for_external_connectivity_through_testclient(self):
188 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
189 cmd = "lxc exec testclient -- ping -c 3 8.8.8.8"
190 status, output = ssh_agent.run_cmd(cmd)
191 assert_equal( status, True)
192
193 def test_vsg_for_external_connectivity(self):
A R Karthick03f40aa2017-03-20 19:33:55 -0700194 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700195 mgmt = 'eth0'
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000196 host = '8.8.8.8'
197 self.success = False
A R Karthick03f40aa2017-03-20 19:33:55 -0700198 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700199 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700200 assert_not_equal(vcpe_ip, None)
201 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
202 log.info('Sending icmp echo requests to external network 8.8.8.8')
203 st, _ = getstatusoutput('ping -c 3 8.8.8.8')
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700204 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700205 assert_equal(st, 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000206
A R Karthick63751492017-03-22 09:28:01 -0700207 def test_vsg_for_external_connectivity_to_google(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000208 host = 'www.google.com'
A R Karthick03f40aa2017-03-20 19:33:55 -0700209 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700210 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700211 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700212 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700213 assert_not_equal(vcpe_ip, None)
214 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
215 log.info('Sending icmp ping requests to %s' %host)
216 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700217 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700218 assert_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000219
A R Karthick63751492017-03-22 09:28:01 -0700220 def test_vsg_for_external_connectivity_to_invalid_host(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000221 host = 'www.goglee.com'
A R Karthick03f40aa2017-03-20 19:33:55 -0700222 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700223 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700224 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700225 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700226 assert_not_equal(vcpe_ip, None)
227 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
228 log.info('Sending icmp ping requests to non existent host %s' %host)
229 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700230 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700231 assert_not_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000232
A R Karthick63751492017-03-22 09:28:01 -0700233 def test_vsg_for_external_connectivity_with_ttl_1(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000234 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700235 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700236 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700237 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700238 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700239 assert_not_equal(vcpe_ip, None)
240 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
241 log.info('Sending icmp ping requests to host %s with ttl 1' %host)
242 st, _ = getstatusoutput('ping -c 1 -t 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700243 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700244 assert_not_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000245
A R Karthick63751492017-03-22 09:28:01 -0700246 def test_vsg_for_external_connectivity_with_wan_interface_toggle_in_vcpe(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000247 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700248 mgmt = 'eth0'
249 vcpe = self.vcpe_container
250 assert_not_equal(vcpe, None)
251 assert_not_equal(self.vcpe_dhcp, None)
252 #first get dhcp on the vcpe interface
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700253 vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt)
A R Karthick03f40aa2017-03-20 19:33:55 -0700254 assert_not_equal(vcpe_ip, None)
255 log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp))
256 log.info('Sending ICMP pings to host %s' %(host))
257 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
258 if st != 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700259 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700260 assert_equal(st, 0)
261 #bring down the wan interface and check again
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700262 st = VSGAccess.vcpe_wan_down(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700263 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700264 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700265 assert_equal(st, True)
266 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
267 if st == 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700268 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700269 assert_not_equal(st, 0)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700270 st = VSGAccess.vcpe_wan_up(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700271 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700272 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700273 assert_equal(st, True)
274 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700275 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700276 assert_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000277
A R Karthick63751492017-03-22 09:28:01 -0700278 def test_vsg_for_external_connectivity_with_lan_interface_toggle_in_vcpe(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000279 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700280 mgmt = 'eth0'
281 vcpe = self.vcpe_container
282 assert_not_equal(vcpe, None)
283 assert_not_equal(self.vcpe_dhcp, None)
284 #first get dhcp on the vcpe interface
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700285 vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt)
A R Karthick03f40aa2017-03-20 19:33:55 -0700286 assert_not_equal(vcpe_ip, None)
287 log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp))
288 log.info('Sending ICMP pings to host %s' %(host))
289 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
290 if st != 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700291 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700292 assert_equal(st, 0)
293 #bring down the lan interface and check again
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700294 st = VSGAccess.vcpe_lan_down(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700295 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700296 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700297 assert_equal(st, True)
298 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
299 if st == 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700300 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700301 assert_not_equal(st, 0)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700302 st = VSGAccess.vcpe_lan_up(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700303 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700304 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700305 assert_equal(st, True)
306 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700307 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700308 assert_equal(st, 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000309
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000310 def test_vsg_firewall_with_deny_destination_ip(self, vcpe=None):
311 host = '8.8.8.8'
312 if not vcpe:
313 vcpe = self.vcpe_container
314 vsg = VSGAccess.get_vcpe_vsg(vcpe)
315 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
316 assert_equal(st, False)
317 try:
318 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
319 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
320 assert_equal(st, True)
321 finally:
322 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
323 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
324
325 def test_vsg_firewall_with_rule_add_and_delete_dest_ip(self, vcpe=None):
326 host = '8.8.8.8'
327 if not vcpe:
328 vcpe = self.vcpe_container
329 vsg = VSGAccess.get_vcpe_vsg(vcpe)
330 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
331 assert_equal(st, False)
332 try:
333 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
334 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
335 assert_equal(st, True)
336 st,_ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host))
337 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
338 assert_equal(st,False)
339 finally:
340 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
341 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
342
343 def test_vsg_firewall_verifying_reachability_for_non_blocked_dest_ip(self, vcpe=None):
344 host1 = '8.8.8.8'
345 host2 = '204.79.197.203'
346 if not vcpe:
347 vcpe = self.vcpe_container
348 vsg = VSGAccess.get_vcpe_vsg(vcpe)
349 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
350 assert_equal(st, False)
351 try:
352 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host1))
353 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
354 assert_equal(st, True)
355 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
356 assert_equal(st,False)
357 finally:
358 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
359 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
360
361 def test_vsg_firewall_appending_rules_with_deny_dest_ip(self, vcpe=None):
362 host1 = '8.8.8.8'
363 host2 = '204.79.197.203'
364 if not vcpe:
365 vcpe = self.vcpe_container
366 vsg = VSGAccess.get_vcpe_vsg(vcpe)
367 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
368 assert_equal(st, False)
369 try:
370 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host1))
371 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
372 assert_equal(st, True)
373 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
374 assert_equal(st, False)
375 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host2))
376 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
377 assert_equal(st,True)
378 finally:
379 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
380 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
381
382 def test_vsg_firewall_removing_one_rule_denying_dest_ip(self, vcpe=None):
383 host1 = '8.8.8.8'
384 host2 = '204.79.197.203'
385 if not vcpe:
386 vcpe = self.vcpe_container
387 vsg = VSGAccess.get_vcpe_vsg(vcpe)
388 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
389 assert_equal(st, False)
390 try:
391 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host1))
392 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host2))
393 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
394 assert_equal(st, True)
395 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
396 assert_equal(st,True)
397 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host2))
398 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
399 assert_equal(st,False)
400 finally:
401 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
402 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
403
404 def test_vsg_firewall_changing_rule_id_deny_dest_ip(self, vcpe=None):
405 host = '8.8.8.8'
406 if not vcpe:
407 vcpe = self.vcpe_container
408 vsg = VSGAccess.get_vcpe_vsg(vcpe)
409 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
410 assert_equal(st, False)
411 try:
412 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
413 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
414 assert_equal(st, True)
415 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -j ACCEPT 2'.format(vcpe))
416 st,output = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD 2 -d {} -j DROP '.format(vcpe,host))
417 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
418 assert_equal(st,False)
419 finally:
420 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
421 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
422
423 def test_vsg_firewall_changing_deny_rule_to_accept_dest_ip(self, vcpe=None):
424 host1 = '8.8.8.8'
425 host2 = '204.79.197.203'
426 if not vcpe:
427 vcpe = self.vcpe_container
428 vsg = VSGAccess.get_vcpe_vsg(vcpe)
429 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
430 assert_equal(st, False)
431 try:
432 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
433 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
434 assert_equal(st, True)
435 st,output = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD -d {} -j ACCEPT 1'.format(vcpe,host))
436 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
437 assert_equal(st,False)
438 finally:
439 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
440 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
441
442 def test_vsg_firewall_denying_destination_network(self, vcpe=None):
443 network = '206.190.36.44/28'
444 host1 = '204.79.197.46'
445 host2 = '204.79.197.51'
446 if not vcpe:
447 vcpe = self.vcpe_container
448 vsg = VSGAccess.get_vcpe_vsg(vcpe)
449 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
450 assert_equal(st, False)
451 try:
452 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,network))
453 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
454 assert_equal(st, True)
455 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
456 assert_equal(st,False)
457 finally:
458 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
459
460 def test_vsg_firewall_denying_destination_network_subnet_modification(self, vcpe=None):
461 network1 = '206.190.36.44/28'
462 network2 = '206.190.36.44/26'
463 host1 = '204.79.197.46'
464 host2 = '204.79.197.51'
465 host2 = '204.79.197.63'
466 if not vcpe:
467 vcpe = self.vcpe_container
468 vsg = VSGAccess.get_vcpe_vsg(vcpe)
469 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
470 assert_equal(st, False)
471 try:
472 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,network1))
473 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
474 assert_equal(st, True)
475 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
476 assert_equal(st,False)
477 st,output = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD -d {} -j DROP'.format(vcpe,network2))
478 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
479 assert_equal(st, True)
480 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
481 assert_equal(st, True)
482 st, _ = getstatusoutput('ping -c 1 {}'.format(host3))
483 assert_equal(st, False)
484 finally:
485 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
486
487 def test_vsg_firewall_with_deny_source_ip(self, vcpe=None):
488 host = '8.8.8.8'
489 source_ip = self.vcpe_dhcp
490 if not vcpe:
491 vcpe = self.vcpe_container
492 vsg = VSGAccess.get_vcpe_vsg(vcpe)
493 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
494 assert_equal(st, False)
495 try:
496 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -s {} -j DROP'.format(vcpe,source_ip))
497 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
498 assert_equal(st, True)
499 finally:
500 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
501
502 def test_vsg_firewall_rule_with_add_and_delete_deny_source_ip(self, vcpe=None):
503 host = '8.8.8.8'
504 source_ip = self.vcpe_dhcp
505 if not vcpe:
506 vcpe = self.vcpe_container
507 vsg = VSGAccess.get_vcpe_vsg(vcpe)
508 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
509 assert_equal(st, False)
510 try:
511 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -s {} -j DROP'.format(vcpe,source_ip))
512 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
513 assert_equal(st, True)
514 st, _ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -s {} -j DROP'.format(vcpe,source_ip))
515 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
516 assert_equal(st, False)
517 finally:
518 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
519
520 def test_vsg_firewall_rule_with_deny_icmp_protocol_echo_requests_type(self, vcpe=None):
521 host = '8.8.8.8'
522 if not vcpe:
523 vcpe = self.vcpe_container
524 vsg = VSGAccess.get_vcpe_vsg(vcpe)
525 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
526 assert_equal(st, False)
527 try:
528 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe))
529 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
530 assert_equal(st, True)
531 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe))
532 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
533 assert_equal(st, False)
534 finally:
535 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
536 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
537
538 def test_vsg_firewall_rule_with_deny_icmp_protocol_echo_reply_type(self, vcpe=None):
539 host = '8.8.8.8'
540 if not vcpe:
541 vcpe = self.vcpe_container
542 vsg = VSGAccess.get_vcpe_vsg(vcpe)
543 st, _ = getstatusoutput('ping -c 1 {}'.format('8.8.8.8'))
544 assert_equal(st, False)
545 try:
546 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe))
547 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
548 assert_equal(st, True)
549 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe))
550 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
551 assert_equal(st,False)
552 finally:
553 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
554 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
555
556 def test_vsg_firewall_changing_deny_rule_to_accept_rule_with_icmp_protocol_echo_requests_type(self, vcpe=None):
557 host = '8.8.8.8'
558 if not vcpe:
559 vcpe = self.vcpe_container
560 vsg = VSGAccess.get_vcpe_vsg(vcpe)
561 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
562 assert_equal(st, False)
563 try:
564 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-request -j DROP'.format(vcpe))
565 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
566 assert_equal(st, True)
567 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-request -j ACCEPT'.format(vcpe))
568 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
569 assert_equal(st,False)
570 finally:
571 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
572 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
573
574 def test_vsg_firewall_changing_deny_rule_to_accept_rule_with_icmp_protocol_echo_reply_type(self, vcpe=None):
575 host = '8.8.8.8'
576 if not vcpe:
577 vcpe = self.vcpe_container
578 vsg = VSGAccess.get_vcpe_vsg(vcpe)
579 st, out1 = getstatusoutput('ping -c 1 {}'.format(host))
580 assert_equal(st, False)
581 try:
582 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-reply -j DROP'.format(vcpe))
583 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
584 assert_equal(st, True)
585 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-reply -j ACCEPT'.format(vcpe))
586 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
587 assert_equal(st,False)
588 finally:
589 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
590 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
591
592 def test_vsg_firewall_for_deny_icmp_protocol(self, vcpe=None):
593 host = '8.8.8.8'
594 if not vcpe:
595 vcpe = self.vcpe_container
596 vsg = VSGAccess.get_vcpe_vsg(vcpe)
597 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
598 assert_equal(st, False)
599 try:
600 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe))
601 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
602 assert_equal(st, True)
603 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe))
604 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
605 assert_equal(st,False)
606 finally:
607 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
608 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
609
610 def test_vsg_firewall_rule_deny_icmp_protocol_and_destination_ip(self, vcpe=None):
611 host = '8.8.8.8'
612 if not vcpe:
613 vcpe = self.vcpe_container
614 vsg = VSGAccess.get_vcpe_vsg(vcpe)
615 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
616 assert_equal(st, False)
617 try:
618 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
619 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
620 assert_equal(st, True)
621 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe))
622 assert_equal(st, True)
623 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host))
624 assert_equal(st, True)
625 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe))
626 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
627 assert_equal(st,False)
628 finally:
629 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
630 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
631
632 def test_vsg_firewall_flushing_all_configured_rules(self, vcpe=None):
633 host = '8.8.8.8'
634 if not vcpe:
635 vcpe = self.vcpe_container
636 vsg = VSGAccess.get_vcpe_vsg(vcpe)
637 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
638 assert_equal(st, False)
639 try:
640 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
641 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
642 assert_equal(st, True)
643 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe))
644 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
645 assert_equal(st, True)
646 st,output = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
647 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
648 assert_equal(st, False)
649 finally:
650 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
651 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
652
A.R Karthick282f0d32017-03-28 16:43:59 -0700653 def test_vsg_xos_subscriber(self):
654 subscriber_info = self.subscriber_info[0]
655 volt_subscriber_info = self.volt_subscriber_info[0]
656 result = self.restApiXos.ApiPost('TENANT_SUBSCRIBER', subscriber_info)
657 assert_equal(result, True)
658 result = self.restApiXos.ApiGet('TENANT_SUBSCRIBER')
659 assert_not_equal(result, None)
660 subId = self.restApiXos.getSubscriberId(result, volt_subscriber_info['account_num'])
661 assert_not_equal(subId, '0')
662 log.info('Subscriber ID for account num %d = %s' %(volt_subscriber_info['account_num'], subId))
663 volt_tenant = volt_subscriber_info['voltTenant']
664 #update the subscriber id in the tenant info before making the rest
665 volt_tenant['subscriber'] = subId
666 result = self.restApiXos.ApiPost('TENANT_VOLT', volt_tenant)
667 assert_equal(result, True)
668
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000669 def test_vsg_for_ping_from_vsg_to_external_network(self):
670 """
671 Algo:
672 1.Create a vSG VM in compute node
673 2.Ensure VM created properly
674 3.Verify login to VM success
675 4.Do ping to external network from vSG VM
676 5.Verify that ping gets success
677 6.Verify ping success flows added in OvS
678 """
A R Karthick63751492017-03-22 09:28:01 -0700679
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000680 def test_vsg_for_ping_from_vcpe_to_external_network(self):
681 """
682 Algo:
683 1.Create a vSG VM in compute node
684 2.Create a vCPE container inside VM
685 3.Verify both VM and Container created properly
686 4.Verify login to vCPE container success
687 5.Do ping to external network from vCPE container
688 6.Verify that ping gets success
689 7.Verify ping success flows added in OvS
690 """
691
Chetan Gaonker52418832017-01-26 23:03:13 +0000692 def test_vsg_for_dns_service(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000693 """
694 Algo:
695 1. Create a test client in Prod VM
696 2. Create a vCPE container in vSG VM inside compute Node
697 3. Ensure vSG VM and vCPE container created properly
698 4. Enable dns service in vCPE ( if not by default )
699 5. Send ping request from test client to valid domain address say, 'www.google'com
700 6. Verify that dns should resolve ping should success
701 7. Now send ping request to invalid domain address say 'www.invalidaddress'.com'
702 8. Verify that dns resolve should fail and hence ping
703 """
A R Karthick63751492017-03-22 09:28:01 -0700704
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000705 def test_vsg_for_10_subscribers_for_same_service(self):
706 """
707 Algo:
708 1.Create a vSG VM in compute node
709 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
710 3.Ensure vSG VM and vCPE container created properly
711 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
712 5.Verify that ping success for all 10 subscribers
713 """
A R Karthick63751492017-03-22 09:28:01 -0700714
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000715 def test_vsg_for_10_subscribers_for_same_service_ping_invalid_ip(self):
716 """
717 Algo:
718 1.Create a vSG VM in compute Node
719 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
720 3.Ensure vSG VM and vCPE container created properly
721 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP
722 5.Verify that ping fails for all 10 subscribers
723 """
A R Karthick63751492017-03-22 09:28:01 -0700724
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000725 def test_vsg_for_10_subscribers_for_same_service_ping_valid_and_invalid_ip(self):
726 """
727 Algo:
728 1.Create a vSG VM in VM
729 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
730 3.Ensure vSG VM and vCPE container created properly
731 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP
732 5.Verify that ping success for all 5 subscribers
733 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP
734 7.Verify that ping fails for all 5 subscribers
735 """
A R Karthick63751492017-03-22 09:28:01 -0700736
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000737 def test_vsg_for_100_subscribers_for_same_service(self):
738 """
739 Algo:
740 1.Create a vSG VM in compute node
741 2.Create 100 vCPE containers for 100 subscribers, in vSG VM
742 3.Ensure vSG VM and vCPE container created properly
743 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
744 5.Verify that ping success for all 100 subscribers
745 """
A R Karthick63751492017-03-22 09:28:01 -0700746
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000747 def test_vsg_for_100_subscribers_for_same_service_ping_invalid_ip(self):
748 """
749 Algo:
750 1.Create a vSG VM in compute Node
751 2.Create 10 vCPE containers for 100 subscribers, in vSG VM
752 3.Ensure vSG VM and vCPE container created properly
753 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP
754 5.Verify that ping fails for all 100 subscribers
755 """
A R Karthick63751492017-03-22 09:28:01 -0700756
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000757 def test_vsg_for_100_subscribers_for_same_service_ping_valid_and_invalid_ip(self):
758 """
759 Algo:
760 1.Create a vSG VM in VM
761 2.Create 10 vCPE containers for 100 subscribers, in vSG VM
762 3.Ensure vSG VM and vCPE container created properly
763 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP
764 5.Verify that ping success for all 5 subscribers
765 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP
766 7.Verify that ping fails for all 5 subscribers
767 """
A R Karthick63751492017-03-22 09:28:01 -0700768
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000769 def test_vsg_for_packet_received_with_invalid_ip_fields(self):
770 """
771 Algo:
772 1.Create a vSG VM in compute node
773 2.Create a vCPE container in vSG VM
774 3.Ensure vSG VM and vCPE container created properly
775 4.From subscriber, send a ping packet with invalid ip fields
776 5.Verify that vSG drops the packet
777 6.Verify ping fails
778 """
A R Karthick63751492017-03-22 09:28:01 -0700779
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000780 def test_vsg_for_packet_received_with_invalid_mac_fields(self):
781 """
782 Algo:
783 1.Create a vSG VM in compute node
784 2.Create a vCPE container in vSG VM
785 3.Ensure vSG VM and vCPE container created properly
786 4.From subscriber, send a ping packet with invalid mac fields
787 5.Verify that vSG drops the packet
788 6.Verify ping fails
789 """
A R Karthick63751492017-03-22 09:28:01 -0700790
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000791 def test_vsg_for_vlan_id_mismatch_in_stag(self):
792 """
793 Algo:
794 1.Create a vSG VM in compute Node
795 2.Create a vCPE container in vSG VM
796 3.Ensure vSG VM and vCPE container created properly
797 4.Send a ping request to external valid IP from subscriber, with incorrect vlan id in s-tag and valid c-tag
798 5.Verify that ping fails as the packet drops at VM entry
799 6.Repeat step 4 with correct s-tag
800 7.Verify that ping success
801 """
A R Karthick63751492017-03-22 09:28:01 -0700802
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000803 def test_vsg_for_vlan_id_mismatch_in_ctag(self):
804 """
805 Algo:
806 1.Create a vSG VM in compute node
807 2.Create a vCPE container in vSG VM
808 3.Ensure vSG VM and vCPE container created properly
809 4.Send a ping request to external valid IP from subscriber, with valid s-tag and incorrect vlan id in c-tag
810 5.Verify that ping fails as the packet drops at vCPE container entry
811 6.Repeat step 4 with valid s-tag and c-tag
812 7.Verify that ping success
813 """
A R Karthick63751492017-03-22 09:28:01 -0700814
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000815 def test_vsg_for_matching_and_mismatching_vlan_id_in_stag(self):
816 """
817 Algo:
818 1.Create two vSG VMs in compute node
819 2.Create a vCPE container in each vSG VM
820 3.Ensure vSG VM and vCPE container created properly
821 4.From subscriber one, send ping request with valid s and c tags
822 5.From subscriber two, send ping request with vlan id mismatch in s-tag and valid c tags
823 6.Verify that ping success for only subscriber one and fails for two.
824 """
A R Karthick63751492017-03-22 09:28:01 -0700825
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000826 def test_vsg_for_matching_and_mismatching_vlan_id_in_ctag(self):
827 """
828 Algo:
829 1.Create a vSG VM in compute node
830 2.Create two vCPE containers in vSG VM
831 3.Ensure vSG VM and vCPE container created properly
832 4.From subscriber one, send ping request with valid s and c tags
833 5.From subscriber two, send ping request with valid s-tag and vlan id mismatch in c-tag
834 6.Verify that ping success for only subscriber one and fails for two
835 """
A R Karthick63751492017-03-22 09:28:01 -0700836
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000837 def test_vsg_for_out_of_range_vlanid_in_ctag(self):
838 """
839 Algo:
840 1.Create a vSG VM in compute node
841 2.Create a vCPE container in vSG VM
842 3.Ensure vSG VM and vCPE container created properly
843 4.From subscriber, send ping request with valid stag and vlan id in c-tag is an out of range value ( like 0,4097 )
844 4.Verify that ping fails as the ping packets drops at vCPE container entry
845 """
A R Karthick63751492017-03-22 09:28:01 -0700846
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000847 def test_vsg_for_out_of_range_vlanid_in_stag(self):
848 """
849 Algo:
850 1.Create a vSG VM in compute node
851 2.Create a vCPE container in vSG VM
852 3.Ensure vSG VM and vCPE container created properly
853 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
854 4.Verify that ping fails as the ping packets drops at vSG VM entry
855 """
A R Karthick63751492017-03-22 09:28:01 -0700856
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000857 def test_vsg_without_creating_vcpe_instance(self):
858 """
859 Algo:
860 1.Create a vSG VM in compute Node
861 2.Ensure vSG VM created properly
862 3.Do not create vCPE container inside vSG VM
863 4.From a subscriber, send ping to external valid IP
864 5.Verify that ping fails as the ping packet drops at vSG VM entry itself.
865 """
A R Karthick63751492017-03-22 09:28:01 -0700866
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000867 def test_vsg_for_remove_vcpe_instance(self):
868 """
869 Algo:
870 1.Create a vSG VM in compute node
871 2.Create a vCPE container in vSG VM
872 3.Ensure vSG VM and vCPE container created properly
873 4.From subscriber, send ping request with valid s-tag and c-tag
874 5.Verify that ping success
875 6.Verify ping success flows in OvS switch in compute node
876 7.Now remove the vCPE container in vSG VM
877 8.Ensure that the container removed properly
878 9.Repeat step 4
879 10.Verify that now, ping fails
880 """
A R Karthick63751492017-03-22 09:28:01 -0700881
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000882 def test_vsg_for_restart_vcpe_instance(self):
883 """
884 Algo:
885 1.Create a vSG VM in compute node
886 2.Create a vCPE container in vSG VM
887 3.Ensure vSG VM and vCPE container created properly
888 4.From subscriber, send ping request with valid s-tag and c-tag
889 5.Verify that ping success
890 6.Verify ping success flows in OvS switch in compute node
891 7.Now restart the vCPE container in vSG VM
892 8.Ensure that the container came up after restart
893 9.Repeat step 4
894 10.Verify that now,ping gets success and flows added in OvS
895 """
A R Karthick63751492017-03-22 09:28:01 -0700896
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000897 def test_vsg_for_restart_vsg_vm(self):
898 """
899 Algo:
900 1.Create a vSG VM in compute node
901 2.Create a vCPE container in vSG VM
902 3.Ensure vSG VM and vCPE container created properly
903 4.From subscriber, send ping request with valid s-tag and c-tag
904 5.Verify that ping success
905 6.Verify ping success flows in OvS switch in compute node
906 7.Now restart the vSG VM
907 8.Ensure that the vSG comes up properly after restart
908 9.Verify that vCPE container comes up after vSG restart
909 10.Repeat step 4
910 11.Verify that now,ping gets success and flows added in OvS
911 """
A R Karthick63751492017-03-22 09:28:01 -0700912
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000913 def test_vsg_for_pause_vcpe_instance(self):
914 """
915 Algo:
916 1.Create a vSG VM in compute node
917 2.Create a vCPE container in vSG VM
918 3.Ensure vSG VM and vCPE container created properly
919 4.From subscriber, send ping request with valid s-tag and c-tag
920 5.Verify that ping success
921 6.Verify ping success flows in OvS switch in compute node
922 7.Now pause vCPE container in vSG VM for a while
923 8.Ensure that the container state is pause
924 9.Repeat step 4
925 10.Verify that now,ping fails now and verify flows in OvS
926 11.Now resume the container
927 12.Now repeat step 4 again
928 13.Verify that now, ping gets success
929 14.Verify ping success flows in OvS
930 """
A R Karthick63751492017-03-22 09:28:01 -0700931
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000932 def test_vsg_for_extract_all_compute_stats_from_all_vcpe_containers(self):
933 """
934 Algo:
935 1.Create a vSG VM in compute node
936 2.Create 10 vCPE containers in VM
937 3.Ensure vSG VM and vCPE containers created properly
938 4.Login to all vCPE containers
939 4.Get all compute stats from all vCPE containers
940 5.Verify the stats # verification method need to add
941 """
A R Karthick63751492017-03-22 09:28:01 -0700942
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000943 def test_vsg_for_extract_dns_stats_from_all_vcpe_containers(self):
944 """
945 Algo:
946 1.Create a vSG VM in compute node
947 2.Create 10 vCPE containers in VM
948 3.Ensure vSG VM and vCPE containers created properly
949 4.From 10 subscribers, send ping to valid and invalid dns hosts
950 5.Verify dns resolves and ping success for valid dns hosts
951 6.Verify ping fails for invalid dns hosts
952 7.Verify dns host name resolve flows in OvS
953 8.Login to all 10 vCPE containers
954 9.Extract all dns stats
955 10.Verify dns stats for queries sent, queries received for dns host resolve success and failed scenarios
956 """
A R Karthick63751492017-03-22 09:28:01 -0700957
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000958 def test_vsg_for_subscriber_access_two_vsg_services(self):
959 """
960 # Intention is to verify if subscriber can reach internet via two vSG VMs
961 Algo:
962 1.Create two vSG VMs for two services in compute node
963 2.Create one vCPE container in each VM for one subscriber
964 3.Ensure VMs and containers created properly
965 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
966 5.Verify ping gets success
967 6.Verify ping success flows in OvS
968 7.Now repeat step 4 with stag corresponds to vSG-2 VM
969 8.Verify that ping again success
970 9.Verify ping success flows in OvS
971 """
A R Karthick63751492017-03-22 09:28:01 -0700972
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000973 def test_vsg_for_subscriber_access_service2_if_service1_goes_down(self):
974 """
975 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
976 Algo:
977 1.Create two vSG VMs for two services in compute node
978 2.Create one vCPE container in each VM for one subscriber
979 3.Ensure VMs and containers created properly
980 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
981 5.Verify ping gets success
982 6.Verify ping success flows in OvS
983 7.Down the vSG-1 VM
984 8.Now repeat step 4
985 9.Verify that ping fails as vSG-1 is down
986 10.Repeat step 4 with stag corresponding to vSG-2
987 9.Verify ping success and flows added in OvS
988 """
A R Karthick63751492017-03-22 09:28:01 -0700989
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000990 def test_vsg_for_subscriber_access_service2_if_service1_goes_restart(self):
991 """
992 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
993 Algo:
994 1.Create two vSG VMs for two services in compute node
995 2.Create one vCPE container in each VM for one subscriber
996 3.Ensure VMs and containers created properly
997 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
998 5.Verify ping gets success
999 6.Verify ping success flows added in OvS
1000 7.Now restart vSG-1 VM
1001 8.Now repeat step 4 while vSG-1 VM restarts
1002 9.Verify that ping fails as vSG-1 is restarting
1003 10.Repeat step 4 with stag corresponding to vSG-2 while vSG-1 VM restarts
1004 11.Verify ping success and flows added in OvS
1005 """
A R Karthick63751492017-03-22 09:28:01 -07001006
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001007 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_goes_down(self):
1008 """
1009 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
1010 Algo:
1011 1.Create a vSG VM in compute node
1012 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1013 3.Ensure VM and containers created properly
1014 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1015 5.Verify ping gets success
1016 6.Verify ping success flows added in OvS
1017 7.Now stop vCPE-1 container
1018 8.Now repeat step 4
1019 9.Verify that ping fails as vCPE-1 container is down
1020 10.Repeat step 4 with ctag corresponding to vCPE-2 container
1021 11.Verify ping success and flows added in OvS
1022 """
A R Karthick63751492017-03-22 09:28:01 -07001023
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001024 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_restart(self):
1025 """
1026 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
1027 Algo:
1028 1.Create a vSG VM in compute node
1029 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1030 3.Ensure VM and containers created properly
1031 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1032 5.Verify ping gets success
1033 6.Verify ping success flows added in OvS
1034 7.Now restart vCPE-1 container
1035 8.Now repeat step 4 while vCPE-1 restarts
1036 9.Verify that ping fails as vCPE-1 container is restarts
1037 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 restarts
1038 11..Verify ping success and flows added in OvS
1039 """
A R Karthick63751492017-03-22 09:28:01 -07001040
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001041 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_pause(self):
1042 """
1043 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 paused
1044 Algo:
1045 1.Create a vSG VM in compute node
1046 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1047 3.Ensure VM and containers created properly
1048 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1049 5.Verify ping gets success
1050 6.Verify ping success flows added in OvS
1051 7.Now pause vCPE-1 container
1052 8.Now repeat step 4 while vCPE-1 in pause state
1053 9.Verify that ping fails as vCPE-1 container in pause state
1054 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 in pause state
1055 11.Verify ping success and flows added in OvS
1056 """
1057 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_removed(self):
1058 """
1059 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 removed
1060 Algo:
1061 1.Create a vSG VM in compute node
1062 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1063 3.Ensure VM and containers created properly
1064 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1065 5.Verify ping gets success
1066 6.Verify ping success flows added in OvS
1067 7.Now remove vCPE-1 container
1068 8.Now repeat step 4
1069 9.Verify that ping fails as vCPE-1 container removed
1070 10.Repeat step 4 with ctag corresponding to vCPE-2 container
1071 11.Verify ping success and flows added in OvS
1072 """
A R Karthick63751492017-03-22 09:28:01 -07001073
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001074 def test_vsg_for_vcpe_instance_removed_and_added_again(self):
1075 """
1076 Algo:
1077 1.Create a vSG VM in compute node
1078 2.Create a vCPE container in vSG VM
1079 3.Ensure VM and containers created properly
1080 4.From subscriber end, send ping to public IP
1081 5.Verify ping gets success
1082 6.Verify ping success flows added in OvS
1083 7.Now remove vCPE container in vSG VM
1084 8.Now repeat step 4
1085 9.Verify that ping fails as vCPE container removed
1086 10.Create the vCPE container again for the same subscriber
1087 11.Ensure that vCPE created now
1088 12.Now repeat step 4
1089 13.Verify ping success and flows added in OvS
1090 """
A R Karthick63751492017-03-22 09:28:01 -07001091
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001092 def test_vsg_for_vsg_vm_removed_and_added_again(self):
1093 """
1094 Algo:
1095 1.Create a vSG VM in compute node
1096 2.Create a vCPE container in vSG VM
1097 3.Ensure VM and containers created properly
1098 4.From subscriber end, send ping to public IP
1099 5.Verify ping gets success
1100 6.Verify ping success flows added in OvS
1101 7.Now remove vSG VM
1102 8.Now repeat step 4
1103 9.Verify that ping fails as vSG VM not exists
1104 10.Create the vSG VM and vCPE container in VM again
1105 11.Ensure that vSG and vCPE created
1106 12.Now repeat step 4
1107 13.Verify ping success and flows added in OvS
1108 """
1109
1110 #Test vSG - Subscriber Configuration
1111 def test_vsg_for_configuring_new_subscriber_in_vcpe(self):
1112 """
1113 Algo:
1114 1.Create a vSG VM in compute node
1115 2.Create a vCPE container in vSG VM
1116 3.Ensure VM and containers created properly
1117 4.Configure a subscriber in XOS and assign a service id
1118 5.Set the admin privileges to the subscriber
1119 6.Verify subscriber configuration is success
1120 """
1121 def test_vsg_for_adding_subscriber_devices_in_vcpe(self):
1122 """
1123 Algo:
1124 1.Create a vSG VM in compute node
1125 2.Create a vCPE container in vSG VM
1126 3.Ensure VM and containers created properly
1127 4.Configure a subscriber in XOS and assign a service id
1128 5.Verify subscriber successfully configured in vCPE
1129 6.Now add devices( Mac addresses ) under the subscriber admin group
1130 7.Verify all devices ( Macs ) added successfully
1131 """
1132 def test_vsg_for_removing_subscriber_devices_in_vcpe(self):
1133 """
1134 Algo:
1135 1.Create a vSG VM in compute node
1136 2.Create a vCPE container in vSG VM
1137 3.Ensure VM and containers created properly
1138 4.Configure a subscriber in XOS and assign a service id
1139 5.Verify subscriber successfully configured
1140 6.Now add devices( Mac addresses ) under the subscriber admin group
1141 7.Verify all devices ( Macs ) added successfully
1142 8.Now remove All the added devices in XOS
1143 9.Verify all the devices removed
1144 """
1145 def test_vsg_for_modify_subscriber_devices_in_vcpe(self):
1146 """
1147 Algo:
1148 1.Create a vSG VM in compute node
1149 2.Create a vCPE container in vSG VM
1150 3.Ensure VM and containers created properly
1151 4.Configure a user in XOS and assign a service id
1152 5.Verify subscriber successfully configured in vCPE.
1153 6.Now add devices( Mac addresses ) under the subscriber admin group
1154 7.Verify all devices ( Macs ) added successfully
1155 8.Now remove few devices in XOS
1156 9.Verify devices removed successfully
1157 10.Now add few additional devices in XOS under the same subscriber admin group
1158 11.Verify newly added devices successfully added
1159 """
1160 def test_vsg_for_vcpe_login_fails_with_incorrect_subscriber_credentials(self):
1161 """
1162 Algo:
1163 1.Create a vSG VM in compute node
1164 2.Create a vCPE container in vSG VM
1165 3.Ensure VM and containers created properly
1166 4.Configure a subscriber in XOS and assign a service id
1167 5.Verify subscriber successfully configured
1168 6.Now add devices( Mac addresses ) under the subscriber admin group
1169 7.Verify all devices ( Macs ) added successfully
1170 8.Login vCPE with credentials with which subscriber configured
1171 9.Verify subscriber successfully logged in
1172 10.Logout and login again with incorrect credentials ( either user name or password )
1173 11.Verify login attempt to vCPE fails wtih incorrect credentials
1174 """
1175 def test_vsg_for_subscriber_configuration_in_vcpe_retain_after_vcpe_restart(self):
1176 """
1177 Algo:
1178 1.Create a vSG VM in compute node
1179 2.Create a vCPE container in vSG VM
1180 3.Ensure VM and containers created properly
1181 4.Configure a subscriber in XOS and assign a service id
1182 5.Verify subscriber successfully configured
1183 6.Now add devices( Mac addresses ) under the subscriber admin group
1184 7.Verify all devices ( Macs ) added successfully
1185 8.Restart vCPE ( locate backup config path while restart )
1186 9.Verify subscriber details in vCPE after restart should be same as before the restart
1187 """
1188 def test_vsg_for_create_multiple_vcpe_instances_and_configure_subscriber_in_each_instance(self):
1189 """
1190 Algo:
1191 1.Create a vSG VM in compute node
1192 2.Create 2 vCPE containers in vSG VM
1193 3.Ensure VM and containers created properly
1194 4.Configure a subscriber in XOS for each vCPE instance and assign a service id
1195 5.Verify subscribers successfully configured
1196 6.Now login vCPE-2 with subscriber-1 credentials
1197 7.Verify login fails
1198 8.Now login vCPE-1 with subscriber-2 credentials
1199 9.Verify login fails
1200 10.Now login vCPE-1 with subscriber-1 and vCPE-2 with subscriber-2 credentials
1201 11.Verify that both the subscribers able to login to their respective vCPE containers
1202 """
1203 def test_vsg_for_same_subscriber_can_be_configured_for_multiple_services(self):
1204 """
1205 Algo:
1206 1.Create 2 vSG VMs in compute node
1207 2.Create a vCPE container in each vSG VM
1208 3.Ensure VMs and containers created properly
1209 4.Configure same subscriber in XOS for each vCPE instance and assign a service id
1210 5.Verify subscriber successfully configured
1211 6.Now login vCPE-1 with subscriber credentials
1212 7.Verify login success
1213 8.Now login vCPE-2 with the same subscriber credentials
1214 9.Verify login success
1215 """
1216
1217 #Test Example Service
1218 def test_vsg_for_subcriber_avail_example_service_running_in_apache_server(self):
1219 """
1220 Algo:
1221 1.Create a vSG VM in compute node
1222 2.Create a vCPE container in each vSG VM
1223 3.Ensure VM and container created properly
1224 4.Configure a subscriber in XOS for the vCPE instance and assign a service id
1225 5.On-board an example service into cord pod
1226 6.Create a VM in compute node and run the example service ( Apache server )
1227 7.Configure the example service with service specific and subscriber specific messages
1228 8.Verify example service on-boarded successfully
1229 9.Verify example service running in VM
1230 10.Run a curl command from subscriber to reach example service
1231 11.Verify subscriber can successfully reach example service via vSG
1232 12.Verify that service specific and subscriber specific messages
1233 """
1234 def test_vsg_for_subcriber_avail_example_service_running_in_apache_server_after_service_restart(self):
1235 """
1236 Algo:
1237 1.Create a vSG VM in compute node
1238 2.Create a vCPE container in each vSG VM
1239 3.Ensure VM and container created properly
1240 4.Configure a subscriber in XOS for the vCPE instance and assign a service id
1241 5.On-board an example service into cord pod
1242 6.Create a VM in compute node and run the example service ( Apache server )
1243 7.Configure the example service with service specific and subscriber specific messages
1244 8.Verify example service on-boarded successfully
1245 9.Verify example service running in VM
1246 10.Run a curl command from subscriber to reach example service
1247 11.Verify subscriber can successfully reach example service via vSG
1248 12.Verify that service specific and subscriber specific messages
1249 13.Restart example service running in VM
1250 14.Repeat step 10
1251 15.Verify the same results as mentioned in steps 11, 12
1252 """
1253
1254 #vCPE Firewall Functionality
1255 def test_vsg_firewall_for_creating_acl_rule_based_on_source_ip(self):
1256 """
1257 Algo:
1258 1.Create a vSG VM in compute node
1259 2.Create vCPE container in the VM
1260 3.Ensure vSG VM and vCPE container created properly
1261 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
1262 5.Bound the acl rule to WAN interface of vCPE
1263 6.Verify configuration in vCPE is success
1264 8.Verify flows added in OvS
1265 """
1266 def test_vsg_firewall_for_creating_acl_rule_based_on_destination_ip(self):
1267 """
1268 Algo:
1269 1.Create a vSG VM in compute node
1270 2.Create vCPE container in the VM
1271 3.Ensure vSG VM and vCPE container created properly
1272 4.Configure ac acl rule in vCPE to deny IP traffic to a destination ip
1273 5.Bound the acl rule to WAN interface of vCPE
1274 6.Verify configuration in vCPE is success
1275 8.Verify flows added in OvS
1276 """
1277 def test_vsg_firewall_for_acl_deny_rule_based_on_source_ip_traffic(self):
1278 """
1279 Algo:
1280 1.Create a vSG VM in compute node
1281 2.Create vCPE container in the VM
1282 3.Ensure vSG VM and vCPE container created properly
1283 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
1284 5.Bound the acl rule to WAN interface of vCPE
1285 6.From subscriber, send ping to the denied IP address
1286 7.Verify that ping fails as vCPE denies ping response
1287 8.Verify flows added in OvS
1288 """
1289 def test_vsg_firewall_for_acl_deny_rule_based_on_destination_ip_traffic(self):
1290 """
1291 Algo:
1292 1.Create a vSG VM in compute node
1293 2.Create vCPE container in the VM
1294 3.Ensure vSG VM and vCPE container created properly
1295 4.Configure ac acl rule in vCPE to deny IP traffic to a destination IP
1296 5.Bound the acl rule to WAN interface of vCPE
1297 6.From subscriber, send ping to the denied IP address
1298 7.Verify that ping fails as vCPE drops the ping request at WAN interface
1299 8.Verify flows added in OvS
1300 """
Chetan Gaonker52418832017-01-26 23:03:13 +00001301
1302 def test_vsg_dnsmasq(self):
1303 pass
1304
1305 def test_vsg_with_external_parental_control_family_shield_for_filter(self):
1306 pass
1307
1308 def test_vsg_with_external_parental_control_with_answerx(self):
1309 pass
1310
1311 def test_vsg_for_subscriber_upstream_bandwidth(self):
1312 pass
1313
1314 def test_vsg_for_subscriber_downstream_bandwidth(self):
1315 pass
1316
1317 def test_vsg_for_diagnostic_run_of_traceroute(self):
1318 pass
1319
1320 def test_vsg_for_diagnostic_run_of_tcpdump(self):
1321 pass
1322
1323 def test_vsg_for_iptable_rules(self):
1324 pass
1325
1326 def test_vsg_for_iptables_with_neutron(self):
1327 pass