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
c8d00461
Commit
c8d00461
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Plain Diff
Finished feature POL1-643-poller-port-type.
parents
5ecfdcd5
f8c9fbe3
No related branches found
No related tags found
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 @
c8d00461
...
@@ -120,11 +120,13 @@ class BRIAN_DASHBOARDS(Enum):
...
@@ -120,11 +120,13 @@ class BRIAN_DASHBOARDS(Enum):
# NREN customer
# NREN customer
NREN
=
auto
()
NREN
=
auto
()
class
PORT_TYPES
(
Enum
):
class
PORT_TYPES
(
Enum
):
ACCESS
=
auto
()
ACCESS
=
auto
()
SERVICE
=
auto
()
SERVICE
=
auto
()
UNKNOWN
=
auto
()
UNKNOWN
=
auto
()
# only used in INTERFACE_LIST_SCHEMA and sphinx docs
# only used in INTERFACE_LIST_SCHEMA and sphinx docs
_DASHBOARD_IDS
=
[
d
.
name
for
d
in
list
(
BRIAN_DASHBOARDS
)]
_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 @
c8d00461
...
@@ -102,7 +102,7 @@ def test_extract_ims_data(mocker):
...
@@ -102,7 +102,7 @@ def test_extract_ims_data(mocker):
assert
res
[
'
lg_routers
'
]
==
[
'
lg router 1
'
,
'
lg router 2
'
]
assert
res
[
'
lg_routers
'
]
==
[
'
lg router 1
'
,
'
lg router 2
'
]
assert
res
[
'
customer_contacts
'
]
==
{
'
123
'
:
'
CON A
'
,
'
456
'
:
'
CON B
'
}
assert
res
[
'
customer_contacts
'
]
==
{
'
123
'
:
'
CON A
'
,
'
456
'
:
'
CON B
'
}
assert
res
[
'
planned_work_contacts
'
]
==
\
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
[
'
circuit_ids_to_monitor
'
]
==
[
123
,
456
,
789
]
assert
res
[
'
additional_circuit_customers
'
]
==
\
assert
res
[
'
additional_circuit_customers
'
]
==
\
[
[
...
@@ -113,7 +113,7 @@ def test_extract_ims_data(mocker):
...
@@ -113,7 +113,7 @@ def test_extract_ims_data(mocker):
]
]
},
},
{
'
id b
'
:
[{
'
id
'
:
'
B
'
,
'
name
'
:
'
customer b
'
}]}
{
'
id b
'
:
[{
'
id
'
:
'
B
'
,
'
name
'
:
'
customer b
'
}]}
]
]
assert
res
[
'
hierarchy
'
]
==
{
assert
res
[
'
hierarchy
'
]
==
{
'
1
'
:
{
'
id
'
:
'
1
'
,
'
value
'
:
'
A
'
},
'
1
'
:
{
'
id
'
:
'
1
'
,
'
value
'
:
'
A
'
},
'
2
'
:
{
'
id
'
:
'
2
'
,
'
value
'
:
'
B
'
}
'
2
'
:
{
'
id
'
:
'
2
'
,
'
value
'
:
'
B
'
}
...
@@ -246,7 +246,7 @@ def test_transform_ims_data():
...
@@ -246,7 +246,7 @@ def test_transform_ims_data():
"
status
"
:
"
operational
"
,
"
status
"
:
"
operational
"
,
"
port_a_id
"
:
"
port_id_3
"
,
"
port_a_id
"
:
"
port_id_3
"
,
"
port_b_id
"
:
"
port_id_4
"
,
"
port_b_id
"
:
"
port_id_4
"
,
}
}
],
],
"
port_id_4
"
:
[
"
port_id_4
"
:
[
{
{
...
@@ -600,7 +600,7 @@ def test_populate_poller_interfaces_cache(
...
@@ -600,7 +600,7 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
ae_a
"
,
"
name
"
:
"
ae_a
"
,
"
bundle
"
:
[],
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION B
"
,
"
description
"
:
"
DESCRIPTION B
$GA-0001
"
,
"
circuits
"
:
[]
"
circuits
"
:
[]
},
},
{
{
...
@@ -616,7 +616,7 @@ def test_populate_poller_interfaces_cache(
...
@@ -616,7 +616,7 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
lab_interface_a
"
,
"
name
"
:
"
lab_interface_a
"
,
"
bundle
"
:
[
"
ae_c
"
],
"
bundle
"
:
[
"
ae_c
"
],
"
bundle-parents
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION C
"
,
"
description
"
:
"
DESCRIPTION C
$GA-0001
"
,
"
circuits
"
:
[]
"
circuits
"
:
[]
},
},
{
{
...
@@ -624,7 +624,7 @@ def test_populate_poller_interfaces_cache(
...
@@ -624,7 +624,7 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
ae_c
"
,
"
name
"
:
"
ae_c
"
,
"
bundle
"
:
[],
"
bundle
"
:
[],
"
bundle-parents
"
:
[],
"
bundle-parents
"
:
[],
"
description
"
:
"
DESCRIPTION D
"
,
"
description
"
:
"
DESCRIPTION D
$GS-0001
"
,
"
circuits
"
:
[]
"
circuits
"
:
[]
},
},
]
]
...
@@ -690,43 +690,45 @@ def test_populate_poller_interfaces_cache(
...
@@ -690,43 +690,45 @@ def test_populate_poller_interfaces_cache(
}
}
}
}
}
}
no_lab_res
=
[
no_lab_res
=
[
{
{
"
router
"
:
"
router_a.geant.net
"
,
'
router
'
:
'
router_a.geant.net
'
,
"
name
"
:
"
interface_a
"
,
'
name
'
:
'
interface_a
'
,
"
bundle
"
:
[
"
ae_a
"
],
'
bundle
'
:
[
'
ae_a
'
],
"
bundle-parents
"
:
[],
'
bundle-parents
'
:
[],
"
description
"
:
"
DESCRIPTION A
"
,
'
description
'
:
'
DESCRIPTION A
'
,
"
circuits
"
:
[],
'
circuits
'
:
[],
"
snmp-index
"
:
12
,
'
port_type
'
:
'
UNKNOWN
'
,
"
dashboards
"
:
[]
'
snmp-index
'
:
12
,
'
dashboards
'
:
[]
},
},
{
{
"
router
"
:
"
router_a.geant.net
"
,
'
router
'
:
'
router_a.geant.net
'
,
"
name
"
:
"
ae_a
"
,
'
name
'
:
'
ae_a
'
,
"
bundle
"
:
[],
'
bundle
'
:
[],
"
bundle-parents
"
:
[
"
interface_a
"
],
'
bundle-parents
'
:
[
'
interface_a
'
],
"
description
"
:
"
DESCRIPTION B
"
,
'
description
'
:
'
DESCRIPTION B $GA-0001
'
,
"
circuits
"
:
[],
'
circuits
'
:
[],
"
snmp-index
"
:
1
,
'
port_type
'
:
'
ACCESS
'
,
"
dashboards
"
:
[]
'
snmp-index
'
:
1
,
'
dashboards
'
:
[]
},
},
{
{
"
router
"
:
"
router_a.geant.net
"
,
'
router
'
:
'
router_a.geant.net
'
,
"
name
"
:
"
ae_a.123
"
,
'
name
'
:
'
ae_a.123
'
,
"
bundle
"
:
[],
'
bundle
'
:
[],
"
bundle-parents
"
:
[
"
interface_a
"
],
'
bundle-parents
'
:
[
'
interface_a
'
],
"
description
"
:
"
DESCRIPTION C
"
,
'
description
'
:
'
DESCRIPTION C
'
,
"
circuits
"
:
[{
'
circuits
'
:
[{
"
id
"
:
321
,
'
id
'
:
321
,
"
name
"
:
"
SERVICE A
"
,
'
name
'
:
'
SERVICE A
'
,
"
type
"
:
"
SERVICE TYPE
"
,
'
type
'
:
'
SERVICE TYPE
'
,
"
status
"
:
"
operational
"
'
status
'
:
'
operational
'
}],
}],
"
snmp-index
"
:
1231
,
'
port_type
'
:
'
UNKNOWN
'
,
"
dashboards
"
:
[]
'
snmp-index
'
:
1231
,
},
'
dashboards
'
:
[]
}
]
]
lab_res
=
[
lab_res
=
[
{
{
...
@@ -734,11 +736,12 @@ def test_populate_poller_interfaces_cache(
...
@@ -734,11 +736,12 @@ def test_populate_poller_interfaces_cache(
"
name
"
:
"
ae_c
"
,
"
name
"
:
"
ae_c
"
,
"
bundle
"
:
[],
"
bundle
"
:
[],
"
bundle-parents
"
:
[
"
lab_interface_a
"
],
"
bundle-parents
"
:
[
"
lab_interface_a
"
],
"
description
"
:
"
DESCRIPTION D
"
,
"
description
"
:
"
DESCRIPTION D
$GS-0001
"
,
"
circuits
"
:
[],
"
circuits
"
:
[],
"
snmp-index
"
:
3
,
"
snmp-index
"
:
3
,
"
dashboards
"
:
[]
"
dashboards
"
:
[],
},
"
port_type
"
:
"
SERVICE
"
}
]
]
for
k
in
r
.
keys
(
"
lab:netconf-interfaces-hosts:*
"
):
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