blob: 15547e2bf262e0a76c34b2e8303a884060828cc1 [file] [log] [blame]
ChetanGaonkerd43b7d42016-06-08 11:07:34 -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
ChetanGaonkerd43b7d42016-06-08 11:07:34 -07007#
Chetan Gaonkercfcce782016-05-10 10:10:42 -07008# http://www.apache.org/licenses/LICENSE-2.0
ChetanGaonkerd43b7d42016-06-08 11:07:34 -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#
A R Karthicka2e53d62016-02-19 17:38:30 -080016import unittest
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080017import time
18import os
19from nose.tools import *
A R Karthick22aa0c62016-05-31 11:17:12 -070020from nose.twistedtools import reactor, deferred
21from twisted.internet import defer
A R Karthicka2e53d62016-02-19 17:38:30 -080022from EapTLS import TLSAuthTest
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080023from OnosCtrl import OnosCtrl
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070024from scapy.all import *
ChetanGaonker6138fcd2016-08-18 17:56:39 -070025from scapy_ssl_tls.ssl_tls import *
26from scapy_ssl_tls.ssl_tls_crypto import *
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070027log.setLevel('INFO')
A R Karthicka2e53d62016-02-19 17:38:30 -080028
29class eap_auth_exchange(unittest.TestCase):
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080030
A.R Karthick95d044e2016-06-10 18:44:36 -070031 app = 'org.opencord.aaa'
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070032 TLS_TIMEOUT = 20
ChetanGaonker6138fcd2016-08-18 17:56:39 -070033 TEST_TIMEOUT = 3600
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070034 CLIENT_CERT_INVALID = '''-----BEGIN CERTIFICATE-----
A R Karthickaa10a202016-08-15 15:06:21 -070035MIIEyTCCA7GgAwIBAgIJAM6l2jUG56pLMA0GCSqGSIb3DQEBCwUAMIGLMQswCQYD
36VQQGEwJVUzELMAkGA1UECBMCQ0ExEjAQBgNVBAcTCVNvbWV3aGVyZTETMBEGA1UE
37ChMKQ2llbmEgSW5jLjEeMBwGCSqGSIb3DQEJARYPYWRtaW5AY2llbmEuY29tMSYw
38JAYDVQQDEx1FeGFtcGxlIENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0xNjAzMTEx
39ODUzMzVaFw0xNzAzMDYxODUzMzVaMIGLMQswCQYDVQQGEwJVUzELMAkGA1UECBMC
40Q0ExEjAQBgNVBAcTCVNvbWV3aGVyZTETMBEGA1UEChMKQ2llbmEgSW5jLjEeMBwG
41CSqGSIb3DQEJARYPYWRtaW5AY2llbmEuY29tMSYwJAYDVQQDEx1FeGFtcGxlIENl
42cnRpZmljYXRlIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
43ggEBAL9Jv54TkqycL3U2Fdd/y5NXdnPVXwAVV3m6I3eIffVCv8eS+mwlbl9dnbjo
44qqlGEgA3sEg5HtnKoW81l3PSyV/YaqzUzbcpDlgWlbNkFQ3nVxh61gSU34Fc4h/W
45plSvCkwGSbV5udLtEe6S9IflP2Fu/eXa9vmUtoPqDk66p9U/nWVf2H1GJy7XanWg
46wke+HpQvbzoSfPJS0e5Rm9KErrzaIkJpqt7soW+OjVJitUax7h45RYY1HHHlbMQ0
47ndWW8UDsCxFQO6d7nsijCzY69Y8HarH4mbVtqhg3KJevxD9UMRy6gdtPMDZLah1c
48LHRu14ucOK4aF8oICOgtcD06auUCAwEAAaOCASwwggEoMB0GA1UdDgQWBBQwEs0m
49c8HARTVp21wtiwgav5biqjCBwAYDVR0jBIG4MIG1gBQwEs0mc8HARTVp21wtiwga
50v5biqqGBkaSBjjCBizELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRIwEAYDVQQH
51EwlTb21ld2hlcmUxEzARBgNVBAoTCkNpZW5hIEluYy4xHjAcBgkqhkiG9w0BCQEW
52D2FkbWluQGNpZW5hLmNvbTEmMCQGA1UEAxMdRXhhbXBsZSBDZXJ0aWZpY2F0ZSBB
53dXRob3JpdHmCCQDOpdo1BueqSzAMBgNVHRMEBTADAQH/MDYGA1UdHwQvMC0wK6Ap
54oCeGJWh0dHA6Ly93d3cuZXhhbXBsZS5jb20vZXhhbXBsZV9jYS5jcmwwDQYJKoZI
55hvcNAQELBQADggEBAK+fyAFO8CbH35P5mOX+5wf7+AeC+5pwaFcoCV0zlfwniANp
56jISgcIX9rcetLxeYRAO5com3+qLdd9dGVNL0kwufH4QhlSPErG7OLHHAs4JWVhUo
57bH3lK9lgFVlnCDBtQhslzqScR64SCicWcQEjv3ZMZsJwYLvl8unSaKz4+LVPeJ2L
58opCpmZw/V/S2NhBbe3QjTiRPmDev2gbaO4GCfi/6sCDU7UO3o8KryrkeeMIiFIej
59gfwn9fovmpeqCEyupy2JNNUTJibEuFknwx7JAX+htPL27nEgwV1FYtwI3qLiZqkM
60729wo9cFSslJNZBu+GsBP5LszQSuvNTDWytV+qY=
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070061-----END CERTIFICATE-----'''
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080062
ChetanGaonker6138fcd2016-08-18 17:56:39 -070063 invalid_cipher_suites = ['TLS_RSA_WITH_NULL_SHA256',
64 'TLS_RSA_WITH_AES_128_CBC_SHA',
65 'TLS_RSA_WITH_AES_128_CBC_SHA256',
66 'TLS_RSA_WITH_AES_256_CBC_SHA256',
67 'TLS_DHE_DSS_WITH_AES_128_CBC_SHA256',
68 'TLS_DHE_RSA_WITH_AES_128_CBC_SHA256',
69 'TLS_DH_anon_WITH_AES_128_CBC_SHA256',
70 'TLS_DHE_DSS_WITH_AES_256_CBC_SHA256',
71 'TLS_DHE_RSA_WITH_AES_256_CBC_SHA256',
72 'TLS_DH_anon_WITH_AES_256_CBC_SHA256']
73
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070074 def setUp(self):
75 self.onos_ctrl = OnosCtrl(self.app)
76 self.onos_aaa_config()
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080077
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070078 def onos_aaa_config(self):
79 aaa_dict = {'apps' : { 'org.onosproject.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080080 'radiusIp': '172.17.0.2' } } } }
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070081 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
82 aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip
83 self.onos_ctrl.activate()
84 time.sleep(2)
85 self.onos_load_config(aaa_dict)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080086
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070087 def onos_load_config(self, config):
88 status, code = OnosCtrl.config(config)
89 if status is False:
90 log.info('Configure request for AAA returned status %d' %code)
91 assert_equal(status, True)
Chetan Gaonker41d2e072016-03-15 16:41:31 -070092 time.sleep(3)
A R Karthick22aa0c62016-05-31 11:17:12 -070093
ChetanGaonkerd43b7d42016-06-08 11:07:34 -070094 @deferred(TLS_TIMEOUT)
95 def test_eap_tls(self):
96 df = defer.Deferred()
97 def eap_tls_verify(df):
98 tls = TLSAuthTest()
99 tls.runTest()
100 df.callback(0)
101 reactor.callLater(0, eap_tls_verify, df)
102 return df
103
104 @deferred(TLS_TIMEOUT)
105 def test_eap_tls_with_no_cert(self):
106 df = defer.Deferred()
107 def eap_tls_no_cert(df):
108 def tls_no_cert_cb():
109 log.info('TLS authentication failed with no certificate')
ChetanGaonkerd43b7d42016-06-08 11:07:34 -0700110 tls = TLSAuthTest(fail_cb = tls_no_cert_cb, client_cert = '')
111 tls.runTest()
112 assert_equal(tls.failTest, True)
113 df.callback(0)
114 reactor.callLater(0, eap_tls_no_cert, df)
115 return df
116
117 @deferred(TLS_TIMEOUT)
118 def test_eap_tls_with_invalid_cert(self):
119 df = defer.Deferred()
120 def eap_tls_invalid_cert(df):
121 def tls_invalid_cert_cb():
122 log.info('TLS authentication failed with invalid certificate')
123
124 tls = TLSAuthTest(fail_cb = tls_invalid_cert_cb,
125 client_cert = self.CLIENT_CERT_INVALID)
126 tls.runTest()
127 assert_equal(tls.failTest, True)
128 df.callback(0)
129 reactor.callLater(0, eap_tls_invalid_cert, df)
130 return df
131
132 @deferred(TLS_TIMEOUT)
133 def test_eap_tls_Nusers_with_same_valid_cert(self):
134 df = defer.Deferred()
135 def eap_tls_Nusers_with_same_valid_cert(df):
136 num_users = 3
137 for i in xrange(num_users):
138 tls = TLSAuthTest(intf = 'veth{}'.format(i*2))
139 tls.runTest()
140 df.callback(0)
141 reactor.callLater(0, eap_tls_Nusers_with_same_valid_cert, df)
142 return df
A R Karthicka2e53d62016-02-19 17:38:30 -0800143
ChetanGaonker6138fcd2016-08-18 17:56:39 -0700144 @deferred(TLS_TIMEOUT)
145 def test_eap_tls_invalid_session_id(self):
146 df = defer.Deferred()
147 def eap_tls_invalid_session_id(df):
148 def tls_invalid_session_id_cb():
149 log.info('TLS authentication failed with invalid session id')
150 tls = TLSAuthTest(fail_cb = tls_invalid_session_id_cb,session_id = 12345, session_id_length = 1)
151 tls.runTest()
152 assert_equal(tls.failTest, True)
153 df.callback(0)
154 reactor.callLater(0, eap_tls_invalid_session_id, df)
155 return df
156
157 @deferred(TLS_TIMEOUT)
158 def test_eap_tls_random_gmt_unix_time(self):
159 df = defer.Deferred()
160 def eap_tls_invalid_gmt_unix_time(df):
161 def eap_tls_invalid_gmt_unix_time_cb():
162 log.info('TLS authentication failed with invalid gmt_unix_time in Client Hello Packet')
163 for i in [0,7265,98758,23627238]:
164 log.info("\nExecuting test case with gmt_unix_time value is set to %d"%i)
165 tls = TLSAuthTest(fail_cb = eap_tls_invalid_gmt_unix_time_cb, gmt_unix_time = i)
166 tls.runTest()
167 assert_equal(tls.failTest, True)
168 df.callback(0)
169 reactor.callLater(0, eap_tls_invalid_gmt_unix_time, df)
170 return df
171
172 @deferred(TLS_TIMEOUT)
173 def test_eap_tls_invalid_content_type(self,Positive_Test=True):
174 df = defer.Deferred()
175 def eap_tls_invalid_content_type(df):
176 def tls_invalid_content_type_cb():
177 log.info('TLS authentication failed with invalid content type in TLSContentType packet')
178 tls = TLSAuthTest(fail_cb = tls_invalid_content_type_cb, invalid_content_type = 24)
179 tls.runTest()
180 assert_equal(tls.failTest, True)
181 df.callback(0)
182 reactor.callLater(0, eap_tls_invalid_content_type, df)
183 return df
184
185 @deferred(TLS_TIMEOUT)
186 def test_eap_tls_invalid_record_fragment_length(self):
187 df = defer.Deferred()
188 def eap_tls_invalid_record_fragment_length(df):
189 def eap_tls_invalid_record_fragment_length_cb():
190 log.info('TLS authentication failed with invalid fragment length field in TLSRecord packet')
191 tls = TLSAuthTest(fail_cb = eap_tls_invalid_record_fragment_length_cb, record_fragment_length = 17384)
192 tls.runTest()
193 assert_equal(tls.failTest, True)
194 df.callback(0)
195 reactor.callLater(0, eap_tls_invalid_record_fragment_length, df)
196 return df
197
198 #invalid id field in identifier response packet
199 @deferred(TLS_TIMEOUT)
200 def test_eap_tls_with_invalid_id_in_identifier_response_packet(self):
201 df = defer.Deferred()
202 def eap_tls_with_invalid_id_in_identifier_response_packet(df):
203 def tls_with_invalid_id_in_identifier_response_packet_cb():
204 log.info('TLS authentication failed with invalid id in identifier packet')
205 tls = TLSAuthTest(fail_cb = tls_with_invalid_id_in_identifier_response_packet_cb,
206 id_mismatch_in_identifier_response_packet = True)
207 tls.runTest()
208 assert_equal(tls.failTest, True)
209 df.callback(0)
210 reactor.callLater(0, eap_tls_with_invalid_id_in_identifier_response_packet, df)
211 return df
212
213 #invalid id field in client hello packet
214 @deferred(TLS_TIMEOUT)
215 def test_eap_tls_with_invalid_id_in_client_hello_packet(self):
216 df = defer.Deferred()
217 def eap_tls_with_invalid_id_in_client_hello_packet(df):
218 def tls_with_invalid_id_in_client_hello_packet_cb():
219 log.info('TLS authentication failed with invalid id in client hello packet')
220 tls = TLSAuthTest(fail_cb = tls_with_invalid_id_in_client_hello_packet_cb,
221 id_mismatch_in_client_hello_packet = True)
222 tls.runTest()
223 assert_equal(tls.failTest, True)
224 df.callback(0)
225 reactor.callLater(0, eap_tls_with_invalid_id_in_client_hello_packet, df)
226 return df
227
228 @deferred(TLS_TIMEOUT)
229 def test_eap_tls_without_sending_client_hello(self):
230 df = defer.Deferred()
231 def eap_tls_without_sending_client_hello(df):
232 def tls_without_sending_client_hello_cb():
233 log.info('TLS authentication failed with not sending client hello')
234 tls = TLSAuthTest(fail_cb = tls_without_sending_client_hello_cb,
235 dont_send_client_hello = True)
236 tls.runTest()
237 assert_equal(tls.failTest, True)
238 df.callback(0)
239 reactor.callLater(0, eap_tls_without_sending_client_hello, df)
240 return df
241
242 @deferred(TLS_TIMEOUT)
243 def test_eap_tls_aaa_app_deactivate(self):
244 df = defer.Deferred()
245 def eap_tls_aaa_app_deactivate(df):
246 def tls_aaa_app_deactivate_cb():
247 log.info('TLS authentication failed with aaa app deactivated in ONOS')
248 tls = TLSAuthTest(fail_cb = tls_aaa_app_deactivate_cb)
249 self.onos_ctrl.deactivate()
250 tls.runTest()
251 assert_equal(tls.failTest, True)
252 df.callback(0)
253 reactor.callLater(0, eap_tls_aaa_app_deactivate, df)
254 return df
255
256 #keeping cipher suite length as zero but including cipher suite key which is more than zero length in client hello packet
257 @deferred(TLS_TIMEOUT)
258 def test_eap_tls_incorrect_cipher_suite_length_field(self):
259 df = defer.Deferred()
260 def eap_tls_incorrect_cipher_suite_length_field(df):
261 def tls_incorrect_cipher_suite_length_field_cb():
262 log.info('TLS authentication failed with incorrect cipher suite length field in client hello packet')
263 tls = TLSAuthTest(fail_cb = tls_incorrect_cipher_suite_length_field_cb, cipher_suites_length = 0)
264 tls.runTest()
265 assert_equal(tls.failTest, True)
266 df.callback(0)
267 reactor.callLater(0, eap_tls_incorrect_cipher_suite_length_field, df)
268 return df
269
270 #keeping compression methods length to zero but sending compression method of more than 0 zero length in client hello packet
271 @deferred(TLS_TIMEOUT)
272 def test_eap_tls_incorrect_compression_methods_length_field(self):
273 df = defer.Deferred()
274 def eap_tls_incorrect_compression_methods_length_field(df):
275 def tls_incorrect_compression_methods_length_field_cb():
276 log.info('TLS authentication failed with incorrect compression methods length field in client hello packet')
277 tls = TLSAuthTest(fail_cb = tls_incorrect_compression_methods_length_field_cb, compression_methods_length=1,compression_methods=TLSCompressionMethod.LZS)
278 tls.runTest()
279 assert_equal(tls.failTest, True)
280 df.callback(0)
281 reactor.callLater(0, eap_tls_incorrect_compression_methods_length_field, df)
282 return df
283
284 #checking with broadcast source mac of EAPOL packet
285 @deferred(TLS_TIMEOUT)
286 def test_eap_tls_invalid_source_mac_broadcast(self):
287 df = defer.Deferred()
288 def eap_tls_invalid_source_mac_broadcast(df):
289 def tls_invalid_source_mac_broadcast_cb():
290 log.info('TLS authentication failed with invalid source mac as broadcast in EAPOL packet')
291 tls = TLSAuthTest(fail_cb = tls_invalid_source_mac_broadcast_cb, src_mac='bcast')
292 tls.runTest()
293 assert_equal(tls.failTest, True)
294 df.callback(0)
295 reactor.callLater(0, eap_tls_invalid_source_mac_broadcast, df)
296 return df
297
298 #checking with multicast source mac of EAPOL packet
299 @deferred(TLS_TIMEOUT)
300 def test_eap_tls_invalid_source_mac_multicast(self):
301 df = defer.Deferred()
302 def eap_tls_invalid_source_mac_multicast(df):
303 def tls_invalid_source_mac_multicast_cb():
304 log.info('TLS authentication failed with invalid source mac as multicast in EAPOL packet')
305 tls = TLSAuthTest(fail_cb = tls_invalid_source_mac_multicast_cb, src_mac='mcast')
306 tls.runTest()
307 assert_equal(tls.failTest, True)
308 df.callback(0)
309 reactor.callLater(0, eap_tls_invalid_source_mac_multicast, df)
310 return df
311
312 #checking with zero source mac of EAPOL packet
313 @deferred(TLS_TIMEOUT)
314 def test_eap_tls_invalid_source_mac_zero(self):
315 df = defer.Deferred()
316 def eap_tls_invalid_source_mac_zero(df):
317 def tls_invalid_source_mac_zero_cb():
318 log.info('TLS authentication failed with invalid source mac as zero in EAPOL packet')
319 tls = TLSAuthTest(fail_cb = tls_invalid_source_mac_zero_cb, src_mac='zeros')
320 tls.runTest()
321 assert_equal(tls.failTest, True)
322 df.callback(0)
323 reactor.callLater(0, eap_tls_invalid_source_mac_zero, df)
324 return df
325
326 #Restarting Radius server after sending client hello
327 @deferred(TLS_TIMEOUT)
328 def test_eap_tls_restart_radius_server(self):
329 df = defer.Deferred()
330 def eap_tls_restart_radius_server(df):
331 def tls_restart_radius_server_cb():
332 log.info('TLS authentication failed with radius server down in middle of authentication process')
333 tls = TLSAuthTest(fail_cb = tls_restart_radius_server_cb, restart_radius=True)
334 tls.runTest()
335 assert_equal(tls.failTest, True)
336 df.callback(0)
337 reactor.callLater(0, eap_tls_restart_radius_server, df)
338 return df
339
340 @deferred(TLS_TIMEOUT)
341 def test_eap_tls_with_incorrect_handshake_type_client_hello(self):
342 df = defer.Deferred()
343 def eap_tls_incorrect_handshake_type_client_hello(df):
344 def tls_incorrect_handshake_type_client_hello_cb():
345 log.info('TLS authentication failed with incorrect handshake type in client hello packet')
346 tls = TLSAuthTest(fail_cb = tls_incorrect_handshake_type_client_hello_cb, invalid_client_hello_handshake_type=True)
347 tls.runTest()
348 assert_equal(tls.failTest, True)
349 df.callback(0)
350 reactor.callLater(0, eap_tls_incorrect_handshake_type_client_hello, df)
351 return df
352
353 #Sending certificate request type of handhsake instead of certificate verify in client certificate request message
354 @deferred(TLS_TIMEOUT)
355 def test_eap_tls_with_incorrect_handshake_type_certificate_request(self):
356 df = defer.Deferred()
357 def eap_tls_incorrect_handshake_type_certificate_request(df):
358 def tls_incorrect_handshake_type_certificate_request_cb():
359 log.info('TLS authentication failed with incorrect handshake type in client certificate request packet')
360 tls = TLSAuthTest(fail_cb = tls_incorrect_handshake_type_certificate_request_cb, invalid_cert_req_handshake=True)
361 tls.runTest()
362 assert_equal(tls.failTest, True)
363 df.callback(0)
364 reactor.callLater(0, eap_tls_incorrect_handshake_type_certificate_request, df)
365 return df
366
367 #Sending tls record content type as 'ALERT' instead of 'HANDSHAKE' in certificate request packet
368 @deferred(TLS_TIMEOUT)
369 def test_eap_tls_with_incorrect_tlsrecord_certificate_request(self):
370 df = defer.Deferred()
371 def eap_tls_incorrect_tlsrecord_certificate_request(df):
372 def tls_incorrect_tlsrecord_certificate_request_cb():
373 log.info('TLS authentication failed with incorrect tlsrecord type in certificate request packet')
374 tls = TLSAuthTest(fail_cb = tls_incorrect_tlsrecord_certificate_request_cb, incorrect_tlsrecord_type_cert_req=True)
375 tls.runTest()
376 assert_equal(tls.failTest, True)
377 df.callback(0)
378 reactor.callLater(0, eap_tls_incorrect_tlsrecord_certificate_request, df)
379 return df
380
381 #Sending client hello with zero lenght field in Handshake protocol
382 @deferred(TLS_TIMEOUT)
383 def test_eap_tls_invalid_handshake_length_client_hello(self):
384 df = defer.Deferred()
385 def eap_tls_invalid_handshake_length_client_hello(df):
386 def tls_invalid_handshake_length_client_hello_cb():
387 log.info('TLS authentication failed with invalid handshake length in client hello packet')
388 tls = TLSAuthTest(fail_cb = tls_invalid_handshake_length_client_hello_cb, invalid_client_hello_handshake_length=True)
389 tls.runTest()
390 assert_equal(tls.failTest, True)
391 df.callback(0)
392 reactor.callLater(0, eap_tls_invalid_handshake_length_client_hello, df)
393 return df
394
395 @deferred(TLS_TIMEOUT)
396 def test_eap_tls_clientkeyex_replace_with_serverkeyex(self):
397 df = defer.Deferred()
398 def eap_tls_clientkeyex_replace_with_serverkeyex(df):
399 def tls_clientkeyex_replace_with_serverkeyex_cb():
400 log.info('TLS authentication failed with client key exchange replaced with server key exchange')
401 tls = TLSAuthTest(fail_cb = tls_clientkeyex_replace_with_serverkeyex_cb,clientkeyex_replace_with_serverkeyex=True)
402 tls.runTest()
403 assert_equal(tls.failTest, True)
404 df.callback(0)
405 reactor.callLater(0, eap_tls_clientkeyex_replace_with_serverkeyex, df)
406 return df
407
408 #simulating authentication for multiple users, 1K in this test case
409 @deferred(TEST_TIMEOUT)
410 def test_eap_tls_1k_with_diff_mac(self):
411 df = defer.Deferred()
412 def eap_tls_1k_with_diff_mac(df):
413 for i in xrange(1000):
414 tls = TLSAuthTest(src_mac = 'random')
415 tls.runTest()
416 log.info('Authentication successfull for user %d'%i)
417 df.callback(0)
418 reactor.callLater(0, eap_tls_1k_with_diff_mac, df)
419 return df
420
421 #simulating authentication for multiple users, 5K in this test case
422 @deferred(TEST_TIMEOUT)
423 def test_eap_tls_5k_with_diff_mac(self):
424 df = defer.Deferred()
425 def eap_tls_5k_with_diff_mac(df):
426 for i in xrange(5000):
427 tls = TLSAuthTest(src_mac = 'random')
428 tls.runTest()
429 log.info('Authentication successfull for user %d'%i)
430 df.callback(0)
431 reactor.callLater(0, eap_tls_5k_with_diff_mac, df)
432 return df
433
A R Karthicka2e53d62016-02-19 17:38:30 -0800434if __name__ == '__main__':
435 t = TLSAuthTest()
436 t.runTest()