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

create router & oid list config files

parent 64a2767e
No related branches found
No related tags found
No related merge requests found
...@@ -19,44 +19,105 @@ MODULE_DIR = os.path.realpath(os.path.join( ...@@ -19,44 +19,105 @@ MODULE_DIR = os.path.realpath(os.path.join(
"..", "..",
"inventory_provider")) "inventory_provider"))
DATA_CONFIG = { OID_LIST_CONF = """
"alarms-db": { #
"hostname": "test-dashboard01.geant.org", # This file is located in dbupdates/conf and is used by scripts under dbupdates/scripts.
"dbname": "alarms", # It holds OID values for retrieving details of a router.
"username": "invprov", #
"password": "invprov-password"
}, ## IPv4
"oid_list.conf": os.path.join( v4Address=.1.3.6.1.2.1.4.20.1.1
MODULE_DIR, v4InterfaceOID=.1.3.6.1.2.1.4.20.1.2
"oid_list.conf"), v4InterfaceName=.1.3.6.1.2.1.31.1.1.1.1
"routers_community.conf": os.path.join( v4Mask=.1.3.6.1.2.1.4.20.1.3
MODULE_DIR,
"routers_community.conf"), ## IPv6
"ssh": { v6AddressAndMask=.1.3.6.1.2.1.55.1.8.1.2
"private-key": os.path.join( v6InterfaceName=.1.3.6.1.2.1.55.1.5.1.2
MODULE_DIR, """
"ssh",
"monitor_dsa"), ROUTERS_COMMUNITY_CONF = """
"known-hosts": os.path.join( ######################################################################################################################################
MODULE_DIR, ## ##
"ssh", ## This is a configuration file that stores router names and the SNMP community name in <router>=<community>,<IP address> format. ##
"monitor_known_hosts") ## ##
######################################################################################################################################
mx2.ath.gr.geant.net=0pBiFbD,62.40.114.59
mx1.tal.ee.geant.net=0pBiFbD,62.40.96.1
mx2.tal.ee.geant.net=0pBiFbD,62.40.96.2
mx2.rig.lv.geant.net=0pBiFbD,62.40.96.4
mx1.kau.lt.geant.net=0pBiFbD,62.40.96.6
mx2.kau.lt.geant.net=0pBiFbD,62.40.96.5
mx2.zag.hr.geant.net=0pBiFbD,62.40.96.8
mx2.lju.si.geant.net=0pBiFbD,62.40.96.10
mx1.bud.hu.geant.net=0pBiFbD,62.40.97.1
mx1.pra.cz.geant.net=0pBiFbD,62.40.97.2
mx2.bra.sk.geant.net=0pBiFbD,62.40.97.4
mx1.lon.uk.geant.net=0pBiFbD,62.40.97.5
mx1.vie.at.geant.net=0pBiFbD,62.40.97.7
mx2.bru.be.geant.net=0pBiFbD,62.40.96.20
mx1.poz.pl.geant.net=0pBiFbD,62.40.97.10
mx1.ams.nl.geant.net=0pBiFbD,62.40.97.11
mx1.fra.de.geant.net=0pBiFbD,62.40.97.12
mx1.par.fr.geant.net=0pBiFbD,62.40.97.13
mx1.gen.ch.geant.net=0pBiFbD,62.40.97.14
mx1.mil2.it.geant.net=0pBiFbD,62.40.97.15
mx1.lis.pt.geant.net=0pBiFbD,62.40.96.16
mx2.lis.pt.geant.net=0pBiFbD,62.40.96.17
mx1.mad.es.geant.net=0pBiFbD,62.40.97.16
mx1.sof.bg.geant.net=0pBiFbD,62.40.96.21
mx1.buc.ro.geant.net=0pBiFbD,62.40.96.19
mx1.ham.de.geant.net=0pBiFbD,62.40.96.26
mx1.dub.ie.geant.net=0pBiFbD,62.40.96.3
mx1.dub2.ie.geant.net=0pBiFbD,62.40.96.25
mx1.mar.fr.geant.net=0pBiFbD,62.40.96.12
mx1.lon2.uk.geant.net=0pBiFbD,62.40.96.15
# rt1.clpk.us.geant.net=GEANT_RO,10.200.64.128
# rt1.denv.us.geant.net=GEANT_RO,10.200.67.128
mx1.ath2.gr.geant.net=0pBiFbD,62.40.96.39
# qfx.par.fr.geant.net=0pBiFbD,62.40.117.170
# qfx.fra.de.geant.net=0pBiFbD,62.40.117.162
"""
def data_config_filename(tmp_dir_name):
config = {
"alarms-db": {
"hostname": "xxxxxxx.yyyyy.zzz",
"dbname": "xxxxxx",
"username": "xxxxxx",
"password": "xxxxxxxx"
},
"oid_list.conf": os.path.join(tmp_dir_name, "oid_list.conf"),
"routers_community.conf": os.path.join(tmp_dir_name, "routers_community.conf"),
"ssh": {
"private-key": "private-key-filename",
"known-hosts": "known-hosts=filename"
}
} }
}
with open(config["oid_list.conf"], "w") as f:
f.write(OID_LIST_CONF)
with open(config["routers_community.conf"], "w") as f:
f.write(ROUTERS_COMMUNITY_CONF)
filename = os.path.join(tmp_dir_name, "config.json")
with open(filename, "w") as f:
f.write(json.dumps(config))
return filename
@pytest.fixture @pytest.fixture
def app_config(): def app_config():
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory() as tmpdir:
data_config_filename = os.path.join(tmpdir, "config.json")
with open(data_config_filename, "w") as f:
f.write(json.dumps(DATA_CONFIG))
app_config_filename = os.path.join(tmpdir, "app.config") app_config_filename = os.path.join(tmpdir, "app.config")
with open(app_config_filename, "w") as f: with open(app_config_filename, "w") as f:
f.write("%s = '%s'\n" % ( f.write("%s = '%s'\n" % (
"INVENTORY_PROVIDER_CONFIG_FILENAME", "INVENTORY_PROVIDER_CONFIG_FILENAME",
data_config_filename)) data_config_filename(tmpdir)))
yield app_config_filename yield app_config_filename
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment