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
93bc746a
Commit
93bc746a
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
flake8 and fix test in test_worker.py
parent
d87c0ec5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory_provider/routes/poller.py
+2
-0
2 additions, 0 deletions
inventory_provider/routes/poller.py
test/test_worker.py
+42
-39
42 additions, 39 deletions
test/test_worker.py
with
44 additions
and
39 deletions
inventory_provider/routes/poller.py
+
2
−
0
View file @
93bc746a
...
...
@@ -120,11 +120,13 @@ class BRIAN_DASHBOARDS(Enum):
# NREN customer
NREN
=
auto
()
class
PORT_TYPES
(
Enum
):
ACCESS
=
auto
()
SERVICE
=
auto
()
UNKNOWN
=
auto
()
# only used in INTERFACE_LIST_SCHEMA and sphinx docs
_DASHBOARD_IDS
=
[
d
.
name
for
d
in
list
(
BRIAN_DASHBOARDS
)]
...
...
This diff is collapsed.
Click to expand it.
test/test_worker.py
+
42
−
39
View file @
93bc746a
...
...
@@ -102,7 +102,7 @@ def test_extract_ims_data(mocker):
assert
res
[
'
lg_routers
'
]
==
[
'
lg router 1
'
,
'
lg router 2
'
]
assert
res
[
'
customer_contacts
'
]
==
{
'
123
'
:
'
CON A
'
,
'
456
'
:
'
CON B
'
}
assert
res
[
'
planned_work_contacts
'
]
==
\
{
'
223
'
:
'
CON PW A
'
,
'
556
'
:
'
CON PW B
'
}
{
'
223
'
:
'
CON PW A
'
,
'
556
'
:
'
CON PW B
'
}
assert
res
[
'
circuit_ids_to_monitor
'
]
==
[
123
,
456
,
789
]
assert
res
[
'
additional_circuit_customers
'
]
==
\
[
...
...
@@ -113,7 +113,7 @@ def test_extract_ims_data(mocker):
]
},
{
'
id b
'
:
[{
'
id
'
:
'
B
'
,
'
name
'
:
'
customer b
'
}]}
]
]
assert
res
[
'
hierarchy
'
]
==
{
'
1
'
:
{
'
id
'
:
'
1
'
,
'
value
'
:
'
A
'
},
'
2
'
:
{
'
id
'
:
'
2
'
,
'
value
'
:
'
B
'
}
...
...
@@ -246,7 +246,7 @@ def test_transform_ims_data():
"
status
"
:
"
operational
"
,
"
port_a_id
"
:
"
port_id_3
"
,
"
port_b_id
"
:
"
port_id_4
"
,
}
}
],
"
port_id_4
"
:
[
{
...
...
@@ -600,7 +600,7 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
ae_a
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION B
"
,
"
description
"
:
"
DESCRIPTION B
$GA-0001
"
,
"
circuits
"
:
[]
},
{
...
...
@@ -616,7 +616,7 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
lab_interface_a
"
,
"
bundle
"
:
[
"
ae_c
"
],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION C
"
,
"
description
"
:
"
DESCRIPTION C
$GA-0001
"
,
"
circuits
"
:
[]
},
{
...
...
@@ -624,7 +624,7 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
ae_c
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION D
"
,
"
description
"
:
"
DESCRIPTION D
$GS-0001
"
,
"
circuits
"
:
[]
},
]
...
...
@@ -690,43 +690,45 @@ def test_populate_poller_interfaces_cache(
}
}
}
no_lab_res
=
[
{
"
router
"
:
"
router_a.geant.net
"
,
"
name
"
:
"
interface_a
"
,
"
bundle
"
:
[
"
ae_a
"
],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION A
"
,
"
circuits
"
:
[],
"
snmp-index
"
:
12
,
"
dashboards
"
:
[]
'
router
'
:
'
router_a.geant.net
'
,
'
name
'
:
'
interface_a
'
,
'
bundle
'
:
[
'
ae_a
'
],
'
bundle-parents
'
:
[],
'
description
'
:
'
DESCRIPTION A
'
,
'
circuits
'
:
[],
'
port_type
'
:
'
UNKNOWN
'
,
'
snmp-index
'
:
12
,
'
dashboards
'
:
[]
},
{
"
router
"
:
"
router_a.geant.net
"
,
"
name
"
:
"
ae_a
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
interface_a
"
],
"
description
"
:
"
DESCRIPTION B
"
,
"
circuits
"
:
[],
"
snmp-index
"
:
1
,
"
dashboards
"
:
[]
'
router
'
:
'
router_a.geant.net
'
,
'
name
'
:
'
ae_a
'
,
'
bundle
'
:
[],
'
bundle-parents
'
:
[
'
interface_a
'
],
'
description
'
:
'
DESCRIPTION B $GA-0001
'
,
'
circuits
'
:
[],
'
port_type
'
:
'
ACCESS
'
,
'
snmp-index
'
:
1
,
'
dashboards
'
:
[]
},
{
"
router
"
:
"
router_a.geant.net
"
,
"
name
"
:
"
ae_a.123
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
interface_a
"
],
"
description
"
:
"
DESCRIPTION C
"
,
"
circuits
"
:
[{
"
id
"
:
321
,
"
name
"
:
"
SERVICE A
"
,
"
type
"
:
"
SERVICE TYPE
"
,
"
status
"
:
"
operational
"
'
router
'
:
'
router_a.geant.net
'
,
'
name
'
:
'
ae_a.123
'
,
'
bundle
'
:
[],
'
bundle-parents
'
:
[
'
interface_a
'
],
'
description
'
:
'
DESCRIPTION C
'
,
'
circuits
'
:
[{
'
id
'
:
321
,
'
name
'
:
'
SERVICE A
'
,
'
type
'
:
'
SERVICE TYPE
'
,
'
status
'
:
'
operational
'
}],
"
snmp-index
"
:
1231
,
"
dashboards
"
:
[]
},
'
port_type
'
:
'
UNKNOWN
'
,
'
snmp-index
'
:
1231
,
'
dashboards
'
:
[]
}
]
lab_res
=
[
{
...
...
@@ -734,11 +736,12 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
ae_c
"
,
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
lab_interface_a
"
],
"
description
"
:
"
DESCRIPTION D
"
,
"
description
"
:
"
DESCRIPTION D
$GS-0001
"
,
"
circuits
"
:
[],
"
snmp-index
"
:
3
,
"
dashboards
"
:
[]
},
"
dashboards
"
:
[],
"
port_type
"
:
"
SERVICE
"
}
]
for
k
in
r
.
keys
(
"
lab:netconf-interfaces-hosts:*
"
):
...
...
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