-
Notifications
You must be signed in to change notification settings - Fork 46
/
test_plugin_aireos_ha.py
55 lines (42 loc) · 1.37 KB
/
test_plugin_aireos_ha.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from time import sleep
import unittest
from unittest.mock import Mock, patch
import unicon
from pyats.topology import loader
from unicon.plugins.tests.mock.mock_device_aireos import MockDeviceTcpWrapperAireos
class TestAireosPluginHAConnect(unittest.TestCase):
""" Run unit testing on a mocked AireOS HA device """
@classmethod
def setUpClass(cls):
cls.md = MockDeviceTcpWrapperAireos(
port=0, state='aireos_exec,aireos_exec_standby', hostname='WLC')
cls.md.start()
cls.testbed = """
devices:
WLC:
os: aireos
type: wlc
connections:
defaults:
class: unicon.Unicon
a:
protocol: telnet
ip: 127.0.0.1
port: {}
b:
protocol: telnet
ip: 127.0.0.1
port: {}
""".format(cls.md.ports[0], cls.md.ports[1])
tb = loader.load(cls.testbed)
cls.wlc = tb.devices['WLC']
cls.wlc.connect(settings=dict(POST_DISCONNECT_WAIT_SEC=0,
GRACEFUL_DISCONNECT_WAIT_SEC=0))
@classmethod
def tearDownClass(cls):
cls.wlc.disconnect()
cls.md.stop()
def test_save_config(self):
self.wlc.execute('save config')
if __name__ == "__main__":
unittest.main()