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
5a857e7c
Commit
5a857e7c
authored
8 months ago
by
geant-release-service
Browse files
Options
Downloads
Plain Diff
Finished release 0.128.
parents
cae47dd5
1ebaa4eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Changelog.md
+3
-0
3 additions, 0 deletions
Changelog.md
inventory_provider/db/ims_data.py
+14
-1
14 additions, 1 deletion
inventory_provider/db/ims_data.py
setup.py
+1
-1
1 addition, 1 deletion
setup.py
test/test_ims_data.py
+16
-17
16 additions, 17 deletions
test/test_ims_data.py
with
34 additions
and
19 deletions
Changelog.md
+
3
−
0
View file @
5a857e7c
...
...
@@ -2,6 +2,9 @@
All notable changes to this project will be documented in this file.
## [0.128] - 2024-08-22
-
Small fix to DBOARD3-1005
## [0.127] - 2024-08-21
-
DBOARD3-1005: Temporarily use a local snapshot of flexils data
...
...
This diff is collapsed.
Click to expand it.
inventory_provider/db/ims_data.py
+
14
−
1
View file @
5a857e7c
...
...
@@ -73,9 +73,22 @@ SITE_LOCATION_SCHEMA = {
}
def
_transform_key
(
key
):
if
key
==
"
null
"
:
return
None
try
:
return
int
(
key
)
except
ValueError
:
return
key
def
get_flexils_by_circuitid
(
ds
:
IMS
):
import
pathlib
return
json
.
loads
((
pathlib
.
Path
(
__file__
).
parent
/
'
flexils_data.json
'
).
read_text
())
raw_data
=
json
.
loads
(
(
pathlib
.
Path
(
__file__
).
parent
/
"
flexils_data.json
"
).
read_text
()
)
return
{
_transform_key
(
k
):
v
for
k
,
v
in
raw_data
.
items
()}
by_circuit
=
defaultdict
(
list
)
found_keys
=
set
()
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
1
View file @
5a857e7c
...
...
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup
(
name
=
'
inventory-provider
'
,
version
=
"
0.12
7
"
,
version
=
"
0.12
8
"
,
author
=
'
GEANT
'
,
author_email
=
'
swd@geant.org
'
,
description
=
'
Dashboard inventory provider
'
,
...
...
This diff is collapsed.
Click to expand it.
test/test_ims_data.py
+
16
−
17
View file @
5a857e7c
...
...
@@ -10,7 +10,6 @@ from inventory_provider.db.ims_data import lookup_lg_routers, \
get_port_id_services
,
get_port_details
,
\
get_circuit_hierarchy
,
get_ids_and_sids
,
NODE_LOCATION_SCHEMA
,
\
get_flexils_by_circuitid
,
SITE_LOCATION_SCHEMA
,
get_site_locations
import
pytest
def
_json_test_data
(
filename
):
...
...
@@ -407,7 +406,6 @@ def test_get_circuit_ids_and_sids(mocker):
assert
res
==
expected_response
@pytest.mark.xfail
(
reason
=
"
Temporary using ims bypass for flexils
"
)
def
test_get_flexils_by_circuit_id
(
mocker
):
ims
=
mocker
.
patch
(
'
inventory_provider.db.ims.IMS
'
)
ims
.
return_value
.
get_all_entities
.
return_value
=
\
...
...
@@ -447,22 +445,23 @@ def test_get_flexils_by_circuit_id(mocker):
"
customproperties
"
:
{}
}
]
expected_result
=
{
702203
:
[
{
'
node_name
'
:
'
CAM01-MTC6-3
'
,
'
full_port_name
'
:
'
1-A-1-S1-1
'
,
'
key
'
:
'
CAM01-MTC6-3:1-A-1-S1-1
'
},
{
'
node_name
'
:
'
CAM01-MTC6-3
'
,
'
full_port_name
'
:
'
1-A-1-L1-1
'
,
'
key
'
:
'
CAM01-MTC6-3:1-A-1-L1-1
'
}
]
}
#
expected_result = {
#
702203: [
#
{
#
'node_name': 'CAM01-MTC6-3',
#
'full_port_name': '1-A-1-S1-1',
#
'key': 'CAM01-MTC6-3:1-A-1-S1-1'
#
},
#
{
#
'node_name': 'CAM01-MTC6-3',
#
'full_port_name': '1-A-1-L1-1',
#
'key': 'CAM01-MTC6-3:1-A-1-L1-1'
#
}
#
]
#
}
ds
=
inventory_provider
.
db
.
ims
.
IMS
(
'
dummy_base
'
,
'
dummy_username
'
,
'
dummy_password
'
)
res
=
get_flexils_by_circuitid
(
ds
)
assert
res
==
expected_result
assert
all
(
isinstance
(
k
,
(
int
,
type
(
None
)))
for
k
in
res
)
# 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