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