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
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
d4056c6a
Verified
Commit
d4056c6a
authored
6 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Filter edge ports on selected partner
parent
89f65bf6
No related branches found
Branches containing commit
Tags
2.27
Tags containing commit
1 merge request
!286
Add Edge Port, GÉANT IP and IAS products
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/utils/helpers.py
+6
-9
6 additions, 9 deletions
gso/utils/helpers.py
gso/workflows/geant_ip/create_geant_ip.py
+1
-1
1 addition, 1 deletion
gso/workflows/geant_ip/create_geant_ip.py
with
7 additions
and
10 deletions
gso/utils/helpers.py
+
6
−
9
View file @
d4056c6a
...
...
@@ -4,6 +4,7 @@ import re
from
typing
import
TYPE_CHECKING
from
uuid
import
UUID
from
pydantic_forms.types
import
UUIDstr
from
pydantic_forms.validators
import
Choice
from
gso
import
settings
...
...
@@ -11,7 +12,7 @@ from gso.products.product_blocks.router import RouterRole
from
gso.products.product_types.router
import
Router
from
gso.services
import
subscriptions
from
gso.services.netbox_client
import
NetboxClient
from
gso.services.partners
import
get_all_partners
,
get_partner_by_name
from
gso.services.partners
import
get_all_partners
from
gso.utils.shared_enums
import
Vendor
from
gso.utils.types.interfaces
import
PhysicalPortCapacity
from
gso.utils.types.ip_address
import
IPv4AddressType
...
...
@@ -210,20 +211,16 @@ def active_switch_selector() -> Choice:
return
Choice
(
"
Select a switch
"
,
zip
(
switch_subscriptions
.
keys
(),
switch_subscriptions
.
items
(),
strict
=
True
))
# type: ignore[arg-type]
def
active_edge_port_selector
(
*
,
geant_only
:
bool
|
None
=
None
)
->
Choice
:
def
active_edge_port_selector
(
*
,
partner_id
:
UUIDstr
|
None
=
None
)
->
Choice
:
"""
Generate a dropdown selector for choosing an active Edge Port in an input form.
"""
edge_port_subscriptions
=
subscriptions
.
get_active_edge_port_subscriptions
(
includes
=
[
"
subscription_id
"
,
"
description
"
,
"
customer_id
"
]
)
if
geant_only
is
not
None
:
# ``geant_only`` is set, so we will filter accordingly.
geant_partner_id
=
get_partner_by_name
(
"
GEANT
"
)[
"
partner_id
"
]
if
partner_id
:
# ``partner_id`` is set, so we will filter accordingly.
edge_port_subscriptions
=
list
(
filter
(
lambda
subscription
:
geant_only
^
bool
(
subscription
[
"
customer_id
"
]
!=
geant_partner_id
),
edge_port_subscriptions
,
)
filter
(
lambda
subscription
:
bool
(
subscription
[
"
customer_id
"
]
==
partner_id
),
edge_port_subscriptions
)
)
edge_ports
=
{
str
(
port
[
"
subscription_id
"
]):
port
[
"
description
"
]
for
port
in
edge_port_subscriptions
}
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/geant_ip/create_geant_ip.py
+
1
−
1
View file @
d4056c6a
...
...
@@ -41,7 +41,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
initial_user_input
=
yield
CreateGeantIPForm
class
EdgePortSelection
(
BaseModel
):
edge_port
:
active_edge_port_selector
()
# type: ignore[valid-type]
edge_port
:
active_edge_port_selector
(
partner_id
=
initial_user_input
.
partner
)
# type: ignore[valid-type]
ap_type
:
APType
def
__hash__
(
self
)
->
int
:
...
...
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