blob: 2f21953bc6a517ee2d8775cc65fb475a28fc3576 [file] [log] [blame]
Chetan Gaonkercb122cc2016-05-10 10:58:34 -07001#!/usr/bin/env python
Chetan Gaonkercfcce782016-05-10 10:10:42 -07002#
3# Copyright 2016-present Ciena Corporation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
A R Karthicka2e53d62016-02-19 17:38:30 -080017import unittest
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080018import time
19import os
20from nose.tools import *
A R Karthicka2e53d62016-02-19 17:38:30 -080021from EapTLS import TLSAuthTest
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080022from OnosCtrl import OnosCtrl
A R Karthicka2e53d62016-02-19 17:38:30 -080023
24class eap_auth_exchange(unittest.TestCase):
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080025
26 app = 'org.onosproject.aaa'
27
28 def setUp(self):
29 self.onos_ctrl = OnosCtrl(self.app)
30 self.onos_aaa_config()
31
32 def onos_aaa_config(self):
33 aaa_dict = {'apps' : { 'org.onosproject.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
34 'radiusIp': '172.17.0.2' } } } }
35 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
36 aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip
Chetan Gaonker41d2e072016-03-15 16:41:31 -070037 self.onos_ctrl.activate()
38 time.sleep(2)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080039 self.onos_load_config(aaa_dict)
40
41 def onos_load_config(self, config):
Chetan Gaonkera2b87df2016-03-31 15:41:31 -070042 status, code = OnosCtrl.config(config)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080043 if status is False:
44 log.info('Configure request for AAA returned status %d' %code)
45 assert_equal(status, True)
Chetan Gaonker41d2e072016-03-15 16:41:31 -070046 time.sleep(3)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080047
A R Karthicka2e53d62016-02-19 17:38:30 -080048 def test_eap_tls(self):
49 tls = TLSAuthTest()
50 tls.runTest()
51
52if __name__ == '__main__':
53 t = TLSAuthTest()
54 t.runTest()
55