blob: 797b8fc505cd9319dcde4c7eca785ba755099bf0 [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
A R Karthick0a4ca3a2017-03-30 09:36:53 -070044 subscriber_account_num = 200
45 subscriber_s_tag = 304
46 subscriber_c_tag = 304
47 subscribers_per_s_tag = 8
48 subscriber_map = {}
49
50 @classmethod
51 def getSubscriberCredentials(cls, subId):
52 """Generate our own account num, s_tag and c_tags"""
53 if subId in cls.subscriber_map:
54 return cls.subscriber_map[subId]
55 account_num = cls.subscriber_account_num
56 cls.subscriber_account_num += 1
57 s_tag, c_tag = cls.subscriber_s_tag, cls.subscriber_c_tag
58 cls.subscriber_c_tag += 1
59 if cls.subscriber_c_tag % cls.subscribers_per_s_tag == 0:
60 cls.subscriber_s_tag += 1
61 cls.subscriber_map[subId] = account_num, s_tag, c_tag
62 return cls.subscriber_map[subId]
A.R Karthick282f0d32017-03-28 16:43:59 -070063
64 @classmethod
A.R Karthicka9b594d2017-03-29 16:25:22 -070065 def getXosCredentials(cls):
66 onos_cfg = OnosCtrl.get_config()
67 if onos_cfg is None:
68 return None
69 if 'apps' in onos_cfg and \
70 'org.opencord.vtn' in onos_cfg['apps'] and \
71 'cordvtn' in onos_cfg['apps']['org.opencord.vtn'] and \
72 'xos' in onos_cfg['apps']['org.opencord.vtn']['cordvtn']:
73 xos_cfg = onos_cfg['apps']['org.opencord.vtn']['cordvtn']['xos']
74 endpoint = xos_cfg['endpoint']
75 user = xos_cfg['user']
76 password = xos_cfg['password']
77 xos_endpoints = endpoint.split(':')
78 xos_host = xos_endpoints[1][len('//'):]
79 xos_port = xos_endpoints[2][:-1]
80 #log.info('xos_host: %s, port: %s, user: %s, password: %s' %(xos_host, xos_port, user, password))
81 return dict(host = xos_host, port = xos_port, user = user, password = password)
82
83 return None
84
85 @classmethod
A.R Karthick282f0d32017-03-28 16:43:59 -070086 def setUpCordApi(cls):
87 our_path = os.path.dirname(os.path.realpath(__file__))
88 cord_api_path = os.path.join(our_path, '..', 'cord-api')
89 framework_path = os.path.join(cord_api_path, 'Framework')
90 utils_path = os.path.join(framework_path, 'utils')
91 data_path = os.path.join(cord_api_path, 'Tests', 'data')
92 subscriber_cfg = os.path.join(data_path, 'Subscriber.json')
93 volt_tenant_cfg = os.path.join(data_path, 'VoltTenant.json')
94
95 with open(subscriber_cfg) as f:
96 subscriber_data = json.load(f)
97 subscriber_info = subscriber_data['SubscriberInfo']
A R Karthick0a4ca3a2017-03-30 09:36:53 -070098 for i in xrange(len(subscriber_info)):
99 subscriber = subscriber_info[i]
100 account_num, _, _ = cls.getSubscriberCredentials('sub{}'.format(i))
A.R Karthick282f0d32017-03-28 16:43:59 -0700101 subscriber['identity']['account_num'] = str(account_num)
A.R Karthick282f0d32017-03-28 16:43:59 -0700102 cls.subscriber_info = subscriber_info
103
104 with open(volt_tenant_cfg) as f:
105 volt_tenant_data = json.load(f)
106 volt_subscriber_info = volt_tenant_data['voltSubscriberInfo']
107 assert_equal(len(volt_subscriber_info), len(cls.subscriber_info))
A R Karthick0a4ca3a2017-03-30 09:36:53 -0700108 for i in xrange(len(volt_subscriber_info)):
109 volt_subscriber = volt_subscriber_info[i]
110 account_num, s_tag, c_tag = cls.getSubscriberCredentials('sub{}'.format(i))
A.R Karthick282f0d32017-03-28 16:43:59 -0700111 volt_subscriber['account_num'] = account_num
A R Karthick0a4ca3a2017-03-30 09:36:53 -0700112 volt_subscriber['voltTenant']['s_tag'] = str(s_tag)
113 volt_subscriber['voltTenant']['c_tag'] = str(c_tag)
A.R Karthick282f0d32017-03-28 16:43:59 -0700114 cls.volt_subscriber_info = volt_subscriber_info
115
116 sys.path.append(utils_path)
117 sys.path.append(framework_path)
118 from restApi import restApi
119 restApiXos = restApi()
A.R Karthicka9b594d2017-03-29 16:25:22 -0700120 xos_credentials = cls.getXosCredentials()
121 if xos_credentials is None:
122 restApiXos.controllerIP = cls.HEAD_NODE
123 restApiXos.controllerPort = '9000'
124 else:
125 restApiXos.controllerIP = xos_credentials['host']
126 restApiXos.controllerPort = xos_credentials['port']
127 restApiXos.user = xos_credentials['user']
128 restApiXos.password = xos_credentials['password']
A.R Karthick282f0d32017-03-28 16:43:59 -0700129 cls.restApiXos = restApiXos
Chetan Gaonker52418832017-01-26 23:03:13 +0000130
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700131 @classmethod
132 def setUpClass(cls):
133 cls.controllers = get_controllers()
134 cls.controller = cls.controllers[0]
135 cls.cli = None
A R Karthick03f40aa2017-03-20 19:33:55 -0700136 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
137 cls.vcpes = cls.olt.get_vcpes()
138 cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp')
139 vcpe_dhcp = None
140 vcpe_dhcp_stag = None
141 vcpe_container = None
142 #cache the first dhcp vcpe in the class for quick testing
143 if cls.vcpes_dhcp:
144 vcpe_container = 'vcpe-{}-{}'.format(cls.vcpes_dhcp[0]['s_tag'], cls.vcpes_dhcp[0]['c_tag'])
145 vcpe_dhcp = 'vcpe0.{}.{}'.format(cls.vcpes_dhcp[0]['s_tag'], cls.vcpes_dhcp[0]['c_tag'])
146 vcpe_dhcp_stag = 'vcpe0.{}'.format(cls.vcpes_dhcp[0]['s_tag'])
147 cls.vcpe_container = vcpe_container
148 cls.vcpe_dhcp = vcpe_dhcp
149 cls.vcpe_dhcp_stag = vcpe_dhcp_stag
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700150 VSGAccess.setUp()
A.R Karthick282f0d32017-03-28 16:43:59 -0700151 cls.setUpCordApi()
Chetan Gaonker52418832017-01-26 23:03:13 +0000152
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700153 @classmethod
154 def tearDownClass(cls):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700155 VSGAccess.tearDown()
Chetan Gaonker52418832017-01-26 23:03:13 +0000156
Chetan Gaonker52418832017-01-26 23:03:13 +0000157 def cliEnter(self, controller = None):
158 retries = 0
159 while retries < 30:
160 self.cli = OnosCliDriver(controller = controller, connect = True)
161 if self.cli.handle:
162 break
163 else:
164 retries += 1
165 time.sleep(2)
166
167 def cliExit(self):
168 self.cli.disconnect()
169
170 def onos_shutdown(self, controller = None):
171 status = True
172 self.cliEnter(controller = controller)
173 try:
174 self.cli.shutdown(timeout = 10)
175 except:
176 log.info('Graceful shutdown of ONOS failed for controller: %s' %controller)
177 status = False
178
179 self.cliExit()
180 return status
181
A.R Karthick9ccd0d02017-03-16 17:11:08 -0700182 def log_set(self, level = None, app = 'org.onosproject'):
183 CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True)
Chetan Gaonker52418832017-01-26 23:03:13 +0000184
A R Karthick63751492017-03-22 09:28:01 -0700185 def test_vsg_health(self):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700186 status = VSGAccess.health_check()
187 assert_equal(status, True)
Chetan Gaonker52418832017-01-26 23:03:13 +0000188
A R Karthick63751492017-03-22 09:28:01 -0700189 def test_vsg_for_vcpe(self):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700190 vsgs = VSGAccess.get_vsgs()
191 compute_nodes = VSGAccess.get_compute_nodes()
A.R Karthick9ccd0d02017-03-16 17:11:08 -0700192 assert_not_equal(len(vsgs), 0)
193 assert_not_equal(len(compute_nodes), 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000194
A R Karthick63751492017-03-22 09:28:01 -0700195 def test_vsg_for_login(self):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700196 vsgs = VSGAccess.get_vsgs()
197 vsg_access_status = map(lambda vsg: vsg.check_access(), vsgs)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700198 status = filter(lambda st: st == False, vsg_access_status)
199 assert_equal(len(status), 0)
200
A R Karthick63751492017-03-22 09:28:01 -0700201 def test_vsg_for_default_route_through_testclient(self):
202 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
203 cmd = "sudo lxc exec testclient -- route | grep default"
204 status, output = ssh_agent.run_cmd(cmd)
205 assert_equal(status, True)
206
207 def test_vsg_for_external_connectivity_through_testclient(self):
208 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
209 cmd = "lxc exec testclient -- ping -c 3 8.8.8.8"
210 status, output = ssh_agent.run_cmd(cmd)
211 assert_equal( status, True)
212
213 def test_vsg_for_external_connectivity(self):
A R Karthick03f40aa2017-03-20 19:33:55 -0700214 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700215 mgmt = 'eth0'
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000216 host = '8.8.8.8'
217 self.success = False
A R Karthick03f40aa2017-03-20 19:33:55 -0700218 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700219 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700220 assert_not_equal(vcpe_ip, None)
221 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
222 log.info('Sending icmp echo requests to external network 8.8.8.8')
223 st, _ = getstatusoutput('ping -c 3 8.8.8.8')
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700224 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700225 assert_equal(st, 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000226
A R Karthick63751492017-03-22 09:28:01 -0700227 def test_vsg_for_external_connectivity_to_google(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000228 host = 'www.google.com'
A R Karthick03f40aa2017-03-20 19:33:55 -0700229 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700230 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700231 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700232 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700233 assert_not_equal(vcpe_ip, None)
234 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
235 log.info('Sending icmp ping requests to %s' %host)
236 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700237 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700238 assert_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000239
A R Karthick63751492017-03-22 09:28:01 -0700240 def test_vsg_for_external_connectivity_to_invalid_host(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000241 host = 'www.goglee.com'
A R Karthick03f40aa2017-03-20 19:33:55 -0700242 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700243 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700244 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700245 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700246 assert_not_equal(vcpe_ip, None)
247 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
248 log.info('Sending icmp ping requests to non existent host %s' %host)
249 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700250 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700251 assert_not_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000252
A R Karthick63751492017-03-22 09:28:01 -0700253 def test_vsg_for_external_connectivity_with_ttl_1(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000254 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700255 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700256 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700257 assert_not_equal(vcpe, None)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700258 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700259 assert_not_equal(vcpe_ip, None)
260 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
261 log.info('Sending icmp ping requests to host %s with ttl 1' %host)
262 st, _ = getstatusoutput('ping -c 1 -t 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700263 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700264 assert_not_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000265
A R Karthick63751492017-03-22 09:28:01 -0700266 def test_vsg_for_external_connectivity_with_wan_interface_toggle_in_vcpe(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000267 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700268 mgmt = 'eth0'
269 vcpe = self.vcpe_container
270 assert_not_equal(vcpe, None)
271 assert_not_equal(self.vcpe_dhcp, None)
272 #first get dhcp on the vcpe interface
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700273 vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt)
A R Karthick03f40aa2017-03-20 19:33:55 -0700274 assert_not_equal(vcpe_ip, None)
275 log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp))
276 log.info('Sending ICMP pings to host %s' %(host))
277 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
278 if st != 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700279 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700280 assert_equal(st, 0)
281 #bring down the wan interface and check again
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700282 st = VSGAccess.vcpe_wan_down(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700283 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700284 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700285 assert_equal(st, True)
286 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
287 if st == 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700288 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700289 assert_not_equal(st, 0)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700290 st = VSGAccess.vcpe_wan_up(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700291 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700292 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700293 assert_equal(st, True)
294 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700295 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700296 assert_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000297
A R Karthick63751492017-03-22 09:28:01 -0700298 def test_vsg_for_external_connectivity_with_lan_interface_toggle_in_vcpe(self):
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000299 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700300 mgmt = 'eth0'
301 vcpe = self.vcpe_container
302 assert_not_equal(vcpe, None)
303 assert_not_equal(self.vcpe_dhcp, None)
304 #first get dhcp on the vcpe interface
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700305 vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt)
A R Karthick03f40aa2017-03-20 19:33:55 -0700306 assert_not_equal(vcpe_ip, None)
307 log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp))
308 log.info('Sending ICMP pings to host %s' %(host))
309 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
310 if st != 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700311 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700312 assert_equal(st, 0)
313 #bring down the lan interface and check again
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700314 st = VSGAccess.vcpe_lan_down(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700315 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700316 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700317 assert_equal(st, True)
318 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
319 if st == 0:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700320 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700321 assert_not_equal(st, 0)
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700322 st = VSGAccess.vcpe_lan_up(vcpe)
A R Karthick03f40aa2017-03-20 19:33:55 -0700323 if st is False:
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700324 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700325 assert_equal(st, True)
326 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700327 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
A R Karthick03f40aa2017-03-20 19:33:55 -0700328 assert_equal(st, 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000329
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000330 def test_vsg_firewall_with_deny_destination_ip(self, vcpe=None):
331 host = '8.8.8.8'
332 if not vcpe:
333 vcpe = self.vcpe_container
334 vsg = VSGAccess.get_vcpe_vsg(vcpe)
335 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
336 assert_equal(st, False)
337 try:
338 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
339 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
340 assert_equal(st, True)
341 finally:
342 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
343 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
344
345 def test_vsg_firewall_with_rule_add_and_delete_dest_ip(self, vcpe=None):
346 host = '8.8.8.8'
347 if not vcpe:
348 vcpe = self.vcpe_container
349 vsg = VSGAccess.get_vcpe_vsg(vcpe)
350 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
351 assert_equal(st, False)
352 try:
353 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
354 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
355 assert_equal(st, True)
356 st,_ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host))
357 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
358 assert_equal(st,False)
359 finally:
360 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
361 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
362
363 def test_vsg_firewall_verifying_reachability_for_non_blocked_dest_ip(self, vcpe=None):
364 host1 = '8.8.8.8'
365 host2 = '204.79.197.203'
366 if not vcpe:
367 vcpe = self.vcpe_container
368 vsg = VSGAccess.get_vcpe_vsg(vcpe)
369 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
370 assert_equal(st, False)
371 try:
372 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host1))
373 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
374 assert_equal(st, True)
375 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
376 assert_equal(st,False)
377 finally:
378 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
379 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
380
381 def test_vsg_firewall_appending_rules_with_deny_dest_ip(self, vcpe=None):
382 host1 = '8.8.8.8'
383 host2 = '204.79.197.203'
384 if not vcpe:
385 vcpe = self.vcpe_container
386 vsg = VSGAccess.get_vcpe_vsg(vcpe)
387 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
388 assert_equal(st, False)
389 try:
390 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host1))
391 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
392 assert_equal(st, True)
393 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
394 assert_equal(st, False)
395 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host2))
396 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
397 assert_equal(st,True)
398 finally:
399 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
400 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
401
402 def test_vsg_firewall_removing_one_rule_denying_dest_ip(self, vcpe=None):
403 host1 = '8.8.8.8'
404 host2 = '204.79.197.203'
405 if not vcpe:
406 vcpe = self.vcpe_container
407 vsg = VSGAccess.get_vcpe_vsg(vcpe)
408 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
409 assert_equal(st, False)
410 try:
411 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host1))
412 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host2))
413 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
414 assert_equal(st, True)
415 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
416 assert_equal(st,True)
417 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host2))
418 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
419 assert_equal(st,False)
420 finally:
421 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
422 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
423
424 def test_vsg_firewall_changing_rule_id_deny_dest_ip(self, vcpe=None):
425 host = '8.8.8.8'
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 -I FORWARD -j ACCEPT 2'.format(vcpe))
436 st,output = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD 2 -d {} -j DROP '.format(vcpe,host))
437 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
438 assert_equal(st,False)
439 finally:
440 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
441 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
442
443 def test_vsg_firewall_changing_deny_rule_to_accept_dest_ip(self, vcpe=None):
444 host1 = '8.8.8.8'
445 host2 = '204.79.197.203'
446 if not vcpe:
447 vcpe = self.vcpe_container
448 vsg = VSGAccess.get_vcpe_vsg(vcpe)
449 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
450 assert_equal(st, False)
451 try:
452 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
453 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
454 assert_equal(st, True)
455 st,output = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD -d {} -j ACCEPT 1'.format(vcpe,host))
456 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
457 assert_equal(st,False)
458 finally:
459 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
460 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
461
462 def test_vsg_firewall_denying_destination_network(self, vcpe=None):
463 network = '206.190.36.44/28'
464 host1 = '204.79.197.46'
465 host2 = '204.79.197.51'
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,network))
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 finally:
478 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
479
480 def test_vsg_firewall_denying_destination_network_subnet_modification(self, vcpe=None):
481 network1 = '206.190.36.44/28'
482 network2 = '206.190.36.44/26'
483 host1 = '204.79.197.46'
484 host2 = '204.79.197.51'
485 host2 = '204.79.197.63'
486 if not vcpe:
487 vcpe = self.vcpe_container
488 vsg = VSGAccess.get_vcpe_vsg(vcpe)
489 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
490 assert_equal(st, False)
491 try:
492 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,network1))
493 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
494 assert_equal(st, True)
495 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
496 assert_equal(st,False)
497 st,output = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD -d {} -j DROP'.format(vcpe,network2))
498 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
499 assert_equal(st, True)
500 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
501 assert_equal(st, True)
502 st, _ = getstatusoutput('ping -c 1 {}'.format(host3))
503 assert_equal(st, False)
504 finally:
505 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
506
507 def test_vsg_firewall_with_deny_source_ip(self, vcpe=None):
508 host = '8.8.8.8'
509 source_ip = self.vcpe_dhcp
510 if not vcpe:
511 vcpe = self.vcpe_container
512 vsg = VSGAccess.get_vcpe_vsg(vcpe)
513 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
514 assert_equal(st, False)
515 try:
516 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -s {} -j DROP'.format(vcpe,source_ip))
517 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
518 assert_equal(st, True)
519 finally:
520 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
521
522 def test_vsg_firewall_rule_with_add_and_delete_deny_source_ip(self, vcpe=None):
523 host = '8.8.8.8'
524 source_ip = self.vcpe_dhcp
525 if not vcpe:
526 vcpe = self.vcpe_container
527 vsg = VSGAccess.get_vcpe_vsg(vcpe)
528 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
529 assert_equal(st, False)
530 try:
531 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -s {} -j DROP'.format(vcpe,source_ip))
532 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
533 assert_equal(st, True)
534 st, _ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -s {} -j DROP'.format(vcpe,source_ip))
535 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
536 assert_equal(st, False)
537 finally:
538 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
539
540 def test_vsg_firewall_rule_with_deny_icmp_protocol_echo_requests_type(self, vcpe=None):
541 host = '8.8.8.8'
542 if not vcpe:
543 vcpe = self.vcpe_container
544 vsg = VSGAccess.get_vcpe_vsg(vcpe)
545 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
546 assert_equal(st, False)
547 try:
548 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe))
549 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
550 assert_equal(st, True)
551 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe))
552 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
553 assert_equal(st, False)
554 finally:
555 vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
556 vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
557
558 def test_vsg_firewall_rule_with_deny_icmp_protocol_echo_reply_type(self, vcpe=None):
559 host = '8.8.8.8'
560 if not vcpe:
561 vcpe = self.vcpe_container
562 vsg = VSGAccess.get_vcpe_vsg(vcpe)
563 st, _ = getstatusoutput('ping -c 1 {}'.format('8.8.8.8'))
564 assert_equal(st, False)
565 try:
566 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe))
567 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
568 assert_equal(st, True)
569 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe))
570 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
571 assert_equal(st,False)
572 finally:
573 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
574 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
575
576 def test_vsg_firewall_changing_deny_rule_to_accept_rule_with_icmp_protocol_echo_requests_type(self, vcpe=None):
577 host = '8.8.8.8'
578 if not vcpe:
579 vcpe = self.vcpe_container
580 vsg = VSGAccess.get_vcpe_vsg(vcpe)
581 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
582 assert_equal(st, False)
583 try:
584 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-request -j DROP'.format(vcpe))
585 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
586 assert_equal(st, True)
587 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-request -j ACCEPT'.format(vcpe))
588 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
589 assert_equal(st,False)
590 finally:
591 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
592 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
593
594 def test_vsg_firewall_changing_deny_rule_to_accept_rule_with_icmp_protocol_echo_reply_type(self, vcpe=None):
595 host = '8.8.8.8'
596 if not vcpe:
597 vcpe = self.vcpe_container
598 vsg = VSGAccess.get_vcpe_vsg(vcpe)
599 st, out1 = getstatusoutput('ping -c 1 {}'.format(host))
600 assert_equal(st, False)
601 try:
602 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-reply -j DROP'.format(vcpe))
603 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
604 assert_equal(st, True)
605 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 1 -p icmp --icmp-type echo-reply -j ACCEPT'.format(vcpe))
606 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
607 assert_equal(st,False)
608 finally:
609 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
610 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
611
612 def test_vsg_firewall_for_deny_icmp_protocol(self, vcpe=None):
613 host = '8.8.8.8'
614 if not vcpe:
615 vcpe = self.vcpe_container
616 vsg = VSGAccess.get_vcpe_vsg(vcpe)
617 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
618 assert_equal(st, False)
619 try:
620 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe))
621 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
622 assert_equal(st, True)
623 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe))
624 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
625 assert_equal(st,False)
626 finally:
627 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
628 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
629
630 def test_vsg_firewall_rule_deny_icmp_protocol_and_destination_ip(self, vcpe=None):
631 host = '8.8.8.8'
632 if not vcpe:
633 vcpe = self.vcpe_container
634 vsg = VSGAccess.get_vcpe_vsg(vcpe)
635 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
636 assert_equal(st, False)
637 try:
638 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
639 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
640 assert_equal(st, True)
641 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe))
642 assert_equal(st, True)
643 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host))
644 assert_equal(st, True)
645 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe))
646 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
647 assert_equal(st,False)
648 finally:
649 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
650 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
651
652 def test_vsg_firewall_flushing_all_configured_rules(self, vcpe=None):
653 host = '8.8.8.8'
654 if not vcpe:
655 vcpe = self.vcpe_container
656 vsg = VSGAccess.get_vcpe_vsg(vcpe)
657 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
658 assert_equal(st, False)
659 try:
660 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
661 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
662 assert_equal(st, True)
663 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe))
664 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
665 assert_equal(st, True)
666 st,output = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
667 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
668 assert_equal(st, False)
669 finally:
670 st, _ = vsg.run_cmd('sudo docker exec {} iptables -X'.format(vcpe))
671 st, _ = vsg.run_cmd('sudo docker exec {} iptables -F'.format(vcpe))
672
A.R Karthick282f0d32017-03-28 16:43:59 -0700673 def test_vsg_xos_subscriber(self):
674 subscriber_info = self.subscriber_info[0]
675 volt_subscriber_info = self.volt_subscriber_info[0]
676 result = self.restApiXos.ApiPost('TENANT_SUBSCRIBER', subscriber_info)
677 assert_equal(result, True)
678 result = self.restApiXos.ApiGet('TENANT_SUBSCRIBER')
679 assert_not_equal(result, None)
680 subId = self.restApiXos.getSubscriberId(result, volt_subscriber_info['account_num'])
681 assert_not_equal(subId, '0')
682 log.info('Subscriber ID for account num %d = %s' %(volt_subscriber_info['account_num'], subId))
683 volt_tenant = volt_subscriber_info['voltTenant']
684 #update the subscriber id in the tenant info before making the rest
685 volt_tenant['subscriber'] = subId
686 result = self.restApiXos.ApiPost('TENANT_VOLT', volt_tenant)
687 assert_equal(result, True)
688
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000689 def test_vsg_for_ping_from_vsg_to_external_network(self):
690 """
691 Algo:
692 1.Create a vSG VM in compute node
693 2.Ensure VM created properly
694 3.Verify login to VM success
695 4.Do ping to external network from vSG VM
696 5.Verify that ping gets success
697 6.Verify ping success flows added in OvS
698 """
A R Karthick63751492017-03-22 09:28:01 -0700699
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000700 def test_vsg_for_ping_from_vcpe_to_external_network(self):
701 """
702 Algo:
703 1.Create a vSG VM in compute node
704 2.Create a vCPE container inside VM
705 3.Verify both VM and Container created properly
706 4.Verify login to vCPE container success
707 5.Do ping to external network from vCPE container
708 6.Verify that ping gets success
709 7.Verify ping success flows added in OvS
710 """
711
Chetan Gaonker52418832017-01-26 23:03:13 +0000712 def test_vsg_for_dns_service(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000713 """
714 Algo:
715 1. Create a test client in Prod VM
716 2. Create a vCPE container in vSG VM inside compute Node
717 3. Ensure vSG VM and vCPE container created properly
718 4. Enable dns service in vCPE ( if not by default )
719 5. Send ping request from test client to valid domain address say, 'www.google'com
720 6. Verify that dns should resolve ping should success
721 7. Now send ping request to invalid domain address say 'www.invalidaddress'.com'
722 8. Verify that dns resolve should fail and hence ping
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(self):
726 """
727 Algo:
728 1.Create a vSG VM in compute node
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 each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
732 5.Verify that ping success for all 10 subscribers
733 """
A R Karthick63751492017-03-22 09:28:01 -0700734
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000735 def test_vsg_for_10_subscribers_for_same_service_ping_invalid_ip(self):
736 """
737 Algo:
738 1.Create a vSG VM in compute Node
739 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
740 3.Ensure vSG VM and vCPE container created properly
741 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP
742 5.Verify that ping fails for all 10 subscribers
743 """
A R Karthick63751492017-03-22 09:28:01 -0700744
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000745 def test_vsg_for_10_subscribers_for_same_service_ping_valid_and_invalid_ip(self):
746 """
747 Algo:
748 1.Create a vSG VM in VM
749 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
750 3.Ensure vSG VM and vCPE container created properly
751 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP
752 5.Verify that ping success for all 5 subscribers
753 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP
754 7.Verify that ping fails for all 5 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(self):
758 """
759 Algo:
760 1.Create a vSG VM in compute node
761 2.Create 100 vCPE containers for 100 subscribers, in vSG VM
762 3.Ensure vSG VM and vCPE container created properly
763 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
764 5.Verify that ping success for all 100 subscribers
765 """
A R Karthick63751492017-03-22 09:28:01 -0700766
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000767 def test_vsg_for_100_subscribers_for_same_service_ping_invalid_ip(self):
768 """
769 Algo:
770 1.Create a vSG VM in compute Node
771 2.Create 10 vCPE containers for 100 subscribers, in vSG VM
772 3.Ensure vSG VM and vCPE container created properly
773 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to invalid IP
774 5.Verify that ping fails for all 100 subscribers
775 """
A R Karthick63751492017-03-22 09:28:01 -0700776
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000777 def test_vsg_for_100_subscribers_for_same_service_ping_valid_and_invalid_ip(self):
778 """
779 Algo:
780 1.Create a vSG VM in VM
781 2.Create 10 vCPE containers for 100 subscribers, in vSG VM
782 3.Ensure vSG VM and vCPE container created properly
783 4.From first 5 subscribers, with same s-tag and different c-tag, send a ping to valid IP
784 5.Verify that ping success for all 5 subscribers
785 6.From next 5 subscribers, with same s-tag and different c-tag, send a ping to invalid IP
786 7.Verify that ping fails for all 5 subscribers
787 """
A R Karthick63751492017-03-22 09:28:01 -0700788
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000789 def test_vsg_for_packet_received_with_invalid_ip_fields(self):
790 """
791 Algo:
792 1.Create a vSG VM in compute node
793 2.Create a vCPE container in vSG VM
794 3.Ensure vSG VM and vCPE container created properly
795 4.From subscriber, send a ping packet with invalid ip fields
796 5.Verify that vSG drops the packet
797 6.Verify ping fails
798 """
A R Karthick63751492017-03-22 09:28:01 -0700799
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000800 def test_vsg_for_packet_received_with_invalid_mac_fields(self):
801 """
802 Algo:
803 1.Create a vSG VM in compute node
804 2.Create a vCPE container in vSG VM
805 3.Ensure vSG VM and vCPE container created properly
806 4.From subscriber, send a ping packet with invalid mac fields
807 5.Verify that vSG drops the packet
808 6.Verify ping fails
809 """
A R Karthick63751492017-03-22 09:28:01 -0700810
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000811 def test_vsg_for_vlan_id_mismatch_in_stag(self):
812 """
813 Algo:
814 1.Create a vSG VM in compute Node
815 2.Create a vCPE container in vSG VM
816 3.Ensure vSG VM and vCPE container created properly
817 4.Send a ping request to external valid IP from subscriber, with incorrect vlan id in s-tag and valid c-tag
818 5.Verify that ping fails as the packet drops at VM entry
819 6.Repeat step 4 with correct s-tag
820 7.Verify that ping success
821 """
A R Karthick63751492017-03-22 09:28:01 -0700822
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000823 def test_vsg_for_vlan_id_mismatch_in_ctag(self):
824 """
825 Algo:
826 1.Create a vSG VM in compute node
827 2.Create a vCPE container in vSG VM
828 3.Ensure vSG VM and vCPE container created properly
829 4.Send a ping request to external valid IP from subscriber, with valid s-tag and incorrect vlan id in c-tag
830 5.Verify that ping fails as the packet drops at vCPE container entry
831 6.Repeat step 4 with valid s-tag and c-tag
832 7.Verify that ping success
833 """
A R Karthick63751492017-03-22 09:28:01 -0700834
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000835 def test_vsg_for_matching_and_mismatching_vlan_id_in_stag(self):
836 """
837 Algo:
838 1.Create two vSG VMs in compute node
839 2.Create a vCPE container in each vSG VM
840 3.Ensure vSG VM and vCPE container created properly
841 4.From subscriber one, send ping request with valid s and c tags
842 5.From subscriber two, send ping request with vlan id mismatch in s-tag and valid c tags
843 6.Verify that ping success for only subscriber one and fails for two.
844 """
A R Karthick63751492017-03-22 09:28:01 -0700845
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000846 def test_vsg_for_matching_and_mismatching_vlan_id_in_ctag(self):
847 """
848 Algo:
849 1.Create a vSG VM in compute node
850 2.Create two vCPE containers in vSG VM
851 3.Ensure vSG VM and vCPE container created properly
852 4.From subscriber one, send ping request with valid s and c tags
853 5.From subscriber two, send ping request with valid s-tag and vlan id mismatch in c-tag
854 6.Verify that ping success for only subscriber one and fails for two
855 """
A R Karthick63751492017-03-22 09:28:01 -0700856
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000857 def test_vsg_for_out_of_range_vlanid_in_ctag(self):
858 """
859 Algo:
860 1.Create a vSG VM in compute node
861 2.Create a vCPE container in vSG VM
862 3.Ensure vSG VM and vCPE container created properly
863 4.From subscriber, send ping request with valid stag and vlan id in c-tag is an out of range value ( like 0,4097 )
864 4.Verify that ping fails as the ping packets drops at vCPE container entry
865 """
A R Karthick63751492017-03-22 09:28:01 -0700866
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000867 def test_vsg_for_out_of_range_vlanid_in_stag(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 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
874 4.Verify that ping fails as the ping packets drops at vSG VM entry
875 """
A R Karthick63751492017-03-22 09:28:01 -0700876
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000877 def test_vsg_without_creating_vcpe_instance(self):
878 """
879 Algo:
880 1.Create a vSG VM in compute Node
881 2.Ensure vSG VM created properly
882 3.Do not create vCPE container inside vSG VM
883 4.From a subscriber, send ping to external valid IP
884 5.Verify that ping fails as the ping packet drops at vSG VM entry itself.
885 """
A R Karthick63751492017-03-22 09:28:01 -0700886
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000887 def test_vsg_for_remove_vcpe_instance(self):
888 """
889 Algo:
890 1.Create a vSG VM in compute node
891 2.Create a vCPE container in vSG VM
892 3.Ensure vSG VM and vCPE container created properly
893 4.From subscriber, send ping request with valid s-tag and c-tag
894 5.Verify that ping success
895 6.Verify ping success flows in OvS switch in compute node
896 7.Now remove the vCPE container in vSG VM
897 8.Ensure that the container removed properly
898 9.Repeat step 4
899 10.Verify that now, ping fails
900 """
A R Karthick63751492017-03-22 09:28:01 -0700901
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000902 def test_vsg_for_restart_vcpe_instance(self):
903 """
904 Algo:
905 1.Create a vSG VM in compute node
906 2.Create a vCPE container in vSG VM
907 3.Ensure vSG VM and vCPE container created properly
908 4.From subscriber, send ping request with valid s-tag and c-tag
909 5.Verify that ping success
910 6.Verify ping success flows in OvS switch in compute node
911 7.Now restart the vCPE container in vSG VM
912 8.Ensure that the container came up after restart
913 9.Repeat step 4
914 10.Verify that now,ping gets success and flows added in OvS
915 """
A R Karthick63751492017-03-22 09:28:01 -0700916
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000917 def test_vsg_for_restart_vsg_vm(self):
918 """
919 Algo:
920 1.Create a vSG VM in compute node
921 2.Create a vCPE container in vSG VM
922 3.Ensure vSG VM and vCPE container created properly
923 4.From subscriber, send ping request with valid s-tag and c-tag
924 5.Verify that ping success
925 6.Verify ping success flows in OvS switch in compute node
926 7.Now restart the vSG VM
927 8.Ensure that the vSG comes up properly after restart
928 9.Verify that vCPE container comes up after vSG restart
929 10.Repeat step 4
930 11.Verify that now,ping gets success and flows added in OvS
931 """
A R Karthick63751492017-03-22 09:28:01 -0700932
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000933 def test_vsg_for_pause_vcpe_instance(self):
934 """
935 Algo:
936 1.Create a vSG VM in compute node
937 2.Create a vCPE container in vSG VM
938 3.Ensure vSG VM and vCPE container created properly
939 4.From subscriber, send ping request with valid s-tag and c-tag
940 5.Verify that ping success
941 6.Verify ping success flows in OvS switch in compute node
942 7.Now pause vCPE container in vSG VM for a while
943 8.Ensure that the container state is pause
944 9.Repeat step 4
945 10.Verify that now,ping fails now and verify flows in OvS
946 11.Now resume the container
947 12.Now repeat step 4 again
948 13.Verify that now, ping gets success
949 14.Verify ping success flows in OvS
950 """
A R Karthick63751492017-03-22 09:28:01 -0700951
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000952 def test_vsg_for_extract_all_compute_stats_from_all_vcpe_containers(self):
953 """
954 Algo:
955 1.Create a vSG VM in compute node
956 2.Create 10 vCPE containers in VM
957 3.Ensure vSG VM and vCPE containers created properly
958 4.Login to all vCPE containers
959 4.Get all compute stats from all vCPE containers
960 5.Verify the stats # verification method need to add
961 """
A R Karthick63751492017-03-22 09:28:01 -0700962
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000963 def test_vsg_for_extract_dns_stats_from_all_vcpe_containers(self):
964 """
965 Algo:
966 1.Create a vSG VM in compute node
967 2.Create 10 vCPE containers in VM
968 3.Ensure vSG VM and vCPE containers created properly
969 4.From 10 subscribers, send ping to valid and invalid dns hosts
970 5.Verify dns resolves and ping success for valid dns hosts
971 6.Verify ping fails for invalid dns hosts
972 7.Verify dns host name resolve flows in OvS
973 8.Login to all 10 vCPE containers
974 9.Extract all dns stats
975 10.Verify dns stats for queries sent, queries received for dns host resolve success and failed scenarios
976 """
A R Karthick63751492017-03-22 09:28:01 -0700977
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000978 def test_vsg_for_subscriber_access_two_vsg_services(self):
979 """
980 # Intention is to verify if subscriber can reach internet via two vSG VMs
981 Algo:
982 1.Create two vSG VMs for two services in compute node
983 2.Create one vCPE container in each VM for one subscriber
984 3.Ensure VMs and containers created properly
985 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
986 5.Verify ping gets success
987 6.Verify ping success flows in OvS
988 7.Now repeat step 4 with stag corresponds to vSG-2 VM
989 8.Verify that ping again success
990 9.Verify ping success flows in OvS
991 """
A R Karthick63751492017-03-22 09:28:01 -0700992
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +0000993 def test_vsg_for_subscriber_access_service2_if_service1_goes_down(self):
994 """
995 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
996 Algo:
997 1.Create two vSG VMs for two services in compute node
998 2.Create one vCPE container in each VM for one subscriber
999 3.Ensure VMs and containers created properly
1000 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
1001 5.Verify ping gets success
1002 6.Verify ping success flows in OvS
1003 7.Down the vSG-1 VM
1004 8.Now repeat step 4
1005 9.Verify that ping fails as vSG-1 is down
1006 10.Repeat step 4 with stag corresponding to vSG-2
1007 9.Verify ping success and flows added in OvS
1008 """
A R Karthick63751492017-03-22 09:28:01 -07001009
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001010 def test_vsg_for_subscriber_access_service2_if_service1_goes_restart(self):
1011 """
1012 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
1013 Algo:
1014 1.Create two vSG VMs for two services in compute node
1015 2.Create one vCPE container in each VM for one subscriber
1016 3.Ensure VMs and containers created properly
1017 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
1018 5.Verify ping gets success
1019 6.Verify ping success flows added in OvS
1020 7.Now restart vSG-1 VM
1021 8.Now repeat step 4 while vSG-1 VM restarts
1022 9.Verify that ping fails as vSG-1 is restarting
1023 10.Repeat step 4 with stag corresponding to vSG-2 while vSG-1 VM restarts
1024 11.Verify ping success and flows added in OvS
1025 """
A R Karthick63751492017-03-22 09:28:01 -07001026
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001027 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_goes_down(self):
1028 """
1029 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
1030 Algo:
1031 1.Create a vSG VM in compute node
1032 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1033 3.Ensure VM and containers created properly
1034 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1035 5.Verify ping gets success
1036 6.Verify ping success flows added in OvS
1037 7.Now stop vCPE-1 container
1038 8.Now repeat step 4
1039 9.Verify that ping fails as vCPE-1 container is down
1040 10.Repeat step 4 with ctag corresponding to vCPE-2 container
1041 11.Verify ping success and flows added in OvS
1042 """
A R Karthick63751492017-03-22 09:28:01 -07001043
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001044 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_restart(self):
1045 """
1046 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
1047 Algo:
1048 1.Create a vSG VM in compute node
1049 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1050 3.Ensure VM and containers created properly
1051 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1052 5.Verify ping gets success
1053 6.Verify ping success flows added in OvS
1054 7.Now restart vCPE-1 container
1055 8.Now repeat step 4 while vCPE-1 restarts
1056 9.Verify that ping fails as vCPE-1 container is restarts
1057 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 restarts
1058 11..Verify ping success and flows added in OvS
1059 """
A R Karthick63751492017-03-22 09:28:01 -07001060
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001061 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_pause(self):
1062 """
1063 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 paused
1064 Algo:
1065 1.Create a vSG VM in compute node
1066 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1067 3.Ensure VM and containers created properly
1068 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1069 5.Verify ping gets success
1070 6.Verify ping success flows added in OvS
1071 7.Now pause vCPE-1 container
1072 8.Now repeat step 4 while vCPE-1 in pause state
1073 9.Verify that ping fails as vCPE-1 container in pause state
1074 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 in pause state
1075 11.Verify ping success and flows added in OvS
1076 """
1077 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_removed(self):
1078 """
1079 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 removed
1080 Algo:
1081 1.Create a vSG VM in compute node
1082 2.Create two vCPE containers corresponds to two subscribers in vSG VM
1083 3.Ensure VM and containers created properly
1084 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
1085 5.Verify ping gets success
1086 6.Verify ping success flows added in OvS
1087 7.Now remove vCPE-1 container
1088 8.Now repeat step 4
1089 9.Verify that ping fails as vCPE-1 container removed
1090 10.Repeat step 4 with ctag corresponding to vCPE-2 container
1091 11.Verify ping success and flows added in OvS
1092 """
A R Karthick63751492017-03-22 09:28:01 -07001093
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001094 def test_vsg_for_vcpe_instance_removed_and_added_again(self):
1095 """
1096 Algo:
1097 1.Create a vSG VM in compute node
1098 2.Create a vCPE container in vSG VM
1099 3.Ensure VM and containers created properly
1100 4.From subscriber end, send ping to public IP
1101 5.Verify ping gets success
1102 6.Verify ping success flows added in OvS
1103 7.Now remove vCPE container in vSG VM
1104 8.Now repeat step 4
1105 9.Verify that ping fails as vCPE container removed
1106 10.Create the vCPE container again for the same subscriber
1107 11.Ensure that vCPE created now
1108 12.Now repeat step 4
1109 13.Verify ping success and flows added in OvS
1110 """
A R Karthick63751492017-03-22 09:28:01 -07001111
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00001112 def test_vsg_for_vsg_vm_removed_and_added_again(self):
1113 """
1114 Algo:
1115 1.Create a vSG VM in compute node
1116 2.Create a vCPE container in vSG VM
1117 3.Ensure VM and containers created properly
1118 4.From subscriber end, send ping to public IP
1119 5.Verify ping gets success
1120 6.Verify ping success flows added in OvS
1121 7.Now remove vSG VM
1122 8.Now repeat step 4
1123 9.Verify that ping fails as vSG VM not exists
1124 10.Create the vSG VM and vCPE container in VM again
1125 11.Ensure that vSG and vCPE created
1126 12.Now repeat step 4
1127 13.Verify ping success and flows added in OvS
1128 """
1129
1130 #Test vSG - Subscriber Configuration
1131 def test_vsg_for_configuring_new_subscriber_in_vcpe(self):
1132 """
1133 Algo:
1134 1.Create a vSG VM in compute node
1135 2.Create a vCPE container in vSG VM
1136 3.Ensure VM and containers created properly
1137 4.Configure a subscriber in XOS and assign a service id
1138 5.Set the admin privileges to the subscriber
1139 6.Verify subscriber configuration is success
1140 """
1141 def test_vsg_for_adding_subscriber_devices_in_vcpe(self):
1142 """
1143 Algo:
1144 1.Create a vSG VM in compute node
1145 2.Create a vCPE container in vSG VM
1146 3.Ensure VM and containers created properly
1147 4.Configure a subscriber in XOS and assign a service id
1148 5.Verify subscriber successfully configured in vCPE
1149 6.Now add devices( Mac addresses ) under the subscriber admin group
1150 7.Verify all devices ( Macs ) added successfully
1151 """
1152 def test_vsg_for_removing_subscriber_devices_in_vcpe(self):
1153 """
1154 Algo:
1155 1.Create a vSG VM in compute node
1156 2.Create a vCPE container in vSG VM
1157 3.Ensure VM and containers created properly
1158 4.Configure a subscriber in XOS and assign a service id
1159 5.Verify subscriber successfully configured
1160 6.Now add devices( Mac addresses ) under the subscriber admin group
1161 7.Verify all devices ( Macs ) added successfully
1162 8.Now remove All the added devices in XOS
1163 9.Verify all the devices removed
1164 """
1165 def test_vsg_for_modify_subscriber_devices_in_vcpe(self):
1166 """
1167 Algo:
1168 1.Create a vSG VM in compute node
1169 2.Create a vCPE container in vSG VM
1170 3.Ensure VM and containers created properly
1171 4.Configure a user in XOS and assign a service id
1172 5.Verify subscriber successfully configured in vCPE.
1173 6.Now add devices( Mac addresses ) under the subscriber admin group
1174 7.Verify all devices ( Macs ) added successfully
1175 8.Now remove few devices in XOS
1176 9.Verify devices removed successfully
1177 10.Now add few additional devices in XOS under the same subscriber admin group
1178 11.Verify newly added devices successfully added
1179 """
1180 def test_vsg_for_vcpe_login_fails_with_incorrect_subscriber_credentials(self):
1181 """
1182 Algo:
1183 1.Create a vSG VM in compute node
1184 2.Create a vCPE container in vSG VM
1185 3.Ensure VM and containers created properly
1186 4.Configure a subscriber in XOS and assign a service id
1187 5.Verify subscriber successfully configured
1188 6.Now add devices( Mac addresses ) under the subscriber admin group
1189 7.Verify all devices ( Macs ) added successfully
1190 8.Login vCPE with credentials with which subscriber configured
1191 9.Verify subscriber successfully logged in
1192 10.Logout and login again with incorrect credentials ( either user name or password )
1193 11.Verify login attempt to vCPE fails wtih incorrect credentials
1194 """
1195 def test_vsg_for_subscriber_configuration_in_vcpe_retain_after_vcpe_restart(self):
1196 """
1197 Algo:
1198 1.Create a vSG VM in compute node
1199 2.Create a vCPE container in vSG VM
1200 3.Ensure VM and containers created properly
1201 4.Configure a subscriber in XOS and assign a service id
1202 5.Verify subscriber successfully configured
1203 6.Now add devices( Mac addresses ) under the subscriber admin group
1204 7.Verify all devices ( Macs ) added successfully
1205 8.Restart vCPE ( locate backup config path while restart )
1206 9.Verify subscriber details in vCPE after restart should be same as before the restart
1207 """
1208 def test_vsg_for_create_multiple_vcpe_instances_and_configure_subscriber_in_each_instance(self):
1209 """
1210 Algo:
1211 1.Create a vSG VM in compute node
1212 2.Create 2 vCPE containers in vSG VM
1213 3.Ensure VM and containers created properly
1214 4.Configure a subscriber in XOS for each vCPE instance and assign a service id
1215 5.Verify subscribers successfully configured
1216 6.Now login vCPE-2 with subscriber-1 credentials
1217 7.Verify login fails
1218 8.Now login vCPE-1 with subscriber-2 credentials
1219 9.Verify login fails
1220 10.Now login vCPE-1 with subscriber-1 and vCPE-2 with subscriber-2 credentials
1221 11.Verify that both the subscribers able to login to their respective vCPE containers
1222 """
1223 def test_vsg_for_same_subscriber_can_be_configured_for_multiple_services(self):
1224 """
1225 Algo:
1226 1.Create 2 vSG VMs in compute node
1227 2.Create a vCPE container in each vSG VM
1228 3.Ensure VMs and containers created properly
1229 4.Configure same subscriber in XOS for each vCPE instance and assign a service id
1230 5.Verify subscriber successfully configured
1231 6.Now login vCPE-1 with subscriber credentials
1232 7.Verify login success
1233 8.Now login vCPE-2 with the same subscriber credentials
1234 9.Verify login success
1235 """
1236
1237 #Test Example Service
1238 def test_vsg_for_subcriber_avail_example_service_running_in_apache_server(self):
1239 """
1240 Algo:
1241 1.Create a vSG VM in compute node
1242 2.Create a vCPE container in each vSG VM
1243 3.Ensure VM and container created properly
1244 4.Configure a subscriber in XOS for the vCPE instance and assign a service id
1245 5.On-board an example service into cord pod
1246 6.Create a VM in compute node and run the example service ( Apache server )
1247 7.Configure the example service with service specific and subscriber specific messages
1248 8.Verify example service on-boarded successfully
1249 9.Verify example service running in VM
1250 10.Run a curl command from subscriber to reach example service
1251 11.Verify subscriber can successfully reach example service via vSG
1252 12.Verify that service specific and subscriber specific messages
1253 """
1254 def test_vsg_for_subcriber_avail_example_service_running_in_apache_server_after_service_restart(self):
1255 """
1256 Algo:
1257 1.Create a vSG VM in compute node
1258 2.Create a vCPE container in each vSG VM
1259 3.Ensure VM and container created properly
1260 4.Configure a subscriber in XOS for the vCPE instance and assign a service id
1261 5.On-board an example service into cord pod
1262 6.Create a VM in compute node and run the example service ( Apache server )
1263 7.Configure the example service with service specific and subscriber specific messages
1264 8.Verify example service on-boarded successfully
1265 9.Verify example service running in VM
1266 10.Run a curl command from subscriber to reach example service
1267 11.Verify subscriber can successfully reach example service via vSG
1268 12.Verify that service specific and subscriber specific messages
1269 13.Restart example service running in VM
1270 14.Repeat step 10
1271 15.Verify the same results as mentioned in steps 11, 12
1272 """
1273
1274 #vCPE Firewall Functionality
1275 def test_vsg_firewall_for_creating_acl_rule_based_on_source_ip(self):
1276 """
1277 Algo:
1278 1.Create a vSG VM in compute node
1279 2.Create vCPE container in the VM
1280 3.Ensure vSG VM and vCPE container created properly
1281 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
1282 5.Bound the acl rule to WAN interface of vCPE
1283 6.Verify configuration in vCPE is success
1284 8.Verify flows added in OvS
1285 """
1286 def test_vsg_firewall_for_creating_acl_rule_based_on_destination_ip(self):
1287 """
1288 Algo:
1289 1.Create a vSG VM in compute node
1290 2.Create vCPE container in the VM
1291 3.Ensure vSG VM and vCPE container created properly
1292 4.Configure ac acl rule in vCPE to deny IP traffic to a destination ip
1293 5.Bound the acl rule to WAN interface of vCPE
1294 6.Verify configuration in vCPE is success
1295 8.Verify flows added in OvS
1296 """
1297 def test_vsg_firewall_for_acl_deny_rule_based_on_source_ip_traffic(self):
1298 """
1299 Algo:
1300 1.Create a vSG VM in compute node
1301 2.Create vCPE container in the VM
1302 3.Ensure vSG VM and vCPE container created properly
1303 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
1304 5.Bound the acl rule to WAN interface of vCPE
1305 6.From subscriber, send ping to the denied IP address
1306 7.Verify that ping fails as vCPE denies ping response
1307 8.Verify flows added in OvS
1308 """
1309 def test_vsg_firewall_for_acl_deny_rule_based_on_destination_ip_traffic(self):
1310 """
1311 Algo:
1312 1.Create a vSG VM in compute node
1313 2.Create vCPE container in the VM
1314 3.Ensure vSG VM and vCPE container created properly
1315 4.Configure ac acl rule in vCPE to deny IP traffic to a destination IP
1316 5.Bound the acl rule to WAN interface of vCPE
1317 6.From subscriber, send ping to the denied IP address
1318 7.Verify that ping fails as vCPE drops the ping request at WAN interface
1319 8.Verify flows added in OvS
1320 """
Chetan Gaonker52418832017-01-26 23:03:13 +00001321
1322 def test_vsg_dnsmasq(self):
1323 pass
1324
1325 def test_vsg_with_external_parental_control_family_shield_for_filter(self):
1326 pass
1327
1328 def test_vsg_with_external_parental_control_with_answerx(self):
1329 pass
1330
1331 def test_vsg_for_subscriber_upstream_bandwidth(self):
1332 pass
1333
1334 def test_vsg_for_subscriber_downstream_bandwidth(self):
1335 pass
1336
1337 def test_vsg_for_diagnostic_run_of_traceroute(self):
1338 pass
1339
1340 def test_vsg_for_diagnostic_run_of_tcpdump(self):
1341 pass
1342
1343 def test_vsg_for_iptable_rules(self):
1344 pass
1345
1346 def test_vsg_for_iptables_with_neutron(self):
1347 pass