A R Karthick | a2e53d6 | 2016-02-19 17:38:30 -0800 | [diff] [blame] | 1 | import unittest |
Chetan Gaonker | 1f7c3f8 | 2016-03-08 12:17:37 -0800 | [diff] [blame] | 2 | import time |
| 3 | import os |
| 4 | from nose.tools import * |
A R Karthick | a2e53d6 | 2016-02-19 17:38:30 -0800 | [diff] [blame] | 5 | from EapTLS import TLSAuthTest |
Chetan Gaonker | 1f7c3f8 | 2016-03-08 12:17:37 -0800 | [diff] [blame] | 6 | from OnosCtrl import OnosCtrl |
A R Karthick | a2e53d6 | 2016-02-19 17:38:30 -0800 | [diff] [blame] | 7 | |
| 8 | class eap_auth_exchange(unittest.TestCase): |
Chetan Gaonker | 1f7c3f8 | 2016-03-08 12:17:37 -0800 | [diff] [blame] | 9 | |
| 10 | app = 'org.onosproject.aaa' |
| 11 | |
| 12 | def setUp(self): |
| 13 | self.onos_ctrl = OnosCtrl(self.app) |
Chetan Gaonker | 41d2e07 | 2016-03-15 16:41:31 -0700 | [diff] [blame] | 14 | self.onos_ctrl.deactivate() |
| 15 | time.sleep(2) |
Chetan Gaonker | 1f7c3f8 | 2016-03-08 12:17:37 -0800 | [diff] [blame] | 16 | self.onos_aaa_config() |
| 17 | |
| 18 | def onos_aaa_config(self): |
| 19 | aaa_dict = {'apps' : { 'org.onosproject.aaa' : { 'AAA' : { 'radiusSecret': 'radius_password', |
| 20 | 'radiusIp': '172.17.0.2' } } } } |
| 21 | radius_ip = os.getenv('ONOS_AAA_IP') or '172.17.0.2' |
| 22 | aaa_dict['apps']['org.onosproject.aaa']['AAA']['radiusIp'] = radius_ip |
Chetan Gaonker | 41d2e07 | 2016-03-15 16:41:31 -0700 | [diff] [blame] | 23 | self.onos_ctrl.activate() |
| 24 | time.sleep(2) |
Chetan Gaonker | 1f7c3f8 | 2016-03-08 12:17:37 -0800 | [diff] [blame] | 25 | self.onos_load_config(aaa_dict) |
| 26 | |
| 27 | def onos_load_config(self, config): |
| 28 | status, code = self.onos_ctrl.config(config) |
| 29 | if status is False: |
| 30 | log.info('Configure request for AAA returned status %d' %code) |
| 31 | assert_equal(status, True) |
Chetan Gaonker | 41d2e07 | 2016-03-15 16:41:31 -0700 | [diff] [blame] | 32 | time.sleep(3) |
Chetan Gaonker | 1f7c3f8 | 2016-03-08 12:17:37 -0800 | [diff] [blame] | 33 | |
A R Karthick | a2e53d6 | 2016-02-19 17:38:30 -0800 | [diff] [blame] | 34 | def test_eap_tls(self): |
| 35 | tls = TLSAuthTest() |
| 36 | tls.runTest() |
| 37 | |
| 38 | if __name__ == '__main__': |
| 39 | t = TLSAuthTest() |
| 40 | t.runTest() |
| 41 | |