summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2016-06-02 23:39:10 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2016-06-02 23:39:10 +0200
commit41eaecd927452eda97875d388f12da2009d6a6cf (patch)
tree2f717e12fcf6562683a7815c84ea7caf339309ea /tests
parent57be36071e3adcb8c7d59f096cfb82d2f47ce8c5 (diff)
downloadhaircontrol-41eaecd927452eda97875d388f12da2009d6a6cf.zip
haircontrol-41eaecd927452eda97875d388f12da2009d6a6cf.tar.gz
haircontrol-41eaecd927452eda97875d388f12da2009d6a6cf.tar.bz2
Make room for direct_neighbours, add inter.py for use in interactive python shell.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/inter.py25
-rwxr-xr-xtests/test_discovery.py3
2 files changed, 27 insertions, 1 deletions
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()