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
0cde7cae
Commit
0cde7cae
authored
2 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
added flexILS data retrieval
parent
11cf7d29
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/db/ims_data.py
+10
-0
10 additions, 0 deletions
inventory_provider/db/ims_data.py
test/test_ims_data.py
+62
-1
62 additions, 1 deletion
test/test_ims_data.py
with
72 additions
and
1 deletion
inventory_provider/db/ims_data.py
+
10
−
0
View file @
0cde7cae
...
...
@@ -67,6 +67,16 @@ NODE_LOCATION_SCHEMA = {
}
def
get_flex_ils_entities
(
ds
:
IMS
):
for
f
in
ds
.
get_all_entities
(
'
FLEXILS_SCHF_SUBINTERFACES
'
):
yield
{
'
circuit_id
'
:
f
[
'
circuitid
'
],
'
node_name
'
:
f
[
'
nodename
'
],
'
port_name
'
:
f
[
'
port
'
],
'
full_port_name
'
:
f
[
'
port_ref
'
]
}
def
get_non_monitored_circuit_ids
(
ds
:
IMS
):
# note the id for the relevant field is hard-coded. I didn't want to use
# the name of the field as this can be changed by users
...
...
This diff is collapsed.
Click to expand it.
test/test_ims_data.py
+
62
−
1
View file @
0cde7cae
...
...
@@ -8,7 +8,8 @@ from inventory_provider.db.ims import InventoryStatus
from
inventory_provider.db.ims_data
import
lookup_lg_routers
,
\
get_node_locations
,
IMS_OPSDB_STATUS_MAP
,
\
get_port_id_services
,
get_port_details
,
\
get_circuit_hierarchy
,
get_ids_and_sids
,
NODE_LOCATION_SCHEMA
get_circuit_hierarchy
,
get_ids_and_sids
,
NODE_LOCATION_SCHEMA
,
\
get_flex_ils_entities
def
_json_test_data
(
filename
):
...
...
@@ -385,3 +386,63 @@ def test_get_circuit_ids_and_sids(mocker):
'
dummy_base
'
,
'
dummy_username
'
,
'
dummy_password
'
)
res
=
list
(
get_ids_and_sids
(
ds
))
assert
res
==
expected_response
def
test_get_flex_ils_entities
(
mocker
):
ims
=
mocker
.
patch
(
'
inventory_provider.db.ims.IMS
'
)
ims
.
return_value
.
get_all_entities
.
return_value
=
\
[
{
"
$id
"
:
"
1630
"
,
"
circuitid
"
:
702203
,
"
circuitname
"
:
"
GEANT LAB-GEANT LAB-OCH-003
"
,
"
id
"
:
1
,
"
nodename
"
:
"
CAM01-MTC6-3
"
,
"
node_id
"
:
130498
,
"
port
"
:
"
A-1-S1
"
,
"
port_ref
"
:
"
1-A-1-S1-1
"
,
"
shelfname
"
:
"
1-MTC-6
"
,
"
rowVersion
"
:
"
0001-01-01T00:00:00
"
,
"
circuit
"
:
None
,
"
node_
"
:
None
,
"
errors
"
:
None
,
"
haserrors
"
:
False
,
"
customproperties
"
:
{}
},
{
"
$id
"
:
"
1631
"
,
"
circuitid
"
:
702203
,
"
circuitname
"
:
"
GEANT LAB-GEANT LAB-OCH-003
"
,
"
id
"
:
2
,
"
nodename
"
:
"
CAM01-MTC6-3
"
,
"
node_id
"
:
130498
,
"
port
"
:
"
A-1-L1
"
,
"
port_ref
"
:
"
1-A-1-L1-1
"
,
"
shelfname
"
:
"
1-MTC-6
"
,
"
rowversion
"
:
"
0001-01-01T00:00:00
"
,
"
circuit
"
:
None
,
"
node_
"
:
None
,
"
errors
"
:
None
,
"
haserrors
"
:
False
,
"
customproperties
"
:
{}
}
]
expected_result
=
[
{
'
circuit_id
'
:
702203
,
'
node_name
'
:
'
CAM01-MTC6-3
'
,
'
port_name
'
:
'
A-1-S1
'
,
'
full_port_name
'
:
'
1-A-1-S1-1
'
},
{
'
circuit_id
'
:
702203
,
'
node_name
'
:
'
CAM01-MTC6-3
'
,
'
port_name
'
:
'
A-1-L1
'
,
'
full_port_name
'
:
'
1-A-1-L1-1
'
}
]
ds
=
inventory_provider
.
db
.
ims
.
IMS
(
'
dummy_base
'
,
'
dummy_username
'
,
'
dummy_password
'
)
res
=
list
(
get_flex_ils_entities
(
ds
))
assert
res
==
expected_result
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