Browse Source

re-add test-options

Marcus Scharf 6 years ago
parent
commit
0de40000f3
1 changed files with 21 additions and 3 deletions
  1. 21 3
      ext-respondd.py

+ 21 - 3
ext-respondd.py

@@ -1,17 +1,35 @@
 #!/usr/bin/env python3
 
 import json
+import argparse
+import sys
 
 
 from lib.respondd_client import ResponddClient
 
+parser = argparse.ArgumentParser()
+
+parser.add_argument('-d', '--test', action='store_true', help='Test Output', required=False)
+#parser.add_argument('-v', '--verbose', action='store_true', help='Verbose Output', required=False)
+
+args = parser.parse_args()
+options = vars(args)
 
 config = {}
 try:
-    with open("config.json", 'r') as cfg_handle:
-        config = json.load(cfg_handle)
+  with open("config.json", 'r') as cfg_handle:
+    config = json.load(cfg_handle)
 except IOError:
-    raise
+  raise
+
+if options["test"]:
+  from lib.nodeinfo import Nodeinfo
+  from lib.statistics import Statistics
+  from lib.neighbours import Neighbours
+  print(json.dumps(Nodeinfo(config).get(), sort_keys=True, indent=4))
+  print(json.dumps(Statistics(config).get(), sort_keys=True, indent=4))
+  print(json.dumps(Neighbours(config).get(), sort_keys=True, indent=4))
+  sys.exit(1)
 
 extResponddClient = ResponddClient(config)
 extResponddClient.start()