blob: 363dc74918cf7beece5c1b7ab19ffcc2640ffb51 [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 *
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +000020from twisted.internet import defer
21from nose.twistedtools import reactor, deferred
A.R Karthick33cfdbe2017-03-17 18:03:48 -070022from CordTestUtils import *
Chetan Gaonker52418832017-01-26 23:03:13 +000023from OltConfig import OltConfig
Chetan Gaonker52418832017-01-26 23:03:13 +000024from onosclidriver import OnosCliDriver
A.R Karthick9ccd0d02017-03-16 17:11:08 -070025from SSHTestAgent import SSHTestAgent
Chetan Gaonker52418832017-01-26 23:03:13 +000026from CordLogger import CordLogger
A R Karthickd0fdf3b2017-03-21 16:54:22 -070027from VSGAccess import VSGAccess
A R Karthick933f5b52017-03-27 15:27:16 -070028from CordTestUtils import log_test as log
A R Karthick19771192017-04-25 14:57:05 -070029from CordTestConfig import setup_module, running_on_ciab
A.R Karthicka9b594d2017-03-29 16:25:22 -070030from OnosCtrl import OnosCtrl
A.R Karthick282f0d32017-03-28 16:43:59 -070031
Chetan Gaonker52418832017-01-26 23:03:13 +000032log.setLevel('INFO')
33
34class vsg_exchange(CordLogger):
35 ONOS_INSTANCES = 3
36 V_INF1 = 'veth0'
37 device_id = 'of:' + get_mac()
Chetan Gaonker52418832017-01-26 23:03:13 +000038 TEST_IP = '8.8.8.8'
39 HOST = "10.1.0.1"
40 USER = "vagrant"
41 PASS = "vagrant"
A R Karthick63751492017-03-22 09:28:01 -070042 head_node = os.getenv('HEAD_NODE', 'prod')
A.R Karthick9ccd0d02017-03-16 17:11:08 -070043 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
A R Karthick03f40aa2017-03-20 19:33:55 -070044 test_path = os.path.dirname(os.path.realpath(__file__))
45 olt_conf_file = os.path.join(test_path, '..', 'setup/olt_config.json')
A.R Karthick282f0d32017-03-28 16:43:59 -070046 restApiXos = None
A R Karthick0a4ca3a2017-03-30 09:36:53 -070047 subscriber_account_num = 200
48 subscriber_s_tag = 304
49 subscriber_c_tag = 304
50 subscribers_per_s_tag = 8
51 subscriber_map = {}
A R Karthickb0cec7c2017-04-21 10:42:54 -070052 subscriber_info = []
53 volt_subscriber_info = []
A R Karthick9a16a112017-04-07 15:40:05 -070054 restore_methods = []
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +000055 TIMEOUT=120
A.R Karthickb145da82017-04-20 14:45:43 -070056 FABRIC_PORT_HEAD_NODE = 1
57 FABRIC_PORT_COMPUTE_NODE = 2
58 APP_NAME = 'org.ciena.xconnect'
59 APP_FILE = os.path.join(test_path, '..', 'apps/xconnect-1.0-SNAPSHOT.oar')
A.R Karthick50f4d9a2017-04-20 16:44:19 -070060 NUM_SUBSCRIBERS = 5
A R Karthick0a4ca3a2017-03-30 09:36:53 -070061
62 @classmethod
63 def getSubscriberCredentials(cls, subId):
64 """Generate our own account num, s_tag and c_tags"""
65 if subId in cls.subscriber_map:
66 return cls.subscriber_map[subId]
67 account_num = cls.subscriber_account_num
68 cls.subscriber_account_num += 1
69 s_tag, c_tag = cls.subscriber_s_tag, cls.subscriber_c_tag
70 cls.subscriber_c_tag += 1
71 if cls.subscriber_c_tag % cls.subscribers_per_s_tag == 0:
72 cls.subscriber_s_tag += 1
73 cls.subscriber_map[subId] = account_num, s_tag, c_tag
74 return cls.subscriber_map[subId]
A.R Karthick282f0d32017-03-28 16:43:59 -070075
76 @classmethod
A.R Karthicka9b594d2017-03-29 16:25:22 -070077 def getXosCredentials(cls):
78 onos_cfg = OnosCtrl.get_config()
79 if onos_cfg is None:
80 return None
81 if 'apps' in onos_cfg and \
82 'org.opencord.vtn' in onos_cfg['apps'] and \
83 'cordvtn' in onos_cfg['apps']['org.opencord.vtn'] and \
84 'xos' in onos_cfg['apps']['org.opencord.vtn']['cordvtn']:
85 xos_cfg = onos_cfg['apps']['org.opencord.vtn']['cordvtn']['xos']
86 endpoint = xos_cfg['endpoint']
87 user = xos_cfg['user']
88 password = xos_cfg['password']
89 xos_endpoints = endpoint.split(':')
90 xos_host = xos_endpoints[1][len('//'):]
91 xos_port = xos_endpoints[2][:-1]
92 #log.info('xos_host: %s, port: %s, user: %s, password: %s' %(xos_host, xos_port, user, password))
93 return dict(host = xos_host, port = xos_port, user = user, password = password)
94
95 return None
96
97 @classmethod
A.R Karthick50f4d9a2017-04-20 16:44:19 -070098 def getSubscriberConfig(cls, num_subscribers):
99 features = {
100 'cdn': True,
101 'uplink_speed': 1000000000,
102 'downlink_speed': 1000000000,
103 'uverse': True,
104 'status': 'enabled'
105 }
106 subscriber_map = []
107 for i in xrange(num_subscribers):
108 subId = 'sub{}'.format(i)
109 account_num, _, _ = cls.getSubscriberCredentials(subId)
110 identity = { 'account_num' : str(account_num),
111 'name' : 'My House {}'.format(i)
112 }
113 sub_info = { 'features' : features,
114 'identity' : identity
115 }
116 subscriber_map.append(sub_info)
117
118 return subscriber_map
119
120 @classmethod
121 def getVoltSubscriberConfig(cls, num_subscribers):
122 voltSubscriberMap = []
123 for i in xrange(num_subscribers):
124 subId = 'sub{}'.format(i)
125 account_num, s_tag, c_tag = cls.getSubscriberCredentials(subId)
126 voltSubscriberInfo = {}
127 voltSubscriberInfo['voltTenant'] = dict(s_tag = str(s_tag),
128 c_tag = str(c_tag),
129 subscriber = '')
130 voltSubscriberInfo['account_num'] = account_num
131 voltSubscriberMap.append(voltSubscriberInfo)
132
133 return voltSubscriberMap
134
135 @classmethod
A.R Karthick282f0d32017-03-28 16:43:59 -0700136 def setUpCordApi(cls):
137 our_path = os.path.dirname(os.path.realpath(__file__))
138 cord_api_path = os.path.join(our_path, '..', 'cord-api')
139 framework_path = os.path.join(cord_api_path, 'Framework')
140 utils_path = os.path.join(framework_path, 'utils')
141 data_path = os.path.join(cord_api_path, 'Tests', 'data')
142 subscriber_cfg = os.path.join(data_path, 'Subscriber.json')
143 volt_tenant_cfg = os.path.join(data_path, 'VoltTenant.json')
A R Karthick035d2e22017-04-25 13:53:00 -0700144 num_subscribers = max(cls.NUM_SUBSCRIBERS, 5)
145 cls.subscriber_info = cls.getSubscriberConfig(num_subscribers)
146 cls.volt_subscriber_info = cls.getVoltSubscriberConfig(num_subscribers)
A.R Karthick282f0d32017-03-28 16:43:59 -0700147
148 sys.path.append(utils_path)
149 sys.path.append(framework_path)
150 from restApi import restApi
151 restApiXos = restApi()
A.R Karthicka9b594d2017-03-29 16:25:22 -0700152 xos_credentials = cls.getXosCredentials()
153 if xos_credentials is None:
154 restApiXos.controllerIP = cls.HEAD_NODE
155 restApiXos.controllerPort = '9000'
156 else:
157 restApiXos.controllerIP = xos_credentials['host']
158 restApiXos.controllerPort = xos_credentials['port']
159 restApiXos.user = xos_credentials['user']
160 restApiXos.password = xos_credentials['password']
A.R Karthick282f0d32017-03-28 16:43:59 -0700161 cls.restApiXos = restApiXos
Chetan Gaonker52418832017-01-26 23:03:13 +0000162
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700163 @classmethod
A R Karthick97e08852017-04-26 10:06:38 -0700164 def getVoltId(cls, result, subId):
165 if type(result) is not type([]):
166 return None
167 for tenant in result:
168 if str(tenant['subscriber']) == str(subId):
169 return str(tenant['id'])
170 return None
171
172 @classmethod
A R Karthickb0cec7c2017-04-21 10:42:54 -0700173 def closeVCPEAccess(cls, volt_subscriber_info):
A R Karthick5d30b3c2017-04-27 10:25:40 -0700174 OnosCtrl.uninstall_app(cls.APP_NAME, onos_ip = cls.HEAD_NODE)
A.R Karthickb145da82017-04-20 14:45:43 -0700175
176 @classmethod
A R Karthickb0cec7c2017-04-21 10:42:54 -0700177 def openVCPEAccess(cls, volt_subscriber_info):
A.R Karthickb145da82017-04-20 14:45:43 -0700178 """
A R Karthickb0cec7c2017-04-21 10:42:54 -0700179 This code is used to configure leaf switch for head node access to compute node over fabric.
180 Care is to be taken to avoid overwriting existing/default vcpe flows.
181 The access is opened for generated subscriber info which should not overlap.
182 We target the fabric onos instance on head node.
A.R Karthickb145da82017-04-20 14:45:43 -0700183 """
A.R Karthickb145da82017-04-20 14:45:43 -0700184 OnosCtrl.install_app(cls.APP_FILE, onos_ip = cls.HEAD_NODE)
185 time.sleep(2)
A R Karthickb0cec7c2017-04-21 10:42:54 -0700186 s_tags = map(lambda tenant: int(tenant['voltTenant']['s_tag']), volt_subscriber_info)
187 #only get unique vlan tags
188 s_tags = list(set(s_tags))
A.R Karthickb145da82017-04-20 14:45:43 -0700189 devices = OnosCtrl.get_device_ids(controller = cls.HEAD_NODE)
A R Karthickb0cec7c2017-04-21 10:42:54 -0700190 if devices:
191 device_config = {}
192 for device in devices:
193 device_config[device] = []
194 for s_tag in s_tags:
195 xconnect_config = {'vlan': s_tag, 'ports' : [ cls.FABRIC_PORT_HEAD_NODE, cls.FABRIC_PORT_COMPUTE_NODE ] }
196 device_config[device].append(xconnect_config)
A.R Karthickb145da82017-04-20 14:45:43 -0700197
A R Karthickb0cec7c2017-04-21 10:42:54 -0700198 cfg = { 'apps' : { 'org.ciena.xconnect' : { 'xconnectTestConfig' : device_config } } }
199 OnosCtrl.config(cfg, controller = cls.HEAD_NODE)
A.R Karthickb145da82017-04-20 14:45:43 -0700200
201 @classmethod
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700202 def setUpClass(cls):
203 cls.controllers = get_controllers()
204 cls.controller = cls.controllers[0]
205 cls.cli = None
A R Karthick19771192017-04-25 14:57:05 -0700206 cls.on_pod = running_on_pod()
207 cls.on_ciab = running_on_ciab()
A R Karthick03f40aa2017-03-20 19:33:55 -0700208 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
209 cls.vcpes = cls.olt.get_vcpes()
210 cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp')
A R Karthick035d2e22017-04-25 13:53:00 -0700211 cls.vcpes_reserved = cls.olt.get_vcpes_by_type('reserved')
212 cls.dhcp_vcpes_reserved = [ 'vcpe{}.{}.{}'.format(i, cls.vcpes_reserved[i]['s_tag'], cls.vcpes_reserved[i]['c_tag'])
213 for i in xrange(len(cls.vcpes_reserved)) ]
214 cls.untagged_dhcp_vcpes_reserved = [ 'vcpe{}'.format(i) for i in xrange(len(cls.vcpes_reserved)) ]
215 cls.container_vcpes_reserved = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_reserved ]
216 vcpe_dhcp_reserved = None
217 vcpe_container_reserved = None
218 if cls.vcpes_reserved:
219 vcpe_dhcp_reserved = cls.dhcp_vcpes_reserved[0]
A R Karthick19771192017-04-25 14:57:05 -0700220 if cls.on_pod is False:
A R Karthick035d2e22017-04-25 13:53:00 -0700221 vcpe_dhcp_reserved = cls.untagged_dhcp_vcpes_reserved[0]
222 vcpe_container_reserved = cls.container_vcpes_reserved[0]
223
224 cls.vcpe_dhcp_reserved = vcpe_dhcp_reserved
225 cls.vcpe_container_reserved = vcpe_container_reserved
226 dhcp_vcpe_offset = len(cls.vcpes_reserved)
A R Karthick927129c2017-04-25 14:08:02 -0700227 cls.dhcp_vcpes = [ 'vcpe{}.{}.{}'.format(i+dhcp_vcpe_offset, cls.vcpes_dhcp[i]['s_tag'], cls.vcpes_dhcp[i]['c_tag'])
228 for i in xrange(len(cls.vcpes_dhcp)) ]
229 cls.untagged_dhcp_vcpes = [ 'vcpe{}'.format(i+dhcp_vcpe_offset) for i in xrange(len(cls.vcpes_dhcp)) ]
230 cls.container_vcpes = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_dhcp ]
A R Karthick03f40aa2017-03-20 19:33:55 -0700231 vcpe_dhcp = None
A R Karthick03f40aa2017-03-20 19:33:55 -0700232 vcpe_container = None
233 #cache the first dhcp vcpe in the class for quick testing
234 if cls.vcpes_dhcp:
A R Karthick035d2e22017-04-25 13:53:00 -0700235 vcpe_container = cls.container_vcpes[0]
236 vcpe_dhcp = cls.dhcp_vcpes[0]
A R Karthick19771192017-04-25 14:57:05 -0700237 if cls.on_pod is False:
A R Karthick035d2e22017-04-25 13:53:00 -0700238 vcpe_dhcp = cls.untagged_dhcp_vcpes[0]
239 cls.vcpe_container = vcpe_container_reserved or vcpe_container
240 cls.vcpe_dhcp = vcpe_dhcp_reserved or vcpe_dhcp
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700241 VSGAccess.setUp()
A.R Karthick282f0d32017-03-28 16:43:59 -0700242 cls.setUpCordApi()
A R Karthick19771192017-04-25 14:57:05 -0700243 if cls.on_pod is True:
A R Karthickb0cec7c2017-04-21 10:42:54 -0700244 cls.openVCPEAccess(cls.volt_subscriber_info)
Chetan Gaonker52418832017-01-26 23:03:13 +0000245
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700246 @classmethod
247 def tearDownClass(cls):
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700248 VSGAccess.tearDown()
A R Karthick19771192017-04-25 14:57:05 -0700249 if cls.on_pod is True:
A R Karthickb0cec7c2017-04-21 10:42:54 -0700250 cls.closeVCPEAccess(cls.volt_subscriber_info)
Chetan Gaonker52418832017-01-26 23:03:13 +0000251
Chetan Gaonker52418832017-01-26 23:03:13 +0000252 def cliEnter(self, controller = None):
253 retries = 0
254 while retries < 30:
255 self.cli = OnosCliDriver(controller = controller, connect = True)
256 if self.cli.handle:
257 break
258 else:
259 retries += 1
260 time.sleep(2)
261
262 def cliExit(self):
263 self.cli.disconnect()
264
265 def onos_shutdown(self, controller = None):
266 status = True
267 self.cliEnter(controller = controller)
268 try:
269 self.cli.shutdown(timeout = 10)
270 except:
271 log.info('Graceful shutdown of ONOS failed for controller: %s' %controller)
272 status = False
273
274 self.cliExit()
275 return status
276
A.R Karthick9ccd0d02017-03-16 17:11:08 -0700277 def log_set(self, level = None, app = 'org.onosproject'):
278 CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True)
Chetan Gaonker52418832017-01-26 23:03:13 +0000279
A R Karthick9a16a112017-04-07 15:40:05 -0700280 @classmethod
281 def get_dhcp(cls, vcpe, mgmt = 'eth0'):
282 """Get DHCP for vcpe interface saving management settings"""
283
284 def put_dhcp():
285 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
286
287 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
288 if vcpe_ip is not None:
289 cls.restore_methods.append(put_dhcp)
290 return vcpe_ip
291
292 @classmethod
293 def config_restore(cls):
294 """Restore the vsg test configuration on test case failures"""
295 for restore_method in cls.restore_methods:
296 restore_method()
297
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000298 def get_vsg_vcpe_pair(self):
299 vcpes = self.vcpes_dhcp
300 vcpe_containers = []
301 vsg_vcpe = {}
302 for vcp in vcpes:
303 vcpe_container = 'vcpe-{}-{}'.format(vcp['s_tag'], vcp['c_tag'])
304 vcpe_containers.append(vcpe_container)
305 vsg = VSGAccess.get_vcpe_vsg(vcpe_container)
306 vsg_vcpe[vcpe_container]=str(vsg.get_ip())
307 return vsg_vcpe
308
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000309 def get_vcpe_containers_and_interfaces(self):
310 vcpe_containers = {}
311 vcpe_interfaces = []
312 vcpes = self.vcpes_dhcp
313 count = 0
314 for vcpe in vcpes:
315 vcpe_intf = 'vcpe{}.{}.{}'.format(count,vcpe['s_tag'],vcpe['c_tag'])
316 vcpe_interfaces.append(vcpe_intf)
317 vcpe_container = 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag'])
318 vcpe_containers[vcpe_intf] = vcpe_container
319 count += 1
320 log.info('vcpe interfaces are %s'%vcpe_interfaces)
321 log.info('vcpe containers are %s'%vcpe_containers)
322 return vcpe_interfaces,vcpe_containers
323
324 def get_vcpe_interface_dhcp_ip(self,vcpe=None):
325 if not vcpe:
A R Karthick035d2e22017-04-25 13:53:00 -0700326 vcpe = self.vcpe_dhcp
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000327 st, _ = getstatusoutput('dhclient {}'.format(vcpe))
328 vcpe_ip = get_ip(vcpe)
329 return vcpe_ip
330
331 def release_vcpe_interface_dhcp_ip(self,vcpe=None):
332 if not vcpe:
A R Karthick035d2e22017-04-25 13:53:00 -0700333 vcpe = self.vcpe_dhcp
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000334 st, _ = getstatusoutput('dhclient {} -r'.format(vcpe))
335 vcpe_ip = get_ip(vcpe)
336 assert_equal(vcpe_ip, None)
337
338 def add_static_route_via_vcpe_interface(self, routes, vcpe=None,dhcp_ip=True):
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000339 if not vcpe:
A R Karthick035d2e22017-04-25 13:53:00 -0700340 vcpe = self.vcpe_dhcp
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000341 if dhcp_ip:
A R Karthick035d2e22017-04-25 13:53:00 -0700342 os.system('dhclient '+vcpe)
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000343 time.sleep(1)
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000344 for route in routes:
A R Karthick035d2e22017-04-25 13:53:00 -0700345 log.info('route is %s'%route)
346 cmd = 'ip route add ' + route + ' via 192.168.0.1 '+ 'dev ' + vcpe
347 cmds.append(cmd)
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000348 for cmd in cmds:
A R Karthick035d2e22017-04-25 13:53:00 -0700349 os.system(cmd)
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000350 return True
351
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000352 def del_static_route_via_vcpe_interface(self,routes,vcpe=None,dhcp_release=True):
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000353 if not vcpe:
A R Karthick035d2e22017-04-25 13:53:00 -0700354 vcpe = self.vcpe_dhcp
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000355 cmds = []
356 for route in routes:
A R Karthick035d2e22017-04-25 13:53:00 -0700357 cmd = 'ip route del ' + route + ' via 192.168.0.1 ' + 'dev ' + vcpe
358 os.system(cmd)
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +0000359 if dhcp_release:
A R Karthick035d2e22017-04-25 13:53:00 -0700360 os.system('dhclient '+vcpe+' -r')
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000361 return True
362
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +0000363 def vsg_for_external_connectivity(self, subscriber_index, reserved = False):
364 if reserved is True:
365 if self.on_pod is True:
366 vcpe = self.dhcp_vcpes_reserved[subscriber_index]
367 else:
368 vcpe = self.untagged_dhcp_vcpes_reserved[subscriber_index]
369 else:
370 if self.on_pod is True:
371 vcpe = self.dhcp_vcpes[subscriber_index]
372 else:
373 vcpe = self.untagged_dhcp_vcpes[subscriber_index]
374 mgmt = 'eth0'
375 host = '8.8.8.8'
376 self.success = False
377 assert_not_equal(vcpe, None)
378 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
379 assert_not_equal(vcpe_ip, None)
380 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
381 log.info('Sending icmp echo requests to external network 8.8.8.8')
382 st, _ = getstatusoutput('ping -c 3 8.8.8.8')
383 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
384 assert_equal(st, 0)
385
A R Karthick63751492017-03-22 09:28:01 -0700386 def test_vsg_health(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000387 """
388 Algo:
389 1. Login to compute node VM
390 2. Get all vSGs
391 3. Ping to all vSGs
392 4. Verifying Ping success
393 """
A R Karthick93ba8d02017-04-13 11:59:58 -0700394 status = True
A R Karthick19771192017-04-25 14:57:05 -0700395 if self.on_pod is True:
A R Karthick93ba8d02017-04-13 11:59:58 -0700396 status = VSGAccess.health_check()
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700397 assert_equal(status, True)
Chetan Gaonker52418832017-01-26 23:03:13 +0000398
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000399 def test_vsg_health_check(self, vsg_name='mysite_vsg-1', verify_status=True):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000400 """
401 Algo:
402 1. If vsg name not specified, Get vsg corresponding to vcpe
403 1. Login to compute mode VM
404 3. Ping to the vSG
405 4. Verifying Ping success
406 """
A R Karthick19771192017-04-25 14:57:05 -0700407 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700408 return
A R Karthick035d2e22017-04-25 13:53:00 -0700409 if not vsg_name:
410 vcpe = self.vcpe_container
411 vsg = VSGAccess.get_vcpe_vsg(vcpe)
412 status = vsg.get_health()
413 assert_equal(status, verify_status)
414 else:
415 vsgs = VSGAccess.get_vsgs()
416 status = None
417 for vsg in vsgs:
418 if vsg.name == vsg_name:
419 status = vsg.get_health()
420 log.info('vsg health check status is %s'%status)
421 assert_equal(status,verify_status)
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000422
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000423 @deferred(TIMEOUT)
A R Karthick63751492017-03-22 09:28:01 -0700424 def test_vsg_for_vcpe(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000425 """
426 Algo:
427 1. Get list of all compute nodes created using Openstack
428 2. Login to compute mode VM
429 3. Get all vSGs
430 4. Verifying atleast one compute node and one vSG created
431 """
A R Karthick035d2e22017-04-25 13:53:00 -0700432 df = defer.Deferred()
433 def vsg_for_vcpe_df(df):
A R Karthick19771192017-04-25 14:57:05 -0700434 if self.on_pod is True:
A R Karthick93ba8d02017-04-13 11:59:58 -0700435 vsgs = VSGAccess.get_vsgs()
436 compute_nodes = VSGAccess.get_compute_nodes()
437 time.sleep(14)
438 assert_not_equal(len(vsgs), 0)
439 assert_not_equal(len(compute_nodes), 0)
A R Karthick035d2e22017-04-25 13:53:00 -0700440 df.callback(0)
441 reactor.callLater(0,vsg_for_vcpe_df,df)
442 return df
Chetan Gaonker52418832017-01-26 23:03:13 +0000443
A R Karthick63751492017-03-22 09:28:01 -0700444 def test_vsg_for_login(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000445 """
446 Algo:
447 1. Login to compute node VM
448 2. Get all vSGs
449 3. Verifying login to vSG is success
450 """
A R Karthick19771192017-04-25 14:57:05 -0700451 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700452 return
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700453 vsgs = VSGAccess.get_vsgs()
454 vsg_access_status = map(lambda vsg: vsg.check_access(), vsgs)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700455 status = filter(lambda st: st == False, vsg_access_status)
456 assert_equal(len(status), 0)
457
A R Karthick63751492017-03-22 09:28:01 -0700458 def test_vsg_for_default_route_through_testclient(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000459 """
460 Algo:
461 1. Login to head node
462 2. Verifying for default route in lxc test client
463 """
A R Karthick19771192017-04-25 14:57:05 -0700464 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700465 return
A R Karthick63751492017-03-22 09:28:01 -0700466 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
467 cmd = "sudo lxc exec testclient -- route | grep default"
468 status, output = ssh_agent.run_cmd(cmd)
469 assert_equal(status, True)
470
471 def test_vsg_for_external_connectivity_through_testclient(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000472 """
473 Algo:
474 1. Login to head node
475 2. On head node, executing ping to 8.8.8.8 from lxc test client
476 3. Verifying for the ping success
477 """
A R Karthick19771192017-04-25 14:57:05 -0700478 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700479 return
A R Karthick63751492017-03-22 09:28:01 -0700480 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
481 cmd = "lxc exec testclient -- ping -c 3 8.8.8.8"
482 status, output = ssh_agent.run_cmd(cmd)
483 assert_equal( status, True)
484
A R Karthick035d2e22017-04-25 13:53:00 -0700485 def test_vsg_for_external_connectivity(self):
486 """
487 Algo:
488 1. Get dhcp IP to vcpe interface in cord-tester
489 2. Verifying vcpe interface gets dhcp IP
490 3. Ping to 8.8.8.8 and Verifying ping should success
491 4. Restoring management interface configuration in cord-tester
492 """
A R Karthick19771192017-04-25 14:57:05 -0700493 reserved = True
494 if self.on_pod:
495 reserved = self.on_ciab
496 self.vsg_for_external_connectivity(0, reserved = reserved)
A R Karthick035d2e22017-04-25 13:53:00 -0700497
A R Karthick63751492017-03-22 09:28:01 -0700498 def test_vsg_for_external_connectivity_to_google(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000499 """
500 Algo:
501 1. Get dhcp IP to vcpe interface in cord-tester
502 2. Verifying vcpe interface gets dhcp IP
503 3. Ping to www.google.com and Verifying ping should success
504 4. Restoring management interface configuration in cord-tester
505 """
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000506 host = 'www.google.com'
A R Karthick03f40aa2017-03-20 19:33:55 -0700507 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700508 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700509 assert_not_equal(vcpe, None)
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000510 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700511 assert_not_equal(vcpe_ip, None)
512 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
513 log.info('Sending icmp ping requests to %s' %host)
514 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700515 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700516 assert_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000517
A R Karthick63751492017-03-22 09:28:01 -0700518 def test_vsg_for_external_connectivity_to_invalid_host(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000519 """
520 Algo:
521 1. Get dhcp IP to vcpe interface in cord-tester
522 2. Verifying vcpe interface gets dhcp IP
523 3. Ping to www.goglee.com and Verifying ping should not success
524 4. Restoring management interface configuration in cord-tester
525 """
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000526 host = 'www.goglee.com'
A R Karthick03f40aa2017-03-20 19:33:55 -0700527 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700528 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700529 assert_not_equal(vcpe, None)
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000530 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700531 assert_not_equal(vcpe_ip, None)
532 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
533 log.info('Sending icmp ping requests to non existent host %s' %host)
534 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700535 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700536 assert_not_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000537
A R Karthick63751492017-03-22 09:28:01 -0700538 def test_vsg_for_external_connectivity_with_ttl_1(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000539 """
540 Algo:
541 1. Get dhcp IP to vcpe interface in cord-tester
542 2. Verifying vcpe interface gets dhcp IP
543 3. Ping to 8.8.8.8 with ttl set to 1
544 4. Verifying ping should not success
545 5. Restoring management interface configuration in cord-tester
546 """
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000547 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700548 vcpe = self.vcpe_dhcp
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700549 mgmt = 'eth0'
A R Karthick03f40aa2017-03-20 19:33:55 -0700550 assert_not_equal(vcpe, None)
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000551 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700552 assert_not_equal(vcpe_ip, None)
553 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
554 log.info('Sending icmp ping requests to host %s with ttl 1' %host)
555 st, _ = getstatusoutput('ping -c 1 -t 1 {}'.format(host))
A R Karthickd0fdf3b2017-03-21 16:54:22 -0700556 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
A.R Karthick33cfdbe2017-03-17 18:03:48 -0700557 assert_not_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000558
A R Karthick63751492017-03-22 09:28:01 -0700559 def test_vsg_for_external_connectivity_with_wan_interface_toggle_in_vcpe(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000560 """
561 Algo:
562 1. Get dhcp IP to vcpe interface in cord-tester
563 2. Verifying vcpe interface gets dhcp IP
A.R Karthick8f7f1b62017-04-06 18:25:07 -0700564 3. Ping to 8.8.8.8 and Verifying ping succeeds
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000565 4. Now down the WAN interface of vcpe
A.R Karthick8f7f1b62017-04-06 18:25:07 -0700566 5. Ping to 8.8.8.8 and Verifying ping fails
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000567 6. Now Up the WAN interface of vcpe
A.R Karthick8f7f1b62017-04-06 18:25:07 -0700568 7. Ping to 8.8.8.8 and Verifying ping succeeds
569 8. Restoring management interface configuration in cord-tester
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000570 """
A R Karthick19771192017-04-25 14:57:05 -0700571 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700572 return
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000573 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700574 mgmt = 'eth0'
575 vcpe = self.vcpe_container
576 assert_not_equal(vcpe, None)
577 assert_not_equal(self.vcpe_dhcp, None)
578 #first get dhcp on the vcpe interface
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000579 vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt)
580 assert_not_equal(vcpe_ip, None)
581 log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp))
582 log.info('Sending ICMP pings to host %s' %(host))
583 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
584 if st != 0:
585 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
586 assert_equal(st, 0)
587 #bring down the wan interface and check again
588 st = VSGAccess.vcpe_wan_down(vcpe)
589 if st is False:
590 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
591 assert_equal(st, True)
592 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
593 if st == 0:
594 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
595 assert_not_equal(st, 0)
596 st = VSGAccess.vcpe_wan_up(vcpe)
597 if st is False:
598 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
599 assert_equal(st, True)
600 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
601 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
602 assert_equal(st, 0)
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000603
A R Karthick63751492017-03-22 09:28:01 -0700604 def test_vsg_for_external_connectivity_with_lan_interface_toggle_in_vcpe(self):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000605 """
606 Algo:
607 1. Get dhcp IP to vcpe interface in cord-tester
608 2. Verifying vcpe interface gets dhcp IP
609 3. Ping to 8.8.8.8 and Verifying ping should success
610 4. Now down the LAN interface of vcpe
611 5. Ping to 8.8.8.8 and Verifying ping should not success
612 6. Now Up the LAN interface of vcpe
613 7. Ping to 8.8.8.8 and Verifying ping should success
614 8. Restoring management interface configuration in cord-tester
615 """
A R Karthick19771192017-04-25 14:57:05 -0700616 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700617 return
Anil Kumar Sanka87115b02017-03-14 17:46:47 +0000618 host = '8.8.8.8'
A R Karthick03f40aa2017-03-20 19:33:55 -0700619 mgmt = 'eth0'
620 vcpe = self.vcpe_container
621 assert_not_equal(vcpe, None)
622 assert_not_equal(self.vcpe_dhcp, None)
623 #first get dhcp on the vcpe interface
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000624 vcpe_ip = VSGAccess.vcpe_get_dhcp(self.vcpe_dhcp, mgmt = mgmt)
625 assert_not_equal(vcpe_ip, None)
626 log.info('Got DHCP IP %s for %s' %(vcpe_ip, self.vcpe_dhcp))
627 log.info('Sending ICMP pings to host %s' %(host))
628 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
629 if st != 0:
630 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
631 assert_equal(st, 0)
632 #bring down the lan interface and check again
633 st = VSGAccess.vcpe_lan_down(vcpe)
634 if st is False:
635 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
636 assert_equal(st, True)
637 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
638 if st == 0:
639 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
640 assert_not_equal(st, 0)
641 st = VSGAccess.vcpe_lan_up(vcpe)
642 if st is False:
643 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
644 assert_equal(st, True)
645 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
646 VSGAccess.restore_interface_config(mgmt, vcpe = self.vcpe_dhcp)
647 assert_equal(st, 0)
Chetan Gaonker52418832017-01-26 23:03:13 +0000648
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +0000649 def test_vsg_multiple_subscribers_for_same_vcpe_instace(self):
650 """
651 Algo:
652 1. Create a vcpe instance
653 2. Create multiple vcpe interfaces in cord-tester with same s-tag and c-tag to access vcpe instance
654 3. Verify all the interfaces gets dhcp IP in same subnet
655 """
656 vcpe_intfs,containers = self.get_vcpe_containers_and_interfaces()
657 for vcpe in vcpe_intfs:
658 vcpe_ip = self.get_vcpe_interface_dhcp_ip(vcpe=vcpe)
659 assert_not_equal(vcpe_ip,None)
660 for vcpe in vcpe_intfs:
661 self.release_vcpe_interface_dhcp_ip(vcpe=vcpe)
662
663 def test_vsg_for_multiple_subscribers_with_same_vcpe_instance_and_validate_external_connectivity(self):
664 """
665 Algo:
666 1. Create a vcpe instance
667 2. Create multiple vcpe interfaces in cord-tester with same s-tag and c-tag to access vcpe instance
668 3. Verify all the interfaces gets dhcp IP in same subnet
669 4. From cord-tester ping to external with vcpe interface option
670 """
671 host = '8.8.8.8'
672 vcpe_intfs, containers = self.get_vcpe_containers_and_interfaces()
673 for vcpe in vcpe_intfs:
674 vcpe_ip = self.get_vcpe_interface_dhcp_ip(vcpe=vcpe)
675 assert_not_equal(vcpe_ip,None)
676 self.add_static_route_via_vcpe_interface([host],vcpe=vcpe,dhcp_ip=False)
677 st, _ = getstatusoutput('ping -I {} -c 3 {}'.format(vcpe,host))
678 assert_equal(st, 0)
679 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe,dhcp_release=False)
680 for vcpe in vcpe_intfs:
681 self.release_vcpe_interface_dhcp_ip(vcpe=vcpe)
682
683 def test_vsg_vcpe_interface_and_validate_dhcp_ip_after_interface_toggle(self):
684 """
685 Algo:
686 1. Create a vcpe instance
687 2. Create a vcpe interface in cord-tester
688 3. Verify the interface gets dhcp IP
689 4. Toggle the interface
690 5. Verify the interface gets dhcp IP
691 """
692 vcpe_intfs,containers = self.get_vcpe_containers_and_interfaces()
693 for vcpe in vcpe_intfs:
694 vcpe_ip = self.get_vcpe_interface_dhcp_ip(vcpe=vcpe)
695 assert_not_equal(vcpe_ip,None)
696 os.system('ifconfig {} down'.format(vcpe))
697 time.sleep(1)
698 os.system('ifconfig {} up'.format(vcpe))
699 time.sleep(1)
700 vcpe_ip2 = get_ip(vcpe)
701 assert_equal(vcpe_ip2,vcpe_ip)
702 for vcpe in vcpe_intfs:
703 self.release_vcpe_interface_dhcp_ip(vcpe=vcpe)
704
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000705 @deferred(TIMEOUT)
706 def test_vsg_for_external_connectivity_with_vcpe_container_paused(self,vcpe_name=None,vcpe_intf=None):
707 """
708 Algo:
709 1. Get vSG corresponding to vcpe
710 2. Get dhcp ip to vcpe interface
711 3. Add static route to destination route in test container
712 4. From test container ping to destination route and verify ping success
713 5. Login to compute node and execute command to pause vcpe container
714 6. From test container ping to destination route and verify ping success
715 """
716 if not vcpe_name:
717 vcpe_name = self.vcpe_container
718 if not vcpe_intf:
719 vcpe_intf = self.vcpe_dhcp
720 df = defer.Deferred()
721 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700722 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700723 df.callback(0)
724 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000725 host = '8.8.8.8'
726 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
727 try:
728 self.add_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
729 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
730 assert_equal(st, False)
731 st, _ = vsg.run_cmd('sudo docker pause {}'.format(vcpe_name))
732 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
733 assert_equal(st, False)
734 finally:
735 vsg.run_cmd('sudo docker unpause'.format(vcpe_name))
736 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
737 df.callback(0)
738 reactor.callLater(0, vcpe_firewall, df)
739 return df
740
741 @deferred(TIMEOUT)
742 def test_vsg_firewall_with_deny_destination_ip(self, vcpe_name=None, vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000743 """
744 Algo:
745 1. Get vSG corresponding to vcpe
746 2. Login to compute node
747 3. Execute iptable command on vcpe from compute node to deny a destination IP
748 4. From cord-tester ping to the denied IP address
749 5. Verifying that ping should not be successful
750 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000751 if not vcpe_name:
752 vcpe_name = self.vcpe_container
753 if not vcpe_intf:
754 vcpe_intf = self.vcpe_dhcp
755 df = defer.Deferred()
756 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700757 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700758 df.callback(0)
759 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000760 host = '8.8.8.8'
761 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
762 try:
763 self.add_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
764 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
765 assert_equal(st, False)
766 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host))
767 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
768 assert_equal(st, True)
769 finally:
770 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
771 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
772 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
773 df.callback(0)
774 reactor.callLater(0, vcpe_firewall, df)
775 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000776
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000777 @deferred(TIMEOUT)
778 def test_vsg_firewall_with_rule_add_and_delete_dest_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000779 """
780 Algo:
781 1. Get vSG corresponding to vcpe
782 2. Login to compute node
783 3. Execute iptable command on vcpe from compute node to deny a destination IP
784 4. From cord-tester ping to the denied IP address
785 5. Verifying that ping should not be successful
786 6. Delete the iptable rule in vcpe
787 7. From cord-tester ping to the denied IP address
788 8. Verifying the ping should success
789 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000790 if not vcpe_name:
791 vcpe_name = self.vcpe_container
792 if not vcpe_intf:
793 vcpe_intf = self.vcpe_dhcp
794 df = defer.Deferred()
795 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700796 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700797 df.callback(0)
798 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000799 host = '8.8.8.8'
800 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
801 try:
802 self.add_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
803 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
804 assert_equal(st, False)
805 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host))
806 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
807 assert_equal(st, True)
808 st,_ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
809 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
810 assert_equal(st, False)
811 finally:
812 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
813 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
814 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
815 df.callback(0)
816 reactor.callLater(0, vcpe_firewall, df)
817 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000818
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000819 @deferred(TIMEOUT)
820 def test_vsg_firewall_verifying_reachability_for_non_blocked_dest_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000821 """
822 Algo:
823 1. Get vSG corresponding to vcpe
824 2. Login to compute node
825 3. Execute iptable command on vcpe from compute node to deny a destination IP
826 4. From cord-tester ping to the denied IP address
827 5. Verifying that ping should not be successful
828 6. From cord-tester ping to the denied IP address other than the denied one
829 7. Verifying the ping should success
830 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000831 if not vcpe_name:
832 vcpe_name = self.vcpe_container
833 if not vcpe_intf:
834 vcpe_intf = self.vcpe_dhcp
835 df = defer.Deferred()
836 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700837 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700838 df.callback(0)
839 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000840 host1 = '8.8.8.8'
841 host2 = '204.79.197.203'
842 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
843 try:
844 self.add_static_route_via_vcpe_interface([host1,host2],vcpe=vcpe_intf)
845 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
846 assert_equal(st, False)
847 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host1))
848 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
849 assert_equal(st, True)
850 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
851 assert_equal(st,False)
852 finally:
853 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host1))
854 self.del_static_route_via_vcpe_interface([host1,host2],vcpe=vcpe_intf)
855 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
856 df.callback(0)
857 reactor.callLater(0, vcpe_firewall, df)
858 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000859
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000860 @deferred(TIMEOUT)
861 def test_vsg_firewall_appending_rules_with_deny_dest_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000862 """
863 Algo:
864 1. Get vSG corresponding to vcpe
865 2. Login to compute node
866 3. Execute iptable command on vcpe from compute node to deny a destination IP1
867 4. From cord-tester ping to the denied IP address IP1
868 5. Verifying that ping should not be successful
869 6. Execute iptable command on vcpe from compute node to deny a destination IP2
870 6. From cord-tester ping to the denied IP address IP2
871 7. Verifying that ping should not be successful
872 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000873 if not vcpe_name:
874 vcpe_name = self.vcpe_container
875 if not vcpe_intf:
876 vcpe_intf = self.vcpe_dhcp
877 df = defer.Deferred()
878 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700879 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700880 df.callback(0)
881 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000882 host1 = '8.8.8.8'
883 host2 = '204.79.197.203'
884 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
885 try:
886 self.add_static_route_via_vcpe_interface([host1,host2],vcpe=vcpe_intf)
887 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
888 assert_equal(st, False)
889 st,_ = vsg.run_cmd('sudo docker exec {} iptables -F FORWARD'.format(vcpe_name))
890 time.sleep(2)
891 st,_ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host1))
892 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
893 assert_equal(st, True)
894 st, out = getstatusoutput('ping -c 1 {}'.format(host2))
895 log.info('host2 ping output is %s'%out)
896 assert_equal(st, False)
897 st, _ = vsg.run_cmd('sudo docker exec {} iptables -A FORWARD -d {} -j DROP'.format(vcpe_name,host2))
898 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
899 assert_equal(st,True)
900 finally:
901 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host1))
902 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host2))
903 self.del_static_route_via_vcpe_interface([host1,host2],vcpe=vcpe_intf)
904 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
905 df.callback(0)
906 reactor.callLater(0, vcpe_firewall, df)
907 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000908
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000909 @deferred(TIMEOUT)
910 def test_vsg_firewall_removing_one_rule_denying_dest_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000911 """
912 Algo:
913 1. Get vSG corresponding to vcpe
914 2. Login to compute node
915 3. Execute iptable command on vcpe from compute node to deny a destination IP1
916 4. Execute iptable command on vcpe from compute node to deny a destination IP2
917 5. From cord-tester ping to the denied IP address IP1
918 6. Verifying that ping should not be successful
919 7. From cord-tester ping to the denied IP address IP2
920 8. Verifying that ping should not be successful
921 9. Execute iptable command on vcpe from compute node to remove deny a destination IP2 rule
922 10. From cord-tester ping to the denied IP address IP2
923 11. Verifying the ping should success
924 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000925 if not vcpe_name:
926 vcpe_name = self.vcpe_container
927 if not vcpe_intf:
928 vcpe_intf = self.vcpe_dhcp
929 df = defer.Deferred()
930 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700931 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700932 df.callback(0)
933 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000934 host1 = '8.8.8.8'
935 host2 = '204.79.197.203'
936 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
937 try:
938 self.add_static_route_via_vcpe_interface([host1,host2],vcpe=self.vcpe_dhcp)
939 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
940 assert_equal(st, False)
941 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host1))
942 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host2))
943 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
944 assert_equal(st, True)
945 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
946 assert_equal(st,True)
947 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host2))
948 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
949 assert_equal(st,False)
950 finally:
951 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host1))
952 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host2))
953 self.del_static_route_via_vcpe_interface([host1,host2],vcpe=vcpe_intf)
954 log.info('restarting vcpe container')
955 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
956 df.callback(0)
957 reactor.callLater(0, vcpe_firewall, df)
958 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +0000959
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000960 @deferred(TIMEOUT)
961 def test_vsg_firewall_changing_rule_id_deny_dest_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +0000962 """
963 Algo:
964 1. Get vSG corresponding to vcpe
965 2. Login to compute node
966 3. Execute iptable command on vcpe from compute node to deny a destination IP
967 5. From cord-tester ping to the denied IP address IP1
968 6. Verifying that ping should not be successful
969 9. Execute iptable command on vcpe from compute node to change the rule ID to 2 to deny the same destination IP
970 10. From cord-tester ping to the denied IP address IP
971 11. Verifying that ping should not be successful
972 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000973 if not vcpe_name:
974 vcpe_name = self.vcpe_container
975 if not vcpe_intf:
976 vcpe_intf = self.vcpe_dhcp
977 df = defer.Deferred()
978 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -0700979 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -0700980 df.callback(0)
981 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +0000982 host = '8.8.8.8'
983 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
984 try:
985 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
986 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
987 assert_equal(st, False)
988 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host))
989 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
990 assert_equal(st, True)
991 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 2 -d {} -j DROP '.format(vcpe_name,host))
992 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
993 assert_equal(st,True)
994 finally:
995 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
996 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
997 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
998 df.callback(0)
999 reactor.callLater(0, vcpe_firewall, df)
1000 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001001
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001002 @deferred(TIMEOUT)
1003 def test_vsg_firewall_changing_deny_rule_to_accept_dest_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001004 """
1005 Algo:
1006 1. Get vSG corresponding to vcpe
1007 2. Login to compute node
1008 3. Execute iptable command on vcpe from compute node to deny a destination IP
1009 5. From cord-tester ping to the denied IP address IP1
1010 6. Verifying that ping should not be successful
1011 9. Execute iptable command on vcpe from compute node to accept the same destination IP
1012 10. From cord-tester ping to the accepted IP
1013 11. Verifying the ping should success
1014 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001015 if not vcpe_name:
1016 vcpe_name = self.vcpe_container
1017 if not vcpe_intf:
1018 vcpe_intf = self.vcpe_dhcp
1019 df = defer.Deferred()
1020 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001021 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001022 df.callback(0)
1023 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001024 host = '8.8.8.8'
1025 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1026 try:
1027 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1028 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1029 assert_equal(st, False)
1030 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host))
1031 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1032 assert_equal(st, True)
1033 st, _ = vsg.run_cmd('sudo docker exec {} iptables -R FORWARD 1 -d {} -j ACCEPT'.format(vcpe_name,host))
1034 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1035 assert_equal(st,False)
1036 finally:
1037 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
1038 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j ACCEPT'.format(vcpe_name,host))
1039 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1040 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1041 df.callback(0)
1042 reactor.callLater(0, vcpe_firewall, df)
1043 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001044
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001045 @deferred(TIMEOUT) #Fail
1046 def test_vsg_firewall_denying_destination_network(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001047 """
1048 Algo:
1049 1. Get vSG corresponding to vcpe
1050 2. Login to compute node
1051 3. Execute iptable command on vcpe from compute node to deny a destination IP subnet
1052 4. From cord-tester ping to the denied IP address IP1 in the denied subnet
1053 5. Verifying that ping should not be successful
1054 6. From cord-tester ping to the denied IP address IP2 in the denied subnet
1055 7. Verifying that ping should not be successful
1056 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001057 if not vcpe_name:
1058 vcpe_name = self.vcpe_container
1059 if not vcpe_intf:
1060 vcpe_intf = self.vcpe_dhcp
1061 df = defer.Deferred()
1062 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001063 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001064 df.callback(0)
1065 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001066 network = '204.79.197.192/28'
1067 host1 = '204.79.197.203'
1068 host2 = '204.79.197.210'
1069 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1070 try:
1071 self.add_static_route_via_vcpe_interface([host1,host2],vcpe=self.vcpe_dhcp)
1072 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
1073 assert_equal(st, False)
1074 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,network))
1075 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
1076 assert_equal(st, True)
1077 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
1078 assert_equal(st,False)
1079 finally:
1080 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,network))
1081 self.del_static_route_via_vcpe_interface([host1,host2],vcpe=vcpe_intf)
1082 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1083 df.callback(0)
1084 reactor.callLater(0, vcpe_firewall, df)
1085 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001086
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001087 @deferred(TIMEOUT)
1088 def test_vsg_firewall_denying_destination_network_subnet_modification(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001089 """
1090 Algo:
1091 1. Get vSG corresponding to vcpe
1092 2. Login to compute node
1093 3. Execute iptable command on vcpe from compute node to deny a destination IP subnet
1094 4. From cord-tester ping to the denied IP address IP1 in the denied subnet
1095 5. Verifying that ping should not be successful
1096 6. From cord-tester ping to the denied IP address IP2 in the denied subnet
1097 7. Verifying that ping should not be successful
1098 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001099 if not vcpe_name:
1100 vcpe_name = self.vcpe_container
1101 if not vcpe_intf:
1102 vcpe_intf = self.vcpe_dhcp
1103 df = defer.Deferred()
1104 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001105 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001106 df.callback(0)
1107 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001108 network1 = '204.79.197.192/28'
1109 network2 = '204.79.197.192/27'
1110 host1 = '204.79.197.203'
1111 host2 = '204.79.197.210'
1112 host3 = '204.79.197.224'
1113 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1114 try:
1115 self.add_static_route_via_vcpe_interface([host1,host2,host3],vcpe=self.vcpe_dhcp)
1116 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
1117 assert_equal(st, False)
1118 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,network1))
1119 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
1120 assert_equal(st, True)
1121 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
1122 assert_equal(st,False)
1123 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD 2 -d {} -j DROP'.format(vcpe_name,network2))
1124 st, _ = getstatusoutput('ping -c 1 {}'.format(host1))
1125 assert_equal(st, True)
1126 st, _ = getstatusoutput('ping -c 1 {}'.format(host2))
1127 assert_equal(st, True)
1128 st, _ = getstatusoutput('ping -c 1 {}'.format(host3))
1129 assert_equal(st, False)
1130 finally:
1131 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,network1))
1132 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,network2))
1133 self.del_static_route_via_vcpe_interface([host1,host2,host3],vcpe=vcpe_intf)
1134 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1135 df.callback(0)
1136 reactor.callLater(0, vcpe_firewall, df)
1137 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001138
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001139 @deferred(TIMEOUT)
1140 def test_vsg_firewall_with_deny_source_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001141 """
1142 Algo:
1143 1. Get vSG corresponding to vcpe
1144 2. Login to compute node
1145 3. Execute iptable command on vcpe from compute node to deny a source IP
1146 4. From cord-tester ping to 8.8.8.8 from the denied IP
1147 5. Verifying that ping should not be successful
1148 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001149 if not vcpe_name:
1150 vcpe_name = self.vcpe_container
1151 if not vcpe_intf:
1152 vcpe_intf = self.vcpe_dhcp
1153 df = defer.Deferred()
1154 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001155 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001156 df.callback(0)
1157 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001158 host = '8.8.8.8'
1159 #source_ip = get_ip(self.vcpe_dhcp)
1160 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1161 try:
1162 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1163 source_ip = get_ip(self.vcpe_dhcp)
1164 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1165 assert_equal(st, False)
1166 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -s {} -j DROP'.format(vcpe_name,source_ip))
1167 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1168 assert_equal(st, True)
1169 finally:
1170 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -s {} -j DROP'.format(vcpe_name,source_ip))
1171 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1172 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1173 df.callback(0)
1174 reactor.callLater(0, vcpe_firewall, df)
1175 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001176
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001177 @deferred(TIMEOUT)
1178 def test_vsg_firewall_rule_with_add_and_delete_deny_source_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001179 """
1180 Algo:
1181 1. Get vSG corresponding to vcpe
1182 2. Login to compute node
1183 3. Execute iptable command on vcpe from compute node to deny a source IP
1184 4. From cord-tester ping to 8.8.8.8 from the denied IP
1185 5. Verifying that ping should not be successful
1186 6. Delete the iptable rule in vcpe
1187 7. From cord-tester ping to 8.8.8.8 from the denied IP
1188 8. Verifying the ping should success
1189 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001190 if not vcpe_name:
1191 vcpe_name = self.vcpe_container
1192 if not vcpe_intf:
1193 vcpe_intf = self.vcpe_dhcp
1194 df = defer.Deferred()
1195 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001196 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001197 df.callback(0)
1198 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001199 host = '8.8.8.8'
1200 source_ip = get_ip(self.vcpe_dhcp)
1201 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1202 try:
1203 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1204 source_ip = get_ip(self.vcpe_dhcp)
1205 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1206 assert_equal(st, False)
1207 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -s {} -j DROP'.format(vcpe_name,source_ip))
1208 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1209 assert_equal(st, True)
1210 st, _ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -s {} -j DROP'.format(vcpe_name,source_ip))
1211 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1212 assert_equal(st, False)
1213 finally:
1214 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -s {} -j DROP'.format(vcpe_name,source_ip))
1215 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1216 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1217 df.callback(0)
1218 reactor.callLater(0, vcpe_firewall, df)
1219 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001220
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001221 @deferred(TIMEOUT)
1222 def test_vsg_firewall_rule_with_deny_icmp_protocol_echo_requests_type(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001223 """
1224 Algo:
1225 1. Get vSG corresponding to vcpe
1226 2. Login to compute node
1227 3. Execute iptable command on vcpe from compute node to deny icmp echo-requests type protocol packets
1228 4. From cord-tester ping to 8.8.8.8
1229 5. Verifying that ping should not be successful
1230 6. Delete the iptable rule
1231 7. From cord-tester ping to 8.8.8.8
1232 8. Verifying the ping should success
1233 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001234 if not vcpe_name:
1235 vcpe_name = self.vcpe_container
1236 if not vcpe_intf:
1237 vcpe_intf = self.vcpe_dhcp
1238 df = defer.Deferred()
1239 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001240 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001241 df.callback(0)
1242 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001243 host = '8.8.8.8'
1244 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1245 try:
1246 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1247 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1248 assert_equal(st, False)
1249 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe_name))
1250 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1251 assert_equal(st, True)
1252 st, _ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe_name))
1253 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1254 assert_equal(st, False)
1255 finally:
1256 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe_name))
1257 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1258 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1259 df.callback(0)
1260 reactor.callLater(0, vcpe_firewall, df)
1261 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001262
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001263 @deferred(TIMEOUT)
1264 def test_vsg_firewall_rule_with_deny_icmp_protocol_echo_reply_type(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001265 """
1266 Algo:
1267 1. Get vSG corresponding to vcpe
1268 2. Login to compute node
1269 3. Execute iptable command on vcpe from compute node to deny icmp echo-reply type protocol packets
1270 4. From cord-tester ping to 8.8.8.8
1271 5. Verifying that ping should not be successful
1272 6. Delete the iptable rule
1273 7. From cord-tester ping to 8.8.8.8
1274 8. Verifying the ping should success
1275 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001276 if not vcpe_name:
1277 vcpe_name = self.vcpe_container
1278 if not vcpe_intf:
1279 vcpe_intf = self.vcpe_dhcp
1280 df = defer.Deferred()
1281 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001282 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001283 df.callback(0)
1284 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001285 host = '8.8.8.8'
1286 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1287 try:
1288 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1289 st, _ = getstatusoutput('ping -c 1 {}'.format('8.8.8.8'))
1290 assert_equal(st, False)
1291 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe_name))
1292 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1293 assert_equal(st, True)
1294 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe_name))
1295 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1296 assert_equal(st,False)
1297 finally:
1298 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe_name))
1299 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1300 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1301 df.callback(0)
1302 reactor.callLater(0, vcpe_firewall, df)
1303 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001304
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001305 @deferred(TIMEOUT)
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +00001306 def test_vsg_firewall_changing_deny_rule_to_accept_rule_with_icmp_protocol_echo_requests_type(self, vcpe_name=None, vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001307 """
1308 Algo:
1309 1. Get vSG corresponding to vcpe
1310 2. Login to compute node
1311 3. Execute iptable command on vcpe from compute node to deny icmp echo-requests type protocol packets
1312 4. From cord-tester ping to 8.8.8.8
1313 5. Verifying that ping should not be successful
1314 6. Insert another rule to accept the icmp-echo requests protocol packets
1315 7. From cord-tester ping to 8.8.8.8
1316 8. Verifying the ping should success
1317 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001318 if not vcpe_name:
1319 vcpe_name = self.vcpe_container
1320 if not vcpe_intf:
1321 vcpe_intf = self.vcpe_dhcp
1322 df = defer.Deferred()
1323 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001324 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001325 df.callback(0)
1326 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001327 host = '8.8.8.8'
1328 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1329 try:
1330 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1331 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1332 assert_equal(st, False)
1333 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe_name))
1334 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1335 assert_equal(st, True)
1336 st, _ = vsg.run_cmd('sudo docker exec {} iptables -R FORWARD 1 -p icmp --icmp-type echo-request -j ACCEPT'.format(vcpe_name))
1337 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1338 assert_equal(st,False)
1339 finally:
1340 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-request -j DROP'.format(vcpe_name))
1341 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-request -j ACCEPT'.format(vcpe_name))
1342 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1343 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1344 df.callback(0)
1345 reactor.callLater(0, vcpe_firewall, df)
1346 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001347
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001348 @deferred(TIMEOUT)
1349 def test_vsg_firewall_changing_deny_rule_to_accept_rule_with_icmp_protocol_echo_reply_type(self,vcpe_name=None,vcpe_intf=None):
1350 """
1351 Algo:
1352 1. Get vSG corresponding to vcpe
1353 2. Login to compute node
1354 3. Execute iptable command on vcpe from compute node to deny icmp echo-reply type protocol packets
1355 4. From cord-tester ping to 8.8.8.8
1356 5. Verifying the ping should not success
1357 6. Insert another rule to accept the icmp-echo requests protocol packets
1358 7. From cord-tester ping to 8.8.8.8
1359 8. Verifying the ping should success
1360 """
1361 if not vcpe_name:
1362 vcpe_name = self.vcpe_container
1363 if not vcpe_intf:
1364 vcpe_intf = self.vcpe_dhcp
1365 df = defer.Deferred()
1366 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001367 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001368 df.callback(0)
1369 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001370 host = '8.8.8.8'
1371 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1372 try:
1373 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1374 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1375 assert_equal(st, False)
1376 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe_name))
1377 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1378 assert_equal(st, True)
1379 st,output = vsg.run_cmd('sudo docker exec {} iptables -R FORWARD 1 -p icmp --icmp-type echo-reply -j ACCEPT'.format(vcpe_name))
1380 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1381 assert_equal(st,False)
1382 finally:
1383 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-reply -j DROP'.format(vcpe_name))
1384 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp --icmp-type echo-reply -j ACCEPT'.format(vcpe_name))
1385 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1386 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1387 df.callback(0)
1388 reactor.callLater(0, vcpe_firewall, df)
1389 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001390
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001391 @deferred(TIMEOUT)
1392 def test_vsg_firewall_for_deny_icmp_protocol(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001393 """
1394 Algo:
1395 1. Get vSG corresponding to vcpe
1396 2. Login to compute node
1397 3. Execute iptable command on vcpe from compute node to deny icmp protocol packets
1398 4. From cord-tester ping to 8.8.8.8
1399 5. Verifying that ping should not be successful
1400 6. Delete the iptable rule
1401 7. From cord-tester ping to 8.8.8.8
1402 8. Verifying the ping should success
1403 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001404 if not vcpe_name:
1405 vcpe_name = self.vcpe_container
1406 if not vcpe_intf:
1407 vcpe_intf = self.vcpe_dhcp
1408 df = defer.Deferred()
1409 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001410 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001411 df.callback(0)
1412 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001413 host = '8.8.8.8'
1414 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1415 try:
1416 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1417 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1418 assert_equal(st, False)
1419 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe_name))
1420 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1421 assert_equal(st, True)
1422 st, _ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe_name))
1423 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1424 assert_equal(st,False)
1425 finally:
1426 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe_name))
1427 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1428 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1429 df.callback(0)
1430 reactor.callLater(0, vcpe_firewall, df)
1431 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001432
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001433 @deferred(TIMEOUT)
1434 def test_vsg_firewall_rule_deny_icmp_protocol_and_destination_ip(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001435 """
1436 Algo:
1437 1. Get vSG corresponding to vcpe
1438 2. Login to compute node
1439 3. Execute iptable command on vcpe from compute node to deny a destination IP
1440 4. From cord-tester ping to 8.8.8.8
1441 5. Verifying that ping should not be successful
1442 6. Execute iptable command on vcpe from compute node to deny icmp protocol packets
1443 7. From cord-tester ping to 8.8.8.8
1444 8. Verifying the ping should success
1445 9. Delete the rule added in step 3
1446 10. From cord-tester ping to 8.8.8.8
1447 11. Verifying that ping should not be successful
1448 12. Delete the rule added in step 6
1449 13. From cord-tester ping to 8.8.8.8
1450 14. Verifying the ping should success
1451 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001452 if not vcpe_name:
1453 vcpe_name = self.vcpe_container
1454 if not vcpe_intf:
1455 vcpe_intf = self.vcpe_dhcp
1456 df = defer.Deferred()
1457 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001458 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001459 df.callback(0)
1460 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001461 host = '8.8.8.8'
1462 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1463 try:
1464 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1465 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1466 assert_equal(st, False)
1467 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host))
1468 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1469 assert_equal(st, True)
1470 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe_name))
1471 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1472 assert_equal(st, True)
1473 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
1474 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1475 assert_equal(st, True)
1476 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe_name))
1477 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1478 assert_equal(st,False)
1479 finally:
1480 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
1481 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p icmp -j DROP'.format(vcpe_name))
1482 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1483 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1484 df.callback(0)
1485 reactor.callLater(0, vcpe_firewall, df)
1486 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001487
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001488 @deferred(TIMEOUT) #Fail
1489 def test_vsg_firewall_flushing_all_configured_rules(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001490 """
1491 Algo:
1492 1. Get vSG corresponding to vcpe
1493 2. Login to compute node
1494 3. Execute iptable command on vcpe from compute node to deny a destination IP
1495 4. From cord-tester ping to 8.8.8.8
1496 5. Verifying that ping should not be successful
1497 6. Execute iptable command on vcpe from compute node to deny icmp protocol packets
1498 7. From cord-tester ping to 8.8.8.8
1499 8. Verifying the ping should success
1500 9. Flush all the iptable rules configuraed in vcpe
1501 10. Delete the rule added in step 6
1502 11. From cord-tester ping to 8.8.8.8
1503 12. Verifying the ping should success
1504 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001505 if not vcpe_name:
1506 vcpe_name = self.vcpe_container
1507 if not vcpe_intf:
1508 vcpe_intf = self.vcpe_dhcp
1509 df = defer.Deferred()
1510 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001511 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001512 df.callback(0)
1513 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001514 host = '8.8.8.8'
1515 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1516 try:
1517 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1518 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1519 assert_equal(st, False)
1520 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe_name,host))
1521 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1522 assert_equal(st, True)
1523 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p icmp -j DROP'.format(vcpe_name))
1524 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1525 assert_equal(st, True)
1526 st,output = vsg.run_cmd('sudo docker exec {} iptables -F FORWARD'.format(vcpe_name))
1527 time.sleep(1)
1528 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1529 assert_equal(st, False)
1530 finally:
1531 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe_name,host))
1532 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1533 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1534 df.callback(0)
1535 reactor.callLater(0, vcpe_firewall, df)
1536 return df
Anil Kumar Sankad47023a2017-03-29 21:11:09 +00001537
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001538 @deferred(TIMEOUT)
1539 def test_vsg_firewall_deny_all_ipv4_traffic(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001540 """
1541 Algo:
1542 1. Get vSG corresponding to vcpe
1543 2. Login to compute node
1544 3. Execute iptable command on vcpe from compute node to deny all ipv4 Traffic
1545 4. From cord-tester ping to 8.8.8.8
1546 5. Verifying that ping should not be successful
1547 6. Delete the iptable rule added
1548 7. From cord-tester ping to 8.8.8.8
1549 8. Verifying the ping should success
1550 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001551 if not vcpe_name:
1552 vcpe_name = self.vcpe_container
1553 if not vcpe_intf:
1554 vcpe_intf = self.vcpe_dhcp
1555 df = defer.Deferred()
1556 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001557 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001558 df.callback(0)
1559 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001560 host = '8.8.8.8'
1561 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1562 try:
1563 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1564 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1565 assert_equal(st, False)
1566 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -4 -j DROP'.format(vcpe_name))
1567 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1568 assert_equal(st, True)
1569 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -4 -j DROP'.format(vcpe_name))
1570 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1571 assert_equal(st, False)
1572 finally:
1573 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -4 -j DROP'.format(vcpe_name))
1574 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1575 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1576 df.callback(0)
1577 reactor.callLater(0, vcpe_firewall, df)
1578 return df
Anil Kumar Sanka966c1932017-03-31 00:48:31 +00001579
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001580 @deferred(TIMEOUT)
1581 def test_vsg_firewall_replacing_deny_rule_to_accept_rule_ipv4_traffic(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001582 """
1583 Algo:
1584 1. Get vSG corresponding to vcpe
1585 2. Login to compute node
1586 3. Execute iptable command on vcpe from compute node to deny all ipv4 Traffic
1587 4. From cord-tester ping to 8.8.8.8
1588 5. Verifying that ping should not be successful
1589 6. Replace the deny rule added in step 3 with accept rule
1590 7. From cord-tester ping to 8.8.8.8
1591 8. Verifying the ping should success
1592 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001593 if not vcpe_name:
1594 vcpe_name = self.vcpe_container
1595 if not vcpe_intf:
1596 vcpe_intf = self.vcpe_dhcp
1597 df = defer.Deferred()
1598 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001599 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001600 df.callback(0)
1601 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001602 host = '8.8.8.8'
1603 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1604 try:
1605 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1606 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1607 assert_equal(st, False)
1608 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -4 -j DROP'.format(vcpe_name))
1609 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1610 assert_equal(st, True)
1611 st,output = vsg.run_cmd('sudo docker exec {} iptables -R FORWARD 1 -4 -j ACCEPT'.format(vcpe_name))
1612 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1613 assert_equal(st, False)
1614 finally:
1615 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -4 -j DROP'.format(vcpe_name))
1616 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1617 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1618 df.callback(0)
1619 reactor.callLater(0, vcpe_firewall, df)
1620 return df
Anil Kumar Sanka966c1932017-03-31 00:48:31 +00001621
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001622 @deferred(TIMEOUT)
1623 def test_vsg_firewall_deny_all_traffic_coming_on_lan_interface_in_vcpe(self,vcpe_name=None,vcpe_intf=None):
1624 """
1625 Algo:
1626 1. Get vSG corresponding to vcpe
1627 2. Login to compute node
1628 3. Execute iptable command on vcpe from compute node to deny all the traffic coming on lan interface inside vcpe container
1629 4. From cord-tester ping to 8.8.8.8
1630 5. Verifying the ping should not success
1631 6. Delete the iptable rule added
1632 7. From cord-tester ping to 8.8.8.8
1633 8. Verifying the ping should success
1634 """
1635 if not vcpe_name:
1636 vcpe_name = self.vcpe_container
1637 if not vcpe_intf:
1638 vcpe_intf = self.vcpe_dhcp
1639 df = defer.Deferred()
1640 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001641 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001642 df.callback(0)
1643 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001644 host = '8.8.8.8'
1645 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1646 try:
1647 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1648 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1649 assert_equal(st, False)
1650 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -i eth1 -j DROP'.format(vcpe_name))
1651 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1652 assert_equal(st, True)
1653 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -i eth1 -j DROP'.format(vcpe_name))
1654 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1655 assert_equal(st, False)
1656 finally:
1657 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -i eth1 -j DROP'.format(vcpe_name))
1658 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1659 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1660 df.callback(0)
1661 reactor.callLater(0, vcpe_firewall, df)
1662 return df
1663
1664 @deferred(TIMEOUT)
1665 def test_vsg_firewall_deny_all_traffic_going_out_of_wan_interface_in_vcpe(self,vcpe_name=None,vcpe_intf=None):
1666 """
1667 Algo:
1668 1. Get vSG corresponding to vcpe
1669 2. Login to compute node
1670 3. Execute iptable command on vcpe from compute node to deny all the traffic going out of wan interface inside vcpe container
1671 4. From cord-tester ping to 8.8.8.8
1672 5. Verifying the ping should not success
1673 6. Delete the iptable rule added
1674 7. From cord-tester ping to 8.8.8.8
1675 8. Verifying the ping should success
1676 """
1677 if not vcpe_name:
1678 vcpe_name = self.vcpe_container
1679 if not vcpe_intf:
1680 vcpe_intf = self.vcpe_dhcp
1681 df = defer.Deferred()
1682 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001683 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001684 df.callback(0)
1685 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001686 host = '8.8.8.8'
1687 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1688 try:
1689 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1690 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1691 assert_equal(st, False)
1692 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -o eth0 -j DROP'.format(vcpe_name))
1693 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1694 assert_equal(st, True)
1695 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -o eth0 -j DROP'.format(vcpe_name))
1696 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1697 assert_equal(st, False)
1698 finally:
1699 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -o eth0 -j DROP'.format(vcpe_name))
1700 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1701 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1702 df.callback(0)
1703 reactor.callLater(0, vcpe_firewall, df)
1704 return df
1705
1706 @deferred(TIMEOUT)
1707 def test_vsg_firewall_deny_all_traffic_from_lan_to_wan_in_vcpe(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001708 """
1709 Algo:
1710 1. Get vSG corresponding to vcpe
1711 2. Login to compute node
1712 3. Execute iptable command on vcpe from compute node to deny all the traffic from lan to wan interface in vcpe
1713 4. From cord-tester ping to 8.8.8.8
1714 5. Verifying that ping should not be successful
1715 6. Delete the iptable rule added
1716 7. From cord-tester ping to 8.8.8.8
1717 8. Verifying the ping should success
1718 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001719 if not vcpe_name:
1720 vcpe_name = self.vcpe_container
1721 if not vcpe_intf:
1722 vcpe_intf = self.vcpe_dhcp
1723 df = defer.Deferred()
1724 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001725 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001726 df.callback(0)
1727 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001728 host = '8.8.8.8'
1729 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1730 try:
1731 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1732 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1733 assert_equal(st, False)
1734 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -i eth1 -o eth0 -j DROP'.format(vcpe_name))
1735 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1736 assert_equal(st, True)
1737 st,output = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -i eth1 -o eth0 -j DROP'.format(vcpe_name))
1738 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1739 assert_equal(st, False)
1740 finally:
1741 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -i eth1 -o eth0 -j DROP'.format(vcpe_name))
1742 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1743 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1744 df.callback(0)
1745 reactor.callLater(0, vcpe_firewall, df)
1746 return df
Anil Kumar Sanka966c1932017-03-31 00:48:31 +00001747
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001748 #this test case needs modification.default route should be vcpe interface to run this test case
1749 @deferred(TIMEOUT)
1750 def test_vsg_firewall_deny_all_dns_traffic(self,vcpe_name=None,vcpe_intf=None):
1751 """
1752 Algo:
1753 1. Get vSG corresponding to vcpe
1754 2. Login to compute node
1755 3. Execute iptable command on vcpe from compute node to deny all dns Traffic
1756 4. From cord-tester ping to www.google.com
1757 5. Verifying the ping should not success
1758 6. Delete the iptable rule added
1759 7. From cord-tester ping to www.google.com
1760 8. Verifying the ping should success
1761 """
1762 if not vcpe_name:
1763 vcpe_name = self.vcpe_container
1764 if not vcpe_intf:
1765 vcpe_intf = self.vcpe_dhcp
1766 df = defer.Deferred()
1767 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001768 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001769 df.callback(0)
1770 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001771 host = 'www.msn.com'
1772 host_ip = '131.253.33.203'
1773 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1774 try:
1775 self.add_static_route_via_vcpe_interface([host_ip],vcpe=self.vcpe_dhcp)
1776 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1777 assert_equal(st, False)
1778 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -p udp --dport 53 -j DROP'.format(vcpe_name))
1779 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1780 assert_equal(st, True)
1781 st,output = vsg.run_cmd('sudo docker exec {} iptables -R FORWARD 1 -p udp --dport 53 -j ACCEPT'.format(vcpe_name))
1782 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1783 assert_equal(st, False)
1784 finally:
1785 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -p udp --dport 53 -j DROP'.format(vcpe_name))
1786 self.del_static_route_via_vcpe_interface([host_ip],vcpe=vcpe_intf)
1787 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1788 df.callback(0)
1789 reactor.callLater(0, vcpe_firewall, df)
1790 return df
1791
1792 @deferred(TIMEOUT)
1793 def test_vsg_firewall_deny_all_ipv4_traffic_vcpe_container_restart(self,vcpe_name=None,vcpe_intf=None):
Anil Kumar Sanka72755c92017-04-06 17:19:02 +00001794 """
1795 Algo:
1796 1. Get vSG corresponding to vcpe
1797 2. Login to compute node
1798 3. Execute iptable command on vcpe from compute node to deny all dns Traffic
1799 4. From cord-tester ping to www.google.com
1800 5. Verifying that ping should not be successful
1801 6. Delete the iptable rule added
1802 7. From cord-tester ping to www.google.com
1803 8. Verifying the ping should success
1804 """
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001805 if not vcpe_name:
1806 vcpe_name = self.vcpe_container
1807 if not vcpe_intf:
1808 vcpe_intf = self.vcpe_dhcp
1809 df = defer.Deferred()
1810 def vcpe_firewall(df):
A R Karthick19771192017-04-25 14:57:05 -07001811 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001812 df.callback(0)
1813 return
Anil Kumar Sankaa357c6a2017-04-12 17:52:24 +00001814 host = '8.8.8.8'
1815 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1816 try:
1817 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1818 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1819 assert_equal(st, False)
1820 st,output = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -4 -j DROP'.format(vcpe_name))
1821 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1822 assert_equal(st, True)
1823 st,output = vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1824 time.sleep(3)
1825 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1826 assert_equal(st, False)
1827 finally:
1828 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -4 -j DROP'.format(vcpe_name))
1829 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1830 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1831 df.callback(0)
1832 reactor.callLater(0, vcpe_firewall, df)
1833 return df
Anil Kumar Sanka966c1932017-03-31 00:48:31 +00001834
Anil Kumar Sanka5fa8d8b2017-04-18 22:01:48 +00001835 @deferred(TIMEOUT)
1836 def test_vsg_dnat_modifying_destination_ip(self,vcpe_name=None,vcpe_intf=None):
1837 """
1838 Algo:
1839 1. Get vSG corresponding to vcpe
1840 2. Login to compute node
1841 3. Execute iptable command on vcpe from compute node to deny all dns Traffic
1842 4. From cord-tester ping to www.google.com
1843 5. Verifying the ping should not success
1844 6. Delete the iptable rule added
1845 7. From cord-tester ping to www.google.com
1846 8. Verifying the ping should success
1847 """
1848 if not vcpe_name:
1849 vcpe_name = self.vcpe_container
1850 if not vcpe_intf:
1851 vcpe_intf = self.vcpe_dhcp
1852 df = defer.Deferred()
1853 def vcpe_firewall(df):
1854 host = '8.8.8.8'
1855 dst_ip = '123.123.123.123'
1856 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1857 try:
1858 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1859 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1860 assert_equal(st, False)
1861 st,output = vsg.run_cmd('sudo docker exec {} iptables -t nat -A PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1862 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1863 assert_equal(st, True)
1864 finally:
1865 vsg.run_cmd('sudo docker exec {} iptables -t nat -D PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1866 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1867 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1868 df.callback(0)
1869 reactor.callLater(0,vcpe_firewall,df)
1870 return df
1871
1872 @deferred(TIMEOUT)
1873 def test_vsg_dnat_modifying_destination_ip_and_delete(self,vcpe_name=None,vcpe_intf=None):
1874 """
1875 Algo:
1876 1. Get vSG corresponding to vcpe
1877 2. Login to compute node
1878 3. Execute iptable command on vcpe from compute node to deny all dns Traffic
1879 4. From cord-tester ping to www.google.com
1880 5. Verifying the ping should not success
1881 6. Delete the iptable rule added
1882 7. From cord-tester ping to www.google.com
1883 8. Verifying the ping should success
1884 """
1885 if not vcpe_name:
1886 vcpe_name = self.vcpe_container
1887 if not vcpe_intf:
1888 vcpe_intf = self.vcpe_dhcp
1889 df = defer.Deferred()
1890 def vcpe_firewall(df):
1891 host = '8.8.8.8'
1892 dst_ip = '123.123.123.123'
1893 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1894 try:
1895 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1896 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1897 assert_equal(st, False)
1898 st,output = vsg.run_cmd('sudo docker exec {} iptables -t nat -A PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1899 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1900 assert_equal(st, True)
1901 st,output = vsg.run_cmd('sudo docker exec {} iptables -t nat -A PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1902 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1903 assert_equal(st, False)
1904 finally:
1905 vsg.run_cmd('sudo docker exec {} iptables -t nat -D PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1906 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1907 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1908 df.callback(0)
1909 reactor.callLater(0,vcpe_firewall,df)
1910 return df
1911
1912 @deferred(TIMEOUT)
1913 def test_vsg_dnat_change_modifying_destination_ip_address(self,vcpe_name=None,vcpe_intf=None):
1914 """
1915 Algo:
1916 1. Get vSG corresponding to vcpe
1917 2. Login to compute node
1918 3. Execute iptable command on vcpe from compute node to deny all dns Traffic
1919 4. From cord-tester ping to www.google.com
1920 5. Verifying the ping should not success
1921 6. Delete the iptable rule added
1922 7. From cord-tester ping to www.google.com
1923 8. Verifying the ping should success
1924 """
1925 if not vcpe_name:
1926 vcpe_name = self.vcpe_container
1927 if not vcpe_intf:
1928 vcpe_intf = self.vcpe_dhcp
1929 df = defer.Deferred()
1930 def vcpe_firewall(df):
1931 host = '8.8.8.8'
1932 dst_ip = '123.123.123.123'
1933 vsg = VSGAccess.get_vcpe_vsg(vcpe_name)
1934 try:
1935 self.add_static_route_via_vcpe_interface([host],vcpe=self.vcpe_dhcp)
1936 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1937 assert_equal(st, False)
1938 st,output = vsg.run_cmd('sudo docker exec {} iptables -t nat -A PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1939 st,_ = getstatusoutput('ping -c 1 {}'.format(host))
1940 assert_equal(st, True)
1941 st,output = vsg.run_cmd('sudo docker exec {} iptables -t nat -R PREROUTING 1 -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,host))
1942 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
1943 assert_equal(st, False)
1944 finally:
1945 vsg.run_cmd('sudo docker exec {} iptables -t nat -D PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,dst_ip))
1946 vsg.run_cmd('sudo docker exec {} iptables -t nat -D PREROUTING -s 192.168.0.0/16 -i eth1 -j DNAT --to-destination {}'.format(vcpe_name,host))
1947 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
1948 vsg.run_cmd('sudo docker restart {}'.format(vcpe_name))
1949 df.callback(0)
1950 reactor.callLater(0,vcpe_firewall,df)
1951 return df
1952
A R Karthick035d2e22017-04-25 13:53:00 -07001953 def vsg_xos_subscriber_create(self, index):
A R Karthick19771192017-04-25 14:57:05 -07001954 if self.on_pod is False:
A R Karthick93ba8d02017-04-13 11:59:58 -07001955 return
A R Karthick035d2e22017-04-25 13:53:00 -07001956 subscriber_info = self.subscriber_info[index]
1957 volt_subscriber_info = self.volt_subscriber_info[index]
A R Karthickd0b06792017-04-25 15:11:23 -07001958 s_tag = int(volt_subscriber_info['voltTenant']['s_tag'])
1959 c_tag = int(volt_subscriber_info['voltTenant']['c_tag'])
1960 vcpe = 'vcpe-{}-{}'.format(s_tag, c_tag)
1961 log.info('Creating tenant with s_tag: %d, c_tag: %d' %(s_tag, c_tag))
A R Karthick97e08852017-04-26 10:06:38 -07001962 subId = ''
1963 try:
1964 result = self.restApiXos.ApiPost('TENANT_SUBSCRIBER', subscriber_info)
1965 assert_equal(result, True)
1966 result = self.restApiXos.ApiGet('TENANT_SUBSCRIBER')
1967 assert_not_equal(result, None)
1968 subId = self.restApiXos.getSubscriberId(result, volt_subscriber_info['account_num'])
1969 assert_not_equal(subId, '0')
1970 log.info('Subscriber ID for account num %d = %s' %(volt_subscriber_info['account_num'], subId))
1971 volt_tenant = volt_subscriber_info['voltTenant']
1972 #update the subscriber id in the tenant info before making the rest
1973 volt_tenant['subscriber'] = subId
1974 result = self.restApiXos.ApiPost('TENANT_VOLT', volt_tenant)
1975 assert_equal(result, True)
1976 #if the vsg instance was already instantiated, then reduce delay
1977 if c_tag % self.subscribers_per_s_tag == 0:
1978 delay = 350
1979 else:
1980 delay = 90
1981 log.info('Delaying %d seconds for the VCPE to be provisioned' %(delay))
1982 time.sleep(delay)
1983 log.info('Testing for external connectivity to VCPE %s' %(vcpe))
1984 self.vsg_for_external_connectivity(index)
1985 finally:
A R Karthick5d30b3c2017-04-27 10:25:40 -07001986 return subId
A R Karthick97e08852017-04-26 10:06:38 -07001987
1988 def vsg_xos_subscriber_delete(self, index, subId = ''):
1989 if self.on_pod is False:
1990 return
1991 subscriber_info = self.subscriber_info[index]
1992 volt_subscriber_info = self.volt_subscriber_info[index]
1993 s_tag = int(volt_subscriber_info['voltTenant']['s_tag'])
1994 c_tag = int(volt_subscriber_info['voltTenant']['c_tag'])
1995 vcpe = 'vcpe-{}-{}'.format(s_tag, c_tag)
1996 log.info('Deleting tenant with s_tag: %d, c_tag: %d' %(s_tag, c_tag))
1997 if not subId:
1998 #get the subscriber id first
1999 result = self.restApiXos.ApiGet('TENANT_SUBSCRIBER')
2000 assert_not_equal(result, None)
2001 subId = self.restApiXos.getSubscriberId(result, volt_subscriber_info['account_num'])
2002 assert_not_equal(subId, '0')
A R Karthick97e08852017-04-26 10:06:38 -07002003 #get the volt id for the subscriber
2004 result = self.restApiXos.ApiGet('TENANT_VOLT')
A.R Karthick282f0d32017-03-28 16:43:59 -07002005 assert_not_equal(result, None)
A R Karthick97e08852017-04-26 10:06:38 -07002006 voltId = self.getVoltId(result, subId)
2007 assert_not_equal(voltId, None)
A R Karthicka385cea2017-04-26 10:12:43 -07002008 log.info('Deleting subscriber ID %s for account num %d' %(subId, volt_subscriber_info['account_num']))
2009 status = self.restApiXos.ApiDelete('TENANT_SUBSCRIBER', subId)
2010 assert_equal(status, True)
A R Karthick97e08852017-04-26 10:06:38 -07002011 #Delete the tenant
2012 log.info('Deleting VOLT Tenant ID %s for subscriber %s' %(voltId, subId))
A R Karthick76944872017-04-26 10:21:37 -07002013 self.restApiXos.ApiDelete('TENANT_VOLT', voltId)
A R Karthick035d2e22017-04-25 13:53:00 -07002014
A R Karthicke29c8d42017-04-27 11:38:52 -07002015 def vsg_xos_subscriber_id(self, index):
2016 volt_subscriber_info = self.volt_subscriber_info[index]
2017 result = self.restApiXos.ApiGet('TENANT_SUBSCRIBER')
2018 assert_not_equal(result, None)
2019 subId = self.restApiXos.getSubscriberId(result, volt_subscriber_info['account_num'])
2020 return subId
2021
2022 def test_vsg_xos_subscriber_create_all(self):
2023 for index in xrange(len(self.subscriber_info)):
2024 #check if the index exists
2025 subId = self.vsg_xos_subscriber_id(index)
2026 if subId and subId != '0':
2027 self.vsg_xos_subscriber_delete(index, subId = subId)
2028 subId = self.vsg_xos_subscriber_create(index)
2029 log.info('Created Subscriber %s' %(subId))
2030
2031 def test_vsg_xos_subscriber_delete_all(self):
2032 for index in xrange(len(self.subscriber_info)):
2033 subId = self.vsg_xos_subscriber_id(index)
2034 if subId and subId != '0':
2035 self.vsg_xos_subscriber_delete(index, subId = subId)
2036
2037 def test_vsg_xos_subscriber_create_and_delete(self):
A R Karthick5d30b3c2017-04-27 10:25:40 -07002038 subId = self.vsg_xos_subscriber_create(0)
2039 if subId and subId != '0':
2040 self.vsg_xos_subscriber_delete(0, subId)
A R Karthick035d2e22017-04-25 13:53:00 -07002041
A R Karthicke29c8d42017-04-27 11:38:52 -07002042 def test_vsg_xos_subscriber_2_create_and_delete(self):
A R Karthick5d30b3c2017-04-27 10:25:40 -07002043 subId = self.vsg_xos_subscriber_create(1)
2044 if subId and subId != '0':
2045 self.vsg_xos_subscriber_delete(1, subId)
A R Karthick035d2e22017-04-25 13:53:00 -07002046
A R Karthicke29c8d42017-04-27 11:38:52 -07002047 def test_vsg_xos_subscriber_3_create_and_delete(self):
A R Karthick5d30b3c2017-04-27 10:25:40 -07002048 subId = self.vsg_xos_subscriber_create(2)
2049 if subId and subId != '0':
2050 self.vsg_xos_subscriber_delete(2, subId)
A R Karthick035d2e22017-04-25 13:53:00 -07002051
A R Karthicke29c8d42017-04-27 11:38:52 -07002052 def test_vsg_xos_subscriber_4_create_and_delete(self):
A R Karthick5d30b3c2017-04-27 10:25:40 -07002053 subId = self.vsg_xos_subscriber_create(3)
2054 if subId and subId != '0':
2055 self.vsg_xos_subscriber_delete(3, subId)
A R Karthick035d2e22017-04-25 13:53:00 -07002056
A R Karthicke29c8d42017-04-27 11:38:52 -07002057 def test_vsg_xos_subscriber_5_create_and_delete(self):
A R Karthick5d30b3c2017-04-27 10:25:40 -07002058 subId = self.vsg_xos_subscriber_create(4)
2059 if subId and subId != '0':
2060 self.vsg_xos_subscriber_delete(4, subId)
A.R Karthick282f0d32017-03-28 16:43:59 -07002061
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002062 def test_vsg_with_xos_subscriber_creating_firewall(self,index=4):
2063 log.info('cls.dhcp_vcpes is %s'%self.dhcp_vcpes)
Chetan Gaonker4cff4432017-05-01 17:56:56 +00002064 host = '8.8.8.8'
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002065 self.vsg_xos_subscriber_delete(4, 3)
2066 subId = self.vsg_xos_subscriber_create(index)
2067 if subId and subId != '0':
2068 subscriber_info = self.subscriber_info[index]
2069 volt_subscriber_info = self.volt_subscriber_info[index]
2070 s_tag = int(volt_subscriber_info['voltTenant']['s_tag'])
2071 c_tag = int(volt_subscriber_info['voltTenant']['c_tag'])
2072 vcpe = 'vcpe-{}-{}'.format(s_tag, c_tag)
2073 vcpe_intf = self.dhcp_vcpes[index] #'vcpe{}.{}.{}'.format(s_tag, c_tag)
2074 vsg = VSGAccess.get_vcpe_vsg(vcpe)
2075 try:
2076 self.add_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
2077 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
2078 assert_equal(st, False)
2079 st, _ = vsg.run_cmd('sudo docker exec {} iptables -I FORWARD -d {} -j DROP'.format(vcpe,host))
2080 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
2081 assert_equal(st, True)
2082 st,_ = vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host))
2083 st, _ = getstatusoutput('ping -c 1 {}'.format(host))
2084 assert_equal(st, False)
2085 finally:
2086 vsg.run_cmd('sudo docker exec {} iptables -D FORWARD -d {} -j DROP'.format(vcpe,host))
2087 self.del_static_route_via_vcpe_interface([host],vcpe=vcpe_intf)
2088 vsg.run_cmd('sudo docker restart {}'.format(vcpe))
2089 self.vsg_xos_subscriber_delete(4, subId)
2090 self.vsg_xos_subscriber_delete(4, subId)
Chetan Gaonker4cff4432017-05-01 17:56:56 +00002091
Anil Kumar Sankaf2e10282017-05-08 22:49:39 +00002092 def get_example_service_vm_public_ip(self,vm='mysite_exampleservice'):
2093 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2094 cmd = "nova list --all-tenants|grep {}|cut -d '|' -f 2".format(vm)
2095 status, nova_id = ssh_agent.run_cmd(cmd)
2096 assert_equal(status, True)
2097 #Get public IP of VM
2098 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2099 status, public_ip = ssh_agent.run_cmd(cmd)
2100 assert_equal(status, True)
2101 return public_ip
2102
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002103 def test_onboarding_example_service(self):
2104 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2105 #Wait for ExampleService VM to come up
2106 cmd = "nova list --all-tenants|grep 'exampleservice.*ACTIVE'"
2107 status, output = ssh_agent.run_cmd(cmd)
2108 assert_equal(status, True)
2109 #Get ID of VM
2110 cmd = "nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
2111 status, nova_id = ssh_agent.run_cmd(cmd)
2112 assert_equal(status, True)
2113 #Get mgmt IP of VM
2114 cmd = 'nova interface-list {} |grep -o -m 1 172\.27\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2115 status, mgmt_ip = ssh_agent.run_cmd(cmd)
2116 assert_equal(status, True)
2117 #Get public IP of VM
2118 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2119 status, public_ip = ssh_agent.run_cmd(cmd)
2120 assert_equal(status, True)
2121 #Get name of compute node
2122 cmd = "nova service-list|grep nova-compute|cut -d '|' -f 3"
2123 status, compute_node = ssh_agent.run_cmd(cmd)
2124 assert_equal(status, True)
2125 #Wait for Apache to come up inside VM
2126 cmd = "ssh -o ProxyCommand='ssh -W %h:%p -l ubuntu {}' ubuntu@{} 'ls /var/run/apache2/apache2.pid'".fromat(compute_node,mgmt_ip)
2127 #Make sure testclient has default route to vSG
2128 cmd = "lxc exec testclient -- route | grep default | grep eth0.222.111"
2129 status, output = ssh_agent.run_cmd(cmd)
2130 assert_equal(status, True)
2131 cmd = 'lxc exec testclient -- apt-get install -y curl'
2132 status, output = ssh_agent.run_cmd(cmd)
2133 assert_equal(status, True)
2134 #Test connectivity to ExampleService from test client
2135 cmd = 'lxc exec testclient -- curl -s http://{}'.format(public_ip)
2136 status, output = ssh_agent.run_cmd(cmd)
2137 assert_equal(status, True)
2138
2139 def test_vsg_onboarding_example_service(self):
2140 if not vcpe_intf:
2141 vcpe_intf = self.dhcp_vcpes_reserved[0]
2142 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2143 cmd = "nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
2144 status, nova_id = ssh_agent.run_cmd(cmd)
2145 assert_equal(status, True)
2146 #Get public IP of VM
2147 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2148 status, public_ip = ssh_agent.run_cmd(cmd)
2149 assert_equal(status, True)
2150 try:
2151 self.add_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2152 #curl request from test container
2153 cmd = 'curl -s http://{}'.format(public_ip)
2154 st,_ = getstatusoutput(cmd)
2155 assert_equal(st, True)
2156 finally:
2157 self.del_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2158
2159 def test_subscriber_validating_example_service_after_subscriber_interface_toggle(self,vcpe_intf=None):
2160 if not vcpe_intf:
2161 vcpe_intf = self.dhcp_vcpes_reserved[0]
2162 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2163 #Get public IP of VM
2164 cmd = "nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
2165 status, nova_id = ssh_agent.run_cmd(cmd)
2166 assert_equal(status, True)
2167 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2168 status, public_ip = ssh_agent.run_cmd(cmd)
2169 assert_equal(status, True)
2170 try:
2171 self.add_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2172 #curl request from test container
2173 cmd = 'curl -s http://{}'.format(public_ip)
2174 st,_ = getstatusoutput(cmd)
2175 assert_equal(st, True)
2176 st,_ = getstatusoutput('ifconfig {} down'.format(vcpe_intf))
2177 assert_equal(st, True)
2178 st,_ = getstatusoutput(cmd)
2179 assert_equal(st, True)
2180 finally:
2181 self.del_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2182
2183 def test_subscriber_example_service_after_service_restart(self, vcpe_intf=None):
2184 if not vcpe_intf:
2185 vcpe_intf = self.dhcp_vcpes_reserved[0]
2186 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2187 cmd = "nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
2188 status, nova_id = ssh_agent.run_cmd(cmd)
2189 assert_equal(status, True)
2190 #Get public IP of VM
2191 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2192 status, public_ip = ssh_agent.run_cmd(cmd)
2193 assert_equal(status, True)
2194 try:
2195 self.add_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2196 #curl request from test container
2197 curl_cmd = 'curl -s http://{}'.format(public_ip)
2198 st,_ = getstatusoutput(curl_cmd)
2199 assert_equal(st, True)
2200 #restarting example service VM
2201 cmd = 'nova reset-state {}'.format(nova_id)
2202 status, _ = ssh_agent.run_cmd(cmd)
2203 assert_equal(status, True)
2204 time.sleep(10)
2205 st,_ = getstatusoutput(curl_cmd)
2206 assert_equal(st, True)
2207 finally:
2208 self.del_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
Chetan Gaonker4cff4432017-05-01 17:56:56 +00002209
Anil Kumar Sankaf2e10282017-05-08 22:49:39 +00002210 def test_vsg_for_subcriber_with_example_service_running_apache_server_after_service_stop(self, vcpe_intf=None):
2211 if not vcpe_intf:
2212 vcpe_intf = self.dhcp_vcpes_reserved[0]
2213 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2214 cmd = "nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
2215 status, nova_id = ssh_agent.run_cmd(cmd)
2216 assert_equal(status, True)
2217 #Get public IP of VM
2218 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2219 status, public_ip = ssh_agent.run_cmd(cmd)
2220 assert_equal(status, True)
2221 try:
2222 self.add_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2223 #curl request from test container
2224 curl_cmd = 'curl -s http://{}'.format(public_ip)
2225 st,_ = getstatusoutput(curl_cmd)
2226 assert_equal(st, True)
2227 #restarting example service VM
2228 cmd = 'nova stop {}'.format(nova_id)
2229 status, _ = ssh_agent.run_cmd(cmd)
2230 assert_equal(status, True)
2231 time.sleep(1)
2232 st,_ = getstatusoutput(curl_cmd)
2233 assert_equal(st, False)
2234 cmd = 'nova start {}'.format(nova_id)
2235 status, _ = ssh_agent.run_cmd(cmd)
2236 assert_equal(status, True)
2237 time.sleep(1)
2238 st,_ = getstatusoutput(curl_cmd)
2239 assert_equal(st, True)
2240 finally:
2241 self.del_static_route_via_vcpe_interface([public_ip],vcpe=vcpe_intf)
2242
2243 def test_vsg_for_multiple_subcribers_with_same_example_service_running_apache_server(self):
2244 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
2245 cmd = "nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
2246 status, nova_id = ssh_agent.run_cmd(cmd)
2247 assert_equal(status, True)
2248 #Get public IP of VM
2249 cmd = 'nova interface-list {} |grep -o -m 1 10\.6\.[[:digit:]]*\.[[:digit:]]*'.format(nova_id)
2250 status, public_ip = ssh_agent.run_cmd(cmd)
2251 assert_equal(status, True)
2252 for vcpe in self.dhcp_vcpes:
2253 self.add_static_route_via_vcpe_interface([public_ip],vcpe=vcpe)
2254 #curl request from test container
2255 curl_cmd = 'curl -s http://{}'.format(public_ip)
2256 st,_ = getstatusoutput(curl_cmd)
2257 assert_equal(st, True)
2258 self.del_static_route_via_vcpe_interface([public_ip],vcpe=vcpe)
2259 time.sleep(1)
2260
Chetan Gaonker52418832017-01-26 23:03:13 +00002261 def test_vsg_for_dns_service(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002262 """
2263 Algo:
2264 1. Create a test client in Prod VM
2265 2. Create a vCPE container in vSG VM inside compute Node
2266 3. Ensure vSG VM and vCPE container created properly
2267 4. Enable dns service in vCPE ( if not by default )
2268 5. Send ping request from test client to valid domain address say, 'www.google'com
2269 6. Verify that dns should resolve ping should success
2270 7. Now send ping request to invalid domain address say 'www.invalidaddress'.com'
2271 8. Verify that dns resolve should fail and hence ping
2272 """
A R Karthick63751492017-03-22 09:28:01 -07002273
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002274 def test_vsg_with_10_subscribers_for_same_service(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002275 """
2276 Algo:
2277 1.Create a vSG VM in compute node
2278 2.Create 10 vCPE containers for 10 subscribers, in vSG VM
2279 3.Ensure vSG VM and vCPE container created properly
2280 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
2281 5.Verify that ping success for all 10 subscribers
2282 """
A R Karthick63751492017-03-22 09:28:01 -07002283
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002284 def test_vsg_with_subscribers_for_same_service(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002285 """
2286 Algo:
2287 1.Create a vSG VM in compute node
2288 2.Create 100 vCPE containers for 100 subscribers, in vSG VM
2289 3.Ensure vSG VM and vCPE container created properly
2290 4.From each of the subscriber, with same s-tag and different c-tag, send a ping to valid external public IP
2291 5.Verify that ping success for all 100 subscribers
2292 """
A R Karthick63751492017-03-22 09:28:01 -07002293
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002294 def test_vsg_for_packet_received_with_invalid_ip_fields(self):
2295 """
2296 Algo:
2297 1.Create a vSG VM in compute node
2298 2.Create a vCPE container in vSG VM
2299 3.Ensure vSG VM and vCPE container created properly
2300 4.From subscriber, send a ping packet with invalid ip fields
2301 5.Verify that vSG drops the packet
2302 6.Verify ping fails
2303 """
A R Karthick63751492017-03-22 09:28:01 -07002304
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002305 def test_vsg_for_packet_received_with_invalid_mac_fields(self):
2306 """
2307 Algo:
2308 1.Create a vSG VM in compute node
2309 2.Create a vCPE container in vSG VM
2310 3.Ensure vSG VM and vCPE container created properly
2311 4.From subscriber, send a ping packet with invalid mac fields
2312 5.Verify that vSG drops the packet
2313 6.Verify ping fails
2314 """
A R Karthick63751492017-03-22 09:28:01 -07002315
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002316 def test_vsg_for_vlan_id_mismatch_in_stag(self):
2317 """
2318 Algo:
2319 1.Create a vSG VM in compute Node
2320 2.Create a vCPE container in vSG VM
2321 3.Ensure vSG VM and vCPE container created properly
2322 4.Send a ping request to external valid IP from subscriber, with incorrect vlan id in s-tag and valid c-tag
2323 5.Verify that ping fails as the packet drops at VM entry
2324 6.Repeat step 4 with correct s-tag
2325 7.Verify that ping success
2326 """
A R Karthick63751492017-03-22 09:28:01 -07002327
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002328 def test_vsg_for_vlan_id_mismatch_in_ctag(self):
2329 """
2330 Algo:
2331 1.Create a vSG VM in compute node
2332 2.Create a vCPE container in vSG VM
2333 3.Ensure vSG VM and vCPE container created properly
2334 4.Send a ping request to external valid IP from subscriber, with valid s-tag and incorrect vlan id in c-tag
2335 5.Verify that ping fails as the packet drops at vCPE container entry
2336 6.Repeat step 4 with valid s-tag and c-tag
2337 7.Verify that ping success
2338 """
A R Karthick63751492017-03-22 09:28:01 -07002339
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002340 def test_vsg_for_matching_and_mismatching_vlan_id_in_stag(self):
2341 """
2342 Algo:
2343 1.Create two vSG VMs in compute node
2344 2.Create a vCPE container in each vSG VM
2345 3.Ensure vSG VM and vCPE container created properly
2346 4.From subscriber one, send ping request with valid s and c tags
2347 5.From subscriber two, send ping request with vlan id mismatch in s-tag and valid c tags
2348 6.Verify that ping success for only subscriber one and fails for two.
2349 """
A R Karthick63751492017-03-22 09:28:01 -07002350
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002351 def test_vsg_for_matching_and_mismatching_vlan_id_in_ctag(self):
2352 """
2353 Algo:
2354 1.Create a vSG VM in compute node
2355 2.Create two vCPE containers in vSG VM
2356 3.Ensure vSG VM and vCPE container created properly
2357 4.From subscriber one, send ping request with valid s and c tags
2358 5.From subscriber two, send ping request with valid s-tag and vlan id mismatch in c-tag
2359 6.Verify that ping success for only subscriber one and fails for two
2360 """
A R Karthick63751492017-03-22 09:28:01 -07002361
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002362 def test_vsg_for_out_of_range_vlanid_in_ctag(self):
2363 """
2364 Algo:
2365 1.Create a vSG VM in compute node
2366 2.Create a vCPE container in vSG VM
2367 3.Ensure vSG VM and vCPE container created properly
2368 4.From subscriber, send ping request with valid stag and vlan id in c-tag is an out of range value ( like 0,4097 )
2369 4.Verify that ping fails as the ping packets drops at vCPE container entry
2370 """
A R Karthick63751492017-03-22 09:28:01 -07002371
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002372 def test_vsg_for_out_of_range_vlanid_in_stag(self):
2373 """
2374 Algo:
2375 1.Create a vSG VM in compute node
2376 2.Create a vCPE container in vSG VM
2377 3.Ensure vSG VM and vCPE container created properly
2378 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
2379 4.Verify that ping fails as the ping packets drops at vSG VM entry
2380 """
A R Karthick63751492017-03-22 09:28:01 -07002381
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002382 def test_vsg_without_creating_vcpe_instance(self):
2383 """
2384 Algo:
2385 1.Create a vSG VM in compute Node
2386 2.Ensure vSG VM created properly
2387 3.Do not create vCPE container inside vSG VM
2388 4.From a subscriber, send ping to external valid IP
2389 5.Verify that ping fails as the ping packet drops at vSG VM entry itself.
2390 """
A R Karthick63751492017-03-22 09:28:01 -07002391
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002392 def test_vsg_for_remove_vcpe_instance(self):
2393 """
2394 Algo:
2395 1.Create a vSG VM in compute node
2396 2.Create a vCPE container in vSG VM
2397 3.Ensure vSG VM and vCPE container created properly
2398 4.From subscriber, send ping request with valid s-tag and c-tag
2399 5.Verify that ping success
2400 6.Verify ping success flows in OvS switch in compute node
2401 7.Now remove the vCPE container in vSG VM
2402 8.Ensure that the container removed properly
2403 9.Repeat step 4
2404 10.Verify that now, ping fails
2405 """
A R Karthick63751492017-03-22 09:28:01 -07002406
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002407 def test_vsg_for_restarting_vcpe_instance(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002408 """
2409 Algo:
2410 1.Create a vSG VM in compute node
2411 2.Create a vCPE container in vSG VM
2412 3.Ensure vSG VM and vCPE container created properly
2413 4.From subscriber, send ping request with valid s-tag and c-tag
2414 5.Verify that ping success
2415 6.Verify ping success flows in OvS switch in compute node
2416 7.Now restart the vCPE container in vSG VM
2417 8.Ensure that the container came up after restart
2418 9.Repeat step 4
2419 10.Verify that now,ping gets success and flows added in OvS
2420 """
A R Karthick63751492017-03-22 09:28:01 -07002421
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002422 def test_vsg_for_restarting_vsg_vm(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002423 """
2424 Algo:
2425 1.Create a vSG VM in compute node
2426 2.Create a vCPE container in vSG VM
2427 3.Ensure vSG VM and vCPE container created properly
2428 4.From subscriber, send ping request with valid s-tag and c-tag
2429 5.Verify that ping success
2430 6.Verify ping success flows in OvS switch in compute node
2431 7.Now restart the vSG VM
2432 8.Ensure that the vSG comes up properly after restart
2433 9.Verify that vCPE container comes up after vSG restart
2434 10.Repeat step 4
2435 11.Verify that now,ping gets success and flows added in OvS
2436 """
A R Karthick63751492017-03-22 09:28:01 -07002437
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002438 def test_vsg_for_pause_of_vcpe_instance(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002439 """
2440 Algo:
2441 1.Create a vSG VM in compute node
2442 2.Create a vCPE container in vSG VM
2443 3.Ensure vSG VM and vCPE container created properly
2444 4.From subscriber, send ping request with valid s-tag and c-tag
2445 5.Verify that ping success
2446 6.Verify ping success flows in OvS switch in compute node
2447 7.Now pause vCPE container in vSG VM for a while
2448 8.Ensure that the container state is pause
2449 9.Repeat step 4
2450 10.Verify that now,ping fails now and verify flows in OvS
2451 11.Now resume the container
2452 12.Now repeat step 4 again
2453 13.Verify that now, ping gets success
2454 14.Verify ping success flows in OvS
2455 """
A R Karthick63751492017-03-22 09:28:01 -07002456
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002457 def test_vsg_for_extracting_all_compute_stats_from_all_vcpe_containers(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002458 """
2459 Algo:
2460 1.Create a vSG VM in compute node
2461 2.Create 10 vCPE containers in VM
2462 3.Ensure vSG VM and vCPE containers created properly
2463 4.Login to all vCPE containers
2464 4.Get all compute stats from all vCPE containers
2465 5.Verify the stats # verification method need to add
2466 """
A R Karthick63751492017-03-22 09:28:01 -07002467
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002468 def test_vsg_for_extracting_dns_stats_from_all_vcpe_containers(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002469 """
2470 Algo:
2471 1.Create a vSG VM in compute node
2472 2.Create 10 vCPE containers in VM
2473 3.Ensure vSG VM and vCPE containers created properly
2474 4.From 10 subscribers, send ping to valid and invalid dns hosts
2475 5.Verify dns resolves and ping success for valid dns hosts
2476 6.Verify ping fails for invalid dns hosts
2477 7.Verify dns host name resolve flows in OvS
2478 8.Login to all 10 vCPE containers
2479 9.Extract all dns stats
2480 10.Verify dns stats for queries sent, queries received for dns host resolve success and failed scenarios
2481 """
A R Karthick63751492017-03-22 09:28:01 -07002482
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002483 def test_subscriber_access_for_two_vsg_services(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002484 """
2485 # Intention is to verify if subscriber can reach internet via two vSG VMs
2486 Algo:
2487 1.Create two vSG VMs for two services in compute node
2488 2.Create one vCPE container in each VM for one subscriber
2489 3.Ensure VMs and containers created properly
2490 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
2491 5.Verify ping gets success
2492 6.Verify ping success flows in OvS
2493 7.Now repeat step 4 with stag corresponds to vSG-2 VM
2494 8.Verify that ping again success
2495 9.Verify ping success flows in OvS
2496 """
A R Karthick63751492017-03-22 09:28:01 -07002497
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002498 def test_subscriber_access_if_vsg1_goes_down(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002499 """
2500 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
2501 Algo:
2502 1.Create two vSG VMs for two services in compute node
2503 2.Create one vCPE container in each VM for one subscriber
2504 3.Ensure VMs and containers created properly
2505 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
2506 5.Verify ping gets success
2507 6.Verify ping success flows in OvS
2508 7.Down the vSG-1 VM
2509 8.Now repeat step 4
2510 9.Verify that ping fails as vSG-1 is down
2511 10.Repeat step 4 with stag corresponding to vSG-2
2512 9.Verify ping success and flows added in OvS
2513 """
A R Karthick63751492017-03-22 09:28:01 -07002514
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002515 def test_subscriber_access_if_vsg2_goes_down(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002516 """
2517 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
2518 Algo:
2519 1.Create two vSG VMs for two services in compute node
2520 2.Create one vCPE container in each VM for one subscriber
2521 3.Ensure VMs and containers created properly
2522 4.From subscriber end, send ping to public IP with stag corresponds to vSG-1 VM and ctag
2523 5.Verify ping gets success
2524 6.Verify ping success flows added in OvS
2525 7.Now restart vSG-1 VM
2526 8.Now repeat step 4 while vSG-1 VM restarts
2527 9.Verify that ping fails as vSG-1 is restarting
2528 10.Repeat step 4 with stag corresponding to vSG-2 while vSG-1 VM restarts
2529 11.Verify ping success and flows added in OvS
2530 """
A R Karthick63751492017-03-22 09:28:01 -07002531
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002532 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_going_down(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002533 """
2534 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 goes down
2535 Algo:
2536 1.Create a vSG VM in compute node
2537 2.Create two vCPE containers corresponds to two subscribers in vSG VM
2538 3.Ensure VM and containers created properly
2539 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
2540 5.Verify ping gets success
2541 6.Verify ping success flows added in OvS
2542 7.Now stop vCPE-1 container
2543 8.Now repeat step 4
2544 9.Verify that ping fails as vCPE-1 container is down
2545 10.Repeat step 4 with ctag corresponding to vCPE-2 container
2546 11.Verify ping success and flows added in OvS
2547 """
A R Karthick63751492017-03-22 09:28:01 -07002548
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002549 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_restart(self):
2550 """
2551 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 restarts
2552 Algo:
2553 1.Create a vSG VM in compute node
2554 2.Create two vCPE containers corresponds to two subscribers in vSG VM
2555 3.Ensure VM and containers created properly
2556 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
2557 5.Verify ping gets success
2558 6.Verify ping success flows added in OvS
2559 7.Now restart vCPE-1 container
2560 8.Now repeat step 4 while vCPE-1 restarts
2561 9.Verify that ping fails as vCPE-1 container is restarts
2562 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 restarts
2563 11..Verify ping success and flows added in OvS
2564 """
A R Karthick63751492017-03-22 09:28:01 -07002565
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002566 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_paused(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002567 """
2568 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 paused
2569 Algo:
2570 1.Create a vSG VM in compute node
2571 2.Create two vCPE containers corresponds to two subscribers in vSG VM
2572 3.Ensure VM and containers created properly
2573 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
2574 5.Verify ping gets success
2575 6.Verify ping success flows added in OvS
2576 7.Now pause vCPE-1 container
2577 8.Now repeat step 4 while vCPE-1 in pause state
2578 9.Verify that ping fails as vCPE-1 container in pause state
2579 10.Repeat step 4 with ctag corresponding to vCPE-2 container while vCPE-1 in pause state
2580 11.Verify ping success and flows added in OvS
2581 """
2582 def test_vsg_for_multiple_vcpes_in_vsg_vm_with_one_vcpe_removed(self):
2583 """
2584 # Intention is to verify if subscriber can reach internet via vSG2 if vSG1 removed
2585 Algo:
2586 1.Create a vSG VM in compute node
2587 2.Create two vCPE containers corresponds to two subscribers in vSG VM
2588 3.Ensure VM and containers created properly
2589 4.From subscriber-1 end, send ping to public IP with ctag corresponds to vCPE-1 and stag
2590 5.Verify ping gets success
2591 6.Verify ping success flows added in OvS
2592 7.Now remove vCPE-1 container
2593 8.Now repeat step 4
2594 9.Verify that ping fails as vCPE-1 container removed
2595 10.Repeat step 4 with ctag corresponding to vCPE-2 container
2596 11.Verify ping success and flows added in OvS
2597 """
A R Karthick63751492017-03-22 09:28:01 -07002598
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002599 def test_vsg_for_vcpe_instance_removed_and_added_again(self):
2600 """
2601 Algo:
2602 1.Create a vSG VM in compute node
2603 2.Create a vCPE container in vSG VM
2604 3.Ensure VM and containers created properly
2605 4.From subscriber end, send ping to public IP
2606 5.Verify ping gets success
2607 6.Verify ping success flows added in OvS
2608 7.Now remove vCPE container in vSG VM
2609 8.Now repeat step 4
2610 9.Verify that ping fails as vCPE container removed
2611 10.Create the vCPE container again for the same subscriber
2612 11.Ensure that vCPE created now
2613 12.Now repeat step 4
2614 13.Verify ping success and flows added in OvS
2615 """
A R Karthick63751492017-03-22 09:28:01 -07002616
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002617 def test_vsg_for_vsg_vm_removed_and_added_again(self):
2618 """
2619 Algo:
2620 1.Create a vSG VM in compute node
2621 2.Create a vCPE container in vSG VM
2622 3.Ensure VM and containers created properly
2623 4.From subscriber end, send ping to public IP
2624 5.Verify ping gets success
2625 6.Verify ping success flows added in OvS
2626 7.Now remove vSG VM
2627 8.Now repeat step 4
2628 9.Verify that ping fails as vSG VM not exists
2629 10.Create the vSG VM and vCPE container in VM again
2630 11.Ensure that vSG and vCPE created
2631 12.Now repeat step 4
2632 13.Verify ping success and flows added in OvS
2633 """
2634
2635 #Test vSG - Subscriber Configuration
2636 def test_vsg_for_configuring_new_subscriber_in_vcpe(self):
2637 """
2638 Algo:
2639 1.Create a vSG VM in compute node
2640 2.Create a vCPE container in vSG VM
2641 3.Ensure VM and containers created properly
2642 4.Configure a subscriber in XOS and assign a service id
2643 5.Set the admin privileges to the subscriber
2644 6.Verify subscriber configuration is success
2645 """
2646 def test_vsg_for_adding_subscriber_devices_in_vcpe(self):
2647 """
2648 Algo:
2649 1.Create a vSG VM in compute node
2650 2.Create a vCPE container in vSG VM
2651 3.Ensure VM and containers created properly
2652 4.Configure a subscriber in XOS and assign a service id
2653 5.Verify subscriber successfully configured in vCPE
2654 6.Now add devices( Mac addresses ) under the subscriber admin group
2655 7.Verify all devices ( Macs ) added successfully
2656 """
2657 def test_vsg_for_removing_subscriber_devices_in_vcpe(self):
2658 """
2659 Algo:
2660 1.Create a vSG VM in compute node
2661 2.Create a vCPE container in vSG VM
2662 3.Ensure VM and containers created properly
2663 4.Configure a subscriber in XOS and assign a service id
2664 5.Verify subscriber successfully configured
2665 6.Now add devices( Mac addresses ) under the subscriber admin group
2666 7.Verify all devices ( Macs ) added successfully
2667 8.Now remove All the added devices in XOS
2668 9.Verify all the devices removed
2669 """
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002670 def test_vsg_modifying_subscriber_devices_in_vcpe(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002671 """
2672 Algo:
2673 1.Create a vSG VM in compute node
2674 2.Create a vCPE container in vSG VM
2675 3.Ensure VM and containers created properly
2676 4.Configure a user in XOS and assign a service id
2677 5.Verify subscriber successfully configured in vCPE.
2678 6.Now add devices( Mac addresses ) under the subscriber admin group
2679 7.Verify all devices ( Macs ) added successfully
2680 8.Now remove few devices in XOS
2681 9.Verify devices removed successfully
2682 10.Now add few additional devices in XOS under the same subscriber admin group
2683 11.Verify newly added devices successfully added
2684 """
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002685 def test_vsg_for_vcpe_login_failing_with_incorrect_subscriber_credentials(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002686 """
2687 Algo:
2688 1.Create a vSG VM in compute node
2689 2.Create a vCPE container in vSG VM
2690 3.Ensure VM and containers created properly
2691 4.Configure a subscriber in XOS and assign a service id
2692 5.Verify subscriber successfully configured
2693 6.Now add devices( Mac addresses ) under the subscriber admin group
2694 7.Verify all devices ( Macs ) added successfully
2695 8.Login vCPE with credentials with which subscriber configured
2696 9.Verify subscriber successfully logged in
2697 10.Logout and login again with incorrect credentials ( either user name or password )
2698 11.Verify login attempt to vCPE fails wtih incorrect credentials
2699 """
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002700 def test_vsg_for_subscriber_configuration_in_vcpe_after_vcpe_restart(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002701 """
2702 Algo:
2703 1.Create a vSG VM in compute node
2704 2.Create a vCPE container in vSG VM
2705 3.Ensure VM and containers created properly
2706 4.Configure a subscriber in XOS and assign a service id
2707 5.Verify subscriber successfully configured
2708 6.Now add devices( Mac addresses ) under the subscriber admin group
2709 7.Verify all devices ( Macs ) added successfully
2710 8.Restart vCPE ( locate backup config path while restart )
2711 9.Verify subscriber details in vCPE after restart should be same as before the restart
2712 """
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002713 def test_vsg_creating_multiple_vcpe_instances_and_configuring_subscriber_in_each_instance(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002714 """
2715 Algo:
2716 1.Create a vSG VM in compute node
2717 2.Create 2 vCPE containers in vSG VM
2718 3.Ensure VM and containers created properly
2719 4.Configure a subscriber in XOS for each vCPE instance and assign a service id
2720 5.Verify subscribers successfully configured
2721 6.Now login vCPE-2 with subscriber-1 credentials
2722 7.Verify login fails
2723 8.Now login vCPE-1 with subscriber-2 credentials
2724 9.Verify login fails
2725 10.Now login vCPE-1 with subscriber-1 and vCPE-2 with subscriber-2 credentials
2726 11.Verify that both the subscribers able to login to their respective vCPE containers
2727 """
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002728 def test_vsg_for_same_subscriber_configuring_multiple_services(self):
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002729 """
2730 Algo:
2731 1.Create 2 vSG VMs in compute node
2732 2.Create a vCPE container in each vSG VM
2733 3.Ensure VMs and containers created properly
2734 4.Configure same subscriber in XOS for each vCPE instance and assign a service id
2735 5.Verify subscriber successfully configured
2736 6.Now login vCPE-1 with subscriber credentials
2737 7.Verify login success
2738 8.Now login vCPE-2 with the same subscriber credentials
2739 9.Verify login success
2740 """
Anil Kumar Sanka1213d4c2017-02-23 22:50:48 +00002741 #vCPE Firewall Functionality
2742 def test_vsg_firewall_for_creating_acl_rule_based_on_source_ip(self):
2743 """
2744 Algo:
2745 1.Create a vSG VM in compute node
2746 2.Create vCPE container in the VM
2747 3.Ensure vSG VM and vCPE container created properly
2748 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
2749 5.Bound the acl rule to WAN interface of vCPE
2750 6.Verify configuration in vCPE is success
2751 8.Verify flows added in OvS
2752 """
2753 def test_vsg_firewall_for_creating_acl_rule_based_on_destination_ip(self):
2754 """
2755 Algo:
2756 1.Create a vSG VM in compute node
2757 2.Create vCPE container in the VM
2758 3.Ensure vSG VM and vCPE container created properly
2759 4.Configure ac acl rule in vCPE to deny IP traffic to a destination ip
2760 5.Bound the acl rule to WAN interface of vCPE
2761 6.Verify configuration in vCPE is success
2762 8.Verify flows added in OvS
2763 """
2764 def test_vsg_firewall_for_acl_deny_rule_based_on_source_ip_traffic(self):
2765 """
2766 Algo:
2767 1.Create a vSG VM in compute node
2768 2.Create vCPE container in the VM
2769 3.Ensure vSG VM and vCPE container created properly
2770 4.Configure ac acl rule in vCPE to deny IP traffic from a source IP
2771 5.Bound the acl rule to WAN interface of vCPE
2772 6.From subscriber, send ping to the denied IP address
2773 7.Verify that ping fails as vCPE denies ping response
2774 8.Verify flows added in OvS
2775 """
2776 def test_vsg_firewall_for_acl_deny_rule_based_on_destination_ip_traffic(self):
2777 """
2778 Algo:
2779 1.Create a vSG VM in compute node
2780 2.Create vCPE container in the VM
2781 3.Ensure vSG VM and vCPE container created properly
2782 4.Configure ac acl rule in vCPE to deny IP traffic to a destination IP
2783 5.Bound the acl rule to WAN interface of vCPE
2784 6.From subscriber, send ping to the denied IP address
2785 7.Verify that ping fails as vCPE drops the ping request at WAN interface
2786 8.Verify flows added in OvS
2787 """
Chetan Gaonker52418832017-01-26 23:03:13 +00002788
2789 def test_vsg_dnsmasq(self):
2790 pass
2791
2792 def test_vsg_with_external_parental_control_family_shield_for_filter(self):
2793 pass
2794
2795 def test_vsg_with_external_parental_control_with_answerx(self):
2796 pass
2797
2798 def test_vsg_for_subscriber_upstream_bandwidth(self):
2799 pass
2800
2801 def test_vsg_for_subscriber_downstream_bandwidth(self):
2802 pass
2803
2804 def test_vsg_for_diagnostic_run_of_traceroute(self):
2805 pass
2806
2807 def test_vsg_for_diagnostic_run_of_tcpdump(self):
2808 pass
2809
2810 def test_vsg_for_iptable_rules(self):
2811 pass
2812
2813 def test_vsg_for_iptables_with_neutron(self):
2814 pass
Anil Kumar Sankaf6a9f392017-05-06 00:18:31 +00002815