blob: 685046820784a9cb78c955dd0cd8a3379cf212b2 [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 Karthick1555c7c2017-09-07 14:59:41 -0700291 OnosCtrl.aaa_load_config()
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700292 self.aaa_loaded = True
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800293
294 def onos_dhcp_table_load(self, config = None):
295 dhcp_dict = {'apps' : { 'org.onosproject.dhcp' : { 'dhcp' : copy.copy(self.dhcp_server_config) } } }
296 dhcp_config = dhcp_dict['apps']['org.onosproject.dhcp']['dhcp']
297 if config:
298 for k in config.keys():
299 if dhcp_config.has_key(k):
300 dhcp_config[k] = config[k]
301 self.onos_load_config('org.onosproject.dhcp', dhcp_dict)
302
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700303 def send_recv(self, mac = None, update_seed = False, validate = True):
304 cip, sip = self.dhcp.discover(mac = mac, update_seed = update_seed)
305 if validate:
306 assert_not_equal(cip, None)
307 assert_not_equal(sip, None)
308 log.info('Got dhcp client IP %s from server %s for mac %s' %
309 (cip, sip, self.dhcp.get_mac(cip)[0]))
310 return cip,sip
311
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800312 def onos_load_config(self, app, config):
Chetan Gaonkera2b87df2016-03-31 15:41:31 -0700313 status, code = OnosCtrl.config(config)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800314 if status is False:
315 log.info('JSON config request for app %s returned status %d' %(app, code))
316 assert_equal(status, True)
317 time.sleep(2)
318
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700319 def dhcp_sndrcv(self, dhcp, update_seed = False):
320 cip, sip = dhcp.discover(update_seed = update_seed)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800321 assert_not_equal(cip, None)
322 assert_not_equal(sip, None)
323 log.info('Got dhcp client IP %s from server %s for mac %s' %
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700324 (cip, sip, dhcp.get_mac(cip)[0]))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800325 return cip,sip
326
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700327 def dhcp_request(self, subscriber, seed_ip = '10.10.10.1', update_seed = False):
Chetan Gaonker00971202016-03-23 15:11:12 -0700328 config = {'startip':'10.10.10.20', 'endip':'10.10.10.200',
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800329 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
330 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
331 self.onos_dhcp_table_load(config)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700332 dhcp = DHCPTest(seed_ip = seed_ip, iface = subscriber.iface)
333 cip, sip = self.dhcp_sndrcv(dhcp, update_seed = update_seed)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800334 return cip, sip
335
336 def recv_channel_cb(self, pkt):
337 ##First verify that we have received the packet for the joined instance
338 chan = self.subscriber.caddr(pkt[IP].dst)
339 assert_equal(chan in self.subscriber.join_map.keys(), True)
340 recv_time = monotonic.monotonic() * 1000000
341 join_time = self.subscriber.join_map[chan][self.subscriber.STATS_JOIN].start
342 delta = recv_time - join_time
343 self.subscriber.join_rx_stats.update(packets=1, t = delta, usecs = True)
344 self.subscriber.channel_update(chan, self.subscriber.STATS_RX, 1, t = delta)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700345 log.debug('Packet received in %.3f usecs for group %s after join' %(delta, pkt[IP].dst))
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800346 self.test_status = True
347
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700348 def tls_verify(self, subscriber):
349 if subscriber.has_service('TLS'):
350 time.sleep(2)
351 tls = TLSAuthTest()
352 log.info('Running subscriber %s tls auth test' %subscriber.name)
353 tls.runTest()
354 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700355 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700356
357 def dhcp_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700358 cip, sip = self.dhcp_request(subscriber, update_seed = True)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700359 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
360 subscriber.src_list = [cip]
361 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700362 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700363
364 def dhcp_jump_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700365 cip, sip = self.dhcp_request(subscriber, seed_ip = '10.10.200.1')
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700366 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
367 subscriber.src_list = [cip]
368 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700369 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700370
371 def dhcp_next_verify(self, subscriber):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700372 cip, sip = self.dhcp_request(subscriber, seed_ip = '10.10.150.1')
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700373 log.info('Subscriber %s got client ip %s from server %s' %(subscriber.name, cip, sip))
374 subscriber.src_list = [cip]
375 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700376 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700377
378 def igmp_verify(self, subscriber):
379 chan = 0
380 if subscriber.has_service('IGMP'):
381 for i in range(5):
382 log.info('Joining channel %d for subscriber %s' %(chan, subscriber.name))
383 subscriber.channel_join(chan, delay = 0)
384 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
385 log.info('Leaving channel %d for subscriber %s' %(chan, subscriber.name))
386 subscriber.channel_leave(chan)
387 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700388 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 -0700389 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700390 return self.test_status
391
392 def igmp_verify_multiChannel(self, subscriber):
393 if subscriber.has_service('IGMP'):
394 for chan in range(DEFAULT_NO_CHANNELS):
395 log.info('Joining channel %d for subscriber %s' %(chan, subscriber.name))
396 subscriber.channel_join(chan, delay = 0)
397 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
398 log.info('Leaving channel %d for subscriber %s' %(chan, subscriber.name))
399 subscriber.channel_leave(chan)
400 time.sleep(3)
401 log.info('Interface %s Join RX stats for subscriber %s, %s' %(subscriber.iface, subscriber.name,subscriber.join_rx_stats))
402 self.test_status = True
403 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700404
405 def igmp_jump_verify(self, subscriber):
406 if subscriber.has_service('IGMP'):
407 for i in xrange(subscriber.num):
408 log.info('Subscriber %s jumping channel' %subscriber.name)
409 chan = subscriber.channel_jump(delay=0)
410 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count = 1)
411 log.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
412 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700413 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 -0700414 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700415 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700416
417 def igmp_next_verify(self, subscriber):
418 if subscriber.has_service('IGMP'):
419 for i in xrange(subscriber.num):
420 if i:
421 chan = subscriber.channel_join_next(delay=0)
422 else:
423 chan = subscriber.channel_join(i, delay=0)
424 log.info('Joined next channel %d for subscriber %s' %(chan, subscriber.name))
425 subscriber.channel_receive(chan, cb = subscriber.recv_channel_cb, count=1)
426 log.info('Verified receive for channel %d, subscriber %s' %(chan, subscriber.name))
427 time.sleep(3)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700428 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 -0700429 self.test_status = True
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700430 return self.test_status
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700431
Chetan Gaonker3d163852016-03-28 12:20:25 -0700432 def generate_port_list(self, subscribers, channels):
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700433 port_list = []
Chetan Gaonker3d163852016-03-28 12:20:25 -0700434 for i in xrange(subscribers):
435 if channels > 1:
436 rx_port = 2*i+1
437 tx_port = 2*i+2
438 else:
439 rx_port = Subscriber.PORT_RX_DEFAULT
440 tx_port = Subscriber.PORT_TX_DEFAULT
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700441 port_list.append((tx_port, rx_port))
442 return port_list
443
444 def subscriber_load(self, create = True, num = 10, num_channels = 1, channel_start = 0, port_list = []):
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700445 '''Load the subscriber from the database'''
446 self.subscriber_db = SubscriberDB(create = create)
447 if create is True:
448 self.subscriber_db.generate(num)
449 self.subscriber_info = self.subscriber_db.read(num)
450 self.subscriber_list = []
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700451 if not port_list:
Chetan Gaonker3d163852016-03-28 12:20:25 -0700452 port_list = self.generate_port_list(num, num_channels)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700453
454 index = 0
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700455 for info in self.subscriber_info:
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700456 self.subscriber_list.append(Subscriber(name=info['Name'],
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700457 service=info['Service'],
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700458 port_map = self.port_map,
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700459 num=num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700460 channel_start = channel_start,
461 tx_port = port_list[index][0],
462 rx_port = port_list[index][1]))
Chetan Gaonker3d163852016-03-28 12:20:25 -0700463 if num_channels > 1:
464 channel_start += num_channels
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700465 index += 1
466
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700467 #load the ssm list for all subscriber channels
468 igmpChannel = IgmpChannel()
469 ssm_groups = map(lambda sub: sub.channels, self.subscriber_list)
470 ssm_list = reduce(lambda ssm1, ssm2: ssm1+ssm2, ssm_groups)
471 igmpChannel.igmp_load_ssm_config(ssm_list)
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700472 #load the subscriber to mcast port map for cord
473 cord_port_map = {}
474 for sub in self.subscriber_list:
475 for chan in sub.channels:
476 cord_port_map[chan] = (sub.tx_port, sub.rx_port)
477
478 igmpChannel.cord_port_table_load(cord_port_map)
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700479
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700480 def subscriber_join_verify( self, num_subscribers = 10, num_channels = 1,
481 channel_start = 0, cbs = None, port_list = [], negative_subscriber_auth = None):
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800482 self.test_status = False
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700483 self.num_subscribers = num_subscribers
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700484 self.sub_loop_count = num_subscribers
Chetan Gaonker7997bb42016-03-28 09:46:15 -0700485 self.subscriber_load(create = True, num = num_subscribers,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700486 num_channels = num_channels, channel_start = channel_start, port_list = port_list)
Chetan Gaonker55fc7882016-03-15 17:46:47 -0700487 self.onos_aaa_load()
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700488 self.thread_pool = ThreadPool(min(100, self.num_subscribers), queue_size=1, wait_timeout=1)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700489
490 if cbs and negative_subscriber_auth is None:
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700491 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700492 cbs_negative = cbs
Chetan Gaonker41d2e072016-03-15 16:41:31 -0700493 for subscriber in self.subscriber_list:
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700494 subscriber.start()
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700495 if negative_subscriber_auth is 'half' and self.sub_loop_count%2 is not 0:
496 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
497 elif negative_subscriber_auth is 'onethird' and self.sub_loop_count%3 is not 0:
498 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify)
499 else:
500 cbs = cbs_negative
501 self.sub_loop_count = self.sub_loop_count - 1
502 pool_object = subscriber_pool(subscriber, cbs, self.test_status)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700503 self.thread_pool.addTask(pool_object.pool_cb)
504 self.thread_pool.cleanUpThreads()
505 for subscriber in self.subscriber_list:
506 subscriber.stop()
ChetanGaonker5b984cb2016-07-12 15:50:49 -0700507 print "self.test_status %s\n"%(self.test_status)
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700508 return self.test_status
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800509
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700510 def tls_invalid_cert(self, subscriber):
511 if subscriber.has_service('TLS'):
512 time.sleep(2)
513 log.info('Running subscriber %s tls auth test' %subscriber.name)
514 tls = TLSAuthTest(client_cert = self.CLIENT_CERT_INVALID)
515 tls.runTest()
516 if tls.failTest == True:
517 self.test_status = False
518 return self.test_status
519
520 def tls_no_cert(self, subscriber):
521 if subscriber.has_service('TLS'):
522 time.sleep(2)
523 log.info('Running subscriber %s tls auth test' %subscriber.name)
524 tls = TLSAuthTest(client_cert = '')
525 tls.runTest()
526 if tls.failTest == True:
527 self.test_status = False
528 return self.test_status
529
530 def tls_self_signed_cert(self, subscriber):
531 if subscriber.has_service('TLS'):
532 time.sleep(2)
533 log.info('Running subscriber %s tls auth test' %subscriber.name)
534 tls = TLSAuthTest(client_cert = self.CLIENT_CERT)
535 tls.runTest()
536 if tls.failTest == False:
537 self.test_status = True
538 return self.test_status
539
540 def tls_Nsubscribers_use_same_valid_cert(self, subscriber):
541 if subscriber.has_service('TLS'):
542 time.sleep(2)
543 log.info('Running subscriber %s tls auth test' %subscriber.name)
544 num_users = 3
545 for i in xrange(num_users):
546 tls = TLSAuthTest(intf = 'veth{}'.format(i*2))
547 tls.runTest()
548 if tls.failTest == False:
549 self.test_status = True
550 return self.test_status
551
552 def dhcp_discover_scenario(self, subscriber):
553 if subscriber.has_service('DHCP'):
554 time.sleep(2)
555 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
556 t1 = self.subscriber_dhcp_1release()
557 self.test_status = True
558 return self.test_status
559
560 def subscriber_dhcp_1release(self, iface = INTF_RX_DEFAULT):
561 config = {'startip':'10.10.100.20', 'endip':'10.10.100.21',
562 'ip':'10.10.100.2', 'mac': "ca:fe:ca:fe:8a:fe",
563 'subnet': '255.255.255.0', 'broadcast':'10.10.100.255', 'router':'10.10.100.1'}
564 self.onos_dhcp_table_load(config)
565 self.dhcp = DHCPTest(seed_ip = '10.10.100.10', iface = iface)
566 cip, sip = self.send_recv()
567 log.info('Releasing ip %s to server %s' %(cip, sip))
568 assert_equal(self.dhcp.release(cip), True)
569 log.info('Triggering DHCP discover again after release')
570 cip2, sip2 = self.send_recv(update_seed = True)
571 log.info('Verifying released IP was given back on rediscover')
572 assert_equal(cip, cip2)
573 log.info('Test done. Releasing ip %s to server %s' %(cip2, sip2))
574 assert_equal(self.dhcp.release(cip2), True)
575
576
577 def dhcp_client_reboot_scenario(self, subscriber):
578 if subscriber.has_service('DHCP'):
579 time.sleep(2)
580 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
581 tl = self.subscriber_dhcp_client_request_after_reboot()
582 self.test_status = True
583 return self.test_status
584
585 def subscriber_dhcp_client_request_after_reboot(self, iface = INTF_RX_DEFAULT):
586 #''' Client sends DHCP Request after reboot.'''
587
588 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
589 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
590 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
591 self.onos_dhcp_table_load(config)
592 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
593 cip, sip, mac, lval = self.dhcp.only_discover()
594 log.info('Got dhcp client IP %s from server %s for mac %s .' %
595 (cip, sip, mac) )
596
597 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
598
599 if (cip == None and mac != None):
600 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
601 assert_not_equal(cip, None)
602
603 else:
604 new_cip, new_sip = self.dhcp.only_request(cip, mac)
605 if new_cip == None:
606 log.info("Got DHCP server NAK.")
607 os.system('ifconfig '+iface+' down')
608 log.info('Client goes down.')
609 log.info('Delay for 5 seconds.')
610
611 time.sleep(5)
612
613 os.system('ifconfig '+iface+' up')
614 log.info('Client is up now.')
615
616 new_cip, new_sip = self.dhcp.only_request(cip, mac)
617 if new_cip == None:
618 log.info("Got DHCP server NAK.")
619 assert_not_equal(new_cip, None)
620 elif new_cip != None:
621 log.info("Got DHCP ACK.")
622
623
624 def dhcp_client_renew_scenario(self, subscriber):
625 if subscriber.has_service('DHCP'):
626 time.sleep(2)
627 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
628 tl = self.subscriber_dhcp_client_renew_time()
629 self.test_status = True
630 return self.test_status
631
632 def subscriber_dhcp_client_renew_time(self, iface = INTF_RX_DEFAULT):
633 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
634 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
635 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
636 self.onos_dhcp_table_load(config)
637 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
638 cip, sip, mac , lval = self.dhcp.only_discover()
639 log.info('Got dhcp client IP %s from server %s for mac %s .' %
640 (cip, sip, mac) )
641
642 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
643 if (cip == None and mac != None):
644 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
645 assert_not_equal(cip, None)
646 elif cip and sip and mac:
647 log.info("Triggering DHCP Request.")
648 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, renew_time = True)
649 if new_cip and new_sip and lval:
650 log.info("Client 's Renewal time is :%s",lval)
651 log.info("Generating delay till renewal time.")
652 time.sleep(lval)
653 log.info("Client Sending Unicast DHCP request.")
654 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac, unicast = True)
655 if latest_cip and latest_sip:
656 log.info("Got DHCP Ack. Lease Renewed for ip %s and mac %s from server %s." %
657 (latest_cip, mac, latest_sip) )
658
659 elif latest_cip == None:
660 log.info("Got DHCP NAK. Lease not renewed.")
661 elif new_cip == None or new_sip == None or lval == None:
662 log.info("Got DHCP NAK.")
663
664
665 def dhcp_server_reboot_scenario(self, subscriber):
666 if subscriber.has_service('DHCP'):
667 time.sleep(2)
668 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
669 tl = self.subscriber_dhcp_server_after_reboot()
670 self.test_status = True
671 return self.test_status
672
673 def subscriber_dhcp_server_after_reboot(self, iface = INTF_RX_DEFAULT):
674 ''' DHCP server goes down.'''
675 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
676 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
677 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
678 self.onos_dhcp_table_load(config)
679 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
680 cip, sip, mac, lval = self.dhcp.only_discover()
681 log.info('Got dhcp client IP %s from server %s for mac %s .' %
682 (cip, sip, mac) )
683 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
684 if (cip == None and mac != None):
685 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
686 assert_not_equal(cip, None)
687 else:
688 new_cip, new_sip = self.dhcp.only_request(cip, mac)
689 if new_cip == None:
690 log.info("Got DHCP server NAK.")
691 assert_not_equal(new_cip, None)
692 log.info('Getting DHCP server Down.')
693 onos_ctrl = OnosCtrl(self.dhcp_app)
694 onos_ctrl.deactivate()
695 for i in range(0,4):
696 log.info("Sending DHCP Request.")
697 log.info('')
698 new_cip, new_sip = self.dhcp.only_request(cip, mac)
699 if new_cip == None and new_sip == None:
700 log.info('')
701 log.info("DHCP Request timed out.")
702 elif new_cip and new_sip:
703 log.info("Got Reply from DHCP server.")
704 assert_equal(new_cip,None) #Neagtive Test Case
705 log.info('Getting DHCP server Up.')
706# self.activate_apps(self.dhcp_app)
707 onos_ctrl = OnosCtrl(self.dhcp_app)
708 status, _ = onos_ctrl.activate()
709 assert_equal(status, True)
710 time.sleep(3)
711 for i in range(0,4):
712 log.info("Sending DHCP Request after DHCP server is up.")
713 log.info('')
714 new_cip, new_sip = self.dhcp.only_request(cip, mac)
715 if new_cip == None and new_sip == None:
716 log.info('')
717 log.info("DHCP Request timed out.")
718 elif new_cip and new_sip:
719 log.info("Got Reply from DHCP server.")
720 assert_equal(new_cip,None) #Neagtive Test Case
721
722 def dhcp_client_rebind_scenario(self, subscriber):
723 if subscriber.has_service('DHCP'):
724 time.sleep(2)
725 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
726 tl = self.subscriber_dhcp_client_rebind_time()
727 self.test_status = True
728 return self.test_status
729
730 def subscriber_dhcp_client_rebind_time(self, iface = INTF_RX_DEFAULT):
731 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
732 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
733 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
734 self.onos_dhcp_table_load(config)
735 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
736 cip, sip, mac, lval = self.dhcp.only_discover()
737 log.info('Got dhcp client IP %s from server %s for mac %s .' %
738 (cip, sip, mac) )
739 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
740 if (cip == None and mac != None):
741 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
742 assert_not_equal(cip, None)
743 elif cip and sip and mac:
744 log.info("Triggering DHCP Request.")
745 new_cip, new_sip, lval = self.dhcp.only_request(cip, mac, rebind_time = True)
746 if new_cip and new_sip and lval:
747 log.info("Client 's Rebind time is :%s",lval)
748 log.info("Generating delay till rebind time.")
749 time.sleep(lval)
750 log.info("Client Sending broadcast DHCP requests for renewing lease or for getting new ip.")
751 self.dhcp.after_T2 = True
752 for i in range(0,4):
753 latest_cip, latest_sip = self.dhcp.only_request(new_cip, mac)
754 if latest_cip and latest_sip:
755 log.info("Got DHCP Ack. Lease Renewed for ip %s and mac %s from server %s." %
756 (latest_cip, mac, latest_sip) )
757 break
758 elif latest_cip == None:
759 log.info("Got DHCP NAK. Lease not renewed.")
760 assert_not_equal(latest_cip, None)
761 elif new_cip == None or new_sip == None or lval == None:
762 log.info("Got DHCP NAK.Lease not Renewed.")
763
764 def dhcp_starvation_scenario(self, subscriber):
765 if subscriber.has_service('DHCP'):
766 time.sleep(2)
767 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
768 tl = self.subscriber_dhcp_starvation()
769 self.test_status = True
770 return self.test_status
771
772
773 def subscriber_dhcp_starvation(self, iface = INTF_RX_DEFAULT):
774 '''DHCP starve'''
775 config = {'startip':'182.17.0.20', 'endip':'182.17.0.69',
776 'ip':'182.17.0.2', 'mac': "ca:fe:c3:fe:ca:fe",
777 'subnet': '255.255.255.0', 'broadcast':'182.17.0.255', 'router':'182.17.0.1'}
778 self.onos_dhcp_table_load(config)
779 self.dhcp = DHCPTest(seed_ip = '182.17.0.1', iface = iface)
780 log.info('Verifying 1 ')
781 for x in xrange(50):
782 mac = RandMAC()._fix()
783 self.send_recv(mac = mac)
784 log.info('Verifying 2 ')
785 cip, sip = self.send_recv(update_seed = True, validate = False)
786 assert_equal(cip, None)
787 assert_equal(sip, None)
788
789 def dhcp_same_client_multi_discovers_scenario(self, subscriber):
790 if subscriber.has_service('DHCP'):
791 time.sleep(2)
792 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
793 tl = self.subscriber_dhcp_same_client_multiple_discover()
794 self.test_status = True
795 return self.test_status
796
797
798 def subscriber_dhcp_same_client_multiple_discover(self, iface = INTF_RX_DEFAULT):
799 ''' DHCP Client sending multiple discover . '''
800 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
801 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
802 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
803 self.onos_dhcp_table_load(config)
804 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
805 cip, sip, mac, lval = self.dhcp.only_discover()
806 log.info('Got dhcp client IP %s from server %s for mac %s . Not going to send DHCPREQUEST.' %
807 (cip, sip, mac) )
808 log.info('Triggering DHCP discover again.')
809 new_cip, new_sip, new_mac , lval = self.dhcp.only_discover()
810 if cip == new_cip:
811 log.info('Got same ip for 2nd DHCP discover for client IP %s from server %s for mac %s. Triggering DHCP Request. '
812 % (new_cip, new_sip, new_mac) )
813 elif cip != new_cip:
814 log.info('Ip after 1st discover %s' %cip)
815 log.info('Map after 2nd discover %s' %new_cip)
816 assert_equal(cip, new_cip)
817
818 def dhcp_same_client_multi_request_scenario(self, subscriber):
819 if subscriber.has_service('DHCP'):
820 time.sleep(2)
821 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
822 tl = self.subscriber_dhcp_same_client_multiple_request()
823 self.test_status = True
824 return self.test_status
825
826 def subscriber_dhcp_same_client_multiple_request(self, iface = INTF_RX_DEFAULT):
827 ''' DHCP Client sending multiple repeat DHCP requests. '''
828 config = {'startip':'10.10.10.20', 'endip':'10.10.10.69',
829 'ip':'10.10.10.2', 'mac': "ca:fe:ca:fe:ca:fe",
830 'subnet': '255.255.255.0', 'broadcast':'10.10.10.255', 'router':'10.10.10.1'}
831 self.onos_dhcp_table_load(config)
832 self.dhcp = DHCPTest(seed_ip = '10.10.10.1', iface = iface)
833 log.info('Sending DHCP discover and DHCP request.')
834 cip, sip = self.send_recv()
835 mac = self.dhcp.get_mac(cip)[0]
836 log.info("Sending DHCP request again.")
837 new_cip, new_sip = self.dhcp.only_request(cip, mac)
838 if (new_cip,new_sip) == (cip,sip):
839 log.info('Got same ip for 2nd DHCP Request for client IP %s from server %s for mac %s.'
840 % (new_cip, new_sip, mac) )
841 elif (new_cip,new_sip):
842 log.info('No DHCP ACK')
843 assert_equal(new_cip, None)
844 assert_equal(new_sip, None)
845 else:
846 print "Something went wrong."
847
848
849 def dhcp_client_desired_ip_scenario(self, subscriber):
850 if subscriber.has_service('DHCP'):
851 time.sleep(2)
852 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
853 tl = self.subscriber_dhcp_client_desired_address()
854 self.test_status = True
855 return self.test_status
856
857 def subscriber_dhcp_client_desired_address(self, iface = INTF_RX_DEFAULT):
858 '''DHCP Client asking for desired IP address.'''
859 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
860 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
861 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
862 self.onos_dhcp_table_load(config)
863 self.dhcp = DHCPTest(seed_ip = '20.20.20.31', iface = iface)
864 cip, sip, mac , lval = self.dhcp.only_discover(desired = True)
865 log.info('Got dhcp client IP %s from server %s for mac %s .' %
866 (cip, sip, mac) )
867 if cip == self.dhcp.seed_ip:
868 log.info('Got dhcp client IP %s from server %s for mac %s as desired .' %
869 (cip, sip, mac) )
870 elif cip != self.dhcp.seed_ip:
871 log.info('Got dhcp client IP %s from server %s for mac %s .' %
872 (cip, sip, mac) )
873 log.info('The desired ip was: %s .' % self.dhcp.seed_ip)
874 assert_equal(cip, self.dhcp.seed_ip)
875
876 def dhcp_client_request_pkt_with_non_offered_ip_scenario(self, subscriber):
877 if subscriber.has_service('DHCP'):
878 time.sleep(2)
879 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
880 tl = self.subscriber_dhcp_server_nak_packet()
881 self.test_status = True
882 return self.test_status
883
884 def subscriber_dhcp_server_nak_packet(self, iface = INTF_RX_DEFAULT):
885 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
886 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
887 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
888 self.onos_dhcp_table_load(config)
889 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
890 cip, sip, mac, lval = self.dhcp.only_discover()
891 log.info('Got dhcp client IP %s from server %s for mac %s .' %
892 (cip, sip, mac) )
893 log.info("Verifying Client 's IP and mac in DHCP Offer packet. Those should not be none, which is expected.")
894 if (cip == None and mac != None):
895 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
896 assert_not_equal(cip, None)
897 else:
898 new_cip, new_sip = self.dhcp.only_request('20.20.20.31', mac)
899 if new_cip == None:
900 log.info("Got DHCP server NAK.")
901 assert_equal(new_cip, None) #Negative Test Case
902
903 def dhcp_client_requested_out_pool_ip_scenario(self, subscriber):
904 if subscriber.has_service('DHCP'):
905 time.sleep(2)
906 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
907 tl = self.subscriber_dhcp_client_desired_address_out_of_pool()
908 self.test_status = True
909 return self.test_status
910
911
912 def subscriber_dhcp_client_desired_address_out_of_pool(self, iface = INTF_RX_DEFAULT):
913 '''DHCP Client asking for desired IP address from out of pool.'''
914 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
915 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
916 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
917 self.onos_dhcp_table_load(config)
918 self.dhcp = DHCPTest(seed_ip = '20.20.20.35', iface = iface)
919 cip, sip, mac, lval = self.dhcp.only_discover(desired = True)
920 log.info('Got dhcp client IP %s from server %s for mac %s .' %
921 (cip, sip, mac) )
922 if cip == self.dhcp.seed_ip:
923 log.info('Got dhcp client IP %s from server %s for mac %s as desired .' %
924 (cip, sip, mac) )
925 assert_equal(cip, self.dhcp.seed_ip) #Negative Test Case
926
927 elif cip != self.dhcp.seed_ip:
928 log.info('Got dhcp client IP %s from server %s for mac %s .' %
929 (cip, sip, mac) )
930 log.info('The desired ip was: %s .' % self.dhcp.seed_ip)
931 assert_not_equal(cip, self.dhcp.seed_ip)
932
933 elif cip == None:
934 log.info('Got DHCP NAK')
935
936
937 def dhcp_client_specific_lease_scenario(self, subscriber):
938 if subscriber.has_service('DHCP'):
939 time.sleep(2)
940 log.info('Running subscriber %s DHCP rediscover scenario test' %subscriber.name)
941 tl = self.subscriber_dhcp_specific_lease_packet()
942 self.test_status = True
943 return self.test_status
944
945 def subscriber_dhcp_specific_lease_packet(self, iface = INTF_RX_DEFAULT):
946 ''' Client sends DHCP Discover packet for particular lease time.'''
947 config = {'startip':'20.20.20.30', 'endip':'20.20.20.69',
948 'ip':'20.20.20.2', 'mac': "ca:fe:ca:fe:ca:fe",
949 'subnet': '255.255.255.0', 'broadcast':'20.20.20.255', 'router':'20.20.20.1'}
950 self.onos_dhcp_table_load(config)
951 self.dhcp = DHCPTest(seed_ip = '20.20.20.45', iface = iface)
952 log.info('Sending DHCP discover with lease time of 700')
953 cip, sip, mac, lval = self.dhcp.only_discover(lease_time = True)
954
955 log.info("Verifying Client 's IP and mac in DHCP Offer packet.")
956 if (cip == None and mac != None):
957 log.info("Verified that Client 's IP and mac in DHCP Offer packet are none, which is not expected behavior.")
958 assert_not_equal(cip, None)
959 elif lval != 700:
960 log.info('Getting dhcp client IP %s from server %s for mac %s with lease time %s. That is not 700.' %
961 (cip, sip, mac, lval) )
962 assert_not_equal(lval, 700)
963
964 def test_subscriber_join_recv_channel(self):
965 ###"""Test subscriber join and receive"""
966 num_subscribers = 1
Chetan Gaonker3d163852016-03-28 12:20:25 -0700967 num_channels = 1
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700968 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700969 num_channels = num_channels,
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700970 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700971 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700972 assert_equal(test_status, True)
Chetan Gaonkercbe79642016-03-09 17:45:58 -0800973
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700974 def test_subscriber_join_jump_channel(self):
975 ###"""Test subscriber join and receive for channel surfing"""
976 num_subscribers = 1
977 num_channels = 1
978 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700979 num_channels = num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700980 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700981 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700982 assert_equal(test_status, True)
Chetan Gaonker4b959fc2016-03-09 19:20:16 -0800983
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700984 def test_subscriber_join_next_channel(self):
985 ###"""Test subscriber join next for channels"""
986 num_subscribers = 1
987 num_channels = 1
988 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
Chetan Gaonker3d163852016-03-28 12:20:25 -0700989 num_channels = num_channels,
Chetan Gaonkera58ab6e2016-03-23 15:04:20 -0700990 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
Chetan Gaonker3d163852016-03-28 12:20:25 -0700991 port_list = self.generate_port_list(num_subscribers, num_channels))
Chetan Gaonkercd86bdd2016-03-17 00:08:12 -0700992 assert_equal(test_status, True)
ChetanGaonkereff07bc2016-06-09 16:39:23 -0700993
994 #@deferred(SUBSCRIBER_TIMEOUT)
995 def test_subscriber_authentication_with_invalid_certificate_and_channel_surfing(self):
996 ### """Test subscriber to auth with invalidCertification and join channel"""
997 num_subscribers = 1
998 num_channels = 1
999 df = defer.Deferred()
1000 def sub_auth_invalid_cert(df):
1001 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1002 num_channels = num_channels,
1003 cbs = (self.tls_invalid_cert, self.dhcp_verify, self.igmp_verify),
1004 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1005 assert_equal(test_status, False)
1006 df.callback(0)
1007 reactor.callLater(0, sub_auth_invalid_cert, df)
1008 return df
1009
1010
1011 #@deferred(SUBSCRIBER_TIMEOUT)
1012 def test_subscriber_authentication_with_no_certificate_and_channel_surfing(self):
1013 ### """Test subscriber to auth with No Certification and join channel"""
1014 num_subscribers = 1
1015 num_channels = 1
1016 df = defer.Deferred()
1017 def sub_auth_no_cert(df):
1018 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1019 num_channels = num_channels,
1020 cbs = (self.tls_no_cert, self.dhcp_verify, self.igmp_verify),
1021 port_list = self.generate_port_list(num_subscribers, num_channels),
1022 negative_subscriber_auth = 'all')
1023 assert_equal(test_status, False)
1024 df.callback(0)
1025 reactor.callLater(0, sub_auth_no_cert, df)
1026 return df
1027
1028 def test_subscriber_authentication_with_self_signed_certificate_and_channel_surfing(self):
1029 ### """Test subscriber to auth with Self Signed Certification 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_self_signed_cert, self.dhcp_verify, self.igmp_verify),
1035 port_list = self.generate_port_list(num_subscribers, num_channels),
1036 negative_subscriber_auth = 'all')
1037 assert_equal(test_status, True)
1038
1039 def test_subscriber_authentication_with_dhcp_discover_and_channel_surfing(self):
1040 ### """Test subscriber auth success, DHCP re-discover with DHCP server and join channel"""
1041 num_subscribers = 1
1042 num_channels = 1
1043 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1044 num_channels = num_channels,
1045 cbs = (self.tls_verify, self.dhcp_discover_scenario, self.igmp_verify),
1046 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1047 assert_equal(test_status, True)
1048
1049 def test_subscriber_authentication_with_dhcp_client_reboot_scenario_and_channel_surfing(self):
1050 ### """Test subscriber auth success, DHCP client got re-booted and join channel"""
1051 num_subscribers = 1
1052 num_channels = 1
1053 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1054 num_channels = num_channels,
1055 cbs = (self.tls_verify, self.dhcp_client_reboot_scenario, self.igmp_verify),
1056 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1057 assert_equal(test_status, True)
1058
1059 def test_subscriber_authentication_with_dhcp_server_reboot_scenario_and_channel_surfing(self):
1060 ### """Test subscriber auth , DHCP server re-boot during DHCP process and join channel"""
1061 num_subscribers = 1
1062 num_channels = 1
1063 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1064 num_channels = num_channels,
1065 cbs = (self.tls_verify, self.dhcp_server_reboot_scenario, self.igmp_verify),
1066 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1067 assert_equal(test_status, True)
1068
1069 def test_subscriber_authentication_with_dhcp_client_rebind_and_channel_surfing(self):
1070 ### """Test subscriber auth , DHCP client rebind IP 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_client_rebind_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
1080 def test_subscriber_authentication_with_dhcp_starvation_scenario_and_channel_surfing(self):
1081 ### """Test subscriber auth , DHCP starvation and join channel"""
1082 num_subscribers = 1
1083 num_channels = 1
1084 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1085 num_channels = num_channels,
1086 cbs = (self.tls_verify, self.dhcp_starvation_scenario, self.igmp_verify),
1087 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1088 assert_equal(test_status, True)
1089
1090 def test_subscriber_authentication_with_multiple_dhcp_discover_for_same_subscriber_and_channel_surfing(self):
1091 ### """Test subscriber auth , sending same DHCP client discover multiple times and join channel"""
1092 num_subscribers = 1
1093 num_channels = 1
1094 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1095 num_channels = num_channels,
1096 cbs = (self.tls_verify, self.dhcp_same_client_multi_discovers_scenario, self.igmp_verify),
1097 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1098 assert_equal(test_status, True)
1099
1100 def test_subscriber_authentication_with_multiple_dhcp_request_for_same_subscriber_and_channel_surfing(self):
1101 ### """Test subscriber auth , same DHCP client multiple requerts times and join channel"""
1102 num_subscribers = 1
1103 num_channels = 1
1104 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1105 num_channels = num_channels,
1106 cbs = (self.tls_verify, self.dhcp_same_client_multi_request_scenario, self.igmp_verify),
1107 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1108 assert_equal(test_status, True)
1109
1110 def test_subscriber_authentication_with_dhcp_client_requested_ip_and_channel_surfing(self):
1111 ### """Test subscriber auth with DHCP client requesting ip and join channel"""
1112 num_subscribers = 1
1113 num_channels = 1
1114 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1115 num_channels = num_channels,
1116 cbs = (self.tls_verify, self.dhcp_client_desired_ip_scenario, self.igmp_verify),
1117 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1118 assert_equal(test_status, True)
1119
1120 def test_subscriber_authentication_with_dhcp_non_offered_ip_and_channel_surfing(self):
1121 ### """Test subscriber auth with DHCP client request for non-offered ip and join channel"""
1122 num_subscribers = 1
1123 num_channels = 1
1124 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1125 num_channels = num_channels,
1126 cbs = (self.tls_verify, self.dhcp_client_request_pkt_with_non_offered_ip_scenario, self.igmp_verify),
1127 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1128 assert_equal(test_status, True)
1129
1130 def test_subscriber_authentication_with_dhcp_request_out_of_pool_ip_by_client_and_channel_surfing(self):
1131 ### """Test subscriber auth with DHCP client requesting out of pool ip and join channel"""
1132 num_subscribers = 1
1133 num_channels = 1
1134 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1135 num_channels = num_channels,
1136 cbs = (self.tls_verify, self.dhcp_client_requested_out_pool_ip_scenario, self.igmp_verify),
1137 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1138 assert_equal(test_status, True)
1139
1140 def test_subscriber_authentication_with_dhcp_specified_lease_time_functionality_and_channel_surfing(self):
1141 ### """Test subscriber auth with DHCP client specifying lease time and join channel"""
1142 num_subscribers = 1
1143 num_channels = 1
1144 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1145 num_channels = num_channels,
1146 cbs = (self.tls_verify, self.dhcp_client_specific_lease_scenario, self.igmp_verify),
1147 port_list = self.generate_port_list(num_subscribers, num_channels), negative_subscriber_auth = 'all')
1148 assert_equal(test_status, True)
ChetanGaonker5b984cb2016-07-12 15:50:49 -07001149
1150
1151 def test_subscriber_join_recv_100channels(self):
1152 num_subscribers = 1
1153 num_channels = 100
1154 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1155 num_channels = num_channels,
1156 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1157 port_list = self.generate_port_list(num_subscribers, num_channels),
1158 negative_subscriber_auth = 'all')
1159 assert_equal(test_status, True)
1160
1161 def test_subscriber_join_recv_400channels(self):
1162 num_subscribers = 1
1163 num_channels = 400
1164 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1165 num_channels = num_channels,
1166 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1167 port_list = self.generate_port_list(num_subscribers, num_channels),
1168 negative_subscriber_auth = 'all')
1169 assert_equal(test_status, True)
1170
1171 def test_subscriber_join_recv_800channels(self):
1172 num_subscribers = 1
1173 num_channels = 800
1174 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1175 num_channels = num_channels,
1176 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1177 port_list = self.generate_port_list(num_subscribers, num_channels),
1178 negative_subscriber_auth = 'all')
1179 assert_equal(test_status, True)
1180
1181 def test_subscriber_join_recv_1200channels(self):
1182 num_subscribers = 1
1183 num_channels = 1200
1184 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1185 num_channels = num_channels,
1186 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1187 port_list = self.generate_port_list(num_subscribers, num_channels),
1188 negative_subscriber_auth = 'all')
1189 assert_equal(test_status, True)
1190
1191 def test_subscriber_join_recv_1500channels(self):
1192 num_subscribers = 1
1193 num_channels = 1500
1194 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1195 num_channels = num_channels,
1196 cbs = (self.tls_verify, self.dhcp_verify, self.igmp_verify),
1197 port_list = self.generate_port_list(num_subscribers, num_channels),
1198 negative_subscriber_auth = 'all')
1199 assert_equal(test_status, True)
1200
1201 def test_subscriber_join_jump_100channels(self):
1202 num_subscribers = 1
1203 num_channels = 100
1204 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1205 num_channels = num_channels,
1206 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1207 port_list = self.generate_port_list(num_subscribers, num_channels),
1208 negative_subscriber_auth = 'all')
1209 assert_equal(test_status, True)
1210 def test_subscriber_join_jump_400channels(self):
1211 num_subscribers = 1
1212 num_channels = 400
1213 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1214 num_channels = num_channels,
1215 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1216 port_list = self.generate_port_list(num_subscribers, num_channels),
1217 negative_subscriber_auth = 'all')
1218 assert_equal(test_status, True)
1219 def test_subscriber_join_jump_800channels(self):
1220 num_subscribers = 1
1221 num_channels = 800
1222 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1223 num_channels = num_channels,
1224 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1225 port_list = self.generate_port_list(num_subscribers, num_channels),
1226 negative_subscriber_auth = 'all')
1227 assert_equal(test_status, True)
1228 def test_subscriber_join_jump_1200channel(sself):
1229 num_subscribers = 1
1230 num_channels = 1200
1231 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1232 num_channels = num_channels,
1233 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1234 port_list = self.generate_port_list(num_subscribers, num_channels),
1235 negative_subscriber_auth = 'all')
1236 assert_equal(test_status, True)
1237 def test_subscriber_join_jump_1500channels(self):
1238 num_subscribers = 1
1239 num_channels = 1500
1240 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1241 num_channels = num_channels,
1242 cbs = (self.tls_verify, self.dhcp_jump_verify, self.igmp_jump_verify),
1243 port_list = self.generate_port_list(num_subscribers, num_channels),
1244 negative_subscriber_auth = 'all')
1245 assert_equal(test_status, True)
1246
1247 def test_subscriber_join_next_100channels(self):
1248 num_subscribers = 1
1249 num_channels = 100
1250 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1251 num_channels = num_channels,
1252 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1253 port_list = self.generate_port_list(num_subscribers, num_channels),
1254 negative_subscriber_auth = 'all')
1255 assert_equal(test_status, True)
1256
1257 def test_subscriber_join_next_400channels(self):
1258 num_subscribers = 1
1259 num_channels = 400
1260 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1261 num_channels = num_channels,
1262 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1263 port_list = self.generate_port_list(num_subscribers, num_channels),
1264 negative_subscriber_auth = 'all')
1265 assert_equal(test_status, True)
1266
1267 def test_subscriber_join_next_800channels(self):
1268 num_subscribers = 1
1269 num_channels = 800
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
1278 def test_subscriber_join_next_1200channels(self):
1279 num_subscribers = 1
1280 num_channels = 1200
1281 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1282 num_channels = num_channels,
1283 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1284 port_list = self.generate_port_list(num_subscribers, num_channels),
1285 negative_subscriber_auth = 'all')
1286 assert_equal(test_status, True)
1287
1288 def test_subscriber_join_next_1500channels(self):
1289 num_subscribers = 1
1290 num_channels = 1500
1291 test_status = self.subscriber_join_verify(num_subscribers = num_subscribers,
1292 num_channels = num_channels,
1293 cbs = (self.tls_verify, self.dhcp_next_verify, self.igmp_next_verify),
1294 port_list = self.generate_port_list(num_subscribers, num_channels),
1295 negative_subscriber_auth = 'all')
1296 assert_equal(test_status, True)