From 41eaecd927452eda97875d388f12da2009d6a6cf Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Thu, 2 Jun 2016 23:39:10 +0200 Subject: Make room for direct_neighbours, add inter.py for use in interactive python shell. --- tests/inter.py | 25 +++++++++++++++++++++++++ tests/test_discovery.py | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 tests/inter.py (limited to 'tests') diff --git a/tests/inter.py b/tests/inter.py new file mode 100755 index 0000000..961aa83 --- /dev/null +++ b/tests/inter.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +# TO USE this in interfactive mode : +# python3 +# >>> from inter import eq +# >>> eq['172.16.20.210'].ifaces +# {'?': ('c0:4a:00:fe:1f:87', '?', [], '[ 0 mac_seen]')} + +import context +from haircontrol import discovery, data #, inspectors + +discovery = discovery.Discovery() #MockInspector('../test-data/input')) +discovery.discover_lldp_hinting(data.Equipment('stg2', '172.16.0.253')) +discovery.discover_static_hinting([ + ('SW_SergeGOUSSE', '172.16.30.23'), + ('SW_PI_EGL', '172.16.30.27'), + ('SW_Eglise_ESTANCARBON', '172.16.30.38'), +]) +discovery.discover_from_root(data.Equipment('stg', '172.16.0.254')) +discovery.compute_neighbourhood() + +eq = discovery.net.equipments + + + diff --git a/tests/test_discovery.py b/tests/test_discovery.py index 2e7b308..d89d6f6 100755 --- a/tests/test_discovery.py +++ b/tests/test_discovery.py @@ -20,8 +20,9 @@ class TestDiscovery(unittest.TestCase): ('SW_Eglise_ESTANCARBON', '172.16.30.38'), ]) self.discovery.discover_from_root(data.Equipment('stg', '172.16.0.254')) + self.discovery.compute_neighbourhood() # self.assertEqual(self.ref_net.get_equipment_list_sorted(), list(self.discovery.net.get_equipment_list_sorted())) - print(self.discovery.net) + print(self.discovery.net) # <----- ya un gros print ici qui affiche... tout. if __name__ == '__main__': unittest.main() -- cgit v1.1