Skip to content
Snippets Groups Projects
Commit af6eefe7 authored by Erik Reid's avatar Erik Reid
Browse files

remove config element 'routers-community.conf'

parent d1300849
Branches
Tags
No related merge requests found
...@@ -27,7 +27,6 @@ CONFIG_SCHEMA = { ...@@ -27,7 +27,6 @@ CONFIG_SCHEMA = {
"alarms-db": {"$ref": "#/definitions/database_credentials"}, "alarms-db": {"$ref": "#/definitions/database_credentials"},
"ops-db": {"$ref": "#/definitions/database_credentials"}, "ops-db": {"$ref": "#/definitions/database_credentials"},
"oid_list.conf": {"type": "string"}, "oid_list.conf": {"type": "string"},
"routers_community.conf": {"type": "string"},
"ssh": { "ssh": {
"type": "object", "type": "object",
"properties": { "properties": {
...@@ -47,6 +46,11 @@ CONFIG_SCHEMA = { ...@@ -47,6 +46,11 @@ CONFIG_SCHEMA = {
"required": ["hostname", "port"], "required": ["hostname", "port"],
"additionalProperties": False "additionalProperties": False
}, },
"junosspace": {
"api": {"type": "string"},
"username": {"type": "string"},
"password": {"type": "string"}
},
"infinera-dna": { "infinera-dna": {
"type": "array", "type": "array",
"items": { "items": {
...@@ -76,9 +80,9 @@ CONFIG_SCHEMA = { ...@@ -76,9 +80,9 @@ CONFIG_SCHEMA = {
"alarms-db", "alarms-db",
"ops-db", "ops-db",
"oid_list.conf", "oid_list.conf",
"routers_community.conf",
"ssh", "ssh",
"redis", "redis",
"junosspace",
"infinera-dna", "infinera-dna",
"coriant-tnms"], "coriant-tnms"],
"additionalProperties": False "additionalProperties": False
...@@ -98,24 +102,24 @@ def _load_oids(config_file): ...@@ -98,24 +102,24 @@ def _load_oids(config_file):
return result return result
def _load_routers(config_file): # def _load_routers(config_file):
""" # """
:param config_file: file-like object # :param config_file: file-like object
:return: # :return:
""" # """
for line in config_file: # for line in config_file:
m = re.match( # m = re.match(
r'^([a-z\d]+\.[a-z\d]{3,4}\.[a-z\d]{2}' # r'^([a-z\d]+\.[a-z\d]{3,4}\.[a-z\d]{2}'
r'\.(geant|eumedconnect)\d*\.net)\s*=([^,]+)\s*,(.*)\s*$', # r'\.(geant|eumedconnect)\d*\.net)\s*=([^,]+)\s*,(.*)\s*$',
line) # line)
if not m: # if not m:
logging.warning("malformed config file line: '%s'" % line.strip()) # logging.warning("malformed config file line: '%s'" % line.strip())
continue # continue
yield { # yield {
"hostname": m.group(1), # "hostname": m.group(1),
"community": m.group(3), # "community": m.group(3),
"address": m.group(4) # "address": m.group(4)
} # }
def load(f): def load(f):
...@@ -129,6 +133,6 @@ def load(f): ...@@ -129,6 +133,6 @@ def load(f):
jsonschema.validate(config, CONFIG_SCHEMA) jsonschema.validate(config, CONFIG_SCHEMA)
with open(config["oid_list.conf"]) as f: with open(config["oid_list.conf"]) as f:
config["oids"] = _load_oids(f) config["oids"] = _load_oids(f)
with open(config["routers_community.conf"]) as f: # with open(config["routers_community.conf"]) as f:
config["routers"] = list(_load_routers(f)) # config["routers"] = list(_load_routers(f))
return config return config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment