Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
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
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
1ad019eb
Commit
1ad019eb
authored
1 year ago
by
Mohammad Torkashvand
Browse files
Options
Downloads
Patches
Plain Diff
add extra fileds to topology api needed in maps
parent
e04b7f9f
No related branches found
No related tags found
No related merge requests found
Pipeline
#86114
canceled
1 year ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/api/v1/network.py
+37
-2
37 additions, 2 deletions
gso/api/v1/network.py
with
37 additions
and
2 deletions
gso/api/v1/network.py
+
37
−
2
View file @
1ad019eb
"""
API endpoints for network related operations.
"""
import
ipaddress
from
uuid
import
UUID
from
fastapi
import
APIRouter
...
...
@@ -8,17 +9,38 @@ from orchestrator.schemas.base import OrchestratorBaseModel
from
orchestrator.services.subscriptions
import
build_extended_domain_model
from
starlette
import
status
from
gso.products.product_blocks.iptrunk
import
PhysicalPortCapacity
from
gso.products.product_blocks.iptrunk
import
IptrunkType
,
PhysicalPortCapacity
from
gso.products.product_blocks.router
import
RouterRole
from
gso.products.product_blocks.site
import
LatitudeCoordinate
,
LongitudeCoordinate
from
gso.services.subscriptions
import
get_active_iptrunk_subscriptions
from
gso.utils.shared_enums
import
Vendor
router
=
APIRouter
(
prefix
=
"
/networks
"
,
tags
=
[
"
Network
"
])
class
SiteBlock
(
OrchestratorBaseModel
):
"""
Site block schema.
"""
site_name
:
str
site_city
:
str
site_country
:
str
site_latitude
:
LatitudeCoordinate
site_longitude
:
LongitudeCoordinate
site_internal_id
:
int
class
RouterBlock
(
OrchestratorBaseModel
):
"""
Router block schema.
"""
subscription_instance_id
:
UUID
router_fqdn
:
str
router_access_via_ts
:
bool
router_lo_ipv4_address
:
ipaddress
.
IPv4Address
router_lo_ipv6_address
:
ipaddress
.
IPv6Address
router_lo_iso_address
:
str
router_role
:
RouterRole
vendor
:
Vendor
router_site
:
SiteBlock
class
IptrunkSideBlock
(
OrchestratorBaseModel
):
...
...
@@ -32,7 +54,10 @@ class IptrunkBlock(OrchestratorBaseModel):
"""
Iptrunk block schema.
"""
subscription_instance_id
:
UUID
iptrunk_speed
:
str
iptrunk_speed
:
PhysicalPortCapacity
iptrunk_type
:
IptrunkType
iptrunk_ipv4_network
:
ipaddress
.
IPv4Network
iptrunk_ipv6_network
:
ipaddress
.
IPv6Network
iptrunk_capacity
:
str
iptrunk_isis_metric
:
int
iptrunk_sides
:
list
[
IptrunkSideBlock
]
...
...
@@ -73,6 +98,9 @@ def network_topology() -> NetworkTopologyDomainModelSchema:
"
iptrunk
"
:
{
"
subscription_instance_id
"
:
extended_model
[
"
iptrunk
"
][
"
subscription_instance_id
"
],
"
iptrunk_speed
"
:
extended_model
[
"
iptrunk
"
][
"
iptrunk_speed
"
],
"
iptrunk_type
"
:
extended_model
[
"
iptrunk
"
][
"
iptrunk_type
"
],
"
iptrunk_ipv4_network
"
:
extended_model
[
"
iptrunk
"
][
"
iptrunk_ipv4_network
"
],
"
iptrunk_ipv6_network
"
:
extended_model
[
"
iptrunk
"
][
"
iptrunk_ipv6_network
"
],
"
iptrunk_isis_metric
"
:
extended_model
[
"
iptrunk
"
][
"
iptrunk_isis_metric
"
],
"
iptrunk_capacity
"
:
_calculate_iptrunk_capacity
(
extended_model
[
"
iptrunk
"
][
"
iptrunk_sides
"
],
extended_model
[
"
iptrunk
"
][
"
iptrunk_speed
"
]
...
...
@@ -83,6 +111,13 @@ def network_topology() -> NetworkTopologyDomainModelSchema:
"
iptrunk_side_node
"
:
{
"
subscription_instance_id
"
:
side
[
"
iptrunk_side_node
"
][
"
subscription_instance_id
"
],
"
router_fqdn
"
:
side
[
"
iptrunk_side_node
"
][
"
router_fqdn
"
],
"
router_access_via_ts
"
:
side
[
"
iptrunk_side_node
"
][
"
router_access_via_ts
"
],
"
router_lo_ipv4_address
"
:
side
[
"
iptrunk_side_node
"
][
"
router_lo_ipv4_address
"
],
"
router_lo_ipv6_address
"
:
side
[
"
iptrunk_side_node
"
][
"
router_lo_ipv6_address
"
],
"
router_lo_iso_address
"
:
side
[
"
iptrunk_side_node
"
][
"
router_lo_iso_address
"
],
"
router_role
"
:
side
[
"
iptrunk_side_node
"
][
"
router_role
"
],
"
vendor
"
:
side
[
"
iptrunk_side_node
"
][
"
vendor
"
],
"
router_site
"
:
side
[
"
iptrunk_side_node
"
][
"
router_site
"
],
},
}
for
side
in
extended_model
[
"
iptrunk
"
][
"
iptrunk_sides
"
]
...
...
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