From af6eefe720eecb41e907df356cf0cc0767235296 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Mon, 4 Feb 2019 13:36:07 +0100
Subject: [PATCH] remove config element 'routers-community.conf'

---
 inventory_provider/config.py | 48 +++++++++++++++++++-----------------
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/inventory_provider/config.py b/inventory_provider/config.py
index 0f6bc1b3..0603b592 100644
--- a/inventory_provider/config.py
+++ b/inventory_provider/config.py
@@ -27,7 +27,6 @@ CONFIG_SCHEMA = {
         "alarms-db": {"$ref": "#/definitions/database_credentials"},
         "ops-db": {"$ref": "#/definitions/database_credentials"},
         "oid_list.conf": {"type": "string"},
-        "routers_community.conf": {"type": "string"},
         "ssh": {
             "type": "object",
             "properties": {
@@ -47,6 +46,11 @@ CONFIG_SCHEMA = {
             "required": ["hostname", "port"],
             "additionalProperties": False
         },
+        "junosspace": {
+            "api": {"type": "string"},
+            "username": {"type": "string"},
+            "password": {"type": "string"}
+        },
         "infinera-dna": {
             "type": "array",
             "items": {
@@ -76,9 +80,9 @@ CONFIG_SCHEMA = {
         "alarms-db",
         "ops-db",
         "oid_list.conf",
-        "routers_community.conf",
         "ssh",
         "redis",
+        "junosspace",
         "infinera-dna",
         "coriant-tnms"],
     "additionalProperties": False
@@ -98,24 +102,24 @@ def _load_oids(config_file):
     return result
 
 
-def _load_routers(config_file):
-    """
-    :param config_file: file-like object
-    :return:
-    """
-    for line in config_file:
-        m = re.match(
-            r'^([a-z\d]+\.[a-z\d]{3,4}\.[a-z\d]{2}'
-            r'\.(geant|eumedconnect)\d*\.net)\s*=([^,]+)\s*,(.*)\s*$',
-            line)
-        if not m:
-            logging.warning("malformed config file line: '%s'" % line.strip())
-            continue
-        yield {
-            "hostname": m.group(1),
-            "community": m.group(3),
-            "address": m.group(4)
-        }
+# def _load_routers(config_file):
+#     """
+#     :param config_file: file-like object
+#     :return:
+#     """
+#     for line in config_file:
+#         m = re.match(
+#             r'^([a-z\d]+\.[a-z\d]{3,4}\.[a-z\d]{2}'
+#             r'\.(geant|eumedconnect)\d*\.net)\s*=([^,]+)\s*,(.*)\s*$',
+#             line)
+#         if not m:
+#             logging.warning("malformed config file line: '%s'" % line.strip())
+#             continue
+#         yield {
+#             "hostname": m.group(1),
+#             "community": m.group(3),
+#             "address": m.group(4)
+#         }
 
 
 def load(f):
@@ -129,6 +133,6 @@ def load(f):
     jsonschema.validate(config, CONFIG_SCHEMA)
     with open(config["oid_list.conf"]) as f:
         config["oids"] = _load_oids(f)
-    with open(config["routers_community.conf"]) as f:
-        config["routers"] = list(_load_routers(f))
+    # with open(config["routers_community.conf"]) as f:
+    #     config["routers"] = list(_load_routers(f))
     return config
-- 
GitLab