blob: 1c031a228e3764eead0d0ee1473cf3574ec58ffc [file] [log] [blame]
Chetan Gaonker357f4892017-06-19 19:38:27 +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#
15import time
16import os
17import sys
18import json
19import requests
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +000020import random
Chetan Gaonker357f4892017-06-19 19:38:27 +000021from nose.tools import *
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +000022from scapy.all import *
Chetan Gaonker357f4892017-06-19 19:38:27 +000023from twisted.internet import defer
24from nose.twistedtools import reactor, deferred
25from CordTestUtils import *
26from OltConfig import OltConfig
27from onosclidriver import OnosCliDriver
28from SSHTestAgent import SSHTestAgent
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000029from Channels import Channels, IgmpChannel
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +000030from IGMP import *
Chetan Gaonker357f4892017-06-19 19:38:27 +000031from CordLogger import CordLogger
32from VSGAccess import VSGAccess
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000033from OnosFlowCtrl import OnosFlowCtrl
34#imports for cord-subscriber module
35from subscriberDb import SubscriberDB
36from Stats import Stats
37from threadPool import ThreadPool
38import threading
39from EapTLS import TLSAuthTest
Chetan Gaonker357f4892017-06-19 19:38:27 +000040from CordTestUtils import log_test as log
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000041from CordTestConfig import setup_module, running_on_ciab
Chetan Gaonker357f4892017-06-19 19:38:27 +000042from OnosCtrl import OnosCtrl
43from CordContainer import Onos
A R Karthicked3a2ca2017-07-06 15:50:03 -070044from CordSubscriberUtils import CordSubscriberUtils, XosUtils
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000045from CordTestServer import cord_test_onos_restart, cord_test_quagga_restart, cord_test_shell, cord_test_radius_restart
46from Scale import scale
Chetan Gaonker357f4892017-06-19 19:38:27 +000047log.setLevel('INFO')
48
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000049
Chetan Gaonker357f4892017-06-19 19:38:27 +000050class scale_exchange(CordLogger):
51 HOST = "10.1.0.1"
52 USER = "vagrant"
53 PASS = "vagrant"
54 head_node = os.getenv('HEAD_NODE', 'prod')
55 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
56 test_path = os.path.dirname(os.path.realpath(__file__))
57 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000058 restApiXos = None
59 cord_subscriber = None
A R Karthicked3a2ca2017-07-06 15:50:03 -070060 SUBSCRIBER_ACCOUNT_NUM = 100
61 SUBSCRIBER_S_TAG = 500
62 SUBSCRIBER_C_TAG = 500
63 SUBSCRIBERS_PER_S_TAG = 8
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000064 subscriber_info = []
65 volt_subscriber_info = []
Chetan Gaonker357f4892017-06-19 19:38:27 +000066 restore_methods = []
67 TIMEOUT=120
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000068 NUM_SUBSCRIBERS = 16
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +000069 wan_intf_ip = '10.6.1.129'
70 V_INF1 = 'veth0'
71 V_INF2 = 'veth1'
72 MGROUP1 = '239.1.2.3'
73 MGROUP2 = '239.2.2.3'
74 MINVALIDGROUP1 = '255.255.255.255'
75 MINVALIDGROUP2 = '239.255.255.255'
76 MMACGROUP1 = "01:00:5e:01:02:03"
77 MMACGROUP2 = "01:00:5e:02:02:03"
78 IGMP_DST_MAC = "01:00:5e:00:00:16"
79 IGMP_SRC_MAC = "5a:e1:ac:ec:4d:a1"
80 IP_SRC = '1.2.3.4'
81 IP_DST = '224.0.0.22'
82 igmp_eth = Ether(dst = IGMP_DST_MAC, type = ETH_P_IP)
83 igmp_ip = IP(dst = IP_DST)
84 PORT_TX_DEFAULT = 2
85 PORT_RX_DEFAULT = 1
86 igmp_app = 'org.opencord.igmp'
Anil Kumar Sanka8942c882017-07-07 17:05:11 +000087 acl_app = 'org.onosproject.acl'
88 aaa_app = 'org.opencord.aaa'
89 app = 'org.onosproject.cli'
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +000090 APP_NAME = 'org.ciena.xconnect'
Anil Kumar Sanka8942c882017-07-07 17:05:11 +000091 INTF_TX_DEFAULT = 'veth2'
92 INTF_RX_DEFAULT = 'veth0'
93 default_port_map = {
94 PORT_TX_DEFAULT : INTF_TX_DEFAULT,
95 PORT_RX_DEFAULT : INTF_RX_DEFAULT,
96 INTF_TX_DEFAULT : PORT_TX_DEFAULT,
97 INTF_RX_DEFAULT : PORT_RX_DEFAULT
98 }
99 vrouter_apps = ('org.onosproject.proxyarp', 'org.onosproject.hostprovider', 'org.onosproject.vrouter', 'org.onosproject.fwd')
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000100 MAX_PORTS = 100
101 subscriber_apps = ('org.opencord.aaa', 'org.onosproject.dhcp')
102 olt_apps = () #'org.opencord.cordmcast')
103 vtn_app = 'org.opencord.vtn'
104 table_app = 'org.ciena.cordigmp'
105 aaa_loaded = False
106 table_app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-multitable-2.0-SNAPSHOT.oar')
107 app_file = os.path.join(test_path, '..', 'apps/ciena-cordigmp-2.0-SNAPSHOT.oar')
108 olt_app_file = os.path.join(test_path, '..', 'apps/olt-app-1.2-SNAPSHOT.oar')
109 olt_app_name = 'org.onosproject.olt'
110 onos_config_path = os.path.join(test_path, '..', 'setup/onos-config')
111 cpqd_path = os.path.join(test_path, '..', 'setup')
112 ovs_path = cpqd_path
113 test_services = ('IGMP', 'TRAFFIC')
114 num_joins = 0
115 num_subscribers = 0
116 leave_flag = True
117 num_channels = 0
118 recv_timeout = False
119 onos_restartable = bool(int(os.getenv('ONOS_RESTART', 0)))
120 SUBSCRIBER_TIMEOUT = 300
121 device_id = 'of:' + get_mac()
122
123 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
124MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
125CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
126IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
127RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
128MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
129BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
130hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
131gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
132+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
133rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
134VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
135eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
1366tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
137PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
138nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
139-----END CERTIFICATE-----"""
140
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000141 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000142MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
143CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
144IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
145RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
146MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
147BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
148hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
149AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
1505An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
151tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
152OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
153qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
1542Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
155BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
156eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
157MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
158VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
159RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
160dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
161T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
162yg==
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000163-----END CERTIFICATE-----'''
164
Chetan Gaonker357f4892017-06-19 19:38:27 +0000165 @classmethod
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000166 def setUpCordApi(cls):
A R Karthick037cb982017-07-07 17:35:30 -0700167 num_subscribers = max(cls.NUM_SUBSCRIBERS, 10)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000168 cls.cord_subscriber = CordSubscriberUtils(num_subscribers,
169 account_num = cls.SUBSCRIBER_ACCOUNT_NUM,
170 s_tag = cls.SUBSCRIBER_S_TAG,
171 c_tag = cls.SUBSCRIBER_C_TAG,
172 subscribers_per_s_tag = cls.SUBSCRIBERS_PER_S_TAG)
173 cls.restApiXos = XosUtils.getRestApi()
174
175 @classmethod
176 def setUpClass(cls):
177 log.info('in setUp class 00000000000000')
178 cls.controllers = get_controllers()
179 cls.controller = cls.controllers[0]
180 cls.cli = None
181 cls.on_pod = running_on_pod()
182 cls.on_ciab = running_on_ciab()
183 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
184 cls.vcpes = cls.olt.get_vcpes()
185 cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp')
186 cls.vcpes_reserved = cls.olt.get_vcpes_by_type('reserved')
187 cls.dhcp_vcpes_reserved = [ 'vcpe{}.{}.{}'.format(i, cls.vcpes_reserved[i]['s_tag'], cls.vcpes_reserved[i]['c_tag'])
188 for i in xrange(len(cls.vcpes_reserved)) ]
189 cls.untagged_dhcp_vcpes_reserved = [ 'vcpe{}'.format(i) for i in xrange(len(cls.vcpes_reserved)) ]
190 cls.container_vcpes_reserved = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_reserved ]
191 vcpe_dhcp_reserved = None
192 vcpe_container_reserved = None
193 if cls.vcpes_reserved:
194 vcpe_dhcp_reserved = cls.dhcp_vcpes_reserved[0]
195 if cls.on_pod is False:
196 vcpe_dhcp_reserved = cls.untagged_dhcp_vcpes_reserved[0]
197 vcpe_container_reserved = cls.container_vcpes_reserved[0]
198
199 cls.vcpe_dhcp_reserved = vcpe_dhcp_reserved
200 cls.vcpe_container_reserved = vcpe_container_reserved
201 dhcp_vcpe_offset = len(cls.vcpes_reserved)
202 cls.dhcp_vcpes = [ 'vcpe{}.{}.{}'.format(i+dhcp_vcpe_offset, cls.vcpes_dhcp[i]['s_tag'], cls.vcpes_dhcp[i]['c_tag'])
203 for i in xrange(len(cls.vcpes_dhcp)) ]
204 cls.untagged_dhcp_vcpes = [ 'vcpe{}'.format(i+dhcp_vcpe_offset) for i in xrange(len(cls.vcpes_dhcp)) ]
205 cls.container_vcpes = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_dhcp ]
206 vcpe_dhcp = None
207 vcpe_container = None
208 #cache the first dhcp vcpe in the class for quick testing
209 if cls.vcpes_dhcp:
210 vcpe_container = cls.container_vcpes[0]
211 vcpe_dhcp = cls.dhcp_vcpes[0]
212 if cls.on_pod is False:
213 vcpe_dhcp = cls.untagged_dhcp_vcpes[0]
214 cls.vcpe_container = vcpe_container_reserved or vcpe_container
215 cls.vcpe_dhcp = vcpe_dhcp_reserved or vcpe_dhcp
216 VSGAccess.setUp()
217 cls.setUpCordApi()
218 if cls.on_pod is True:
219 cls.openVCPEAccess(cls.cord_subscriber.volt_subscriber_info)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000220
221 @classmethod
222 def tearDownClass(cls):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000223 VSGAccess.tearDown()
224 if cls.on_pod is True:
225 cls.closeVCPEAccess(cls.cord_subscriber.volt_subscriber_info)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000226
227 def log_set(self, level = None, app = 'org.onosproject'):
228 CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000229######################## vsg - vcpe utility functions #########################
230 @classmethod
231 def closeVCPEAccess(cls, volt_subscriber_info):
232 OnosCtrl.uninstall_app(cls.APP_NAME, onos_ip = cls.HEAD_NODE)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000233
234 @classmethod
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000235 def openVCPEAccess(cls, volt_subscriber_info):
236 """
237 This code is used to configure leaf switch for head node access to compute node over fabric.
238 Care is to be taken to avoid overwriting existing/default vcpe flows.
239 The access is opened for generated subscriber info which should not overlap.
240 We target the fabric onos instance on head node.
241 """
242 version = Onos.getVersion(onos_ip = cls.HEAD_NODE)
243 app_version = '1.0-SNAPSHOT'
244 major = int(version.split('.')[0])
245 minor = int(version.split('.')[1])
246 if major > 1:
247 app_version = '2.0-SNAPSHOT'
248 elif major == 1 and minor > 10:
249 app_version = '2.0-SNAPSHOT'
250 cls.APP_FILE = os.path.join(cls.test_path, '..', 'apps/xconnect-{}.oar'.format(app_version))
251 OnosCtrl.install_app(cls.APP_FILE, onos_ip = cls.HEAD_NODE)
252 time.sleep(2)
253 s_tags = map(lambda tenant: int(tenant['voltTenant']['s_tag']), volt_subscriber_info)
254 #only get unique vlan tags
255 s_tags = list(set(s_tags))
256 devices = OnosCtrl.get_device_ids(controller = cls.HEAD_NODE)
257 if devices:
258 device_config = {}
259 for device in devices:
260 device_config[device] = []
261 for s_tag in s_tags:
262 xconnect_config = {'vlan': s_tag, 'ports' : [ cls.FABRIC_PORT_HEAD_NODE, cls.FABRIC_PORT_COMPUTE_NODE ] }
263 device_config[device].append(xconnect_config)
264
265 cfg = { 'apps' : { 'org.ciena.xconnect' : { 'xconnectTestConfig' : device_config } } }
266 OnosCtrl.config(cfg, controller = cls.HEAD_NODE)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000267
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000268 def get_system_cpu_usage(self):
269 """ Getting compute node CPU usage """
270 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
271 cmd = "top -b -n1 | grep 'Cpu(s)' | awk '{print $2 + $4}'"
272 status, output = ssh_agent.run_cmd(cmd)
273 assert_equal(status, True)
274 return float(output)
275
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000276 def vsg_for_external_connectivity(self, subscriber_index, reserved = False):
277 if reserved is True:
278 if self.on_pod is True:
279 vcpe = self.dhcp_vcpes_reserved[subscriber_index]
280 else:
281 vcpe = self.untagged_dhcp_vcpes_reserved[subscriber_index]
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000282 else:
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000283 if self.on_pod is True:
284 vcpe = self.dhcp_vcpes[subscriber_index]
285 else:
286 vcpe = self.untagged_dhcp_vcpes[subscriber_index]
287 mgmt = 'eth0'
288 host = '8.8.8.8'
289 self.success = False
290 assert_not_equal(vcpe, None)
291 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
292 assert_not_equal(vcpe_ip, None)
293 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
294 log.info('Sending icmp echo requests to external network 8.8.8.8')
295 st, _ = getstatusoutput('ping -c 3 8.8.8.8')
296 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
297 assert_equal(st, 0)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000298
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000299 def vsg_xos_subscriber_create(self, index, subscriber_info = None, volt_subscriber_info = None):
300 if self.on_pod is False:
301 return ''
302 if subscriber_info is None:
303 subscriber_info = self.cord_subscriber.subscriber_info[index]
304 if volt_subscriber_info is None:
305 volt_subscriber_info = self.cord_subscriber.volt_subscriber_info[index]
306 s_tag = int(volt_subscriber_info['voltTenant']['s_tag'])
307 c_tag = int(volt_subscriber_info['voltTenant']['c_tag'])
308 vcpe = 'vcpe-{}-{}'.format(s_tag, c_tag)
309 subId = self.cord_subscriber.subscriberCreate(index, subscriber_info, volt_subscriber_info)
310 if subId:
311 #if the vsg instance was already instantiated, then reduce delay
312 if c_tag % self.SUBSCRIBERS_PER_S_TAG == 0:
313 delay = 350
314 else:
315 delay = 90
316 log.info('Delaying %d seconds for the VCPE to be provisioned' %(delay))
317 time.sleep(delay)
318 #log.info('Testing for external connectivity to VCPE %s' %(vcpe))
319 #self.vsg_for_external_connectivity(index)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000320
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000321 return subId
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000322
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000323 def vsg_delete(self, num_subscribers):
324 if self.on_pod is False:
325 return
326 num_subscribers = min(num_subscribers, len(self.cord_subscriber.subscriber_info))
327 for index in xrange(num_subscribers):
328 subId = self.vsg_xos_subscriber_id(index)
329 if subId and subId != '0':
330 self.vsg_xos_subscriber_delete(index, subId = subId)
331
332 def vsg_xos_subscriber_delete(self, index, subId = '', voltId = '', subscriber_info = None, volt_subscriber_info = None):
333 if self.on_pod is False:
334 return
335 self.cord_subscriber.subscriberDelete(index, subId = subId, voltId = voltId,
336 subscriber_info = subscriber_info,
337 volt_subscriber_info = volt_subscriber_info)
338
339 def vsg_xos_subscriber_id(self, index):
340 if self.on_pod is False:
341 return ''
342 return self.cord_subscriber.subscriberId(index)
343
344 def vsg_xos_subscriber_create_reserved(self):
345 if self.on_pod is False:
346 return
347 tags_reserved = [ (int(vcpe['s_tag']), int(vcpe['c_tag'])) for vcpe in self.vcpes_reserved ]
348 volt_tenants = self.restApiXos.ApiGet('TENANT_VOLT')
349 subscribers = self.restApiXos.ApiGet('TENANT_SUBSCRIBER')
350 reserved_tenants = filter(lambda tenant: (int(tenant['s_tag']), int(tenant['c_tag'])) in tags_reserved, volt_tenants)
351 reserved_config = []
352 for tenant in reserved_tenants:
353 for subscriber in subscribers:
354 if int(subscriber['id']) == int(tenant['subscriber']):
355 volt_subscriber_info = {}
356 volt_subscriber_info['voltTenant'] = dict(s_tag = tenant['s_tag'],
357 c_tag = tenant['c_tag'],
358 subscriber = tenant['subscriber'])
359 volt_subscriber_info['volt_id'] = tenant['id']
360 volt_subscriber_info['account_num'] = subscriber['identity']['account_num']
361 reserved_config.append( (subscriber, volt_subscriber_info) )
362 break
363 else:
364 log.info('Subscriber not found for tenant %s, s_tag: %s, c_tag: %s' %(str(tenant['subscriber']),
365 str(tenant['s_tag']),
366 str(tenant['c_tag'])))
367
368 for subscriber_info, volt_subscriber_info in reserved_config:
369 self.vsg_xos_subscriber_delete(0,
370 subId = str(subscriber_info['id']),
371 voltId = str(volt_subscriber_info['volt_id']),
372 subscriber_info = subscriber_info,
373 volt_subscriber_info = volt_subscriber_info)
374 subId = self.vsg_xos_subscriber_create(0,
375 subscriber_info = subscriber_info,
376 volt_subscriber_info = volt_subscriber_info)
377 log.info('Created reserved subscriber %s' %(subId))
378
379 @deferred(1800)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000380 def test_scale_for_vsg_vm_creations(self):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000381 try:
382 df = defer.Deferred()
383 def scale_vsg_vms(df):
384 for index in xrange(len(self.cord_subscriber.subscriber_info)):
385 #check if the index exists
386 subId = self.vsg_xos_subscriber_id(index)
387 log.info('test_vsg_xos_subscriber_creation - subId is %s'%subId)
388 if subId and subId != '0':
389 self.vsg_xos_subscriber_delete(index, subId = subId)
390 subId = self.vsg_xos_subscriber_create(index)
391 log.info('Created Subscriber %s' %(subId))
392 df.callback(0)
393 reactor.callLater(0, scale_vsg_vms, df)
394 return df
395 finally:
396 pass
397 #self.vsg_delete(len(self.cord_subscriber.subscriber_info))
398 self.vsg_xos_subscriber_create_reserved
Chetan Gaonker357f4892017-06-19 19:38:27 +0000399
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000400 @deferred(1800)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000401 def test_scale_for_vcpe_creations(self):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000402 try:
403 df = defer.Deferred()
404 def scale_vcpe_instances(df):
405 for index in xrange(len(self.cord_subscriber.subscriber_info)):
406 #check if the index exists
407 subId = self.vsg_xos_subscriber_id(index)
408 log.info('test_vsg_xos_subscriber_creation')
409 if subId and subId != '0':
410 self.vsg_xos_subscriber_delete(index, subId = subId)
411 subId = self.vsg_xos_subscriber_create(index)
412 log.info('Created Subscriber %s' %(subId))
413 df.callback(0)
414 reactor.callLater(0, scale_vcpe_instances, df)
415 return df
416 except:
417 self.vsg_delete(len(self.cord_subscriber.subscriber_info))
418 self.vsg_xos_subscriber_create_reserved
Chetan Gaonker357f4892017-06-19 19:38:27 +0000419
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000420 @deferred(1800)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000421 def test_scale_of_subcriber_vcpe_creations_in_single_vsg_vm(self):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000422 try:
423 df = defer.Deferred()
424 def scale_vcpe_instances(df):
425 subId = self.vsg_xos_subscriber_create(100)
426 if subId and subId != '0':
427 self.vsg_xos_subscriber_delete(100, subId)
428 df.callback(0)
429 reactor.callLater(0, scale_vsg_vms, df)
430 return df
431 except:
432 self.vsg_delete(len(self.cord_subscriber.subscriber_info))
433 self.vsg_xos_subscriber_create_reserved
Chetan Gaonker357f4892017-06-19 19:38:27 +0000434
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000435 @deferred(1800)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000436 def test_scale_of_subcriber_vcpe_creations_in_multiple_vsg_vm(self):
A R Karthick037cb982017-07-07 17:35:30 -0700437 try:
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000438 df = defer.Deferred()
439 def scale_vcpe_instances(df):
440 subId = self.vsg_xos_subscriber_create(100)
441 if subId and subId != '0':
442 self.vsg_xos_subscriber_delete(100, subId)
443 df.callback(0)
444 reactor.callLater(0, scale_vsg_vms, df)
445 return df
446 except:
447 self.vsg_delete(len(self.cord_subscriber.subscriber_info))
448 self.vsg_xos_subscriber_create_reserved
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000449
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000450 @deferred(1800)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000451 def test_scale_of_subcriber_vcpe_creations_with_one_vcpe_in_one_vsg_vm(self):
A R Karthick037cb982017-07-07 17:35:30 -0700452 try:
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000453 df = defer.Deferred()
454 def scale_vcpe_instances(df):
455 subId = self.vsg_xos_subscriber_create(100)
456 if subId and subId != '0':
457 self.vsg_xos_subscriber_delete(100, subId)
458 df.callback(0)
459 reactor.callLater(0, scale_vsg_vms, df)
460 return df
461 except:
462 self.vsg_delete(len(self.cord_subscriber.subscriber_info))
463 self.vsg_xos_subscriber_create_reserved
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000464
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000465 @deferred(1800)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000466 def test_scale_for_cord_subscriber_creation_and_deletion(self):
A R Karthick037cb982017-07-07 17:35:30 -0700467 try:
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000468 df = defer.Deferred()
469 def scale_vcpe_instances(df):
470 subId = self.vsg_xos_subscriber_create(100)
471 if subId and subId != '0':
472 self.vsg_xos_subscriber_delete(100, subId)
473 df.callback(0)
474 reactor.callLater(0, scale_vsg_vms, df)
475 return df
476 except:
477 self.vsg_delete(len(self.cord_subscriber.subscriber_info))
478 self.vsg_xos_subscriber_create_reserved
Chetan Gaonker357f4892017-06-19 19:38:27 +0000479
480 def test_cord_for_scale_of_subscriber_containers_per_compute_node(self):
481 pass
482
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000483 @deferred(10)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000484 def test_latency_of_cord_for_control_packets_using_icmp_packet(self):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000485 df = defer.Deferred()
486 def scale_vcpe_instances(df):
487 cmd = "ping -c 4 {0} | tail -1| awk '{{print $4}}'".format(self.wan_intf_ip)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000488 st, out = getstatusoutput(cmd)
489 if out != '':
490 out = out.split('/')
491 avg_rtt = out[1]
492 latency = float(avg_rtt)/float(2)
493 else:
494 latency = None
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000495 log.info('CORD setup latency calculated from icmp packet is = %s ms'%latency)
496 assert_not_equal(latency,None)
497 df.callback(0)
498 reactor.callLater(0, scale_vsg_vms, df)
499 return df
500
501 @deferred(20)
502 def test_latency_of_cord_for_control_packets_using_increasing_sizes_of_icmp_packet(self):
503 df = defer.Deferred()
504 def scale_vcpe_instances(df):
505 pckt_sizes = [100,500,1000,1500]
506 for size in pckt_sizes:
507 cmd = "ping -c 4 -s {} {} | tail -1| awk '{{print $4}}'".format(size,self.wan_intf_ip)
508 st, out = getstatusoutput(cmd)
509 if out != '':
510 out = out.split('/')
511 avg_rtt = out[1]
512 latency = float(avg_rtt)/float(2)
513 else:
514 latency = None
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000515 log.info('CORD setup latency calculated from icmp packet with size %s bytes is = %s ms'%(size,latency))
516 assert_not_equal(latency,None)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000517 df.callback(0)
518 reactor.callLater(0, scale_vsg_vms, df)
519 return df
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000520
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000521 @deferred(10)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000522 def test_latency_of_cord_with_traceroute(self):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000523 df = defer.Deferred()
524 def scale_vcpe_instances(df):
525 cmd = "traceroute -q1 {} | tail -1| awk '{{print $4}}'".format(self.wan_intf_ip)
526 avg_rtt = float(0)
527 latency = None
528 for index in [1,2,3]:
529 st, out = getstatusoutput(cmd)
530 if out != '':
531 avg_rtt += float(out)
532 latency = float(avg_rtt)/float(6)
533 log.info('CORD setup latency calculated from traceroute is = %s ms'%latency)
534 assert_not_equal(latency,0.0)
535 assert_not_equal(latency,None)
536 df.callback(0)
537 reactor.callLater(0, scale_vsg_vms, df)
538 return df
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000539
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000540 #tested with 50 igmp joins on CiaB setup
541 @deferred(1000)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000542 def test_scale_with_igmp_joins_for_500_multicast_groups_and_check_cpu_usage(self, group_count=500):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000543 df = defer.Deferred()
544 def scale_igmp_joins(df):
545 OnosCtrl(self.igmp_app).activate()
546 groups = scale().generate_random_multicast_ip_addresses(count = group_count)
547 sources = scale().generate_random_unicast_ip_addresses(count = group_count)
548 scale().onos_ssm_table_load(groups,src_list=sources,flag=True)
549 try:
550 for index in range(group_count):
551 scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000552 iface = self.V_INF1)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000553 status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
554 assert_equal(status, True)
555 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
556 except Exception as error:
557 log.info('Got unexpected error %s'%error)
558 raise
559 df.callback(0)
560 reactor.callLater(0, scale_igmp_joins, df)
561 return df
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000562
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000563 #tested with 50 igmp joins on CiaB setup
564 @deferred(1000)
565 def test_scale_with_igmp_joins_for_1000_multicast_groups_and_igmp_app_toggle(self, group_count=1000):
566 df = defer.Deferred()
567 def scale_igmp_joins(df):
568 OnosCtrl(self.igmp_app).activate()
569 groups = scale().generate_random_multicast_ip_addresses(count = group_count)
570 sources = scale().generate_random_unicast_ip_addresses(count = group_count)
571 scale().onos_ssm_table_load(groups,src_list=sources,flag=True)
572 try:
573 for index in range(group_count):
574 scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000575 iface = self.V_INF1)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000576 status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
577 assert_equal(status, True)
578 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
579 log_test.info('Deactivating igmp app in onos')
580 OnosCtrl(self.igmp_app).deactivate()
581 time.sleep(2)
582 for index in range(group_count):
583 status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
584 assert_equal(status, False)
585 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
586 OnosCtrl(self.igmp_app).ctivate()
587 except Exception as error:
588 log.info('Got unexpected error %s'%error)
589 OnosCtrl(self.igmp_app).activate()
590 raise
591 df.callback(0)
592 reactor.callLater(0, scale_igmp_joins, df)
593 return df
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000594
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000595 #tested with 50 igmp joins on CiaB setup
596 @deferred(1800)
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000597 def test_scale_with_igmp_joins_for_2000_multicast_groups_and_check_cpu_usage(self, group_count=2000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000598 df = defer.Deferred()
599 def scale_igmp_joins(df):
600 OnosCtrl(self.igmp_app).activate()
601 groups = scale().generate_random_multicast_ip_addresses(count = group_count)
602 sources = scale().generate_random_unicast_ip_addresses(count = group_count)
603 scale().onos_ssm_table_load(groups,src_list=sources,flag=True)
604 try:
605 for index in range(group_count):
606 scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000607 iface = self.V_INF1)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000608 status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
609 assert_equal(status, True)
610 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
611 if index % 50 == 0:
612 cpu_usage = scale().get_system_cpu_usage()
613 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
614 except Exception as error:
615 log.info('Got unexpected error %s'%error)
616 raise
617 df.callback(0)
618 reactor.callLater(0, scale_igmp_joins, df)
619 return df
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000620
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000621 #tested with 50 igmp joins on CiaB setup
622 @deferred(1000)
623 def test_scale_of_igmp_joins_for_2000_multicast_groups_and_check_cpu_usage_after_app_deactivation_and_activation(self,group_count=2000):
624 df = defer.Deferred()
625 def scale_igmp_joins(df):
626 cpu_usage1 = scale().get_system_cpu_usage()
627 OnosCtrl(self.igmp_app).activate()
628 groups = scale().generate_random_multicast_ip_addresses(count = group_count)
629 sources = scale().generate_random_unicast_ip_addresses(count = group_count)
630 scale().onos_ssm_table_load(groups,src_list=sources,flag=True)
631 try:
632 for index in range(group_count):
633 scale().send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000634 iface = self.V_INF1)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000635 status = scale().verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
636 assert_equal(status, True)
637 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
638 if index % 50 == 0:
639 cpu_usage = self.get_system_cpu_usage()
640 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
641 cpu_usage2 = scale().get_system_cpu_usage()
642 OnosCtrl(self.igmp_app).deactivate()
643 time.sleep(2)
644 cpu_usage3 = scale().get_system_cpu_usage()
645 log.info('CPU usage before test start = %f after %d igmp entries registered in onos = %f and after the app deactivated = %f are'%(cpu_usage1,cpu_usage2,cpu_usage3))
646 except Exception as error:
647 log.info('Got unexpected error %s'%error)
648 raise
649 df.callback(0)
650 reactor.callLater(0, scale_igmp_joins, df)
651 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000652
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000653 #tested with 100 flow entries on CiaB setup
654 @deferred(1000)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000655 def test_scale_adding_1k_flow_entries_in_onos_with_dynamic_tcp_ports(self,count=1000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000656 scale().flows_setup()
657 df = defer.Deferred()
658 def scale_flow_entries(df):
659 egress = 1
660 ingress = 2
661 egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1', 'tcp_port': random.randint(1024,65535) }
662 ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1', 'tcp_port': random.randint(1024,65535) }
663 try:
664 for index in range(0,count):
665 ingress_map['tcp_port'] = random.randint(1024,65535)
666 egress_map['tcp_port'] = random.randint(1024,65535)
667 src_port = ingress_map['tcp_port']
668 egr_port = egress_map['tcp_port']
669 #log.info('ingress port is %d and egress port is %d'%(src_port,egr_port))
670 flow = OnosFlowCtrl(deviceId = self.device_id,
671 egressPort = egress + scale().port_offset,
672 ingressPort = ingress + scale().port_offset,
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000673 tcpSrc = ingress_map['tcp_port'],
674 tcpDst = egress_map['tcp_port']
675 )
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000676 result = flow.addFlow()
677 assert_equal(result, True)
678 log_test.info("flow number = %d is added",index+1)
679 def mac_recv_task():
680 def recv_cb(pkt):
681 log_test.info('Pkt seen with ingress TCP port %s, egress TCP port %s' %(pkt[TCP].sport, pkt[TCP].dport))
682 result = True
683 sniff(count=2, timeout=5,
684 lfilter = lambda p: TCP in p and p[TCP].dport == egr_port and p[TCP].sport == src_port ,prn = recv_cb, iface = scale().port_map[egress])
685 t = threading.Thread(target = mac_recv_task)
686 t.start()
687 L2 = Ether(src = ingress_map['ether'], dst = egress_map['ether'])
688 L3 = IP(src = ingress_map['ip'], dst = egress_map['ip'])
689 L4 = TCP(sport = src_port, dport = egr_port)
690 pkt = L2/L3/L4
691 log_test.info('Sending packets to verify if flows are correct')
692 sendp(pkt, count=50, iface = scale().port_map[ingress])
693 t.join()
694 except Exception as error:
695 log.info('Got unexpected error %s'%error)
696 raise
697 df.callback(0)
698 reactor.callLater(0,scale_flow_entries, df)
699 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000700
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000701 #tested with 100 flow entries on CiaB setup
702 @deferred(1000)
703 def test_scale_adding_5k_ip_flow_entries_in_onos_and_checking_cpu_usage(self,count=5000):
704 scale().flows_setup()
705 df = defer.Deferred()
706 def scale_flow_entries(df):
707 cpu_usage1 = scale().get_system_cpu_usage()
708 egress = 1
709 ingress = 2
710 egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '182.0.0.0' }
711 ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.0.0.0' }
712 try:
713 for index in range(0,count):
714 ingress_map['ip'] = scale().generate_random_unicast_ip_addresses()[0] #next_ip(ingress_map['ip'])
715 assert_not_equal(ingress_map['ip'], None)
716 egress_map['ip'] = scale().generate_random_unicast_ip_addresses()[0] #to_egress_ip(ingress_map['ip'])
717 flow = OnosFlowCtrl(deviceId = self.device_id,
718 egressPort = egress + scale().port_offset,
719 ingressPort = ingress + scale().port_offset,
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000720 ethType = '0x0800',
721 ipSrc = ('IPV4_SRC', ingress_map['ip']+'/8'),
722 ipDst = ('IPV4_DST', egress_map['ip']+'/8')
723 )
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000724 if index % 50 == 0:
725 cpu_usage = scale().get_system_cpu_usage()
726 log.info('CPU usage is %s for flow number %d added'%(cpu_usage,index+1))
727 time.sleep(1)
728 def mac_recv_task():
729 def recv_cb(pkt):
730 log_test.info('Pkt seen with ingress source IP %s, destination IP %s' %(pkt[IP].src, pkt[IP].dst))
731 result = True
732 sniff(count=2, timeout=5,
733 lfilter = lambda p: IP in p and p[IP].dst == egress_map['ip'] and p[IP].src == ingress_map['ip'] ,prn = recv_cb, iface = scale().port_map[egress])
734 t = threading.Thread(target = mac_recv_task)
735 t.start()
736 L2 = Ether(src = ingress_map['ether'], dst = egress_map['ether'])
737 L3 = IP(src = ingress_map['ip'], dst = egress_map['ip'])
738 pkt = L2/L3
739 log_test.info('Sending packets to verify if flows are correct')
740 sendp(pkt, count=50, iface = scale().port_map[ingress])
741 t.join()
742 cpu_usage2 = scale().get_system_cpu_usage()
743 log.info('system cpu usage before flows added = %f and after %d flows added = %f'%(cpu_usage1,count,cpu_usage2))
744 except Exception as error:
745 log.info('Got unexpected error %s'%error)
746 raise
747 df.callback(0)
748 reactor.callLater(0, scale_flow_entries, df)
749 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000750
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000751 #tested with 100 flow entries on CiaB setup
752 @deferred(1000)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000753 def test_scale_adding_10k_flow_entries_in_onos_with_dynamic_udp_ports(self,count=10000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000754 scale().flows_setup()
755 df = defer.Deferred()
756 def scale_flow_entries(df):
757 egress = 1
758 ingress = 2
759 egress_map = { 'ether': '00:00:00:00:00:03', 'ip': '192.168.30.1', 'udp_port': random.randint(1024,65535) }
760 ingress_map = { 'ether': '00:00:00:00:00:04', 'ip': '192.168.40.1', 'udp_port': random.randint(1024,65535) }
761 try:
762 for index in range(0,count):
763 ingress_map['udp_port'] = random.randint(1024,65535)
764 egress_map['udp_port'] = random.randint(1024,65535)
765 src_port = ingress_map['udp_port']
766 egr_port = egress_map['udp_port']
767 #log.info('ingress port is %d and egress port is %d'%(src_port,egr_port))
768 flow = OnosFlowCtrl(deviceId = self.device_id,
769 egressPort = egress + scale().port_offset,
770 ingressPort = ingress + scale().port_offset,
771 udpSrc = ingress_map['udp_port'],
772 udpDst = egress_map['udp_port']
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000773 )
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000774 result = flow.addFlow()
775 assert_equal(result, True)
776 log_test.info("flow number = %d is added",index+1)
777 def mac_recv_task():
778 def recv_cb(pkt):
779 log_test.info('Pkt seen with ingress UDP port %s, egress UDP port %s' %(pkt[UDP].sport, pkt[UDP].dport))
780 result = True
781 sniff(count=2, timeout=5,
782 lfilter = lambda p: UDP in p and p[UDP].dport == egr_port and p[UDP].sport == src_port ,prn = recv_cb, iface = scale().port_map[egress])
783 t = threading.Thread(target = mac_recv_task)
784 t.start()
785 L2 = Ether(src = ingress_map['ether'], dst = egress_map['ether'])
786 L3 = IP(src = ingress_map['ip'], dst = egress_map['ip'])
787 L4 = UDP(sport = src_port, dport = egr_port)
788 pkt = L2/L3/L4
789 log_test.info('Sending packets to verify if flows are correct')
790 sendp(pkt, count=50, iface = scale().port_map[ingress])
791 t.join()
792 except Exception as error:
793 log.info('Got unexpected error %s'%error)
794 raise
795 df.callback(0)
796 reactor.callLater(0,scale_flow_entries, df)
797 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000798
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000799 #tested with 100 flow entries on CiaB setup
800 @deferred(1000)
801 def test_scale_adding_10k_constant_destination_mac_flow_entries_in_onos_and_check_cpu_usage(self,count=100):
802 scale().flows_setup()
803 df = defer.Deferred()
804 def scale_flow_entries(df):
805 cpu_usage1 = self.get_system_cpu_usage()
806 egress = 1
807 ingress = 2
808 egress_mac = '02:00:00:00:0:0'
809 ingress_mac = '03:00:00:00:00:00'
810 try:
811 for index in range(0,count):
812 result = False
813 ingress_mac = scale().next_mac(ingress_mac)
814 flow = OnosFlowCtrl(deviceId = self.device_id,
815 egressPort = egress + scale().port_offset,
816 ingressPort = ingress + scale().port_offset,
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000817 ethSrc = ingress_mac,
818 ethDst = egress_mac)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000819 result = flow.addFlow()
820 assert_equal(result, True)
821 log.info("flow number = %d is added",index+1)
822 if index % 100 == 0:
823 cpu_usage = scale().get_system_cpu_usage()
824 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
825 time.sleep(1)
826 def mac_recv_task():
827 def recv_cb(pkt):
828 log_test.info('Pkt seen with ingress mac %s, egress mac %s' %(pkt.src , pkt.dst))
829 result = True
830 sniff(count=2, timeout=5,
831 lfilter = lambda p: p.src == ingress_mac and p.dst == egress_mac ,prn = recv_cb, iface = scale().port_map[egress])
832 t = threading.Thread(target = mac_recv_task)
833 t.start()
834 L2 = Ether(src = ingress_mac, dst = egress_mac)
835 pkt = L2/IP()
836 log_test.info('Sending packets to verify if flows are correct')
837 sendp(pkt, count=50, iface = scale().port_map[ingress])
838 t.join()
839 assert_equal(result, True)
840 cpu_usage2 = self.get_system_cpu_usage()
841 log.info('system cpu usage before flows added = %f and after %d flows added = %f'%(cpu_usage1,count,cpu_usage2))
842 except Exception as error:
843 log.info('Got unexpected error %s'%error)
844 raise
845 df.callback(0)
846 reactor.callLater(0,scale_flow_entries, df)
847 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000848
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000849
850 @deferred(1000)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000851 def test_scale_adding_10k_acl_rules_to_deny_matching_destination_tcp_port_traffic(self,count=10000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000852 df = defer.Deferred()
853 def scale_vcpe_instances(df):
854 cpu_usage1 = self.get_system_cpu_usage()
855 acl_rule = ACLTest()
856 for index in range(0,count):
857 src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
858 dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
859 dst_port = random.randint(1024,65535)
860 log.info('adding acl rule = %d with src ip = %s, dst ip = %s and dst tcp port = %d'%(index+1, src_ip,dst_ip,dst_port))
861 status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip, ipProto ='TCP', dstTpPort =dst_port, action = 'deny')
862 assert_equal(status, True)
863 if index % 100 == 0:
864 cpu_usage = self.get_system_cpu_usage()
865 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
866 time.sleep(1)
867 cpu_usage2 = self.get_system_cpu_usage()
868 log.info('system cpu usage before flows added = %f and after %d flows added = %f'%(cpu_usage1,count,cpu_usage2))
869 df.callback(0)
870 reactor.callLater(0, scale_vsg_vms, df)
871 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000872
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000873 @deferred(1000)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000874 def test_scale_adding_and_deleting_10k_acl_rules_to_allow_src_and_dst_ip_matching_traffic_check_cpu_usage(self,count=10000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000875 df = defer.Deferred()
876 def scale_vcpe_instances(df):
877 cpu_usage1 = self.get_system_cpu_usage()
878 acl_rule = ACLTest()
879 for index in range(0,count):
880 src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
881 dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
882 dst_port = random.randint(1024,65535)
883 log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip))
884 status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'allow')
885 assert_equal(status, True)
886 if index % 100 == 0:
887 cpu_usage = self.get_system_cpu_usage()
888 log.info('CPU usage is %s for acl rule number %s'%(cpu_usage,index+1))
889 time.sleep(1)
890 cpu_usage2 = self.get_system_cpu_usage()
891 result = acl_rule.get_acl_rules()
892 result = result.json()['aclRules']
893 for acl in result:
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000894 acl_rule.remove_acl_rule(acl['id'])
895 #log.info('acl is %s'%acl)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000896 cpu_usage3 = self.get_system_cpu_usage()
897 log.info('system cpu usage before flows added = %f and after %d flows added = %f, after deleting all acl rules = %f'%(cpu_usage1,count,cpu_usage2,cpu_usage3))
898 df.callback(0)
899 reactor.callLater(0, scale_vsg_vms, df)
900 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000901
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000902 @deferred(1000)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000903 def test_scale_adding_20k_acl_rules_to_allow_src_and_dst_ip_matching_traffic_and_deactivate_acl_app_checking_cpu_usage(self,count=20000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000904 df = defer.Deferred()
905 def scale_vcpe_instances(df):
906 cpu_usage1 = self.get_system_cpu_usage()
907 acl_rule = ACLTest()
908 for index in range(0,count):
909 src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
910 dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
911 dst_port = random.randint(1024,65535)
912 log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip))
913 status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'allow')
914 assert_equal(status, True)
915 if index % 200 == 0:
916 cpu_usage = self.get_system_cpu_usage()
917 log.info('CPU usage is %s for acl rule number %s'%(cpu_usage,index+1))
918 time.sleep(1)
919 cpu_usage2 = self.get_system_cpu_usage()
920 OnosCtrl(cls.acl_app).deactivate()
921 time.sleep(3)
922 cpu_usage3 = self.get_system_cpu_usage()
923 log.info('system cpu usage before flows added = %f, after %d flows added = %f, and after deactivating acl app = %f'%(cpu_usage1,count,cpu_usage2,cpu_usage3))
924 df.callback(0)
925 reactor.callLater(0, scale_vsg_vms, df)
926 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000927
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000928 @deferred(1000)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000929 def test_scale_adding_igmp_and_acl_with_flow_entries_and_check_cpu_usage(self,igmp_groups=1300, flows_count=10000):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000930 df = defer.Deferred()
931 def scale_vcpe_instances(df):
932 cpu_usage1 = self.get_system_cpu_usage()
933 egress = 1
934 ingress = 2
935 egress_mac = '00:00:00:00:01:01'
936 ingress_mac = '02:00:00:00:00:00'
937 acl_rule = ACLTest()
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000938 OnosCtrl(self.igmp_app).activate()
939 groups = self.generate_random_multicast_ip_addresses(count = igmp_groups)
940 sources = self.generate_random_unicast_ip_addresses(count = igmp_groups)
941 self.onos_ssm_table_load(groups,src_list=sources,flag=True)
942 for index in range(igmp_groups):
943 self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000944 iface = self.V_INF1)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000945 status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
946 assert_equal(status, True)
947 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000948 for index in range(flows_count):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000949 src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
950 dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
951 log.info('adding acl rule = %d with src ip = %s, dst ip = %s '%(index+1, src_ip,dst_ip))
952 status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip,action = 'allow')
953 assert_equal(status, True)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +0000954 ingress_mac = self.next_mac(ingress_mac)
955 flow = OnosFlowCtrl(deviceId = self.device_id,
956 egressPort = egress + self.port_offset,
957 ingressPort = ingress + self.port_offset,
958 ethSrc = ingress_mac,
959 ethDst = egress_mac)
960 result = flow.addFlow()
961 assert_equal(result, True)
962 log.info("flow number = %d is added",index+1)
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +0000963 if index % 200 == 0:
964 cpu_usage = self.get_system_cpu_usage()
965 log.info('CPU usage is %s for acl rule number %s'%(cpu_usage,index+1))
966 time.sleep(1)
967 cpu_usage2 = self.get_system_cpu_usage()
968 log.info('system cpu usage before flows added = %f, after %d flows added = %f'%(cpu_usage1,count,cpu_usage2))
969 df.callback(0)
970 reactor.callLater(0, scale_vsg_vms, df)
971 return df
972
973 @deferred(1000)
974 def test_scale_adding_igmp_acl_and_flow_entries_and_simultaneously_toggling_app_activation(self,igmp_groups=1300, flows_count=10000):
975 df = defer.Deferred()
976 def scale_vcpe_instances(df):
977 cpu_usage1 = self.get_system_cpu_usage()
978 def adding_igmp_entries():
979 OnosCtrl(self.igmp_app).activate()
980 groups = self.generate_random_multicast_ip_addresses(count = igmp_groups)
981 sources = self.generate_random_unicast_ip_addresses(count = igmp_groups)
982 self.onos_ssm_table_load(groups,src_list=sources,flag=True)
983 for index in range(igmp_groups):
984 self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
985 iface = self.V_INF1)
986 status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
987 assert_equal(status, True)
988 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
989 def adding_flow_entries():
990 egress = 1
991 ingress = 2
992 egress_mac = '00:00:00:00:01:01'
993 ingress_mac = '02:00:00:00:00:00'
994 for index in range(flows_count):
995 ingress_mac = self.next_mac(ingress_mac)
996 flow = OnosFlowCtrl(deviceId = self.device_id,
997 egressPort = egress + self.port_offset,
998 ingressPort = ingress + self.port_offset,
999 ethSrc = ingress_mac,
1000 ethDst = egress_mac)
1001 result = flow.addFlow()
1002 assert_equal(result, True)
1003 log.info("flow number = %d is added",index+1)
1004 def adding_acl_entries():
1005 OnosCtrl(self.acl_app).activate()
1006 for index in range(flows_count):
1007 src_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
1008 dst_ip = self.generate_random_unicast_ip_addresses(count=1)[0]+'/32'
1009 dst_port = random.randint(1024,65535)
1010 log.info('adding acl rule = %d with src ip = %s, dst ip = %s and dst tcp port = %d'%(index+1, src_ip,dst_ip,dst_port))
1011 status,code = acl_rule.adding_acl_rule('v4', srcIp=src_ip, dstIp = dst_ip, ipProto ='TCP', dstTpPort =dst_port, action = 'deny')
1012 assert_equal(status, True)
1013 igmp_thread = threading.Thread(target = adding_igmp_entries)
1014 flows_thread = threading.Thread(target = adding_flow_entries)
1015 acl_thread = threading.Thread(target = adding_acl_entries)
1016 igmp_thread.start()
1017 flows_thread.start()
1018 acl_thread.start()
1019 time.sleep(1)
1020 igmp_thread.join()
1021 flows_thread.join()
1022 acl_thread.join()
1023 cpu_usage2 = self.get_system_cpu_usage()
1024 OnosCtrl(self.igmp_app).deactivate()
1025 OnosCtrl(self.acl_app).deactivate()
1026 cpu_usage3 = self.get_system_cpu_usage()
1027 log.info('cpu usage before test start = %f, after igmp,flow and acl entries loaded = %f and after the apps deactivated = %f'%(cpu_usage1,cpu_usage2,cpu_usage3))
1028 OnosCtrl(self.igmp_app).activate()
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001029 OnosCtrl(self.acl_app).activate()
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001030 df.callback(0)
1031 reactor.callLater(0, scale_vsg_vms, df)
1032 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001033
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001034 @deferred(1000)
1035 def test_scale_for_vrouter_with_10_routes_with_10_peers(self):
1036 scale().vrouter_setup()
1037 df = defer.Deferred()
1038 def scale_vrouter_routes(df):
1039 try:
1040 res = scale().vrouter_network_verify(100, peers = 10)
1041 assert_equal(res, True)
1042 except Exception as error:
1043 log.info('Got Unexpected error %s'%error)
1044 raise
1045 df.callback(0)
1046 reactor.callLater(0, scale_vrouter_routes, df)
1047 return df
A R Karthick8f930292017-07-07 12:36:22 -07001048
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001049 #tested with 100 routes on CiaB
1050 @deferred(1000)
1051 def test_scale_for_vrouter_with_20000_routes_with_100_peers(self):
1052 scale().vrouter_setup()
1053 df = defer.Deferred()
1054 def scale_vrouter_routes(df):
1055 try:
1056 res = scale().vrouter_network_verify(10000, peers = 100)
1057 assert_equal(res, True)
1058 except Exception as error:
1059 log.info('Got Unexpected error %s'%error)
1060 raise
1061 df.callback(0)
1062 reactor.callLater(0, scale_vrouter_routes, df)
1063 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001064
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001065 #tested with 100 routes on CiaB
1066 @deferred(1500)
1067 def test_scale_for_vrouter_with_20000_routes_with_100_peers(self):
1068 scale().vrouter_setup()
1069 df = defer.Deferred()
1070 def scale_vrouter_routes(df):
1071 try:
1072 res = scale().vrouter_network_verify(20000, peers = 100)
1073 assert_equal(res, True)
1074 except Exception as error:
1075 log.info('Got Unexpected error %s'%error)
1076 raise
1077 df.callback(0)
1078 reactor.callLater(0, scale_vrouter_routes, df)
1079 return df
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001080
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001081 #tested with 100 subscribers on CiaB
1082 @deferred(1800)
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001083 def test_scale_of_eap_tls_with_5k_sessions_using_diff_mac(self):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001084 OnosCtrl('org.opencord.aaa').activate()
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001085 df = defer.Deferred()
1086 def eap_tls_5k_with_diff_mac(df):
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001087 try:
1088 for i in xrange(5000):
1089 tls = TLSAuthTest(src_mac = 'random')
1090 tls.runTest()
1091 log_test.info('Authentication successfull for user %d'%i)
1092 except Exception as error:
1093 log.info('Got Unexpected error %s'%error)
1094 raise
Anil Kumar Sanka8942c882017-07-07 17:05:11 +00001095 df.callback(0)
1096 reactor.callLater(0, eap_tls_5k_with_diff_mac, df)
1097 return df
Anil Kumar Sankafcb9a0f2017-07-22 00:24:35 +00001098
1099 #tested with 100 subscribers on CiaB
1100 @deferred(1800)
1101 def test_scale_of_eap_tls_with_5k_sessions_using_diff_mac_with_aaa_deactivate_and_activated(self):
1102 OnosCtrl('org.opencord.aaa').activate()
1103 df = defer.Deferred()
1104 def eap_tls_5k_with_diff_mac(df):
1105 try:
1106 for i in xrange(5000):
1107 tls = TLSAuthTest(src_mac = 'random')
1108 tls.runTest()
1109 log_test.info('Authentication successfull for user %d'%i)
1110 OnosCtrl('org.opencord.aaa').deactivate()
1111 time.sleep(2)
1112 OnosCtrl('org.opencord.aaa').activate()
1113 for i in xrange(100):
1114 tls = TLSAuthTest(src_mac = 'random')
1115 tls.runTest()
1116 log_test.info('Authentication successfull for user %d'%i)
1117 OnosCtrl('org.opencord.aaa').activate()
1118 except Exception as error:
1119 log.info('Got Unexpected error %s'%error)
1120 OnosCtrl('org.opencord.aaa').activate()
1121 raise
1122 df.callback(0)
1123 reactor.callLater(0, eap_tls_5k_with_diff_mac, df)
1124 return df
1125
1126 #tested with 10 subscribers on CiaB
1127 @deferred(1800)
1128 def test_scale_5k_cord_subscribers_authentication_with_valid_and_invalid_certificates_and_channel_surfing(self):
1129 scale().subscriber_setup()
1130 df = defer.Deferred()
1131 def cordsub_auth_invalid_cert(df):
1132 num_subscribers = 2
1133 num_channels = 1
1134 try:
1135 test_status = scale().subscriber_join_verify(num_subscribers = num_subscribers,
1136 num_channels = num_channels,
1137 cbs = (scale().tls_invalid_cert, scale().dhcp_verify, scale().igmp_verify),
1138 port_list = scale().generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'half')
1139 assert_equal(test_status, True)
1140 except Exception as error:
1141 log.info('Got Unexpected error %s'%error)
1142 raise
1143 finally:
1144 scale().subscriber_teardown()
1145 df.callback(0)
1146 reactor.callLater(0, cordsub_auth_invalid_cert, df)
1147 return df
1148
1149 #tested with 10 subscribers on CiaB
1150 @deferred(1800)
1151 def test_scale_5k_cord_subscribers_igmp_join_jump_1500channel(self):
1152 scale().subscriber_setup()
1153 df = defer.Deferred()
1154 def cordsub_igmp_join_jump(df):
1155 num_subscribers = 5000
1156 num_channels = 1500
1157 try:
1158 test_status = scale().subscriber_join_verify(num_subscribers = num_subscribers,
1159 num_channels = num_channels,
1160 cbs = (scale().tls_verify, scale().dhcp_jump_verify, scale().igmp_jump_verify),
1161 port_list = scale().generate_port_list(num_subscribers, num_channels),
1162 negative_subscriber_auth = 'all')
1163 assert_equal(test_status, True)
1164 except Exception as error:
1165 log.info('Got Unexpected error %s'%error)
1166 raise
1167 finally:
1168 scale().subscriber_teardown()
1169 df.callback(0)
1170 reactor.callLater(0, cordsub_igmp_join_jump, df)
1171 return df
1172
1173 #tested with 10 subscribers on CiaB
1174 @deferred(1800)
1175 def test_scale_10k_cord_subscribers_authentication_with_valid_and_non_ca_authorized_certificates_and_channel_surfing(self):
1176 scale().subscriber_setup()
1177 df = defer.Deferred()
1178 def cordsub_auth_valid_cert(df):
1179 num_subscribers = 10000
1180 num_channels = 1
1181 try:
1182 test_status = scale().subscriber_join_verify(num_subscribers = num_subscribers,
1183 num_channels = num_channels,
1184 cbs = (scale().tls_non_ca_authrized_cert, scale().dhcp_verify, scale().igmp_verify),
1185 port_list = scale().generate_port_list(num_subscribers, num_channels),
1186 negative_subscriber_auth = 'onethird')
1187 assert_equal(test_status, True)
1188 except Exception as error:
1189 log.info('Got Unexpected error %s'%error)
1190 raise
1191 finally:
1192 scale().subscriber_teardown()
1193 df.callback(0)
1194 reactor.callLater(0, cordsub_auth_valid_cert, df)
1195 return df