Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Mapping 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
Next Generation Map
Mapping Provider
Commits
4e9a1cab
Commit
4e9a1cab
authored
3 weeks ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
lint & typing
parent
4bcafeb6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mapping_provider/api/map.py
+2
-2
2 additions, 2 deletions
mapping_provider/api/map.py
mapping_provider/backends/inventory.py
+1
-1
1 addition, 1 deletion
mapping_provider/backends/inventory.py
mapping_provider/backends/services.py
+7
-6
7 additions, 6 deletions
mapping_provider/backends/services.py
with
10 additions
and
9 deletions
mapping_provider/api/map.py
+
2
−
2
View file @
4e9a1cab
...
@@ -139,7 +139,7 @@ def get_pops() -> PopList:
...
@@ -139,7 +139,7 @@ def get_pops() -> PopList:
city
=
pop_dict
[
'
city
'
],
city
=
pop_dict
[
'
city
'
],
country
=
pop_dict
[
'
country
'
],
country
=
pop_dict
[
'
country
'
],
)
)
return
PopList
(
pops
=
map
(
_make_pop
,
pop_list_obj
))
return
PopList
(
pops
=
list
(
map
(
_make_pop
,
pop_list_obj
))
)
@router.get
(
"
/equipment
"
)
@router.get
(
"
/equipment
"
)
...
@@ -163,7 +163,7 @@ def get_equipment() -> EquipmentList:
...
@@ -163,7 +163,7 @@ def get_equipment() -> EquipmentList:
pop
=
equipment_dict
[
'
pop
'
],
pop
=
equipment_dict
[
'
pop
'
],
status
=
equipment_dict
[
'
status
'
],
status
=
equipment_dict
[
'
status
'
],
)
)
return
EquipmentList
(
equipment
=
map
(
_make_equipment
,
equipment_list_obj
))
return
EquipmentList
(
equipment
=
list
(
map
(
_make_equipment
,
equipment_list_obj
))
)
@router.get
(
"
/trunks
"
)
@router.get
(
"
/trunks
"
)
...
...
This diff is collapsed.
Click to expand it.
mapping_provider/backends/inventory.py
+
1
−
1
View file @
4e9a1cab
import
concurrent.futures
import
concurrent.futures
import
jsonschema
import
logging
import
logging
import
time
import
time
from
threading
import
Event
from
threading
import
Event
from
typing
import
Any
from
typing
import
Any
import
jsonschema
import
requests
import
requests
from
.
import
cache
from
.
import
cache
...
...
This diff is collapsed.
Click to expand it.
mapping_provider/backends/services.py
+
7
−
6
View file @
4e9a1cab
import
functools
import
functools
import
logging
import
logging
from
collections.abc
import
Generator
import
re
import
re
from
collections.abc
import
Generator
from
typing
import
Any
from
typing
import
Any
from
pydantic
import
BaseModel
from
pydantic
import
BaseModel
...
@@ -36,9 +36,10 @@ class Service(BaseModel):
...
@@ -36,9 +36,10 @@ class Service(BaseModel):
class
ServiceList
(
BaseModel
):
class
ServiceList
(
BaseModel
):
services
:
list
[
Service
]
services
:
list
[
Service
]
def
endpoint_to_pop
(
endpoint
:
dict
[
str
,
Any
],
inprov_equipment_dict
:
list
[
dict
[
str
,
str
]])
->
str
:
def
endpoint_to_pop
(
endpoint
:
dict
[
str
,
Any
],
inprov_equipment_dict
:
dict
[
str
,
dict
[
str
,
Any
]])
->
str
:
def
_hostname_to_equipment
(
_hn
)
:
def
_hostname_to_equipment
(
_hn
:
str
)
->
str
:
m
=
re
.
match
(
r
'
^(.+)\.geant\.net$
'
,
_hn
)
m
=
re
.
match
(
r
'
^(.+)\.geant\.net$
'
,
_hn
)
if
not
m
:
if
not
m
:
logger
.
error
(
f
'
unexpected hostname pattern:
{
_hn
}
'
)
logger
.
error
(
f
'
unexpected hostname pattern:
{
_hn
}
'
)
...
@@ -58,9 +59,9 @@ def endpoint_to_pop(endpoint: dict[str, Any], inprov_equipment_dict: list[dict[s
...
@@ -58,9 +59,9 @@ def endpoint_to_pop(endpoint: dict[str, Any], inprov_equipment_dict: list[dict[s
logger
.
error
(
f
'
unknown endpoint equipment:
{
eq_name
}
'
)
logger
.
error
(
f
'
unknown endpoint equipment:
{
eq_name
}
'
)
return
'
?
'
return
'
?
'
return
inprov_equipment_dict
[
eq_name
][
'
pop
'
]
pop_name
=
inprov_equipment_dict
[
eq_name
][
'
pop
'
]
assert
isinstance
(
pop_name
,
str
)
# mypy noise
return
pop_name
def
_services
(
service_type
:
str
|
None
=
None
)
->
Generator
[
Service
]:
def
_services
(
service_type
:
str
|
None
=
None
)
->
Generator
[
Service
]:
...
...
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