diff --git a/inventory_provider/config.py b/inventory_provider/config.py index 0f6bc1b320d17da8e4b328cd0957c9f23424eb45..0603b592cb68860703b18dcd6602d8f2ae981968 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