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
e9f3c0f6
Commit
e9f3c0f6
authored
3 years ago
by
Sam Roberts
Browse files
Options
Downloads
Patches
Plain Diff
add copernicus-specific logic to set up copernicus-specific dashboard
parent
0fa52597
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inventory_provider/routes/poller.py
+7
-1
7 additions, 1 deletion
inventory_provider/routes/poller.py
test/test_general_poller_routes.py
+11
-1
11 additions, 1 deletion
test/test_general_poller_routes.py
test/test_worker.py
+2
-2
2 additions, 2 deletions
test/test_worker.py
with
20 additions
and
4 deletions
inventory_provider/routes/poller.py
+
7
−
1
View file @
e9f3c0f6
...
...
@@ -116,6 +116,9 @@ class BRIAN_DASHBOARDS(Enum):
# NREN customer
NREN
=
auto
()
# COPERNICUS
COPERNICUS
=
auto
()
# only used in INTERFACE_LIST_SCHEMA and sphinx docs
_DASHBOARD_IDS
=
[
d
.
name
for
d
in
list
(
BRIAN_DASHBOARDS
)]
...
...
@@ -415,7 +418,8 @@ def _get_dashboards(interface):
router
=
interface
.
get
(
'
router
'
,
''
).
lower
()
ifc_name
=
interface
.
get
(
'
name
'
,
''
)
description
=
interface
.
get
(
'
description
'
,
''
).
strip
()
if
re
.
search
(
r
'
COPERNICUS.*?\|
'
,
description
,
flags
=
re
.
IGNORECASE
):
yield
BRIAN_DASHBOARDS
.
COPERNICUS
if
'
SRV_CLS
'
in
description
:
yield
BRIAN_DASHBOARDS
.
CLS
if
'
SRV_CLS PRIVATE
'
in
description
:
...
...
@@ -507,6 +511,8 @@ def _get_dashboard_data(ifc):
host
=
ifc
[
'
router
'
]
location
=
host
.
split
(
'
.
'
)[
1
].
upper
()
name
=
f
'
{
name
}
-
{
location
}
'
elif
BRIAN_DASHBOARDS
.
COPERNICUS
.
name
in
dashboards
:
name
=
"
COPERNICUS
"
else
:
name
=
_get_customer_name
(
description
)
...
...
This diff is collapsed.
Click to expand it.
test/test_general_poller_routes.py
+
11
−
1
View file @
e9f3c0f6
...
...
@@ -296,7 +296,9 @@ def test_fw_counter_bytes_oid_values(customer, interface_name, expected_oid):
(
'
SRV_MDVPN CUSTOMER REDIRIS #RedIRIS_AP1_BGP_LU_CoC_1 | MD VPN CoC-REDIRIS -
'
,
# noqa: E501
[
'
MDVPN_CUSTOMERS
'
,
'
NREN
'
]),
(
'
SRV_L2CIRCUIT CUSTOMER TENET PSNC #lon-lon-GEANTOPEN-PSNC-TENET-18067 |
'
,
# noqa: E501
[
'
GEANTOPEN
'
,
'
L2_CIRCUIT
'
])
[
'
GEANTOPEN
'
,
'
L2_CIRCUIT
'
]),
(
'
SRV_L3VPN RE_INTERCONNECT REDCLARA #REDCLARA-MAD-COPERNICUS | ASN27750
'
,
[
'
LHCONE
'
,
'
COPERNICUS
'
,
'
RE_PEER
'
])
])
def
test_interface_dashboard_mapping
(
description
,
expected_dashboards
):
interface
=
{
...
...
@@ -375,6 +377,14 @@ def test_interface_dashboard_mapping(description, expected_dashboards):
'
description
'
:
'
SRV_MDVPN CUSTOMER
'
,
'
dashboards
'
:
[
'
MDVPN_CUSTOMERS
'
,
'
NREN
'
]
},
{
'
name
'
:
'
SRV_MDVPN CUSTOMER
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
({
'
description
'
:
'
SRV_MDVPN CUSTOMER
'
,
'
dashboards
'
:
[
'
MDVPN_CUSTOMERS
'
,
'
NREN
'
]
},
{
'
name
'
:
'
SRV_MDVPN CUSTOMER
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
({
'
description
'
:
'
SRV_L3VPN RE_INTERCONNECT REDCLARA #REDCLARA-MAD-COPERNICUS | ASN27750
'
,
# noqa: E501
'
dashboards
'
:
[
'
COPERNICUS
'
]
},
{
'
name
'
:
'
COPERNICUS
'
,
'
interface_type
'
:
'
LOGICAL
'
}),
])
def
test_description_dashboard_parsing
(
interface
,
dashboard_info
):
...
...
This diff is collapsed.
Click to expand it.
test/test_worker.py
+
2
−
2
View file @
e9f3c0f6
...
...
@@ -74,7 +74,7 @@ def test_extract_ims_data(mocker):
assert
res
[
'
customer_contacts
'
]
==
{
'
123
'
:
'
CON A
'
,
'
456
'
:
'
CON B
'
}
assert
res
[
'
circuit_ids_to_monitor
'
]
==
[
123
,
456
,
789
]
assert
res
[
'
additional_circuit_customer_ids
'
]
==
\
[{
'
id a
'
:
[
'
A
'
,
'
A2
'
]},
{
'
id b
'
:
[
'
B
'
]}]
[{
'
id a
'
:
[
'
A
'
,
'
A2
'
]},
{
'
id b
'
:
[
'
B
'
]}]
assert
res
[
'
hierarchy
'
]
==
{
'
1
'
:
{
'
id
'
:
'
1
'
,
'
value
'
:
'
A
'
},
'
2
'
:
{
'
id
'
:
'
2
'
,
'
value
'
:
'
B
'
}
...
...
@@ -436,7 +436,7 @@ def test_persist_ims_data(mocker, data_config, mocked_redis):
[
"
poller_cache:eq1
"
,
"
poller_cache:eq2
"
]
assert
json
.
loads
(
r
.
get
(
"
ims:sid_services
"
).
decode
(
"
utf-8
"
))
==
\
data
[
"
sid_services
"
]
data
[
"
sid_services
"
]
def
test_retrieve_and_persist_neteng_managed_device_list
(
...
...
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