blob: 1cd491fd1f7ab633b3a64a93d97fb9c63682cf51 [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 Sanka12a5ec52017-06-29 18:41:51 +000029from Channels import IgmpChannel
30from IGMP import *
Chetan Gaonker357f4892017-06-19 19:38:27 +000031from CordLogger import CordLogger
32from VSGAccess import VSGAccess
33from CordTestUtils import log_test as log
34from CordTestConfig import setup_module, running_on_ciab
35from OnosCtrl import OnosCtrl
36from CordContainer import Onos
A R Karthicked3a2ca2017-07-06 15:50:03 -070037from CordSubscriberUtils import CordSubscriberUtils, XosUtils
Chetan Gaonker357f4892017-06-19 19:38:27 +000038log.setLevel('INFO')
39
40class scale_exchange(CordLogger):
41 HOST = "10.1.0.1"
42 USER = "vagrant"
43 PASS = "vagrant"
44 head_node = os.getenv('HEAD_NODE', 'prod')
45 HEAD_NODE = head_node + '.cord.lab' if len(head_node.split('.')) == 1 else head_node
46 test_path = os.path.dirname(os.path.realpath(__file__))
47 olt_conf_file = os.getenv('OLT_CONFIG_FILE', os.path.join(test_path, '..', 'setup/olt_config.json'))
48 restApiXos = None
A R Karthicked3a2ca2017-07-06 15:50:03 -070049 cord_subscriber = None
50 SUBSCRIBER_ACCOUNT_NUM = 100
51 SUBSCRIBER_S_TAG = 500
52 SUBSCRIBER_C_TAG = 500
53 SUBSCRIBERS_PER_S_TAG = 8
Chetan Gaonker357f4892017-06-19 19:38:27 +000054 subscriber_info = []
55 volt_subscriber_info = []
56 restore_methods = []
57 TIMEOUT=120
58 NUM_SUBSCRIBERS = 100
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +000059 wan_intf_ip = '10.6.1.129'
60 V_INF1 = 'veth0'
61 V_INF2 = 'veth1'
62 MGROUP1 = '239.1.2.3'
63 MGROUP2 = '239.2.2.3'
64 MINVALIDGROUP1 = '255.255.255.255'
65 MINVALIDGROUP2 = '239.255.255.255'
66 MMACGROUP1 = "01:00:5e:01:02:03"
67 MMACGROUP2 = "01:00:5e:02:02:03"
68 IGMP_DST_MAC = "01:00:5e:00:00:16"
69 IGMP_SRC_MAC = "5a:e1:ac:ec:4d:a1"
70 IP_SRC = '1.2.3.4'
71 IP_DST = '224.0.0.22'
72 igmp_eth = Ether(dst = IGMP_DST_MAC, type = ETH_P_IP)
73 igmp_ip = IP(dst = IP_DST)
74 PORT_TX_DEFAULT = 2
75 PORT_RX_DEFAULT = 1
76 igmp_app = 'org.opencord.igmp'
77
Chetan Gaonker357f4892017-06-19 19:38:27 +000078 @classmethod
79 def setUpCordApi(cls):
Chetan Gaonker357f4892017-06-19 19:38:27 +000080 num_subscribers = max(cls.NUM_SUBSCRIBERS, 10)
A R Karthicked3a2ca2017-07-06 15:50:03 -070081 cls.cord_subscriber = CordSubscriberUtils(num_subscribers,
82 account_num = cls.SUBSCRIBER_ACCOUNT_NUM,
83 s_tag = cls.SUBSCRIBER_S_TAG,
84 c_tag = cls.SUBSCRIBER_C_TAG,
85 subscribers_per_s_tag = cls.SUBSCRIBERS_PER_S_TAG)
86 cls.restApiXos = XosUtils.getRestApi()
Chetan Gaonker357f4892017-06-19 19:38:27 +000087
88 @classmethod
89 def setUpClass(cls):
90 cls.controllers = get_controllers()
91 cls.controller = cls.controllers[0]
92 cls.cli = None
93 cls.on_pod = running_on_pod()
94 cls.on_ciab = running_on_ciab()
95 cls.olt = OltConfig(olt_conf_file = cls.olt_conf_file)
96 cls.vcpes = cls.olt.get_vcpes()
97 cls.vcpes_dhcp = cls.olt.get_vcpes_by_type('dhcp')
98 cls.vcpes_reserved = cls.olt.get_vcpes_by_type('reserved')
99 cls.dhcp_vcpes_reserved = [ 'vcpe{}.{}.{}'.format(i, cls.vcpes_reserved[i]['s_tag'], cls.vcpes_reserved[i]['c_tag'])
100 for i in xrange(len(cls.vcpes_reserved)) ]
101 cls.untagged_dhcp_vcpes_reserved = [ 'vcpe{}'.format(i) for i in xrange(len(cls.vcpes_reserved)) ]
102 cls.container_vcpes_reserved = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_reserved ]
103 vcpe_dhcp_reserved = None
104 vcpe_container_reserved = None
105 if cls.vcpes_reserved:
106 vcpe_dhcp_reserved = cls.dhcp_vcpes_reserved[0]
107 if cls.on_pod is False:
108 vcpe_dhcp_reserved = cls.untagged_dhcp_vcpes_reserved[0]
109 vcpe_container_reserved = cls.container_vcpes_reserved[0]
110
111 cls.vcpe_dhcp_reserved = vcpe_dhcp_reserved
112 cls.vcpe_container_reserved = vcpe_container_reserved
113 dhcp_vcpe_offset = len(cls.vcpes_reserved)
114 cls.dhcp_vcpes = [ 'vcpe{}.{}.{}'.format(i+dhcp_vcpe_offset, cls.vcpes_dhcp[i]['s_tag'], cls.vcpes_dhcp[i]['c_tag'])
115 for i in xrange(len(cls.vcpes_dhcp)) ]
116 cls.untagged_dhcp_vcpes = [ 'vcpe{}'.format(i+dhcp_vcpe_offset) for i in xrange(len(cls.vcpes_dhcp)) ]
117 cls.container_vcpes = [ 'vcpe-{}-{}'.format(vcpe['s_tag'], vcpe['c_tag']) for vcpe in cls.vcpes_dhcp ]
118 vcpe_dhcp = None
119 vcpe_container = None
120 #cache the first dhcp vcpe in the class for quick testing
121 if cls.vcpes_dhcp:
122 vcpe_container = cls.container_vcpes[0]
123 vcpe_dhcp = cls.dhcp_vcpes[0]
124 if cls.on_pod is False:
125 vcpe_dhcp = cls.untagged_dhcp_vcpes[0]
126 cls.vcpe_container = vcpe_container_reserved or vcpe_container
127 cls.vcpe_dhcp = vcpe_dhcp_reserved or vcpe_dhcp
128 VSGAccess.setUp()
A R Karthicked3a2ca2017-07-06 15:50:03 -0700129 cls.setUpCordApi()
Chetan Gaonker357f4892017-06-19 19:38:27 +0000130 if cls.on_pod is True:
A R Karthicked3a2ca2017-07-06 15:50:03 -0700131 cls.openVCPEAccess(cls.cord_subscriber.volt_subscriber_info)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000132
133 @classmethod
134 def tearDownClass(cls):
135 VSGAccess.tearDown()
136 if cls.on_pod is True:
A R Karthicked3a2ca2017-07-06 15:50:03 -0700137 cls.closeVCPEAccess(cls.cord_subscriber.volt_subscriber_info)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000138
139 def log_set(self, level = None, app = 'org.onosproject'):
140 CordLogger.logSet(level = level, app = app, controllers = self.controllers, forced = True)
141
142 @classmethod
143 def config_restore(cls):
144 """Restore the vsg test configuration on test case failures"""
145 for restore_method in cls.restore_methods:
146 restore_method()
147
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000148 def get_system_cpu_usage(self):
149 """ Getting compute node CPU usage """
150 ssh_agent = SSHTestAgent(host = self.HEAD_NODE, user = self.USER, password = self.PASS)
151 cmd = "top -b -n1 | grep 'Cpu(s)' | awk '{print $2 + $4}'"
152 status, output = ssh_agent.run_cmd(cmd)
153 assert_equal(status, True)
154 return float(output)
155
A R Karthicked3a2ca2017-07-06 15:50:03 -0700156 def vsg_for_external_connectivity(self, subscriber_index, reserved = False):
157 if reserved is True:
158 if self.on_pod is True:
159 vcpe = self.dhcp_vcpes_reserved[subscriber_index]
160 else:
161 vcpe = self.untagged_dhcp_vcpes_reserved[subscriber_index]
162 else:
163 if self.on_pod is True:
164 vcpe = self.dhcp_vcpes[subscriber_index]
165 else:
166 vcpe = self.untagged_dhcp_vcpes[subscriber_index]
167 mgmt = 'eth0'
168 host = '8.8.8.8'
169 self.success = False
170 assert_not_equal(vcpe, None)
171 vcpe_ip = VSGAccess.vcpe_get_dhcp(vcpe, mgmt = mgmt)
172 assert_not_equal(vcpe_ip, None)
173 log.info('Got DHCP IP %s for %s' %(vcpe_ip, vcpe))
174 log.info('Sending icmp echo requests to external network 8.8.8.8')
175 st, _ = getstatusoutput('ping -c 3 8.8.8.8')
176 VSGAccess.restore_interface_config(mgmt, vcpe = vcpe)
177 assert_equal(st, 0)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000178
179 def vsg_xos_subscriber_create(self, index, subscriber_info = None, volt_subscriber_info = None):
180 if self.on_pod is False:
181 return ''
182 if subscriber_info is None:
A R Karthicked3a2ca2017-07-06 15:50:03 -0700183 subscriber_info = self.cord_subscriber.subscriber_info[index]
Chetan Gaonker357f4892017-06-19 19:38:27 +0000184 if volt_subscriber_info is None:
A R Karthicked3a2ca2017-07-06 15:50:03 -0700185 volt_subscriber_info = self.cord_subscriber.volt_subscriber_info[index]
Chetan Gaonker357f4892017-06-19 19:38:27 +0000186 s_tag = int(volt_subscriber_info['voltTenant']['s_tag'])
187 c_tag = int(volt_subscriber_info['voltTenant']['c_tag'])
188 vcpe = 'vcpe-{}-{}'.format(s_tag, c_tag)
A R Karthicked3a2ca2017-07-06 15:50:03 -0700189 subId = self.cord_subscriber.subscriberCreate(index, subscriber_info, volt_subscriber_info)
190 if subId:
Chetan Gaonker357f4892017-06-19 19:38:27 +0000191 #if the vsg instance was already instantiated, then reduce delay
A R Karthicked3a2ca2017-07-06 15:50:03 -0700192 if c_tag % self.SUBSCRIBERS_PER_S_TAG == 0:
Chetan Gaonker357f4892017-06-19 19:38:27 +0000193 delay = 350
194 else:
195 delay = 90
196 log.info('Delaying %d seconds for the VCPE to be provisioned' %(delay))
197 time.sleep(delay)
198 log.info('Testing for external connectivity to VCPE %s' %(vcpe))
199 self.vsg_for_external_connectivity(index)
A R Karthicked3a2ca2017-07-06 15:50:03 -0700200
201 return subId
Chetan Gaonker357f4892017-06-19 19:38:27 +0000202
203 def vsg_xos_subscriber_delete(self, index, subId = '', voltId = '', subscriber_info = None, volt_subscriber_info = None):
204 if self.on_pod is False:
205 return
A R Karthicked3a2ca2017-07-06 15:50:03 -0700206 self.cord_subscriber.subscriberDelete(index, subId = subId, voltId = voltId,
207 subscriber_info = subscriber_info,
208 volt_subscriber_info = volt_subscriber_info)
209
210 def vsg_xos_subscriber_id(self, index):
211 if self.on_pod is False:
212 return ''
213 return self.cord_subscriber.subscriberId(index)
Chetan Gaonker357f4892017-06-19 19:38:27 +0000214
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000215 def onos_load_config(self, config):
216 #log_test.info('onos load config is %s'%config)
217 status, code = OnosCtrl.config(config)
218 if status is False:
219 log_test.info('JSON request returned status %d' %code)
220 assert_equal(status, True)
221 time.sleep(2)
222
223 def onos_ssm_table_load(self, groups, src_list = ['1.2.3.4'],flag = False):
224 ssm_dict = {'apps' : { 'org.opencord.igmp' : { 'ssmTranslate' : [] } } }
225 ssm_xlate_list = ssm_dict['apps']['org.opencord.igmp']['ssmTranslate']
226 if flag: #to maintain seperate group-source pair.
227 for i in range(len(groups)):
228 d = {}
229 d['source'] = src_list[i] or '0.0.0.0'
230 d['group'] = groups[i]
231 ssm_xlate_list.append(d)
232 else:
233 for g in groups:
234 for s in src_list:
235 d = {}
236 d['source'] = s or '0.0.0.0'
237 d['group'] = g
238 ssm_xlate_list.append(d)
239 self.onos_load_config(ssm_dict)
240 cord_port_map = {}
241 for g in groups:
242 cord_port_map[g] = (self.PORT_TX_DEFAULT, self.PORT_RX_DEFAULT)
243 IgmpChannel().cord_port_table_load(cord_port_map)
244 time.sleep(2)
245
246 def generate_random_multicast_ip_addresses(self,count=500):
247 multicast_ips = []
248 while(count >= 1):
249 ip = '.'.join([str(random.randint(224,239)),str(random.randint(1,254)),str(random.randint(1,254)),str(random.randint(1,254))])
250 if ip in multicast_ips:
251 pass
252 else:
253 multicast_ips.append(ip)
254 count -= 1
255 return multicast_ips
256
257 def generate_random_unicast_ip_addresses(self,count=500):
258 unicast_ips = []
259 while(count >= 1):
260 ip = '.'.join([str(random.randint(11,126)),str(random.randint(1,254)),str(random.randint(1,254)),str(random.randint(1,254))])
261 if ip in unicast_ips:
262 pass
263 else:
264 unicast_ips.append(ip)
265 count -= 1
266 return unicast_ips
267
268 def iptomac(self, mcast_ip):
269 mcast_mac = '01:00:5e:'
270 octets = mcast_ip.split('.')
271 second_oct = int(octets[1]) & 127
272 third_oct = int(octets[2])
273 fourth_oct = int(octets[3])
274 mcast_mac = mcast_mac + format(second_oct,'02x') + ':' + format(third_oct, '02x') + ':' + format(fourth_oct, '02x')
275 return mcast_mac
276
277 def send_igmp_join(self, groups, src_list = ['1.2.3.4'], record_type=IGMP_V3_GR_TYPE_INCLUDE,
278 ip_pkt = None, iface = 'veth0', ssm_load = False, delay = 1):
279 if ssm_load is True:
280 self.onos_ssm_table_load(groups, src_list)
281 igmp = IGMPv3(type = IGMP_TYPE_V3_MEMBERSHIP_REPORT, max_resp_code=30,
282 gaddr=self.IP_DST)
283 for g in groups:
284 gr = IGMPv3gr(rtype= record_type, mcaddr=g)
285 gr.sources = src_list
286 igmp.grps.append(gr)
287 if ip_pkt is None:
288 ip_pkt = self.igmp_eth/self.igmp_ip
289 pkt = ip_pkt/igmp
290 IGMPv3.fixup(pkt)
291 log.info('sending igmp join packet %s'%pkt.show())
292 sendp(pkt, iface=iface)
293 time.sleep(delay)
294
295 def send_multicast_data_traffic(self, group, intf= 'veth2',source = '1.2.3.4'):
296 dst_mac = self.iptomac(group)
297 eth = Ether(dst= dst_mac)
298 ip = IP(dst=group,src=source)
299 data = repr(monotonic.monotonic())
300 sendp(eth/ip/data,count=20, iface = intf)
301
302 def verify_igmp_data_traffic(self, group, intf='veth0', source='1.2.3.4' ):
303 log_test.info('verifying multicast traffic for group %s from source %s'%(group,source))
304 self.success = False
305 def recv_task():
306 def igmp_recv_cb(pkt):
307 #log_test.info('received multicast data packet is %s'%pkt.show())
308 log_test.info('multicast data received for group %s from source %s'%(group,source))
309 self.success = True
310 sniff(prn = igmp_recv_cb,lfilter = lambda p: IP in p and p[IP].dst == group and p[IP].src == source, count=1,timeout = 2, iface='veth0')
311 t = threading.Thread(target = recv_task)
312 t.start()
313 self.send_multicast_data_traffic(group,source=source)
314 t.join()
315 return self.success
316
Chetan Gaonker357f4892017-06-19 19:38:27 +0000317 def test_scale_for_vsg_vm_creations(self):
A R Karthicked3a2ca2017-07-06 15:50:03 -0700318 for index in xrange(len(self.cord_subscriber.subscriber_info)):
Chetan Gaonker357f4892017-06-19 19:38:27 +0000319 #check if the index exists
320 subId = self.vsg_xos_subscriber_id(index)
321 log.info('test_vsg_xos_subscriber_creation')
322 if subId and subId != '0':
323 self.vsg_xos_subscriber_delete(index, subId = subId)
324 subId = self.vsg_xos_subscriber_create(index)
325 log.info('Created Subscriber %s' %(subId))
326
327 def test_scale_for_vcpe_creations(self):
A R Karthicked3a2ca2017-07-06 15:50:03 -0700328 for index in xrange(len(self.cord_subscriber.subscriber_info)):
Chetan Gaonker357f4892017-06-19 19:38:27 +0000329 #check if the index exists
330 subId = self.vsg_xos_subscriber_id(index)
331 log.info('test_vsg_xos_subscriber_creation')
332 if subId and subId != '0':
333 self.vsg_xos_subscriber_delete(index, subId = subId)
334 subId = self.vsg_xos_subscriber_create(index)
335 log.info('Created Subscriber %s' %(subId))
336
337 def test_scale_of_subcriber_vcpe_creations_in_single_vsg_vm(self):
338 subId = self.vsg_xos_subscriber_create(100)
339 if subId and subId != '0':
340 self.vsg_xos_subscriber_delete(100, subId)
341
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000342 def test_scale_of_subcriber_vcpe_creations_in_multiple_vsg_vm(self):
343 subId = self.vsg_xos_subscriber_create(100)
344 if subId and subId != '0':
345 self.vsg_xos_subscriber_delete(100, subId)
346
347 def test_scale_of_subcriber_vcpe_creations_with_one_vcpe_in_one_vsg_vm(self):
348 subId = self.vsg_xos_subscriber_create(100)
349 if subId and subId != '0':
350 self.vsg_xos_subscriber_delete(100, subId)
351
Chetan Gaonker357f4892017-06-19 19:38:27 +0000352 def test_scale_for_cord_subscriber_creation_and_deletion(self):
353 subId = self.vsg_xos_subscriber_create(100)
354 if subId and subId != '0':
355 self.vsg_xos_subscriber_delete(100, subId)
356
357 def test_cord_for_scale_of_subscriber_containers_per_compute_node(self):
358 pass
359
Anil Kumar Sanka12a5ec52017-06-29 18:41:51 +0000360 def test_latency_of_cord_for_control_packets_using_icmp_packet(self):
361 cmd = "ping -c 4 {0} | tail -1| awk '{{print $4}}'".format(self.wan_intf_ip)
362 st, out = getstatusoutput(cmd)
363 if out != '':
364 out = out.split('/')
365 avg_rtt = out[1]
366 latency = float(avg_rtt)/float(2)
367 else:
368 latency = None
369 log.info('CORD setup latency calculated from icmp packet is = %s ms'%latency)
370 assert_not_equal(latency,None)
371
372 def test_latency_of_cord_for_control_packets_using_increasing_sizes_of_icmp_packet(self):
373 pckt_sizes = [100,500,1000,1500]
374 for size in pckt_sizes:
375 cmd = "ping -c 4 -s {} {} | tail -1| awk '{{print $4}}'".format(size,self.wan_intf_ip)
376 st, out = getstatusoutput(cmd)
377 if out != '':
378 out = out.split('/')
379 avg_rtt = out[1]
380 latency = float(avg_rtt)/float(2)
381 else:
382 latency = None
383 log.info('CORD setup latency calculated from icmp packet with size %s bytes is = %s ms'%(size,latency))
384 assert_not_equal(latency,None)
385
386 def test_latency_of_cord_with_traceroute(self):
387 cmd = "traceroute -q1 {} | tail -1| awk '{{print $4}}'".format(self.wan_intf_ip)
388 avg_rtt = float(0)
389 latency = None
390 for index in [1,2,3]:
391 st, out = getstatusoutput(cmd)
392 if out != '':
393 avg_rtt += float(out)
394 latency = float(avg_rtt)/float(6)
395 log.info('CORD setup latency calculated from traceroute is = %s ms'%latency)
396 assert_not_equal(latency,0.0)
397
398 def test_scale_with_igmp_joins_for_500_multicast_groups_and_check_cpu_usage(self, group_count=500):
399 OnosCtrl(self.igmp_app).activate()
400 groups = self.generate_random_multicast_ip_addresses(count = group_count)
401 sources = self.generate_random_unicast_ip_addresses(count = group_count)
402 self.onos_ssm_table_load(groups,src_list=sources,flag=True)
403 for index in range(group_count):
404 self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
405 iface = self.V_INF1)
406 status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
407 assert_equal(status, True)
408 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
409 if index % 50 == 0:
410 cpu_usage = self.get_system_cpu_usage()
411 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
412
413 def test_scale_with_igmp_joins_for_1000_multicast_groups_and_check_cpu_usage(self, group_count=1000):
414 OnosCtrl(self.igmp_app).activate()
415 groups = self.generate_random_multicast_ip_addresses(count = group_count)
416 sources = self.generate_random_unicast_ip_addresses(count = group_count)
417 self.onos_ssm_table_load(groups,src_list=sources,flag=True)
418 for index in range(group_count):
419 self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
420 iface = self.V_INF1)
421 status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
422 assert_equal(status, True)
423 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
424 if index % 50 == 0:
425 cpu_usage = self.get_system_cpu_usage()
426 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
427
428 def test_scale_with_igmp_joins_for_2000_multicast_groups_and_check_cpu_usage(self, group_count=2000):
429 OnosCtrl(self.igmp_app).activate()
430 groups = self.generate_random_multicast_ip_addresses(count = group_count)
431 sources = self.generate_random_unicast_ip_addresses(count = group_count)
432 self.onos_ssm_table_load(groups,src_list=sources,flag=True)
433 for index in range(group_count):
434 self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
435 iface = self.V_INF1)
436 status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
437 assert_equal(status, True)
438 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
439 if index % 50 == 0:
440 cpu_usage = self.get_system_cpu_usage()
441 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
442
443 def test_scale_igmp_joins_for_2000_multicast_groups_and_check_cpu_usage_after_app_deactivation_and_activation(self,group_count=500):
444 OnosCtrl(self.igmp_app).activate()
445 groups = self.generate_random_multicast_ip_addresses(count = group_count)
446 sources = self.generate_random_unicast_ip_addresses(count = group_count)
447 self.onos_ssm_table_load(groups,src_list=sources,flag=True)
448 for index in range(group_count):
449 self.send_igmp_join(groups = [groups[index]], src_list = [sources[index]],record_type = IGMP_V3_GR_TYPE_INCLUDE,
450 iface = self.V_INF1)
451 status = self.verify_igmp_data_traffic(groups[index],intf=self.V_INF1,source=sources[index])
452 assert_equal(status, True)
453 log_test.info('data received for group %s from source %s - %d'%(groups[index],sources[index],index))
454 if index % 50 == 0:
455 cpu_usage = self.get_system_cpu_usage()
456 log.info('CPU usage is %s for multicast group entries %s'%(cpu_usage,index+1))
457 OnosCtrl(self.igmp_app).deactivate()
458 time.sleep(1)
459 cpu_usage = self.get_system_cpu_usage()
460 log.info('CPU usage is %s for multicast group entries %s after igmp app deactivated'%(cpu_usage,index+1))