Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
dashboardv3
inventory-provider
Commits
e418b449
Commit
e418b449
authored
6 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
create router & oid list config files
parent
64a2767e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_data_routes.py
+88
-27
88 additions, 27 deletions
test/test_data_routes.py
with
88 additions
and
27 deletions
test/test_data_routes.py
+
88
−
27
View file @
e418b449
...
...
@@ -19,44 +19,105 @@ MODULE_DIR = os.path.realpath(os.path.join(
"
..
"
,
"
inventory_provider
"
))
DATA_CONFIG
=
{
"
alarms-db
"
:
{
"
hostname
"
:
"
test-dashboard01.geant.org
"
,
"
dbname
"
:
"
alarms
"
,
"
username
"
:
"
invprov
"
,
"
password
"
:
"
invprov-password
"
},
"
oid_list.conf
"
:
os
.
path
.
join
(
MODULE_DIR
,
"
oid_list.conf
"
),
"
routers_community.conf
"
:
os
.
path
.
join
(
MODULE_DIR
,
"
routers_community.conf
"
),
"
ssh
"
:
{
"
private-key
"
:
os
.
path
.
join
(
MODULE_DIR
,
"
ssh
"
,
"
monitor_dsa
"
),
"
known-hosts
"
:
os
.
path
.
join
(
MODULE_DIR
,
"
ssh
"
,
"
monitor_known_hosts
"
)
OID_LIST_CONF
=
"""
#
# This file is located in dbupdates/conf and is used by scripts under dbupdates/scripts.
# It holds OID values for retrieving details of a router.
#
## IPv4
v4Address=.1.3.6.1.2.1.4.20.1.1
v4InterfaceOID=.1.3.6.1.2.1.4.20.1.2
v4InterfaceName=.1.3.6.1.2.1.31.1.1.1.1
v4Mask=.1.3.6.1.2.1.4.20.1.3
## IPv6
v6AddressAndMask=.1.3.6.1.2.1.55.1.8.1.2
v6InterfaceName=.1.3.6.1.2.1.55.1.5.1.2
"""
ROUTERS_COMMUNITY_CONF
=
"""
######################################################################################################################################
## ##
## This is a configuration file that stores router names and the SNMP community name in <router>=<community>,<IP address> format. ##
## ##
######################################################################################################################################
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
def
app_config
():
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
"
)
with
open
(
app_config_filename
,
"
w
"
)
as
f
:
f
.
write
(
"
%s =
'
%s
'
\n
"
%
(
"
INVENTORY_PROVIDER_CONFIG_FILENAME
"
,
data_config_filename
))
data_config_filename
(
tmpdir
)
))
yield
app_config_filename
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment