blob: c98a069c7df54e3b9ff546efa704c022552dcf91 [file] [log] [blame]
Chetan Gaonkercfcce782016-05-10 10:10:42 -07001#
2# 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
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#
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 Karthicka2e53d62016-02-19 17:38:30 -080020from EapTLS import TLSAuthTest
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080021from OnosCtrl import OnosCtrl
A R Karthicka2e53d62016-02-19 17:38:30 -080022
23class eap_auth_exchange(unittest.TestCase):
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080024
25 app = 'org.onosproject.aaa'
26
27 def setUp(self):
28 self.onos_ctrl = OnosCtrl(self.app)
29 self.onos_aaa_config()
30
31 def onos_aaa_config(self):
32 aaa_dict = {'apps' : { 'org.onosproject.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password',
33 'radiusIp': '172.17.0.2' } } } }
34 radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2'
35 aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip
Chetan Gaonker41d2e072016-03-15 16:41:31 -070036 self.onos_ctrl.activate()
37 time.sleep(2)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080038 self.onos_load_config(aaa_dict)
39
40 def onos_load_config(self, config):
Chetan Gaonkera2b87df2016-03-31 15:41:31 -070041 status, code = OnosCtrl.config(config)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080042 if status is False:
43 log.info('Configure request for AAA returned status %d' %code)
44 assert_equal(status, True)
Chetan Gaonker41d2e072016-03-15 16:41:31 -070045 time.sleep(3)
Chetan Gaonker1f7c3f82016-03-08 12:17:37 -080046
A R Karthicka2e53d62016-02-19 17:38:30 -080047 def test_eap_tls(self):
48 tls = TLSAuthTest()
49 tls.runTest()
50
51if __name__ == '__main__':
52 t = TLSAuthTest()
53 t.runTest()
54