blob: ab1e6a78e56d5ebe17a2c2ce2be9c111d30598bb [file] [log] [blame]
ChetanGaonkereff07bc2016-06-09 16:39:23 -07001#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07002# Copyright 2016-present Ciena Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
ChetanGaonkereff07bc2016-06-09 16:39:23 -07007#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07008# http://www.apache.org/licenses/LICENSE-2.0
ChetanGaonkereff07bc2016-06-09 16:39:23 -07009#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070010# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
Chetan Gaonkercbe79642016-03-09 17:45:58 -080016import unittest
17from nose.tools import *
18from nose.twistedtools import reactor, deferred
19from twisted.internet import defer
20from scapy.all import *
21import time, monotonic
22import os, sys
23import tempfile
24import random
25import threading
26from Stats import Stats
27from OnosCtrl import OnosCtrl
28from DHCP import DHCPTest
29from EapTLS import TLSAuthTest
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -070030from Channels import Channels, IgmpChannel
Chetan Gaonker41d2e072016-03-15 16:41:31 -070031from subscriberDb import SubscriberDB
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -070032from threadPool import ThreadPool
ChetanGaonkereff07bc2016-06-09 16:39:23 -070033from portmaps import g_subscriber_port_map
Chetan Gaonker7997bb42016-03-28 09:46:15 -070034from OltConfig import *
ChetanGaonkereff07bc2016-06-09 16:39:23 -070035from CordContainer import *
36import copy
Chetan Gaonkercbe79642016-03-09 17:45:58 -080037log.setLevel('INFO')
ChetanGaonkereff07bc2016-06-09 16:39:23 -070038DEFAULT_NO_CHANNELS = 1
Chetan Gaonkercbe79642016-03-09 17:45:58 -080039
40class Subscriber(Channels):
Chetan Gaonker7997bb42016-03-28 09:46:15 -070041 PORT_TX_DEFAULT = 2
42 PORT_RX_DEFAULT = 1
43 INTF_TX_DEFAULT = 'veth2'
44 INTF_RX_DEFAULT = 'veth0'
Chetan Gaonkercbe79642016-03-09 17:45:58 -080045 STATS_RX = 0
46 STATS_TX = 1
47 STATS_JOIN = 2
48 STATS_LEAVE = 3
Chetan Gaonker41d2e072016-03-15 16:41:31 -070049 SUBSCRIBER_SERVICES = 'DHCP IGMP TLS'
ChetanGaonkereff07bc2016-06-09 16:39:23 -070050
51
Chetan Gaonker7997bb42016-03-28 09:46:15 -070052 def __init__(self, name = 'sub', service = SUBSCRIBER_SERVICES, port_map = None,
53 num = 1, channel_start = 0,
54 tx_port = PORT_TX_DEFAULT, rx_port = PORT_RX_DEFAULT,
55 iface = INTF_RX_DEFAULT, iface_mcast = INTF_TX_DEFAULT,
Chetan Gaonkercbe79642016-03-09 17:45:58 -080056 mcast_cb = None, loginType = 'wireless'):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -070057 self.tx_port = tx_port
58 self.rx_port = rx_port
Chetan Gaonker7997bb42016-03-28 09:46:15 -070059 self.port_map = port_map or g_subscriber_port_map
60 try:
61 self.tx_intf = self.port_map[tx_port]
62 self.rx_intf = self.port_map[rx_port]
63 except:
Chetan Gaonker3d163852016-03-28 12:20:25 -070064 self.tx_intf = self.port_map[self.PORT_TX_DEFAULT]
65 self.rx_intf = self.port_map[self.PORT_RX_DEFAULT]
Chetan Gaonker7997bb42016-03-28 09:46:15 -070066
ChetanGaonkereff07bc2016-06-09 16:39:23 -070067 Channels.__init__(self, num, channel_start = channel_start,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -070068 iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
Chetan Gaonker41d2e072016-03-15 16:41:31 -070069 self.name = name
70 self.service = service
71 self.service_map = {}
72 services = self.service.strip().split(' ')
73 for s in services:
74 self.service_map[s] = True
Chetan Gaonkercbe79642016-03-09 17:45:58 -080075 self.loginType = loginType
76 ##start streaming channels
77 self.join_map = {}
78 ##accumulated join recv stats
79 self.join_rx_stats = Stats()
80
Chetan Gaonker41d2e072016-03-15 16:41:31 -070081 def has_service(self, service):
82 if self.service_map.has_key(service):
83 return self.service_map[service]
84 if self.service_map.has_key(service.upper()):
85 return self.service_map[service.upper()]
86 return False
87
Chetan Gaonkercbe79642016-03-09 17:45:58 -080088 def channel_join_update(self, chan, join_time):
89 self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
90 self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
91
92 def channel_join(self, chan = 0, delay = 2):
93 '''Join a channel and create a send/recv stats map'''
94 if self.join_map.has_key(chan):
95 del self.join_map[chan]
96 self.delay = delay
97 chan, join_time = self.join(chan)
98 self.channel_join_update(chan, join_time)
99 return chan
100
101 def channel_join_next(self, delay = 2):
102 '''Joins the next channel leaving the last channel'''
103 if self.last_chan:
104 if self.join_map.has_key(self.last_chan):
105 del self.join_map[self.last_chan]
106 self.delay = delay
107 chan, join_time = self.join_next()
108 self.channel_join_update(chan, join_time)
109 return chan
110
111 def channel_jump(self, delay = 2):
112 '''Jumps randomly to the next channel leaving the last channel'''
Chetan Gaonker4a82bae2016-05-19 17:35:30 -0700113 log.info("Jumps randomly to the next channel leaving the last channel")
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800114 if self.last_chan is not None:
115 if self.join_map.has_key(self.last_chan):
116 del self.join_map[self.last_chan]
117 self.delay = delay
118 chan, join_time = self.jump()
119 self.channel_join_update(chan, join_time)
120 return chan
121
122 def channel_leave(self, chan = 0):
123 if self.join_map.has_key(chan):
124 del self.join_map[chan]
125 self.leave(chan)
126
127 def channel_update(self, chan, stats_type, packets, t=0):
128 if type(chan) == type(0):
129 chan_list = (chan,)
130 else:
131 chan_list = chan
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700132 for c in chan_list:
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800133 if self.join_map.has_key(c):
134 self.join_map[c][stats_type].update(packets = packets, t = t)
135
136 def channel_receive(self, chan, cb = None, count = 1):
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700137 log.info('Subscriber %s receiving from group %s, channel %d' %(self.name, self.gaddr(chan), chan))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800138 self.recv(chan, cb = cb, count = count)
139
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700140 def recv_channel_cb(self, pkt):
141 ##First verify that we have received the packet for the joined instance
142 log.debug('Packet received for group %s, subscriber %s' %(pkt[IP].dst, self.name))
143 chan = self.caddr(pkt[IP].dst)
144 assert_equal(chan in self.join_map.keys(), True)
145 recv_time = monotonic.monotonic() * 1000000
146 join_time = self.join_map[chan][self.STATS_JOIN].start
147 delta = recv_time - join_time
148 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
149 self.channel_update(chan, self.STATS_RX, 1, t = delta)
150 log.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
151
152class subscriber_pool:
153
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700154 def __init__(self, subscriber, test_cbs, test_status):
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700155 self.subscriber = subscriber
156 self.test_cbs = test_cbs
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700157 self.test_status = test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700158
159 def pool_cb(self):
160 for cb in self.test_cbs:
161 if cb:
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700162 self.test_status = cb(self.subscriber)
163# cb(self.subscriber)
164 if self.test_status is not True:
165 log.info('This service is failed and other services will not run for this subscriber')
166 break
167 log.info('This Subscriber is tested for multiple service elgibility ')
168 self.test_status = True
169
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800170class subscriber_exchange(unittest.TestCase):
171
A.R Karthick95d044e2016-06-10 18:44:36 -0700172 apps = [ 'org.opencord.aaa', 'org.onosproject.dhcp' ]
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700173
174 dhcp_app = 'org.onosproject.dhcp'
175
A.R Karthick95d044e2016-06-10 18:44:36 -0700176 olt_apps = [ 'org.opencord.igmp', 'org.opencord.cordmcast' ]
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800177 dhcp_server_config = {
178 "ip": "10.1.11.50",
179 "mac": "ca:fe:ca:fe:ca:fe",
180 "subnet": "255.255.252.0",
181 "broadcast": "10.1.11.255",
182 "router": "10.1.8.1",
183 "domain": "8.8.8.8",
184 "ttl": "63",
185 "delay": "2",
186 "startip": "10.1.11.51",
187 "endip": "10.1.11.100"
188 }
189
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700190 aaa_loaded = False
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700191 INTF_TX_DEFAULT = 'veth2'
192 INTF_RX_DEFAULT = 'veth0'
193 SUBSCRIBER_TIMEOUT = 20
194
195 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
196MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
197CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
198IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
199RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
200MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
201BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
202hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
203gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
204+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
205rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
206VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
207eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2086tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
209PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
210nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
211-----END CERTIFICATE-----"""
212
213 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
214MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
215CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
216IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
217RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
218MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
219BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
220hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
221AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
2225An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
223tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
224OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
225qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
2262Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
227BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
228eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
229MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
230VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
231RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
232dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
233T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
234yg==
235-----END CERTIFICATE-----'''
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700236
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800237 def setUp(self):
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700238 '''Load the OLT config and activate relevant apps'''
239 self.olt = OltConfig()
A R Karthickb03cecd2016-07-27 10:27:55 -0700240 self.port_map, _ = self.olt.olt_port_map()
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700241 ##if no olt config, fall back to ovs port map
242 if not self.port_map:
243 self.port_map = g_subscriber_port_map
244 else:
245 log.info('Using OLT Port configuration for test setup')
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700246 log.info('Configuring CORD OLT access device information')
247 OnosCtrl.cord_olt_config(self.olt.olt_device_data())
248 self.activate_apps(self.olt_apps)
249
250 self.activate_apps(self.apps)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800251
252 def teardown(self):
253 '''Deactivate the dhcp app'''
254 for app in self.apps:
255 onos_ctrl = OnosCtrl(app)
256 onos_ctrl.deactivate()
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700257 log.info('Restarting the Radius container in the setup after running every subscriber test cases by default')
258 rest = Container('cord-radius', 'cord-test/radius',)
259 rest.restart('cord-radius','10')
260 radius = Radius()
261 radius_ip = radius.ip()
262 print('Radius server is running with IP %s' %radius_ip)
263 #os.system('ifconfig '+INTF_RX_DEFAULT+' up')
264
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800265
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700266 def activate_apps(self, apps):
Chetan Gaonker735495f2016-05-10 14:51:16 -0700267 for app in apps:
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700268 onos_ctrl = OnosCtrl(app)
269 status, _ = onos_ctrl.activate()
270 assert_equal(status, True)
271 time.sleep(2)
272
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800273 def onos_aaa_load(self):
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700274 if self.aaa_loaded:
275 return
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700276 aaa_dict = {'apps' : { 'org.onosproject.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800277 'radiusIp': '172.17.0.2' } } } }
278 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
279 aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip
280 self.onos_load_config('org.onosproject.aaa', aaa_dict)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700281 self.aaa_loaded = True
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800282
283 def onos_dhcp_table_load(self, config = None):
284 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
285 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
286 if config:
287 for k in config.keys():
288 if dhcp_config.has_key(k):
289 dhcp_config[k] = config[k]
290 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
291
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700292 def send_recv(self, mac = None, update_seed = False, validate = True):
293 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
294 if validate:
295 assert_not_equal(cip, None)
296 assert_not_equal(sip, None)
297 log.info('Got dhcp client IP %s from server %s for mac %s' %
298 (cip, sip, self.dhcp.get_mac(cip)[0]))
299 return cip,sip
300
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800301 def onos_load_config(self, app, config):
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700302 status, code = OnosCtrl.config(config)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800303 if status is False:
304 log.info('JSON config request for app %s returned status %d' %(app, code))
305 assert_equal(status, True)
306 time.sleep(2)
307
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700308 def dhcp_sndrcv(self, dhcp, update_seed = False):
309 cip, sip = dhcp.discover(update_seed = update_seed)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800310 assert_not_equal(cip, None)
311 assert_not_equal(sip, None)
312 log.info('Got dhcp client IP %s from server %s for mac %s' %
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700313 (cip, sip, dhcp.get_mac(cip)[0]))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800314 return cip,sip
315
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700316 def dhcp_request(self, subscriber, seed_ip = '10.10.10.1', update_seed = False):
Chetan Gaonker00971202016-03-23 15:11:12 -0700317 config = {'startip':'10.10.10.20', 'endip':'10.10.10.200',
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800318 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
319 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
320 self.onos_dhcp_table_load(config)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700321 dhcp = DHCPTest(seed_ip = seed_ip, iface = subscriber.iface)
322 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800323 return cip, sip
324
325 def recv_channel_cb(self, pkt):
326 ##First verify that we have received the packet for the joined instance
327 chan = self.subscriber.caddr(pkt[IP].dst)
328 assert_equal(chan in self.subscriber.join_map.keys(), True)
329 recv_time = monotonic.monotonic() * 1000000
330 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
331 delta = recv_time - join_time
332 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
333 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700334 log.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800335 self.test_status = True
336
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700337 def tls_verify(self, subscriber):
338 if subscriber.has_service('TLS'):
339 time.sleep(2)
340 tls = TLSAuthTest()
341 log.info('Running subscriber %s tls auth test' %subscriber.name)
342 tls.runTest()
343 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700344 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700345
346 def dhcp_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700347 cip, sip = self.dhcp_request(subscriber, update_seed = True)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700348 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
349 subscriber.src_list = [cip]
350 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700351 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700352
353 def dhcp_jump_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700354 cip, sip = self.dhcp_request(subscriber, seed_ip = '10.10.200.1')
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700355 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
356 subscriber.src_list = [cip]
357 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700358 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700359
360 def dhcp_next_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700361 cip, sip = self.dhcp_request(subscriber, seed_ip = '10.10.150.1')
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700362 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
363 subscriber.src_list = [cip]
364 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700365 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700366
367 def igmp_verify(self, subscriber):
368 chan = 0
369 if subscriber.has_service('IGMP'):
370 for i in range(5):
371 log.info('Joining channel %d for subscriber %s' %(chan, subscriber.name))
372 subscriber.channel_join(chan, delay = 0)
373 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
374 log.info('Leaving channel %d for subscriber %s' %(chan, subscriber.name))
375 subscriber.channel_leave(chan)
376 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700377 log.info('Interface %s Join RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name,subscriber.join_rx_stats))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700378 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700379 return self.test_status
380
381 def igmp_verify_multiChannel(self, subscriber):
382 if subscriber.has_service('IGMP'):
383 for chan in range(DEFAULT_NO_CHANNELS):
384 log.info('Joining channel %d for subscriber %s' %(chan, subscriber.name))
385 subscriber.channel_join(chan, delay = 0)
386 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
387 log.info('Leaving channel %d for subscriber %s' %(chan, subscriber.name))
388 subscriber.channel_leave(chan)
389 time.sleep(3)
390 log.info('Interface %s Join RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name,subscriber.join_rx_stats))
391 self.test_status = True
392 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700393
394 def igmp_jump_verify(self, subscriber):
395 if subscriber.has_service('IGMP'):
396 for i in xrange(subscriber.num):
397 log.info('Subscriber %s jumping channel' %subscriber.name)
398 chan = subscriber.channel_jump(delay=0)
399 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
400 log.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
401 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700402 log.info('Interface %s Jump RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700403 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700404 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700405
406 def igmp_next_verify(self, subscriber):
407 if subscriber.has_service('IGMP'):
408 for i in xrange(subscriber.num):
409 if i:
410 chan = subscriber.channel_join_next(delay=0)
411 else:
412 chan = subscriber.channel_join(i, delay=0)
413 log.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
414 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
415 log.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
416 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700417 log.info('Interface %s Join Next RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name, subscriber.join_rx_stats))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700418 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700419 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700420
Chetan Gaonker3d163852016-03-28 12:20:25 -0700421 def generate_port_list(self, subscribers, channels):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700422 port_list = []
Chetan Gaonker3d163852016-03-28 12:20:25 -0700423 for i in xrange(subscribers):
424 if channels > 1:
425 rx_port = 2*i+1
426 tx_port = 2*i+2
427 else:
428 rx_port = Subscriber.PORT_RX_DEFAULT
429 tx_port = Subscriber.PORT_TX_DEFAULT
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700430 port_list.append((tx_port, rx_port))
431 return port_list
432
433 def subscriber_load(self, create = True, num = 10, num_channels = 1, channel_start = 0, port_list = []):
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700434 '''Load the subscriber from the database'''
435 self.subscriber_db = SubscriberDB(create = create)
436 if create is True:
437 self.subscriber_db.generate(num)
438 self.subscriber_info = self.subscriber_db.read(num)
439 self.subscriber_list = []
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700440 if not port_list:
Chetan Gaonker3d163852016-03-28 12:20:25 -0700441 port_list = self.generate_port_list(num, num_channels)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700442
443 index = 0
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700444 for info in self.subscriber_info:
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700445 self.subscriber_list.append(Subscriber(name=info['Name'],
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700446 service=info['Service'],
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700447 port_map = self.port_map,
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700448 num=num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700449 channel_start = channel_start,
450 tx_port = port_list[index][0],
451 rx_port = port_list[index][1]))
Chetan Gaonker3d163852016-03-28 12:20:25 -0700452 if num_channels > 1:
453 channel_start += num_channels
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700454 index += 1
455
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700456 #load the ssm list for all subscriber channels
457 igmpChannel = IgmpChannel()
458 ssm_groups = map(lambda sub: sub.channels, self.subscriber_list)
459 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
460 igmpChannel.igmp_load_ssm_config(ssm_list)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700461 #load the subscriber to mcast port map for cord
462 cord_port_map = {}
463 for sub in self.subscriber_list:
464 for chan in sub.channels:
465 cord_port_map[chan] = (sub.tx_port, sub.rx_port)
466
467 igmpChannel.cord_port_table_load(cord_port_map)
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700468
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700469 def subscriber_join_verify( self, num_subscribers = 10, num_channels = 1,
470 channel_start = 0, cbs = None, port_list = [], negative_subscriber_auth = None):
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800471 self.test_status = False
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700472 self.num_subscribers = num_subscribers
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700473 self.sub_loop_count = num_subscribers
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700474 self.subscriber_load(create = True, num = num_subscribers,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700475 num_channels = num_channels, channel_start = channel_start, port_list = port_list)
Chetan Gaonker55fc7882016-03-15 17:46:47 -0700476 self.onos_aaa_load()
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700477 self.thread_pool = ThreadPool(min(100, self.num_subscribers), queue_size=1, wait_timeout=1)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700478
479 if cbs and negative_subscriber_auth is None:
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700480 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700481 cbs_negative = cbs
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700482 for subscriber in self.subscriber_list:
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700483 subscriber.start()
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700484 if negative_subscriber_auth is 'half' and self.sub_loop_count%2 is not 0:
485 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
486 elif negative_subscriber_auth is 'onethird' and self.sub_loop_count%3 is not 0:
487 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
488 else:
489 cbs = cbs_negative
490 self.sub_loop_count = self.sub_loop_count - 1
491 pool_object = subscriber_pool(subscriber, cbs, self.test_status)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700492 self.thread_pool.addTask(pool_object.pool_cb)
493 self.thread_pool.cleanUpThreads()
494 for subscriber in self.subscriber_list:
495 subscriber.stop()
ChetanGaonker5b984cb2016-07-12 15:50:49 -0700496 print "self.test_status %s\n"%(self.test_status)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700497 return self.test_status
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800498
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700499 def tls_invalid_cert(self, subscriber):
500 if subscriber.has_service('TLS'):
501 time.sleep(2)
502 log.info('Running subscriber %s tls auth test' %subscriber.name)
503 tls = TLSAuthTest(client_cert = self.CLIENT_CERT_INVALID)
504 tls.runTest()
505 if tls.failTest == True:
506 self.test_status = False
507 return self.test_status
508
509 def tls_no_cert(self, subscriber):
510 if subscriber.has_service('TLS'):
511 time.sleep(2)
512 log.info('Running subscriber %s tls auth test' %subscriber.name)
513 tls = TLSAuthTest(client_cert = '')
514 tls.runTest()
515 if tls.failTest == True:
516 self.test_status = False
517 return self.test_status
518
519 def tls_self_signed_cert(self, subscriber):
520 if subscriber.has_service('TLS'):
521 time.sleep(2)
522 log.info('Running subscriber %s tls auth test' %subscriber.name)
523 tls = TLSAuthTest(client_cert = self.CLIENT_CERT)
524 tls.runTest()
525 if tls.failTest == False:
526 self.test_status = True
527 return self.test_status
528
529 def tls_Nsubscribers_use_same_valid_cert(self, subscriber):
530 if subscriber.has_service('TLS'):
531 time.sleep(2)
532 log.info('Running subscriber %s tls auth test' %subscriber.name)
533 num_users = 3
534 for i in xrange(num_users):
535 tls = TLSAuthTest(intf = 'veth{}'.format(i*2))
536 tls.runTest()
537 if tls.failTest == False:
538 self.test_status = True
539 return self.test_status
540
541 def dhcp_discover_scenario(self, subscriber):
542 if subscriber.has_service('DHCP'):
543 time.sleep(2)
544 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
545 t1 = self.subscriber_dhcp_1release()
546 self.test_status = True
547 return self.test_status
548
549 def subscriber_dhcp_1release(self, iface = INTF_RX_DEFAULT):
550 config = {'startip':'10.10.100.20', 'endip':'10.10.100.21',
551 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
552 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
553 self.onos_dhcp_table_load(config)
554 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
555 cip, sip = self.send_recv()
556 log.info('Releasing ip %s to server %s' %(cip, sip))
557 assert_equal(self.dhcp.release(cip), True)
558 log.info('Triggering DHCP discover again after release')
559 cip2, sip2 = self.send_recv(update_seed = True)
560 log.info('Verifying released IP was given back on rediscover')
561 assert_equal(cip, cip2)
562 log.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
563 assert_equal(self.dhcp.release(cip2), True)
564
565
566 def dhcp_client_reboot_scenario(self, subscriber):
567 if subscriber.has_service('DHCP'):
568 time.sleep(2)
569 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
570 tl = self.subscriber_dhcp_client_request_after_reboot()
571 self.test_status = True
572 return self.test_status
573
574 def subscriber_dhcp_client_request_after_reboot(self, iface = INTF_RX_DEFAULT):
575 #''' Client sends DHCP Request after reboot.'''
576
577 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
578 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
579 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
580 self.onos_dhcp_table_load(config)
581 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
582 cip, sip, mac, lval = self.dhcp.only_discover()
583 log.info('Got dhcp client IP %s from server %s for mac %s .' %
584 (cip, sip, mac) )
585
586 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
587
588 if (cip == None and mac != None):
589 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
590 assert_not_equal(cip, None)
591
592 else:
593 new_cip, new_sip = self.dhcp.only_request(cip, mac)
594 if new_cip == None:
595 log.info("Got DHCP server NAK.")
596 os.system('ifconfig '+iface+' down')
597 log.info('Client goes down.')
598 log.info('Delay for 5 seconds.')
599
600 time.sleep(5)
601
602 os.system('ifconfig '+iface+' up')
603 log.info('Client is up now.')
604
605 new_cip, new_sip = self.dhcp.only_request(cip, mac)
606 if new_cip == None:
607 log.info("Got DHCP server NAK.")
608 assert_not_equal(new_cip, None)
609 elif new_cip != None:
610 log.info("Got DHCP ACK.")
611
612
613 def dhcp_client_renew_scenario(self, subscriber):
614 if subscriber.has_service('DHCP'):
615 time.sleep(2)
616 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
617 tl = self.subscriber_dhcp_client_renew_time()
618 self.test_status = True
619 return self.test_status
620
621 def subscriber_dhcp_client_renew_time(self, iface = INTF_RX_DEFAULT):
622 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
623 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
624 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
625 self.onos_dhcp_table_load(config)
626 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
627 cip, sip, mac , lval = self.dhcp.only_discover()
628 log.info('Got dhcp client IP %s from server %s for mac %s .' %
629 (cip, sip, mac) )
630
631 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
632 if (cip == None and mac != None):
633 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
634 assert_not_equal(cip, None)
635 elif cip and sip and mac:
636 log.info("Triggering DHCP Request.")
637 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
638 if new_cip and new_sip and lval:
639 log.info("Client 's Renewal time is :%s",lval)
640 log.info("Generating delay till renewal time.")
641 time.sleep(lval)
642 log.info("Client Sending Unicast DHCP request.")
643 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
644 if latest_cip and latest_sip:
645 log.info("Got DHCP Ack. Lease Renewed for ip %s and mac %s from server %s." %
646 (latest_cip, mac, latest_sip) )
647
648 elif latest_cip == None:
649 log.info("Got DHCP NAK. Lease not renewed.")
650 elif new_cip == None or new_sip == None or lval == None:
651 log.info("Got DHCP NAK.")
652
653
654 def dhcp_server_reboot_scenario(self, subscriber):
655 if subscriber.has_service('DHCP'):
656 time.sleep(2)
657 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
658 tl = self.subscriber_dhcp_server_after_reboot()
659 self.test_status = True
660 return self.test_status
661
662 def subscriber_dhcp_server_after_reboot(self, iface = INTF_RX_DEFAULT):
663 ''' DHCP server goes down.'''
664 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
665 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
666 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
667 self.onos_dhcp_table_load(config)
668 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
669 cip, sip, mac, lval = self.dhcp.only_discover()
670 log.info('Got dhcp client IP %s from server %s for mac %s .' %
671 (cip, sip, mac) )
672 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
673 if (cip == None and mac != None):
674 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
675 assert_not_equal(cip, None)
676 else:
677 new_cip, new_sip = self.dhcp.only_request(cip, mac)
678 if new_cip == None:
679 log.info("Got DHCP server NAK.")
680 assert_not_equal(new_cip, None)
681 log.info('Getting DHCP server Down.')
682 onos_ctrl = OnosCtrl(self.dhcp_app)
683 onos_ctrl.deactivate()
684 for i in range(0,4):
685 log.info("Sending DHCP Request.")
686 log.info('')
687 new_cip, new_sip = self.dhcp.only_request(cip, mac)
688 if new_cip == None and new_sip == None:
689 log.info('')
690 log.info("DHCP Request timed out.")
691 elif new_cip and new_sip:
692 log.info("Got Reply from DHCP server.")
693 assert_equal(new_cip,None) #Neagtive Test Case
694 log.info('Getting DHCP server Up.')
695# self.activate_apps(self.dhcp_app)
696 onos_ctrl = OnosCtrl(self.dhcp_app)
697 status, _ = onos_ctrl.activate()
698 assert_equal(status, True)
699 time.sleep(3)
700 for i in range(0,4):
701 log.info("Sending DHCP Request after DHCP server is up.")
702 log.info('')
703 new_cip, new_sip = self.dhcp.only_request(cip, mac)
704 if new_cip == None and new_sip == None:
705 log.info('')
706 log.info("DHCP Request timed out.")
707 elif new_cip and new_sip:
708 log.info("Got Reply from DHCP server.")
709 assert_equal(new_cip,None) #Neagtive Test Case
710
711 def dhcp_client_rebind_scenario(self, subscriber):
712 if subscriber.has_service('DHCP'):
713 time.sleep(2)
714 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
715 tl = self.subscriber_dhcp_client_rebind_time()
716 self.test_status = True
717 return self.test_status
718
719 def subscriber_dhcp_client_rebind_time(self, iface = INTF_RX_DEFAULT):
720 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
721 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
722 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
723 self.onos_dhcp_table_load(config)
724 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
725 cip, sip, mac, lval = self.dhcp.only_discover()
726 log.info('Got dhcp client IP %s from server %s for mac %s .' %
727 (cip, sip, mac) )
728 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
729 if (cip == None and mac != None):
730 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
731 assert_not_equal(cip, None)
732 elif cip and sip and mac:
733 log.info("Triggering DHCP Request.")
734 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
735 if new_cip and new_sip and lval:
736 log.info("Client 's Rebind time is :%s",lval)
737 log.info("Generating delay till rebind time.")
738 time.sleep(lval)
739 log.info("Client Sending broadcast DHCP requests for renewing lease or for getting new ip.")
740 self.dhcp.after_T2 = True
741 for i in range(0,4):
742 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
743 if latest_cip and latest_sip:
744 log.info("Got DHCP Ack. Lease Renewed for ip %s and mac %s from server %s." %
745 (latest_cip, mac, latest_sip) )
746 break
747 elif latest_cip == None:
748 log.info("Got DHCP NAK. Lease not renewed.")
749 assert_not_equal(latest_cip, None)
750 elif new_cip == None or new_sip == None or lval == None:
751 log.info("Got DHCP NAK.Lease not Renewed.")
752
753 def dhcp_starvation_scenario(self, subscriber):
754 if subscriber.has_service('DHCP'):
755 time.sleep(2)
756 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
757 tl = self.subscriber_dhcp_starvation()
758 self.test_status = True
759 return self.test_status
760
761
762 def subscriber_dhcp_starvation(self, iface = INTF_RX_DEFAULT):
763 '''DHCP starve'''
764 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
765 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
766 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
767 self.onos_dhcp_table_load(config)
768 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
769 log.info('Verifying 1 ')
770 for x in xrange(50):
771 mac = RandMAC()._fix()
772 self.send_recv(mac = mac)
773 log.info('Verifying 2 ')
774 cip, sip = self.send_recv(update_seed = True, validate = False)
775 assert_equal(cip, None)
776 assert_equal(sip, None)
777
778 def dhcp_same_client_multi_discovers_scenario(self, subscriber):
779 if subscriber.has_service('DHCP'):
780 time.sleep(2)
781 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
782 tl = self.subscriber_dhcp_same_client_multiple_discover()
783 self.test_status = True
784 return self.test_status
785
786
787 def subscriber_dhcp_same_client_multiple_discover(self, iface = INTF_RX_DEFAULT):
788 ''' DHCP Client sending multiple discover . '''
789 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
790 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
791 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
792 self.onos_dhcp_table_load(config)
793 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
794 cip, sip, mac, lval = self.dhcp.only_discover()
795 log.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
796 (cip, sip, mac) )
797 log.info('Triggering DHCP discover again.')
798 new_cip, new_sip, new_mac , lval = self.dhcp.only_discover()
799 if cip == new_cip:
800 log.info('Got same ip for 2nd DHCP discover for client IP %s from server %s for mac %s. Triggering DHCP Request. '
801 % (new_cip, new_sip, new_mac) )
802 elif cip != new_cip:
803 log.info('Ip after 1st discover %s' %cip)
804 log.info('Map after 2nd discover %s' %new_cip)
805 assert_equal(cip, new_cip)
806
807 def dhcp_same_client_multi_request_scenario(self, subscriber):
808 if subscriber.has_service('DHCP'):
809 time.sleep(2)
810 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
811 tl = self.subscriber_dhcp_same_client_multiple_request()
812 self.test_status = True
813 return self.test_status
814
815 def subscriber_dhcp_same_client_multiple_request(self, iface = INTF_RX_DEFAULT):
816 ''' DHCP Client sending multiple repeat DHCP requests. '''
817 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
818 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
819 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
820 self.onos_dhcp_table_load(config)
821 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
822 log.info('Sending DHCP discover and DHCP request.')
823 cip, sip = self.send_recv()
824 mac = self.dhcp.get_mac(cip)[0]
825 log.info("Sending DHCP request again.")
826 new_cip, new_sip = self.dhcp.only_request(cip, mac)
827 if (new_cip,new_sip) == (cip,sip):
828 log.info('Got same ip for 2nd DHCP Request for client IP %s from server %s for mac %s.'
829 % (new_cip, new_sip, mac) )
830 elif (new_cip,new_sip):
831 log.info('No DHCP ACK')
832 assert_equal(new_cip, None)
833 assert_equal(new_sip, None)
834 else:
835 print "Something went wrong."
836
837
838 def dhcp_client_desired_ip_scenario(self, subscriber):
839 if subscriber.has_service('DHCP'):
840 time.sleep(2)
841 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
842 tl = self.subscriber_dhcp_client_desired_address()
843 self.test_status = True
844 return self.test_status
845
846 def subscriber_dhcp_client_desired_address(self, iface = INTF_RX_DEFAULT):
847 '''DHCP Client asking for desired IP address.'''
848 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
849 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
850 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
851 self.onos_dhcp_table_load(config)
852 self.dhcp = DHCPTest(seed_ip = '20.20.20.31', iface = iface)
853 cip, sip, mac , lval = self.dhcp.only_discover(desired = True)
854 log.info('Got dhcp client IP %s from server %s for mac %s .' %
855 (cip, sip, mac) )
856 if cip == self.dhcp.seed_ip:
857 log.info('Got dhcp client IP %s from server %s for mac %s as desired .' %
858 (cip, sip, mac) )
859 elif cip != self.dhcp.seed_ip:
860 log.info('Got dhcp client IP %s from server %s for mac %s .' %
861 (cip, sip, mac) )
862 log.info('The desired ip was: %s .' % self.dhcp.seed_ip)
863 assert_equal(cip, self.dhcp.seed_ip)
864
865 def dhcp_client_request_pkt_with_non_offered_ip_scenario(self, subscriber):
866 if subscriber.has_service('DHCP'):
867 time.sleep(2)
868 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
869 tl = self.subscriber_dhcp_server_nak_packet()
870 self.test_status = True
871 return self.test_status
872
873 def subscriber_dhcp_server_nak_packet(self, iface = INTF_RX_DEFAULT):
874 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
875 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
876 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
877 self.onos_dhcp_table_load(config)
878 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
879 cip, sip, mac, lval = self.dhcp.only_discover()
880 log.info('Got dhcp client IP %s from server %s for mac %s .' %
881 (cip, sip, mac) )
882 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
883 if (cip == None and mac != None):
884 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
885 assert_not_equal(cip, None)
886 else:
887 new_cip, new_sip = self.dhcp.only_request('20.20.20.31', mac)
888 if new_cip == None:
889 log.info("Got DHCP server NAK.")
890 assert_equal(new_cip, None) #Negative Test Case
891
892 def dhcp_client_requested_out_pool_ip_scenario(self, subscriber):
893 if subscriber.has_service('DHCP'):
894 time.sleep(2)
895 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
896 tl = self.subscriber_dhcp_client_desired_address_out_of_pool()
897 self.test_status = True
898 return self.test_status
899
900
901 def subscriber_dhcp_client_desired_address_out_of_pool(self, iface = INTF_RX_DEFAULT):
902 '''DHCP Client asking for desired IP address from out of pool.'''
903 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
904 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
905 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
906 self.onos_dhcp_table_load(config)
907 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
908 cip, sip, mac, lval = self.dhcp.only_discover(desired = True)
909 log.info('Got dhcp client IP %s from server %s for mac %s .' %
910 (cip, sip, mac) )
911 if cip == self.dhcp.seed_ip:
912 log.info('Got dhcp client IP %s from server %s for mac %s as desired .' %
913 (cip, sip, mac) )
914 assert_equal(cip, self.dhcp.seed_ip) #Negative Test Case
915
916 elif cip != self.dhcp.seed_ip:
917 log.info('Got dhcp client IP %s from server %s for mac %s .' %
918 (cip, sip, mac) )
919 log.info('The desired ip was: %s .' % self.dhcp.seed_ip)
920 assert_not_equal(cip, self.dhcp.seed_ip)
921
922 elif cip == None:
923 log.info('Got DHCP NAK')
924
925
926 def dhcp_client_specific_lease_scenario(self, subscriber):
927 if subscriber.has_service('DHCP'):
928 time.sleep(2)
929 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
930 tl = self.subscriber_dhcp_specific_lease_packet()
931 self.test_status = True
932 return self.test_status
933
934 def subscriber_dhcp_specific_lease_packet(self, iface = INTF_RX_DEFAULT):
935 ''' Client sends DHCP Discover packet for particular lease time.'''
936 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
937 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
938 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
939 self.onos_dhcp_table_load(config)
940 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
941 log.info('Sending DHCP discover with lease time of 700')
942 cip, sip, mac, lval = self.dhcp.only_discover(lease_time = True)
943
944 log.info("Verifying Client 's IP and mac in DHCP Offer packet.")
945 if (cip == None and mac != None):
946 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
947 assert_not_equal(cip, None)
948 elif lval != 700:
949 log.info('Getting dhcp client IP %s from server %s for mac %s with lease time %s. That is not 700.' %
950 (cip, sip, mac, lval) )
951 assert_not_equal(lval, 700)
952
953 def test_subscriber_join_recv_channel(self):
954 ###"""Test subscriber join and receive"""
955 num_subscribers = 1
Chetan Gaonker3d163852016-03-28 12:20:25 -0700956 num_channels = 1
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700957 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700958 num_channels = num_channels,
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700959 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700960 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700961 assert_equal(test_status, True)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800962
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700963 def test_subscriber_join_jump_channel(self):
964 ###"""Test subscriber join and receive for channel surfing"""
965 num_subscribers = 1
966 num_channels = 1
967 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700968 num_channels = num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700969 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700970 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700971 assert_equal(test_status, True)
Chetan Gaonker4b959fc2016-03-09 19:20:16 -0800972
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700973 def test_subscriber_join_next_channel(self):
974 ###"""Test subscriber join next for channels"""
975 num_subscribers = 1
976 num_channels = 1
977 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700978 num_channels = num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700979 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700980 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700981 assert_equal(test_status, True)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700982
983 #@deferred(SUBSCRIBER_TIMEOUT)
984 def test_subscriber_authentication_with_invalid_certificate_and_channel_surfing(self):
985 ### """Test subscriber to auth with invalidCertification and join channel"""
986 num_subscribers = 1
987 num_channels = 1
988 df = defer.Deferred()
989 def sub_auth_invalid_cert(df):
990 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
991 num_channels = num_channels,
992 cbs = (self.tls_invalid_cert, self.dhcp_verify, self.igmp_verify),
993 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
994 assert_equal(test_status, False)
995 df.callback(0)
996 reactor.callLater(0, sub_auth_invalid_cert, df)
997 return df
998
999
1000 #@deferred(SUBSCRIBER_TIMEOUT)
1001 def test_subscriber_authentication_with_no_certificate_and_channel_surfing(self):
1002 ### """Test subscriber to auth with No Certification and join channel"""
1003 num_subscribers = 1
1004 num_channels = 1
1005 df = defer.Deferred()
1006 def sub_auth_no_cert(df):
1007 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1008 num_channels = num_channels,
1009 cbs = (self.tls_no_cert, self.dhcp_verify, self.igmp_verify),
1010 port_list = self.generate_port_list(num_subscribers, num_channels),
1011 negative_subscriber_auth = 'all')
1012 assert_equal(test_status, False)
1013 df.callback(0)
1014 reactor.callLater(0, sub_auth_no_cert, df)
1015 return df
1016
1017 def test_subscriber_authentication_with_self_signed_certificate_and_channel_surfing(self):
1018 ### """Test subscriber to auth with Self Signed Certification and join channel"""
1019 num_subscribers = 1
1020 num_channels = 1
1021 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1022 num_channels = num_channels,
1023 cbs = (self.tls_self_signed_cert, self.dhcp_verify, self.igmp_verify),
1024 port_list = self.generate_port_list(num_subscribers, num_channels),
1025 negative_subscriber_auth = 'all')
1026 assert_equal(test_status, True)
1027
1028 def test_subscriber_authentication_with_dhcp_discover_and_channel_surfing(self):
1029 ### """Test subscriber auth success, DHCP re-discover with DHCP server and join channel"""
1030 num_subscribers = 1
1031 num_channels = 1
1032 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1033 num_channels = num_channels,
1034 cbs = (self.tls_verify, self.dhcp_discover_scenario, self.igmp_verify),
1035 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1036 assert_equal(test_status, True)
1037
1038 def test_subscriber_authentication_with_dhcp_client_reboot_scenario_and_channel_surfing(self):
1039 ### """Test subscriber auth success, DHCP client got re-booted and join channel"""
1040 num_subscribers = 1
1041 num_channels = 1
1042 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1043 num_channels = num_channels,
1044 cbs = (self.tls_verify, self.dhcp_client_reboot_scenario, self.igmp_verify),
1045 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1046 assert_equal(test_status, True)
1047
1048 def test_subscriber_authentication_with_dhcp_server_reboot_scenario_and_channel_surfing(self):
1049 ### """Test subscriber auth , DHCP server re-boot during DHCP process and join channel"""
1050 num_subscribers = 1
1051 num_channels = 1
1052 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1053 num_channels = num_channels,
1054 cbs = (self.tls_verify, self.dhcp_server_reboot_scenario, self.igmp_verify),
1055 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1056 assert_equal(test_status, True)
1057
1058 def test_subscriber_authentication_with_dhcp_client_rebind_and_channel_surfing(self):
1059 ### """Test subscriber auth , DHCP client rebind IP and join channel"""
1060 num_subscribers = 1
1061 num_channels = 1
1062 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1063 num_channels = num_channels,
1064 cbs = (self.tls_verify, self.dhcp_client_rebind_scenario, self.igmp_verify),
1065 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1066 assert_equal(test_status, True)
1067
1068
1069 def test_subscriber_authentication_with_dhcp_starvation_scenario_and_channel_surfing(self):
1070 ### """Test subscriber auth , DHCP starvation and join channel"""
1071 num_subscribers = 1
1072 num_channels = 1
1073 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1074 num_channels = num_channels,
1075 cbs = (self.tls_verify, self.dhcp_starvation_scenario, self.igmp_verify),
1076 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1077 assert_equal(test_status, True)
1078
1079 def test_subscriber_authentication_with_multiple_dhcp_discover_for_same_subscriber_and_channel_surfing(self):
1080 ### """Test subscriber auth , sending same DHCP client discover multiple times and join channel"""
1081 num_subscribers = 1
1082 num_channels = 1
1083 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1084 num_channels = num_channels,
1085 cbs = (self.tls_verify, self.dhcp_same_client_multi_discovers_scenario, self.igmp_verify),
1086 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1087 assert_equal(test_status, True)
1088
1089 def test_subscriber_authentication_with_multiple_dhcp_request_for_same_subscriber_and_channel_surfing(self):
1090 ### """Test subscriber auth , same DHCP client multiple requerts times and join channel"""
1091 num_subscribers = 1
1092 num_channels = 1
1093 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1094 num_channels = num_channels,
1095 cbs = (self.tls_verify, self.dhcp_same_client_multi_request_scenario, self.igmp_verify),
1096 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1097 assert_equal(test_status, True)
1098
1099 def test_subscriber_authentication_with_dhcp_client_requested_ip_and_channel_surfing(self):
1100 ### """Test subscriber auth with DHCP client requesting ip and join channel"""
1101 num_subscribers = 1
1102 num_channels = 1
1103 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1104 num_channels = num_channels,
1105 cbs = (self.tls_verify, self.dhcp_client_desired_ip_scenario, self.igmp_verify),
1106 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1107 assert_equal(test_status, True)
1108
1109 def test_subscriber_authentication_with_dhcp_non_offered_ip_and_channel_surfing(self):
1110 ### """Test subscriber auth with DHCP client request for non-offered ip and join channel"""
1111 num_subscribers = 1
1112 num_channels = 1
1113 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1114 num_channels = num_channels,
1115 cbs = (self.tls_verify, self.dhcp_client_request_pkt_with_non_offered_ip_scenario, self.igmp_verify),
1116 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1117 assert_equal(test_status, True)
1118
1119 def test_subscriber_authentication_with_dhcp_request_out_of_pool_ip_by_client_and_channel_surfing(self):
1120 ### """Test subscriber auth with DHCP client requesting out of pool ip and join channel"""
1121 num_subscribers = 1
1122 num_channels = 1
1123 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1124 num_channels = num_channels,
1125 cbs = (self.tls_verify, self.dhcp_client_requested_out_pool_ip_scenario, self.igmp_verify),
1126 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1127 assert_equal(test_status, True)
1128
1129 def test_subscriber_authentication_with_dhcp_specified_lease_time_functionality_and_channel_surfing(self):
1130 ### """Test subscriber auth with DHCP client specifying lease time and join channel"""
1131 num_subscribers = 1
1132 num_channels = 1
1133 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1134 num_channels = num_channels,
1135 cbs = (self.tls_verify, self.dhcp_client_specific_lease_scenario, self.igmp_verify),
1136 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1137 assert_equal(test_status, True)
ChetanGaonker5b984cb2016-07-12 15:50:49 -07001138
1139
1140 def test_subscriber_join_recv_100channels(self):
1141 num_subscribers = 1
1142 num_channels = 100
1143 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1144 num_channels = num_channels,
1145 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1146 port_list = self.generate_port_list(num_subscribers, num_channels),
1147 negative_subscriber_auth = 'all')
1148 assert_equal(test_status, True)
1149
1150 def test_subscriber_join_recv_400channels(self):
1151 num_subscribers = 1
1152 num_channels = 400
1153 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1154 num_channels = num_channels,
1155 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1156 port_list = self.generate_port_list(num_subscribers, num_channels),
1157 negative_subscriber_auth = 'all')
1158 assert_equal(test_status, True)
1159
1160 def test_subscriber_join_recv_800channels(self):
1161 num_subscribers = 1
1162 num_channels = 800
1163 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1164 num_channels = num_channels,
1165 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1166 port_list = self.generate_port_list(num_subscribers, num_channels),
1167 negative_subscriber_auth = 'all')
1168 assert_equal(test_status, True)
1169
1170 def test_subscriber_join_recv_1200channels(self):
1171 num_subscribers = 1
1172 num_channels = 1200
1173 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1174 num_channels = num_channels,
1175 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1176 port_list = self.generate_port_list(num_subscribers, num_channels),
1177 negative_subscriber_auth = 'all')
1178 assert_equal(test_status, True)
1179
1180 def test_subscriber_join_recv_1500channels(self):
1181 num_subscribers = 1
1182 num_channels = 1500
1183 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1184 num_channels = num_channels,
1185 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1186 port_list = self.generate_port_list(num_subscribers, num_channels),
1187 negative_subscriber_auth = 'all')
1188 assert_equal(test_status, True)
1189
1190 def test_subscriber_join_jump_100channels(self):
1191 num_subscribers = 1
1192 num_channels = 100
1193 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1194 num_channels = num_channels,
1195 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1196 port_list = self.generate_port_list(num_subscribers, num_channels),
1197 negative_subscriber_auth = 'all')
1198 assert_equal(test_status, True)
1199 def test_subscriber_join_jump_400channels(self):
1200 num_subscribers = 1
1201 num_channels = 400
1202 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1203 num_channels = num_channels,
1204 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1205 port_list = self.generate_port_list(num_subscribers, num_channels),
1206 negative_subscriber_auth = 'all')
1207 assert_equal(test_status, True)
1208 def test_subscriber_join_jump_800channels(self):
1209 num_subscribers = 1
1210 num_channels = 800
1211 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1212 num_channels = num_channels,
1213 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1214 port_list = self.generate_port_list(num_subscribers, num_channels),
1215 negative_subscriber_auth = 'all')
1216 assert_equal(test_status, True)
1217 def test_subscriber_join_jump_1200channel(sself):
1218 num_subscribers = 1
1219 num_channels = 1200
1220 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1221 num_channels = num_channels,
1222 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1223 port_list = self.generate_port_list(num_subscribers, num_channels),
1224 negative_subscriber_auth = 'all')
1225 assert_equal(test_status, True)
1226 def test_subscriber_join_jump_1500channels(self):
1227 num_subscribers = 1
1228 num_channels = 1500
1229 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1230 num_channels = num_channels,
1231 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1232 port_list = self.generate_port_list(num_subscribers, num_channels),
1233 negative_subscriber_auth = 'all')
1234 assert_equal(test_status, True)
1235
1236 def test_subscriber_join_next_100channels(self):
1237 num_subscribers = 1
1238 num_channels = 100
1239 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1240 num_channels = num_channels,
1241 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1242 port_list = self.generate_port_list(num_subscribers, num_channels),
1243 negative_subscriber_auth = 'all')
1244 assert_equal(test_status, True)
1245
1246 def test_subscriber_join_next_400channels(self):
1247 num_subscribers = 1
1248 num_channels = 400
1249 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1250 num_channels = num_channels,
1251 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1252 port_list = self.generate_port_list(num_subscribers, num_channels),
1253 negative_subscriber_auth = 'all')
1254 assert_equal(test_status, True)
1255
1256 def test_subscriber_join_next_800channels(self):
1257 num_subscribers = 1
1258 num_channels = 800
1259 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1260 num_channels = num_channels,
1261 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1262 port_list = self.generate_port_list(num_subscribers, num_channels),
1263 negative_subscriber_auth = 'all')
1264 assert_equal(test_status, True)
1265
1266
1267 def test_subscriber_join_next_1200channels(self):
1268 num_subscribers = 1
1269 num_channels = 1200
1270 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1271 num_channels = num_channels,
1272 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1273 port_list = self.generate_port_list(num_subscribers, num_channels),
1274 negative_subscriber_auth = 'all')
1275 assert_equal(test_status, True)
1276
1277 def test_subscriber_join_next_1500channels(self):
1278 num_subscribers = 1
1279 num_channels = 1500
1280 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1281 num_channels = num_channels,
1282 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1283 port_list = self.generate_port_list(num_subscribers, num_channels),
1284 negative_subscriber_auth = 'all')
1285 assert_equal(test_status, True)