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
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment