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
d4bb5654
You need to sign in or sign up before continuing.
Commit
d4bb5654
authored
1 year ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
one possible way of combining similar methods
parent
18164f0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!8
Feature/iptrunks prototype
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gso/workflows/iptrunk/create_iptrunk.py
+5
-22
5 additions, 22 deletions
gso/workflows/iptrunk/create_iptrunk.py
with
5 additions
and
22 deletions
gso/workflows/iptrunk/create_iptrunk.py
+
5
−
22
View file @
d4bb5654
...
...
@@ -19,26 +19,8 @@ from orchestrator.db.models import ProductTable, SubscriptionTable
from
orchestrator.forms.validators
import
Choice
,
choice_list
from
typing
import
List
,
Optional
def
a_side_device_selector
()
->
list
:
device_subscriptions
=
{}
for
device_id
,
device_description
in
(
SubscriptionTable
.
query
.
join
(
ProductTable
)
.
filter
(
ProductTable
.
product_type
==
"
Device
"
,
SubscriptionTable
.
status
==
"
active
"
,
)
.
with_entities
(
SubscriptionTable
.
subscription_id
,
SubscriptionTable
.
description
)
.
all
()
):
device_subscriptions
[
str
(
device_id
)]
=
device_description
return
choice_list
(
Choice
(
"
DeviceEnumA
"
,
zip
(
device_subscriptions
.
keys
(),
device_subscriptions
.
items
())),
# type:ignore
min_items
=
1
,
max_items
=
1
,
)
def
b_side_
device_selector
()
->
list
:
def
device_selector
(
choice_value
:
str
)
->
list
:
device_subscriptions
=
{}
for
device_id
,
device_description
in
(
SubscriptionTable
.
query
.
join
(
ProductTable
)
...
...
@@ -52,19 +34,20 @@ def b_side_device_selector() -> list:
device_subscriptions
[
str
(
device_id
)]
=
device_description
return
choice_list
(
Choice
(
"
DeviceEnumB
"
,
zip
(
device_subscriptions
.
keys
(),
device_subscriptions
.
items
())),
# type:ignore
Choice
(
choice_value
,
zip
(
device_subscriptions
.
keys
(),
device_subscriptions
.
items
())),
# type:ignore
min_items
=
1
,
max_items
=
1
,
)
def
initial_input_form_generator
(
product_name
:
str
)
->
FormGenerator
:
class
CreateIptrunkForm
(
FormPage
):
class
Config
:
title
=
product_name
geant_s_sid
:
str
iptrunk_sideA_fqdn
:
a_side_
device_selector
()
iptrunk_sideB_fqdn
:
b_side_
device_selector
()
iptrunk_sideA_fqdn
:
device_selector
(
choice_value
=
'
DeviceEnumA
'
)
iptrunk_sideB_fqdn
:
device_selector
(
choice_value
=
'
DeviceEnumB
'
)
user_input
=
yield
CreateIptrunkForm
...
...
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