summaryrefslogtreecommitdiff
path: root/tests/test_discovery.py
blob: ba30dabab4986d0ab271998699f74e3734d90a65 (plain)
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
#!/usr/bin/env python3
import unittest
#import pudb; pudb.set_trace()

from context import haircontrol
from haircontrol import discovery, data #, inspectors

class TestDiscovery(unittest.TestCase):
    
    def setUp(self):
        self.discovery = discovery.Discovery() #MockInspector('../test-data/input'))
        self.maxDiff=None

    def test_wire_graph(self):
        ref_net = data.EtherDomain() #json.load('../test-data/ref-output/equipments.json')

        self.discovery.discover_lldp_hinting(data.Equipment('stg2', '172.16.0.253'))
        self.discovery.discover_static_hinting([
            ('SW_SergeGOUSSE', '172.16.30.23'),
            ('SW_PI_EGL', '172.16.30.27'),
            ('SW_Eglise_ESTANCARBON', '172.16.30.38'),
        ])
        self.discovery.discover_from_root(data.Equipment('stg', '172.16.0.254'))

        self.assertEqual(ref_net.get_equipment_list_sorted(), list(self.discovery.net.get_equipment_list_sorted()))

if __name__ == '__main__':
    unittest.main()