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
b74618ad
Commit
b74618ad
authored
6 months ago
by
Mohammad Torkashvand
Browse files
Options
Downloads
Patches
Plain Diff
expand vrf subscription objects
parent
0b2e777d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!357
fix redeploy base config if there is a vprn
Pipeline
#91905
passed
6 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Stage: trigger_jenkins_build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/services/subscriptions.py
+12
-6
12 additions, 6 deletions
gso/services/subscriptions.py
test/fixtures/vrf_fixtures.py
+6
-1
6 additions, 1 deletion
test/fixtures/vrf_fixtures.py
with
18 additions
and
7 deletions
gso/services/subscriptions.py
+
12
−
6
View file @
b74618ad
...
...
@@ -185,7 +185,7 @@ def get_trunks_that_terminate_on_router(
)
def
get_active_l3_services_linked_to_edge_port
(
edge_port_id
:
UUIDstr
)
->
list
[
Subscription
Table
]:
def
get_active_l3_services_linked_to_edge_port
(
edge_port_id
:
UUIDstr
)
->
list
[
Subscription
Model
]:
"""
Retrieve all active l3 core services that are on top of the given edge port.
Args:
...
...
@@ -194,7 +194,7 @@ def get_active_l3_services_linked_to_edge_port(edge_port_id: UUIDstr) -> list[Su
Returns:
A list of active services that are on top of the edge port.
"""
re
turn
(
re
sults
=
(
query_in_use_by_subscriptions
(
UUID
(
edge_port_id
))
.
join
(
ProductTable
)
.
filter
(
...
...
@@ -206,10 +206,12 @@ def get_active_l3_services_linked_to_edge_port(edge_port_id: UUIDstr) -> list[Su
.
all
()
)
return
[
SubscriptionModel
.
from_subscription
(
result
.
subscription_id
)
for
result
in
results
]
def
get_active_l2_circuit_services_linked_to_edge_port
(
edge_port_id
:
UUIDstr
)
->
list
[
Subscription
Table
]:
def
get_active_l2_circuit_services_linked_to_edge_port
(
edge_port_id
:
UUIDstr
)
->
list
[
Subscription
Model
]:
"""
Retrieve all active l2 circuit services that are on top of the given edge port.
"""
re
turn
(
re
sults
=
(
query_in_use_by_subscriptions
(
UUID
(
edge_port_id
))
.
join
(
ProductTable
)
.
filter
(
...
...
@@ -221,8 +223,10 @@ def get_active_l2_circuit_services_linked_to_edge_port(edge_port_id: UUIDstr) ->
.
all
()
)
return
[
SubscriptionModel
.
from_subscription
(
result
.
subscription_id
)
for
result
in
results
]
def
get_active_vrfs_linked_to_router
(
router_id
:
UUIDstr
)
->
list
[
SubscriptionTable
]:
def
get_active_vrfs_linked_to_router
(
router_id
:
UUIDstr
)
->
list
[
SubscriptionModel
]:
"""
Retrieve all active VRFs that are linked to the router.
Args:
...
...
@@ -231,7 +235,7 @@ def get_active_vrfs_linked_to_router(router_id: UUIDstr) -> list[SubscriptionTab
Returns:
A list of active VRFs that are linked to the router.
"""
re
turn
(
re
sults
=
(
query_in_use_by_subscriptions
(
UUID
(
router_id
))
.
join
(
ProductTable
)
.
filter
(
...
...
@@ -243,6 +247,8 @@ def get_active_vrfs_linked_to_router(router_id: UUIDstr) -> list[SubscriptionTab
.
all
()
)
return
[
SubscriptionModel
.
from_subscription
(
result
.
subscription_id
)
for
result
in
results
]
def
get_product_id_by_name
(
product_name
:
ProductName
)
->
UUID
:
"""
Retrieve the UUID of a product by its name.
...
...
This diff is collapsed.
Click to expand it.
test/fixtures/vrf_fixtures.py
+
6
−
1
View file @
b74618ad
...
...
@@ -3,7 +3,7 @@ from orchestrator.db import db
from
orchestrator.domain
import
SubscriptionModel
from
orchestrator.types
import
SubscriptionLifecycle
from
gso.products
import
ProductName
from
gso.products
import
ProductName
,
Router
from
gso.products.product_types.vrf
import
VRFInactive
from
gso.services.subscriptions
import
get_product_id_by_name
...
...
@@ -19,9 +19,13 @@ def vrf_subscription_factory(faker, geant_partner):
route_target
:
str
|
None
=
None
,
vrf_as_number
:
int
|
None
=
None
,
status
:
SubscriptionLifecycle
|
None
=
None
,
vrf_router_list
:
list
[
Router
]
|
None
=
None
,
)
->
SubscriptionModel
:
if
partner
is
None
:
partner
=
geant_partner
vrf_router_list
=
vrf_router_list
or
[]
product_id
=
get_product_id_by_name
(
ProductName
.
VRF
)
vrf_subscription
=
VRFInactive
.
from_product_id
(
product_id
,
customer_id
=
partner
[
"
partner_id
"
],
insync
=
True
)
vrf_subscription
.
vrf
.
vrf_name
=
vrf_name
or
faker
.
pystr
()
...
...
@@ -32,6 +36,7 @@ def vrf_subscription_factory(faker, geant_partner):
vrf_subscription
=
SubscriptionModel
.
from_other_lifecycle
(
vrf_subscription
,
SubscriptionLifecycle
.
ACTIVE
)
vrf_subscription
.
description
=
description
or
f
"
VRF
{
vrf_subscription
.
vrf
.
vrf_name
}
"
vrf_subscription
.
start_date
=
start_date
vrf_subscription
.
vrf
.
vrf_router_list
=
[
router
.
router
for
router
in
vrf_router_list
]
if
status
:
vrf_subscription
.
status
=
status
...
...
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