blob: 438791ae0a2df7f85e09e992ea7f4040700c24d4 [file] [log] [blame]
Matteo Scandolo48d3d2d2017-08-08 13:05:27 -07001
2# Copyright 2017-present Open Networking Foundation
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
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# 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
16
ChetanGaonkereff07bc2016-06-09 16:39:23 -070017#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070018# Copyright 2016-present Ciena Corporation
19#
20# Licensed under the Apache License, Version 2.0 (the "License");
21# you may not use this file except in compliance with the License.
22# You may obtain a copy of the License at
ChetanGaonkereff07bc2016-06-09 16:39:23 -070023#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070024# http://www.apache.org/licenses/LICENSE-2.0
ChetanGaonkereff07bc2016-06-09 16:39:23 -070025#
Chetan Gaonkercfcce782016-05-10 10:10:42 -070026# Unless required by applicable law or agreed to in writing, software
27# distributed under the License is distributed on an "AS IS" BASIS,
28# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29# See the License for the specific language governing permissions and
30# limitations under the License.
31#
Chetan Gaonkercbe79642016-03-09 17:45:58 -080032import unittest
33from nose.tools import *
34from nose.twistedtools import reactor, deferred
35from twisted.internet import defer
Chetan Gaonkercbe79642016-03-09 17:45:58 -080036import time, monotonic
37import os, sys
38import tempfile
39import random
40import threading
41from Stats import Stats
42from OnosCtrl import OnosCtrl
43from DHCP import DHCPTest
44from EapTLS import TLSAuthTest
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -070045from Channels import Channels, IgmpChannel
Chetan Gaonker41d2e072016-03-15 16:41:31 -070046from subscriberDb import SubscriberDB
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -070047from threadPool import ThreadPool
ChetanGaonkereff07bc2016-06-09 16:39:23 -070048from portmaps import g_subscriber_port_map
Chetan Gaonker7997bb42016-03-28 09:46:15 -070049from OltConfig import *
ChetanGaonkereff07bc2016-06-09 16:39:23 -070050from CordContainer import *
A R Karthick9313b762016-11-07 13:14:35 -080051from CordTestServer import cord_test_radius_restart
52from CordLogger import CordLogger
A R Karthick76a497a2017-04-12 10:59:39 -070053from CordTestUtils import log_test as log
ChetanGaonkereff07bc2016-06-09 16:39:23 -070054import copy
Chetan Gaonkercbe79642016-03-09 17:45:58 -080055log.setLevel('INFO')
ChetanGaonkereff07bc2016-06-09 16:39:23 -070056DEFAULT_NO_CHANNELS = 1
Chetan Gaonkercbe79642016-03-09 17:45:58 -080057
58class Subscriber(Channels):
Chetan Gaonker7997bb42016-03-28 09:46:15 -070059 PORT_TX_DEFAULT = 2
60 PORT_RX_DEFAULT = 1
61 INTF_TX_DEFAULT = 'veth2'
62 INTF_RX_DEFAULT = 'veth0'
Chetan Gaonkercbe79642016-03-09 17:45:58 -080063 STATS_RX = 0
64 STATS_TX = 1
65 STATS_JOIN = 2
66 STATS_LEAVE = 3
Chetan Gaonker41d2e072016-03-15 16:41:31 -070067 SUBSCRIBER_SERVICES = 'DHCP IGMP TLS'
ChetanGaonkereff07bc2016-06-09 16:39:23 -070068
69
Chetan Gaonker7997bb42016-03-28 09:46:15 -070070 def __init__(self, name = 'sub', service = SUBSCRIBER_SERVICES, port_map = None,
71 num = 1, channel_start = 0,
72 tx_port = PORT_TX_DEFAULT, rx_port = PORT_RX_DEFAULT,
73 iface = INTF_RX_DEFAULT, iface_mcast = INTF_TX_DEFAULT,
Chetan Gaonkercbe79642016-03-09 17:45:58 -080074 mcast_cb = None, loginType = 'wireless'):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -070075 self.tx_port = tx_port
76 self.rx_port = rx_port
Chetan Gaonker7997bb42016-03-28 09:46:15 -070077 self.port_map = port_map or g_subscriber_port_map
78 try:
79 self.tx_intf = self.port_map[tx_port]
80 self.rx_intf = self.port_map[rx_port]
81 except:
Chetan Gaonker3d163852016-03-28 12:20:25 -070082 self.tx_intf = self.port_map[self.PORT_TX_DEFAULT]
83 self.rx_intf = self.port_map[self.PORT_RX_DEFAULT]
Chetan Gaonker7997bb42016-03-28 09:46:15 -070084
ChetanGaonkereff07bc2016-06-09 16:39:23 -070085 Channels.__init__(self, num, channel_start = channel_start,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -070086 iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
Chetan Gaonker41d2e072016-03-15 16:41:31 -070087 self.name = name
88 self.service = service
89 self.service_map = {}
90 services = self.service.strip().split(' ')
91 for s in services:
92 self.service_map[s] = True
Chetan Gaonkercbe79642016-03-09 17:45:58 -080093 self.loginType = loginType
94 ##start streaming channels
95 self.join_map = {}
96 ##accumulated join recv stats
97 self.join_rx_stats = Stats()
98
Chetan Gaonker41d2e072016-03-15 16:41:31 -070099 def has_service(self, service):
100 if self.service_map.has_key(service):
101 return self.service_map[service]
102 if self.service_map.has_key(service.upper()):
103 return self.service_map[service.upper()]
104 return False
105
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800106 def channel_join_update(self, chan, join_time):
107 self.join_map[chan] = ( Stats(), Stats(), Stats(), Stats() )
108 self.channel_update(chan, self.STATS_JOIN, 1, t = join_time)
109
110 def channel_join(self, chan = 0, delay = 2):
111 '''Join a channel and create a send/recv stats map'''
112 if self.join_map.has_key(chan):
113 del self.join_map[chan]
114 self.delay = delay
115 chan, join_time = self.join(chan)
116 self.channel_join_update(chan, join_time)
117 return chan
118
119 def channel_join_next(self, delay = 2):
120 '''Joins the next channel leaving the last channel'''
121 if self.last_chan:
122 if self.join_map.has_key(self.last_chan):
123 del self.join_map[self.last_chan]
124 self.delay = delay
125 chan, join_time = self.join_next()
126 self.channel_join_update(chan, join_time)
127 return chan
128
129 def channel_jump(self, delay = 2):
130 '''Jumps randomly to the next channel leaving the last channel'''
Chetan Gaonker4a82bae2016-05-19 17:35:30 -0700131 log.info("Jumps randomly to the next channel leaving the last channel")
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800132 if self.last_chan is not None:
133 if self.join_map.has_key(self.last_chan):
134 del self.join_map[self.last_chan]
135 self.delay = delay
136 chan, join_time = self.jump()
137 self.channel_join_update(chan, join_time)
138 return chan
139
140 def channel_leave(self, chan = 0):
141 if self.join_map.has_key(chan):
142 del self.join_map[chan]
143 self.leave(chan)
144
145 def channel_update(self, chan, stats_type, packets, t=0):
146 if type(chan) == type(0):
147 chan_list = (chan,)
148 else:
149 chan_list = chan
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700150 for c in chan_list:
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800151 if self.join_map.has_key(c):
152 self.join_map[c][stats_type].update(packets = packets, t = t)
153
154 def channel_receive(self, chan, cb = None, count = 1):
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700155 log.info('Subscriber %s receiving from group %s, channel %d' %(self.name, self.gaddr(chan), chan))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800156 self.recv(chan, cb = cb, count = count)
157
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700158 def recv_channel_cb(self, pkt):
159 ##First verify that we have received the packet for the joined instance
160 log.debug('Packet received for group %s, subscriber %s' %(pkt[IP].dst, self.name))
161 chan = self.caddr(pkt[IP].dst)
162 assert_equal(chan in self.join_map.keys(), True)
163 recv_time = monotonic.monotonic() * 1000000
164 join_time = self.join_map[chan][self.STATS_JOIN].start
165 delta = recv_time - join_time
166 self.join_rx_stats.update(packets=1, t = delta, usecs = True)
167 self.channel_update(chan, self.STATS_RX, 1, t = delta)
168 log.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
169
170class subscriber_pool:
171
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700172 def __init__(self, subscriber, test_cbs, test_status):
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700173 self.subscriber = subscriber
174 self.test_cbs = test_cbs
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700175 self.test_status = test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700176
177 def pool_cb(self):
178 for cb in self.test_cbs:
179 if cb:
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700180 self.test_status = cb(self.subscriber)
181# cb(self.subscriber)
182 if self.test_status is not True:
183 log.info('This service is failed and other services will not run for this subscriber')
184 break
185 log.info('This Subscriber is tested for multiple service elgibility ')
186 self.test_status = True
187
A R Karthick9313b762016-11-07 13:14:35 -0800188class subscriber_exchange(CordLogger):
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800189
A.R Karthick95d044e2016-06-10 18:44:36 -0700190 apps = [ 'org.opencord.aaa', 'org.onosproject.dhcp' ]
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700191
192 dhcp_app = 'org.onosproject.dhcp'
193
A.R Karthick95d044e2016-06-10 18:44:36 -0700194 olt_apps = [ 'org.opencord.igmp', 'org.opencord.cordmcast' ]
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800195 dhcp_server_config = {
196 "ip": "10.1.11.50",
197 "mac": "ca:fe:ca:fe:ca:fe",
198 "subnet": "255.255.252.0",
199 "broadcast": "10.1.11.255",
200 "router": "10.1.8.1",
201 "domain": "8.8.8.8",
202 "ttl": "63",
203 "delay": "2",
204 "startip": "10.1.11.51",
205 "endip": "10.1.11.100"
206 }
207
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700208 aaa_loaded = False
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700209 INTF_TX_DEFAULT = 'veth2'
210 INTF_RX_DEFAULT = 'veth0'
211 SUBSCRIBER_TIMEOUT = 20
212
213 CLIENT_CERT = """-----BEGIN CERTIFICATE-----
214MIICuDCCAiGgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
215CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
216IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
217RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwNjA2MjExMjI3WhcN
218MTcwNjAxMjExMjI3WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
219BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
220hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
221gYEAwvXiSzb9LZ6c7uNziUfKvoHO7wu/uiFC5YUpXbmVGuGZizbVrny0xnR85Dfe
222+9R4diansfDhIhzOUl1XjN3YDeSS9OeF5YWNNE8XDhlz2d3rVzaN6hIhdotBkUjg
223rUewjTg5OFR31QEyG3v8xR3CLgiE9xQELjZbSA07pD79zuUCAwEAAaNPME0wEwYD
224VR0lBAwwCgYIKwYBBQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5l
225eGFtcGxlLmNvbS9leGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOBgQDAjkrY
2266tDChmKbvr8w6Du/t8vHjTCoCIocHTN0qzWOeb1YsAGX89+TrWIuO1dFyYd+Z0KC
227PDKB5j/ygml9Na+AklSYAVJIjvlzXKZrOaPmhZqDufi+rXWti/utVqY4VMW2+HKC
228nXp37qWeuFLGyR1519Y1d6F/5XzqmvbwURuEug==
229-----END CERTIFICATE-----"""
230
231 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
232MIIDvTCCAqWgAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMCVVMx
233CzAJBgNVBAgTAkNBMRIwEAYDVQQHEwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5h
234IEluYy4xHjAcBgkqhkiG9w0BCQEWD2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMd
235RXhhbXBsZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTYwMzExMTg1MzM2WhcN
236MTcwMzA2MTg1MzM2WjBnMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEzARBgNV
237BAoTCkNpZW5hIEluYy4xFzAVBgNVBAMUDnVzZXJAY2llbmEuY29tMR0wGwYJKoZI
238hvcNAQkBFg51c2VyQGNpZW5hLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
239AQoCggEBAOxemcBsPn9tZsCa5o2JA6sQDC7A6JgCNXXl2VFzKLNNvB9PS6D7ZBsQ
2405An0zEDMNzi51q7lnrYg1XyiE4S8FzMGAFr94RlGMQJUbRD9V/oqszMX4k++iAOK
241tIA1gr3x7Zi+0tkjVSVzXTmgNnhChAamdMsjYUG5+CY9WAicXyy+VEV3zTphZZDR
242OjcjEp4m/TSXVPYPgYDXI40YZKX5BdvqykWtT/tIgZb48RS1NPyN/XkCYzl3bv21
243qx7Mc0fcEbsJBIIRYTUkfxnsilcnmLxSYO+p+DZ9uBLBzcQt+4Rd5pLSfi21WM39
2442Z2oOi3vs/OYAPAqgmi2JWOv3mePa/8CAwEAAaNPME0wEwYDVR0lBAwwCgYIKwYB
245BQUHAwIwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL3d3dy5leGFtcGxlLmNvbS9l
246eGFtcGxlX2NhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEALBzMPDTIB6sLyPl0T6JV
247MjOkyldAVhXWiQsTjaGQGJUUe1cmUJyZbUZEc13MygXMPOM4x7z6VpXGuq1c/Vxn
248VzQ2fNnbJcIAHi/7G8W5/SQfPesIVDsHTEc4ZspPi5jlS/MVX3HOC+BDbOjdbwqP
249RX0JEr+uOyhjO+lRxG8ilMRACoBUbw1eDuVDoEBgErSUC44pq5ioDw2xelc+Y6hQ
250dmtYwfY0DbvwxHtA495frLyPcastDiT/zre7NL51MyUDPjjYjghNQEwvu66IKbQ3
251T1tJBrgI7/WI+dqhKBFolKGKTDWIHsZXQvZ1snGu/FRYzg1l+R/jT8cRB9BDwhUt
252yg==
253-----END CERTIFICATE-----'''
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700254
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800255 def setUp(self):
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700256 '''Load the OLT config and activate relevant apps'''
A R Karthick9313b762016-11-07 13:14:35 -0800257 super(subscriber_exchange, self).setUp()
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700258 self.olt = OltConfig()
A R Karthickb03cecd2016-07-27 10:27:55 -0700259 self.port_map, _ = self.olt.olt_port_map()
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700260 ##if no olt config, fall back to ovs port map
261 if not self.port_map:
262 self.port_map = g_subscriber_port_map
263 else:
264 log.info('Using OLT Port configuration for test setup')
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700265 log.info('Configuring CORD OLT access device information')
A R Karthick0f6b6842016-12-06 17:17:44 -0800266 OnosCtrl.cord_olt_config(self.olt)
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700267 self.activate_apps(self.olt_apps)
268
269 self.activate_apps(self.apps)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800270
A R Karthick9313b762016-11-07 13:14:35 -0800271 def tearDown(self):
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800272 '''Deactivate the dhcp app'''
A R Karthick9313b762016-11-07 13:14:35 -0800273 super(subscriber_exchange, self).tearDown()
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800274 for app in self.apps:
275 onos_ctrl = OnosCtrl(app)
276 onos_ctrl.deactivate()
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700277 log.info('Restarting the Radius container in the setup after running every subscriber test cases by default')
A R Karthick9313b762016-11-07 13:14:35 -0800278 cord_test_radius_restart()
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700279 #os.system('ifconfig '+INTF_RX_DEFAULT+' up')
280
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700281 def activate_apps(self, apps):
Chetan Gaonker735495f2016-05-10 14:51:16 -0700282 for app in apps:
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700283 onos_ctrl = OnosCtrl(app)
284 status, _ = onos_ctrl.activate()
285 assert_equal(status, True)
286 time.sleep(2)
287
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800288 def onos_aaa_load(self):
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700289 if self.aaa_loaded:
290 return
A.R Karthicka6c88fd2017-03-13 09:29:41 -0700291 aaa_dict = {'apps' : { 'org.opencord.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
292 'radiusIp': '172.17.0.2' } } } }
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800293 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
A.R Karthicka6c88fd2017-03-13 09:29:41 -0700294 aaa_dict['apps']['org.opencord.aaa']['AAA']['radiusIp'] = radius_ip
295 self.onos_load_config('org.opencord.aaa', aaa_dict)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700296 self.aaa_loaded = True
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800297
298 def onos_dhcp_table_load(self, config = None):
299 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
300 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
301 if config:
302 for k in config.keys():
303 if dhcp_config.has_key(k):
304 dhcp_config[k] = config[k]
305 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
306
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700307 def send_recv(self, mac = None, update_seed = False, validate = True):
308 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
309 if validate:
310 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' %
313 (cip, sip, self.dhcp.get_mac(cip)[0]))
314 return cip,sip
315
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800316 def onos_load_config(self, app, config):
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700317 status, code = OnosCtrl.config(config)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800318 if status is False:
319 log.info('JSON config request for app %s returned status %d' %(app, code))
320 assert_equal(status, True)
321 time.sleep(2)
322
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700323 def dhcp_sndrcv(self, dhcp, update_seed = False):
324 cip, sip = dhcp.discover(update_seed = update_seed)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800325 assert_not_equal(cip, None)
326 assert_not_equal(sip, None)
327 log.info('Got dhcp client IP %s from server %s for mac %s' %
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700328 (cip, sip, dhcp.get_mac(cip)[0]))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800329 return cip,sip
330
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700331 def dhcp_request(self, subscriber, seed_ip = '10.10.10.1', update_seed = False):
Chetan Gaonker00971202016-03-23 15:11:12 -0700332 config = {'startip':'10.10.10.20', 'endip':'10.10.10.200',
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800333 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
334 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
335 self.onos_dhcp_table_load(config)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700336 dhcp = DHCPTest(seed_ip = seed_ip, iface = subscriber.iface)
337 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800338 return cip, sip
339
340 def recv_channel_cb(self, pkt):
341 ##First verify that we have received the packet for the joined instance
342 chan = self.subscriber.caddr(pkt[IP].dst)
343 assert_equal(chan in self.subscriber.join_map.keys(), True)
344 recv_time = monotonic.monotonic() * 1000000
345 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
346 delta = recv_time - join_time
347 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
348 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700349 log.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800350 self.test_status = True
351
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700352 def tls_verify(self, subscriber):
353 if subscriber.has_service('TLS'):
354 time.sleep(2)
355 tls = TLSAuthTest()
356 log.info('Running subscriber %s tls auth test' %subscriber.name)
357 tls.runTest()
358 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700359 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700360
361 def dhcp_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700362 cip, sip = self.dhcp_request(subscriber, update_seed = True)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700363 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
364 subscriber.src_list = [cip]
365 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700366 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700367
368 def dhcp_jump_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700369 cip, sip = self.dhcp_request(subscriber, seed_ip = '10.10.200.1')
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700370 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
371 subscriber.src_list = [cip]
372 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700373 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700374
375 def dhcp_next_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700376 cip, sip = self.dhcp_request(subscriber, seed_ip = '10.10.150.1')
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700377 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
378 subscriber.src_list = [cip]
379 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700380 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700381
382 def igmp_verify(self, subscriber):
383 chan = 0
384 if subscriber.has_service('IGMP'):
385 for i in range(5):
386 log.info('Joining channel %d for subscriber %s' %(chan, subscriber.name))
387 subscriber.channel_join(chan, delay = 0)
388 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
389 log.info('Leaving channel %d for subscriber %s' %(chan, subscriber.name))
390 subscriber.channel_leave(chan)
391 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700392 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 -0700393 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700394 return self.test_status
395
396 def igmp_verify_multiChannel(self, subscriber):
397 if subscriber.has_service('IGMP'):
398 for chan in range(DEFAULT_NO_CHANNELS):
399 log.info('Joining channel %d for subscriber %s' %(chan, subscriber.name))
400 subscriber.channel_join(chan, delay = 0)
401 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
402 log.info('Leaving channel %d for subscriber %s' %(chan, subscriber.name))
403 subscriber.channel_leave(chan)
404 time.sleep(3)
405 log.info('Interface %s Join RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name,subscriber.join_rx_stats))
406 self.test_status = True
407 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700408
409 def igmp_jump_verify(self, subscriber):
410 if subscriber.has_service('IGMP'):
411 for i in xrange(subscriber.num):
412 log.info('Subscriber %s jumping channel' %subscriber.name)
413 chan = subscriber.channel_jump(delay=0)
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 Jump 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
421 def igmp_next_verify(self, subscriber):
422 if subscriber.has_service('IGMP'):
423 for i in xrange(subscriber.num):
424 if i:
425 chan = subscriber.channel_join_next(delay=0)
426 else:
427 chan = subscriber.channel_join(i, delay=0)
428 log.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
429 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
430 log.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
431 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700432 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 -0700433 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700434 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700435
Chetan Gaonker3d163852016-03-28 12:20:25 -0700436 def generate_port_list(self, subscribers, channels):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700437 port_list = []
Chetan Gaonker3d163852016-03-28 12:20:25 -0700438 for i in xrange(subscribers):
439 if channels > 1:
440 rx_port = 2*i+1
441 tx_port = 2*i+2
442 else:
443 rx_port = Subscriber.PORT_RX_DEFAULT
444 tx_port = Subscriber.PORT_TX_DEFAULT
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700445 port_list.append((tx_port, rx_port))
446 return port_list
447
448 def subscriber_load(self, create = True, num = 10, num_channels = 1, channel_start = 0, port_list = []):
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700449 '''Load the subscriber from the database'''
450 self.subscriber_db = SubscriberDB(create = create)
451 if create is True:
452 self.subscriber_db.generate(num)
453 self.subscriber_info = self.subscriber_db.read(num)
454 self.subscriber_list = []
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700455 if not port_list:
Chetan Gaonker3d163852016-03-28 12:20:25 -0700456 port_list = self.generate_port_list(num, num_channels)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700457
458 index = 0
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700459 for info in self.subscriber_info:
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700460 self.subscriber_list.append(Subscriber(name=info['Name'],
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700461 service=info['Service'],
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700462 port_map = self.port_map,
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700463 num=num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700464 channel_start = channel_start,
465 tx_port = port_list[index][0],
466 rx_port = port_list[index][1]))
Chetan Gaonker3d163852016-03-28 12:20:25 -0700467 if num_channels > 1:
468 channel_start += num_channels
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700469 index += 1
470
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700471 #load the ssm list for all subscriber channels
472 igmpChannel = IgmpChannel()
473 ssm_groups = map(lambda sub: sub.channels, self.subscriber_list)
474 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
475 igmpChannel.igmp_load_ssm_config(ssm_list)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700476 #load the subscriber to mcast port map for cord
477 cord_port_map = {}
478 for sub in self.subscriber_list:
479 for chan in sub.channels:
480 cord_port_map[chan] = (sub.tx_port, sub.rx_port)
481
482 igmpChannel.cord_port_table_load(cord_port_map)
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700483
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700484 def subscriber_join_verify( self, num_subscribers = 10, num_channels = 1,
485 channel_start = 0, cbs = None, port_list = [], negative_subscriber_auth = None):
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800486 self.test_status = False
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700487 self.num_subscribers = num_subscribers
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700488 self.sub_loop_count = num_subscribers
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700489 self.subscriber_load(create = True, num = num_subscribers,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700490 num_channels = num_channels, channel_start = channel_start, port_list = port_list)
Chetan Gaonker55fc7882016-03-15 17:46:47 -0700491 self.onos_aaa_load()
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700492 self.thread_pool = ThreadPool(min(100, self.num_subscribers), queue_size=1, wait_timeout=1)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700493
494 if cbs and negative_subscriber_auth is None:
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700495 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700496 cbs_negative = cbs
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700497 for subscriber in self.subscriber_list:
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700498 subscriber.start()
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700499 if negative_subscriber_auth is 'half' and self.sub_loop_count%2 is not 0:
500 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
501 elif negative_subscriber_auth is 'onethird' and self.sub_loop_count%3 is not 0:
502 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
503 else:
504 cbs = cbs_negative
505 self.sub_loop_count = self.sub_loop_count - 1
506 pool_object = subscriber_pool(subscriber, cbs, self.test_status)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700507 self.thread_pool.addTask(pool_object.pool_cb)
508 self.thread_pool.cleanUpThreads()
509 for subscriber in self.subscriber_list:
510 subscriber.stop()
ChetanGaonker5b984cb2016-07-12 15:50:49 -0700511 print "self.test_status %s\n"%(self.test_status)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700512 return self.test_status
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800513
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700514 def tls_invalid_cert(self, subscriber):
515 if subscriber.has_service('TLS'):
516 time.sleep(2)
517 log.info('Running subscriber %s tls auth test' %subscriber.name)
518 tls = TLSAuthTest(client_cert = self.CLIENT_CERT_INVALID)
519 tls.runTest()
520 if tls.failTest == True:
521 self.test_status = False
522 return self.test_status
523
524 def tls_no_cert(self, subscriber):
525 if subscriber.has_service('TLS'):
526 time.sleep(2)
527 log.info('Running subscriber %s tls auth test' %subscriber.name)
528 tls = TLSAuthTest(client_cert = '')
529 tls.runTest()
530 if tls.failTest == True:
531 self.test_status = False
532 return self.test_status
533
534 def tls_self_signed_cert(self, subscriber):
535 if subscriber.has_service('TLS'):
536 time.sleep(2)
537 log.info('Running subscriber %s tls auth test' %subscriber.name)
538 tls = TLSAuthTest(client_cert = self.CLIENT_CERT)
539 tls.runTest()
540 if tls.failTest == False:
541 self.test_status = True
542 return self.test_status
543
544 def tls_Nsubscribers_use_same_valid_cert(self, subscriber):
545 if subscriber.has_service('TLS'):
546 time.sleep(2)
547 log.info('Running subscriber %s tls auth test' %subscriber.name)
548 num_users = 3
549 for i in xrange(num_users):
550 tls = TLSAuthTest(intf = 'veth{}'.format(i*2))
551 tls.runTest()
552 if tls.failTest == False:
553 self.test_status = True
554 return self.test_status
555
556 def dhcp_discover_scenario(self, subscriber):
557 if subscriber.has_service('DHCP'):
558 time.sleep(2)
559 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
560 t1 = self.subscriber_dhcp_1release()
561 self.test_status = True
562 return self.test_status
563
564 def subscriber_dhcp_1release(self, iface = INTF_RX_DEFAULT):
565 config = {'startip':'10.10.100.20', 'endip':'10.10.100.21',
566 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
567 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
568 self.onos_dhcp_table_load(config)
569 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
570 cip, sip = self.send_recv()
571 log.info('Releasing ip %s to server %s' %(cip, sip))
572 assert_equal(self.dhcp.release(cip), True)
573 log.info('Triggering DHCP discover again after release')
574 cip2, sip2 = self.send_recv(update_seed = True)
575 log.info('Verifying released IP was given back on rediscover')
576 assert_equal(cip, cip2)
577 log.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
578 assert_equal(self.dhcp.release(cip2), True)
579
580
581 def dhcp_client_reboot_scenario(self, subscriber):
582 if subscriber.has_service('DHCP'):
583 time.sleep(2)
584 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
585 tl = self.subscriber_dhcp_client_request_after_reboot()
586 self.test_status = True
587 return self.test_status
588
589 def subscriber_dhcp_client_request_after_reboot(self, iface = INTF_RX_DEFAULT):
590 #''' Client sends DHCP Request after reboot.'''
591
592 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
593 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
594 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
595 self.onos_dhcp_table_load(config)
596 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
597 cip, sip, mac, lval = self.dhcp.only_discover()
598 log.info('Got dhcp client IP %s from server %s for mac %s .' %
599 (cip, sip, mac) )
600
601 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
602
603 if (cip == None and mac != None):
604 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
605 assert_not_equal(cip, None)
606
607 else:
608 new_cip, new_sip = self.dhcp.only_request(cip, mac)
609 if new_cip == None:
610 log.info("Got DHCP server NAK.")
611 os.system('ifconfig '+iface+' down')
612 log.info('Client goes down.')
613 log.info('Delay for 5 seconds.')
614
615 time.sleep(5)
616
617 os.system('ifconfig '+iface+' up')
618 log.info('Client is up now.')
619
620 new_cip, new_sip = self.dhcp.only_request(cip, mac)
621 if new_cip == None:
622 log.info("Got DHCP server NAK.")
623 assert_not_equal(new_cip, None)
624 elif new_cip != None:
625 log.info("Got DHCP ACK.")
626
627
628 def dhcp_client_renew_scenario(self, subscriber):
629 if subscriber.has_service('DHCP'):
630 time.sleep(2)
631 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
632 tl = self.subscriber_dhcp_client_renew_time()
633 self.test_status = True
634 return self.test_status
635
636 def subscriber_dhcp_client_renew_time(self, iface = INTF_RX_DEFAULT):
637 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
638 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
639 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
640 self.onos_dhcp_table_load(config)
641 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
642 cip, sip, mac , lval = self.dhcp.only_discover()
643 log.info('Got dhcp client IP %s from server %s for mac %s .' %
644 (cip, sip, mac) )
645
646 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
647 if (cip == None and mac != None):
648 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
649 assert_not_equal(cip, None)
650 elif cip and sip and mac:
651 log.info("Triggering DHCP Request.")
652 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
653 if new_cip and new_sip and lval:
654 log.info("Client 's Renewal time is :%s",lval)
655 log.info("Generating delay till renewal time.")
656 time.sleep(lval)
657 log.info("Client Sending Unicast DHCP request.")
658 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
659 if latest_cip and latest_sip:
660 log.info("Got DHCP Ack. Lease Renewed for ip %s and mac %s from server %s." %
661 (latest_cip, mac, latest_sip) )
662
663 elif latest_cip == None:
664 log.info("Got DHCP NAK. Lease not renewed.")
665 elif new_cip == None or new_sip == None or lval == None:
666 log.info("Got DHCP NAK.")
667
668
669 def dhcp_server_reboot_scenario(self, subscriber):
670 if subscriber.has_service('DHCP'):
671 time.sleep(2)
672 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
673 tl = self.subscriber_dhcp_server_after_reboot()
674 self.test_status = True
675 return self.test_status
676
677 def subscriber_dhcp_server_after_reboot(self, iface = INTF_RX_DEFAULT):
678 ''' DHCP server goes down.'''
679 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
680 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
681 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
682 self.onos_dhcp_table_load(config)
683 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
684 cip, sip, mac, lval = self.dhcp.only_discover()
685 log.info('Got dhcp client IP %s from server %s for mac %s .' %
686 (cip, sip, mac) )
687 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
688 if (cip == None and mac != None):
689 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
690 assert_not_equal(cip, None)
691 else:
692 new_cip, new_sip = self.dhcp.only_request(cip, mac)
693 if new_cip == None:
694 log.info("Got DHCP server NAK.")
695 assert_not_equal(new_cip, None)
696 log.info('Getting DHCP server Down.')
697 onos_ctrl = OnosCtrl(self.dhcp_app)
698 onos_ctrl.deactivate()
699 for i in range(0,4):
700 log.info("Sending DHCP Request.")
701 log.info('')
702 new_cip, new_sip = self.dhcp.only_request(cip, mac)
703 if new_cip == None and new_sip == None:
704 log.info('')
705 log.info("DHCP Request timed out.")
706 elif new_cip and new_sip:
707 log.info("Got Reply from DHCP server.")
708 assert_equal(new_cip,None) #Neagtive Test Case
709 log.info('Getting DHCP server Up.')
710# self.activate_apps(self.dhcp_app)
711 onos_ctrl = OnosCtrl(self.dhcp_app)
712 status, _ = onos_ctrl.activate()
713 assert_equal(status, True)
714 time.sleep(3)
715 for i in range(0,4):
716 log.info("Sending DHCP Request after DHCP server is up.")
717 log.info('')
718 new_cip, new_sip = self.dhcp.only_request(cip, mac)
719 if new_cip == None and new_sip == None:
720 log.info('')
721 log.info("DHCP Request timed out.")
722 elif new_cip and new_sip:
723 log.info("Got Reply from DHCP server.")
724 assert_equal(new_cip,None) #Neagtive Test Case
725
726 def dhcp_client_rebind_scenario(self, subscriber):
727 if subscriber.has_service('DHCP'):
728 time.sleep(2)
729 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
730 tl = self.subscriber_dhcp_client_rebind_time()
731 self.test_status = True
732 return self.test_status
733
734 def subscriber_dhcp_client_rebind_time(self, iface = INTF_RX_DEFAULT):
735 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
736 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
737 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
738 self.onos_dhcp_table_load(config)
739 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
740 cip, sip, mac, lval = self.dhcp.only_discover()
741 log.info('Got dhcp client IP %s from server %s for mac %s .' %
742 (cip, sip, mac) )
743 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
744 if (cip == None and mac != None):
745 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
746 assert_not_equal(cip, None)
747 elif cip and sip and mac:
748 log.info("Triggering DHCP Request.")
749 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
750 if new_cip and new_sip and lval:
751 log.info("Client 's Rebind time is :%s",lval)
752 log.info("Generating delay till rebind time.")
753 time.sleep(lval)
754 log.info("Client Sending broadcast DHCP requests for renewing lease or for getting new ip.")
755 self.dhcp.after_T2 = True
756 for i in range(0,4):
757 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
758 if latest_cip and latest_sip:
759 log.info("Got DHCP Ack. Lease Renewed for ip %s and mac %s from server %s." %
760 (latest_cip, mac, latest_sip) )
761 break
762 elif latest_cip == None:
763 log.info("Got DHCP NAK. Lease not renewed.")
764 assert_not_equal(latest_cip, None)
765 elif new_cip == None or new_sip == None or lval == None:
766 log.info("Got DHCP NAK.Lease not Renewed.")
767
768 def dhcp_starvation_scenario(self, subscriber):
769 if subscriber.has_service('DHCP'):
770 time.sleep(2)
771 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
772 tl = self.subscriber_dhcp_starvation()
773 self.test_status = True
774 return self.test_status
775
776
777 def subscriber_dhcp_starvation(self, iface = INTF_RX_DEFAULT):
778 '''DHCP starve'''
779 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
780 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
781 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
782 self.onos_dhcp_table_load(config)
783 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
784 log.info('Verifying 1 ')
785 for x in xrange(50):
786 mac = RandMAC()._fix()
787 self.send_recv(mac = mac)
788 log.info('Verifying 2 ')
789 cip, sip = self.send_recv(update_seed = True, validate = False)
790 assert_equal(cip, None)
791 assert_equal(sip, None)
792
793 def dhcp_same_client_multi_discovers_scenario(self, subscriber):
794 if subscriber.has_service('DHCP'):
795 time.sleep(2)
796 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
797 tl = self.subscriber_dhcp_same_client_multiple_discover()
798 self.test_status = True
799 return self.test_status
800
801
802 def subscriber_dhcp_same_client_multiple_discover(self, iface = INTF_RX_DEFAULT):
803 ''' DHCP Client sending multiple discover . '''
804 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
805 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
806 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
807 self.onos_dhcp_table_load(config)
808 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
809 cip, sip, mac, lval = self.dhcp.only_discover()
810 log.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
811 (cip, sip, mac) )
812 log.info('Triggering DHCP discover again.')
813 new_cip, new_sip, new_mac , lval = self.dhcp.only_discover()
814 if cip == new_cip:
815 log.info('Got same ip for 2nd DHCP discover for client IP %s from server %s for mac %s. Triggering DHCP Request. '
816 % (new_cip, new_sip, new_mac) )
817 elif cip != new_cip:
818 log.info('Ip after 1st discover %s' %cip)
819 log.info('Map after 2nd discover %s' %new_cip)
820 assert_equal(cip, new_cip)
821
822 def dhcp_same_client_multi_request_scenario(self, subscriber):
823 if subscriber.has_service('DHCP'):
824 time.sleep(2)
825 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
826 tl = self.subscriber_dhcp_same_client_multiple_request()
827 self.test_status = True
828 return self.test_status
829
830 def subscriber_dhcp_same_client_multiple_request(self, iface = INTF_RX_DEFAULT):
831 ''' DHCP Client sending multiple repeat DHCP requests. '''
832 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
833 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
834 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
835 self.onos_dhcp_table_load(config)
836 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
837 log.info('Sending DHCP discover and DHCP request.')
838 cip, sip = self.send_recv()
839 mac = self.dhcp.get_mac(cip)[0]
840 log.info("Sending DHCP request again.")
841 new_cip, new_sip = self.dhcp.only_request(cip, mac)
842 if (new_cip,new_sip) == (cip,sip):
843 log.info('Got same ip for 2nd DHCP Request for client IP %s from server %s for mac %s.'
844 % (new_cip, new_sip, mac) )
845 elif (new_cip,new_sip):
846 log.info('No DHCP ACK')
847 assert_equal(new_cip, None)
848 assert_equal(new_sip, None)
849 else:
850 print "Something went wrong."
851
852
853 def dhcp_client_desired_ip_scenario(self, subscriber):
854 if subscriber.has_service('DHCP'):
855 time.sleep(2)
856 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
857 tl = self.subscriber_dhcp_client_desired_address()
858 self.test_status = True
859 return self.test_status
860
861 def subscriber_dhcp_client_desired_address(self, iface = INTF_RX_DEFAULT):
862 '''DHCP Client asking for desired IP address.'''
863 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
864 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
865 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
866 self.onos_dhcp_table_load(config)
867 self.dhcp = DHCPTest(seed_ip = '20.20.20.31', iface = iface)
868 cip, sip, mac , lval = self.dhcp.only_discover(desired = True)
869 log.info('Got dhcp client IP %s from server %s for mac %s .' %
870 (cip, sip, mac) )
871 if cip == self.dhcp.seed_ip:
872 log.info('Got dhcp client IP %s from server %s for mac %s as desired .' %
873 (cip, sip, mac) )
874 elif cip != self.dhcp.seed_ip:
875 log.info('Got dhcp client IP %s from server %s for mac %s .' %
876 (cip, sip, mac) )
877 log.info('The desired ip was: %s .' % self.dhcp.seed_ip)
878 assert_equal(cip, self.dhcp.seed_ip)
879
880 def dhcp_client_request_pkt_with_non_offered_ip_scenario(self, subscriber):
881 if subscriber.has_service('DHCP'):
882 time.sleep(2)
883 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
884 tl = self.subscriber_dhcp_server_nak_packet()
885 self.test_status = True
886 return self.test_status
887
888 def subscriber_dhcp_server_nak_packet(self, iface = INTF_RX_DEFAULT):
889 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
890 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
891 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
892 self.onos_dhcp_table_load(config)
893 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
894 cip, sip, mac, lval = self.dhcp.only_discover()
895 log.info('Got dhcp client IP %s from server %s for mac %s .' %
896 (cip, sip, mac) )
897 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
898 if (cip == None and mac != None):
899 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
900 assert_not_equal(cip, None)
901 else:
902 new_cip, new_sip = self.dhcp.only_request('20.20.20.31', mac)
903 if new_cip == None:
904 log.info("Got DHCP server NAK.")
905 assert_equal(new_cip, None) #Negative Test Case
906
907 def dhcp_client_requested_out_pool_ip_scenario(self, subscriber):
908 if subscriber.has_service('DHCP'):
909 time.sleep(2)
910 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
911 tl = self.subscriber_dhcp_client_desired_address_out_of_pool()
912 self.test_status = True
913 return self.test_status
914
915
916 def subscriber_dhcp_client_desired_address_out_of_pool(self, iface = INTF_RX_DEFAULT):
917 '''DHCP Client asking for desired IP address from out of pool.'''
918 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
919 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
920 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
921 self.onos_dhcp_table_load(config)
922 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
923 cip, sip, mac, lval = self.dhcp.only_discover(desired = True)
924 log.info('Got dhcp client IP %s from server %s for mac %s .' %
925 (cip, sip, mac) )
926 if cip == self.dhcp.seed_ip:
927 log.info('Got dhcp client IP %s from server %s for mac %s as desired .' %
928 (cip, sip, mac) )
929 assert_equal(cip, self.dhcp.seed_ip) #Negative Test Case
930
931 elif cip != self.dhcp.seed_ip:
932 log.info('Got dhcp client IP %s from server %s for mac %s .' %
933 (cip, sip, mac) )
934 log.info('The desired ip was: %s .' % self.dhcp.seed_ip)
935 assert_not_equal(cip, self.dhcp.seed_ip)
936
937 elif cip == None:
938 log.info('Got DHCP NAK')
939
940
941 def dhcp_client_specific_lease_scenario(self, subscriber):
942 if subscriber.has_service('DHCP'):
943 time.sleep(2)
944 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
945 tl = self.subscriber_dhcp_specific_lease_packet()
946 self.test_status = True
947 return self.test_status
948
949 def subscriber_dhcp_specific_lease_packet(self, iface = INTF_RX_DEFAULT):
950 ''' Client sends DHCP Discover packet for particular lease time.'''
951 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
952 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
953 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
954 self.onos_dhcp_table_load(config)
955 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
956 log.info('Sending DHCP discover with lease time of 700')
957 cip, sip, mac, lval = self.dhcp.only_discover(lease_time = True)
958
959 log.info("Verifying Client 's IP and mac in DHCP Offer packet.")
960 if (cip == None and mac != None):
961 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
962 assert_not_equal(cip, None)
963 elif lval != 700:
964 log.info('Getting dhcp client IP %s from server %s for mac %s with lease time %s. That is not 700.' %
965 (cip, sip, mac, lval) )
966 assert_not_equal(lval, 700)
967
968 def test_subscriber_join_recv_channel(self):
969 ###"""Test subscriber join and receive"""
970 num_subscribers = 1
Chetan Gaonker3d163852016-03-28 12:20:25 -0700971 num_channels = 1
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700972 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700973 num_channels = num_channels,
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700974 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700975 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700976 assert_equal(test_status, True)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800977
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700978 def test_subscriber_join_jump_channel(self):
979 ###"""Test subscriber join and receive for channel surfing"""
980 num_subscribers = 1
981 num_channels = 1
982 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700983 num_channels = num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700984 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700985 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700986 assert_equal(test_status, True)
Chetan Gaonker4b959fc2016-03-09 19:20:16 -0800987
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700988 def test_subscriber_join_next_channel(self):
989 ###"""Test subscriber join next for channels"""
990 num_subscribers = 1
991 num_channels = 1
992 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700993 num_channels = num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700994 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700995 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700996 assert_equal(test_status, True)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700997
998 #@deferred(SUBSCRIBER_TIMEOUT)
999 def test_subscriber_authentication_with_invalid_certificate_and_channel_surfing(self):
1000 ### """Test subscriber to auth with invalidCertification and join channel"""
1001 num_subscribers = 1
1002 num_channels = 1
1003 df = defer.Deferred()
1004 def sub_auth_invalid_cert(df):
1005 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1006 num_channels = num_channels,
1007 cbs = (self.tls_invalid_cert, self.dhcp_verify, self.igmp_verify),
1008 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1009 assert_equal(test_status, False)
1010 df.callback(0)
1011 reactor.callLater(0, sub_auth_invalid_cert, df)
1012 return df
1013
1014
1015 #@deferred(SUBSCRIBER_TIMEOUT)
1016 def test_subscriber_authentication_with_no_certificate_and_channel_surfing(self):
1017 ### """Test subscriber to auth with No Certification and join channel"""
1018 num_subscribers = 1
1019 num_channels = 1
1020 df = defer.Deferred()
1021 def sub_auth_no_cert(df):
1022 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1023 num_channels = num_channels,
1024 cbs = (self.tls_no_cert, self.dhcp_verify, self.igmp_verify),
1025 port_list = self.generate_port_list(num_subscribers, num_channels),
1026 negative_subscriber_auth = 'all')
1027 assert_equal(test_status, False)
1028 df.callback(0)
1029 reactor.callLater(0, sub_auth_no_cert, df)
1030 return df
1031
1032 def test_subscriber_authentication_with_self_signed_certificate_and_channel_surfing(self):
1033 ### """Test subscriber to auth with Self Signed Certification and join channel"""
1034 num_subscribers = 1
1035 num_channels = 1
1036 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1037 num_channels = num_channels,
1038 cbs = (self.tls_self_signed_cert, self.dhcp_verify, self.igmp_verify),
1039 port_list = self.generate_port_list(num_subscribers, num_channels),
1040 negative_subscriber_auth = 'all')
1041 assert_equal(test_status, True)
1042
1043 def test_subscriber_authentication_with_dhcp_discover_and_channel_surfing(self):
1044 ### """Test subscriber auth success, DHCP re-discover with DHCP server and join channel"""
1045 num_subscribers = 1
1046 num_channels = 1
1047 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1048 num_channels = num_channels,
1049 cbs = (self.tls_verify, self.dhcp_discover_scenario, self.igmp_verify),
1050 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1051 assert_equal(test_status, True)
1052
1053 def test_subscriber_authentication_with_dhcp_client_reboot_scenario_and_channel_surfing(self):
1054 ### """Test subscriber auth success, DHCP client got re-booted and join channel"""
1055 num_subscribers = 1
1056 num_channels = 1
1057 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1058 num_channels = num_channels,
1059 cbs = (self.tls_verify, self.dhcp_client_reboot_scenario, self.igmp_verify),
1060 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1061 assert_equal(test_status, True)
1062
1063 def test_subscriber_authentication_with_dhcp_server_reboot_scenario_and_channel_surfing(self):
1064 ### """Test subscriber auth , DHCP server re-boot during DHCP process and join channel"""
1065 num_subscribers = 1
1066 num_channels = 1
1067 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1068 num_channels = num_channels,
1069 cbs = (self.tls_verify, self.dhcp_server_reboot_scenario, self.igmp_verify),
1070 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1071 assert_equal(test_status, True)
1072
1073 def test_subscriber_authentication_with_dhcp_client_rebind_and_channel_surfing(self):
1074 ### """Test subscriber auth , DHCP client rebind IP and join channel"""
1075 num_subscribers = 1
1076 num_channels = 1
1077 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1078 num_channels = num_channels,
1079 cbs = (self.tls_verify, self.dhcp_client_rebind_scenario, self.igmp_verify),
1080 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1081 assert_equal(test_status, True)
1082
1083
1084 def test_subscriber_authentication_with_dhcp_starvation_scenario_and_channel_surfing(self):
1085 ### """Test subscriber auth , DHCP starvation and join channel"""
1086 num_subscribers = 1
1087 num_channels = 1
1088 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1089 num_channels = num_channels,
1090 cbs = (self.tls_verify, self.dhcp_starvation_scenario, self.igmp_verify),
1091 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1092 assert_equal(test_status, True)
1093
1094 def test_subscriber_authentication_with_multiple_dhcp_discover_for_same_subscriber_and_channel_surfing(self):
1095 ### """Test subscriber auth , sending same DHCP client discover multiple times and join channel"""
1096 num_subscribers = 1
1097 num_channels = 1
1098 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1099 num_channels = num_channels,
1100 cbs = (self.tls_verify, self.dhcp_same_client_multi_discovers_scenario, self.igmp_verify),
1101 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1102 assert_equal(test_status, True)
1103
1104 def test_subscriber_authentication_with_multiple_dhcp_request_for_same_subscriber_and_channel_surfing(self):
1105 ### """Test subscriber auth , same DHCP client multiple requerts times and join channel"""
1106 num_subscribers = 1
1107 num_channels = 1
1108 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1109 num_channels = num_channels,
1110 cbs = (self.tls_verify, self.dhcp_same_client_multi_request_scenario, self.igmp_verify),
1111 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1112 assert_equal(test_status, True)
1113
1114 def test_subscriber_authentication_with_dhcp_client_requested_ip_and_channel_surfing(self):
1115 ### """Test subscriber auth with DHCP client requesting ip and join channel"""
1116 num_subscribers = 1
1117 num_channels = 1
1118 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1119 num_channels = num_channels,
1120 cbs = (self.tls_verify, self.dhcp_client_desired_ip_scenario, self.igmp_verify),
1121 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1122 assert_equal(test_status, True)
1123
1124 def test_subscriber_authentication_with_dhcp_non_offered_ip_and_channel_surfing(self):
1125 ### """Test subscriber auth with DHCP client request for non-offered ip and join channel"""
1126 num_subscribers = 1
1127 num_channels = 1
1128 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1129 num_channels = num_channels,
1130 cbs = (self.tls_verify, self.dhcp_client_request_pkt_with_non_offered_ip_scenario, self.igmp_verify),
1131 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1132 assert_equal(test_status, True)
1133
1134 def test_subscriber_authentication_with_dhcp_request_out_of_pool_ip_by_client_and_channel_surfing(self):
1135 ### """Test subscriber auth with DHCP client requesting out of pool ip and join channel"""
1136 num_subscribers = 1
1137 num_channels = 1
1138 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1139 num_channels = num_channels,
1140 cbs = (self.tls_verify, self.dhcp_client_requested_out_pool_ip_scenario, self.igmp_verify),
1141 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1142 assert_equal(test_status, True)
1143
1144 def test_subscriber_authentication_with_dhcp_specified_lease_time_functionality_and_channel_surfing(self):
1145 ### """Test subscriber auth with DHCP client specifying lease time and join channel"""
1146 num_subscribers = 1
1147 num_channels = 1
1148 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1149 num_channels = num_channels,
1150 cbs = (self.tls_verify, self.dhcp_client_specific_lease_scenario, self.igmp_verify),
1151 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1152 assert_equal(test_status, True)
ChetanGaonker5b984cb2016-07-12 15:50:49 -07001153
1154
1155 def test_subscriber_join_recv_100channels(self):
1156 num_subscribers = 1
1157 num_channels = 100
1158 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1159 num_channels = num_channels,
1160 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1161 port_list = self.generate_port_list(num_subscribers, num_channels),
1162 negative_subscriber_auth = 'all')
1163 assert_equal(test_status, True)
1164
1165 def test_subscriber_join_recv_400channels(self):
1166 num_subscribers = 1
1167 num_channels = 400
1168 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1169 num_channels = num_channels,
1170 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1171 port_list = self.generate_port_list(num_subscribers, num_channels),
1172 negative_subscriber_auth = 'all')
1173 assert_equal(test_status, True)
1174
1175 def test_subscriber_join_recv_800channels(self):
1176 num_subscribers = 1
1177 num_channels = 800
1178 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1179 num_channels = num_channels,
1180 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1181 port_list = self.generate_port_list(num_subscribers, num_channels),
1182 negative_subscriber_auth = 'all')
1183 assert_equal(test_status, True)
1184
1185 def test_subscriber_join_recv_1200channels(self):
1186 num_subscribers = 1
1187 num_channels = 1200
1188 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1189 num_channels = num_channels,
1190 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1191 port_list = self.generate_port_list(num_subscribers, num_channels),
1192 negative_subscriber_auth = 'all')
1193 assert_equal(test_status, True)
1194
1195 def test_subscriber_join_recv_1500channels(self):
1196 num_subscribers = 1
1197 num_channels = 1500
1198 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1199 num_channels = num_channels,
1200 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1201 port_list = self.generate_port_list(num_subscribers, num_channels),
1202 negative_subscriber_auth = 'all')
1203 assert_equal(test_status, True)
1204
1205 def test_subscriber_join_jump_100channels(self):
1206 num_subscribers = 1
1207 num_channels = 100
1208 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1209 num_channels = num_channels,
1210 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1211 port_list = self.generate_port_list(num_subscribers, num_channels),
1212 negative_subscriber_auth = 'all')
1213 assert_equal(test_status, True)
1214 def test_subscriber_join_jump_400channels(self):
1215 num_subscribers = 1
1216 num_channels = 400
1217 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1218 num_channels = num_channels,
1219 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1220 port_list = self.generate_port_list(num_subscribers, num_channels),
1221 negative_subscriber_auth = 'all')
1222 assert_equal(test_status, True)
1223 def test_subscriber_join_jump_800channels(self):
1224 num_subscribers = 1
1225 num_channels = 800
1226 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1227 num_channels = num_channels,
1228 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1229 port_list = self.generate_port_list(num_subscribers, num_channels),
1230 negative_subscriber_auth = 'all')
1231 assert_equal(test_status, True)
1232 def test_subscriber_join_jump_1200channel(sself):
1233 num_subscribers = 1
1234 num_channels = 1200
1235 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1236 num_channels = num_channels,
1237 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1238 port_list = self.generate_port_list(num_subscribers, num_channels),
1239 negative_subscriber_auth = 'all')
1240 assert_equal(test_status, True)
1241 def test_subscriber_join_jump_1500channels(self):
1242 num_subscribers = 1
1243 num_channels = 1500
1244 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1245 num_channels = num_channels,
1246 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1247 port_list = self.generate_port_list(num_subscribers, num_channels),
1248 negative_subscriber_auth = 'all')
1249 assert_equal(test_status, True)
1250
1251 def test_subscriber_join_next_100channels(self):
1252 num_subscribers = 1
1253 num_channels = 100
1254 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1255 num_channels = num_channels,
1256 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1257 port_list = self.generate_port_list(num_subscribers, num_channels),
1258 negative_subscriber_auth = 'all')
1259 assert_equal(test_status, True)
1260
1261 def test_subscriber_join_next_400channels(self):
1262 num_subscribers = 1
1263 num_channels = 400
1264 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1265 num_channels = num_channels,
1266 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1267 port_list = self.generate_port_list(num_subscribers, num_channels),
1268 negative_subscriber_auth = 'all')
1269 assert_equal(test_status, True)
1270
1271 def test_subscriber_join_next_800channels(self):
1272 num_subscribers = 1
1273 num_channels = 800
1274 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1275 num_channels = num_channels,
1276 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1277 port_list = self.generate_port_list(num_subscribers, num_channels),
1278 negative_subscriber_auth = 'all')
1279 assert_equal(test_status, True)
1280
1281
1282 def test_subscriber_join_next_1200channels(self):
1283 num_subscribers = 1
1284 num_channels = 1200
1285 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1286 num_channels = num_channels,
1287 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1288 port_list = self.generate_port_list(num_subscribers, num_channels),
1289 negative_subscriber_auth = 'all')
1290 assert_equal(test_status, True)
1291
1292 def test_subscriber_join_next_1500channels(self):
1293 num_subscribers = 1
1294 num_channels = 1500
1295 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1296 num_channels = num_channels,
1297 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1298 port_list = self.generate_port_list(num_subscribers, num_channels),
1299 negative_subscriber_auth = 'all')
1300 assert_equal(test_status, True)