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
77b923be
Commit
77b923be
authored
4 months ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Fix mypy errors.
parent
cbcc15f5
Branches
main
No related tags found
1 merge request
!307
Feature/l2circuits
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/products/product_blocks/layer_2_circuit.py
+2
-1
2 additions, 1 deletion
gso/products/product_blocks/layer_2_circuit.py
gso/workflows/l2_circuit/create_layer_2_circuit.py
+16
-6
16 additions, 6 deletions
gso/workflows/l2_circuit/create_layer_2_circuit.py
with
18 additions
and
7 deletions
gso/products/product_blocks/layer_2_circuit.py
+
2
−
1
View file @
77b923be
"""
Layer 2 Circuit product block.
"""
"""
Layer 2 Circuit product block.
"""
from
collections.abc
import
Sequence
from
typing
import
Annotated
,
TypeVar
from
typing
import
Annotated
,
TypeVar
from
annotated_types
import
Len
from
annotated_types
import
Len
...
@@ -51,7 +52,7 @@ Layer2CircuitSideBlockType = TypeVar(
...
@@ -51,7 +52,7 @@ Layer2CircuitSideBlockType = TypeVar(
)
)
Layer2CircuitSides
=
Annotated
[
Layer2CircuitSides
=
Annotated
[
list
[
Layer2CircuitSideBlockType
],
Sequence
[
Layer2CircuitSideBlockType
],
AfterValidator
(
validate_unique_list
),
AfterValidator
(
validate_unique_list
),
Len
(
min_length
=
2
,
max_length
=
2
),
Len
(
min_length
=
2
,
max_length
=
2
),
Doc
(
"
A list of two Layer 2 Circuit sides.
"
),
Doc
(
"
A list of two Layer 2 Circuit sides.
"
),
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/l2_circuit/create_layer_2_circuit.py
+
16
−
6
View file @
77b923be
...
@@ -52,12 +52,6 @@ def initial_input_generator(product_name: str) -> FormGenerator:
...
@@ -52,12 +52,6 @@ def initial_input_generator(product_name: str) -> FormGenerator:
class
Layer2CircuitServiceSidesPage
(
FormPage
):
class
Layer2CircuitServiceSidesPage
(
FormPage
):
model_config
=
ConfigDict
(
title
=
f
"
{
product_name
}
- Configure Edge Ports
"
)
model_config
=
ConfigDict
(
title
=
f
"
{
product_name
}
- Configure Edge Ports
"
)
vlan_range_label
:
Label
|
None
=
Field
(
None
,
exclude
=
True
)
vlan_range_lower_bound
:
VLAN_ID
|
None
=
None
vlan_range_upper_bound
:
VLAN_ID
|
None
=
None
policer_bandwidth
:
BandwidthString
|
None
=
None
if
initial_user_input
.
layer_2_circuit_type
==
Layer2CircuitType
.
TAGGED
:
if
initial_user_input
.
layer_2_circuit_type
==
Layer2CircuitType
.
TAGGED
:
vlan_range_label
:
Label
=
Field
(
"
Please set a VLAN range, bounds including.
"
,
exclude
=
True
)
vlan_range_label
:
Label
=
Field
(
"
Please set a VLAN range, bounds including.
"
,
exclude
=
True
)
vlan_range_lower_bound
:
VLAN_ID
vlan_range_lower_bound
:
VLAN_ID
...
@@ -79,6 +73,22 @@ def initial_input_generator(product_name: str) -> FormGenerator:
...
@@ -79,6 +73,22 @@ def initial_input_generator(product_name: str) -> FormGenerator:
side_divider
:
Divider
=
Field
(
None
,
exclude
=
True
)
side_divider
:
Divider
=
Field
(
None
,
exclude
=
True
)
layer_2_circuit_side_b
:
Layer2CircuitSideSelection
layer_2_circuit_side_b
:
Layer2CircuitSideSelection
def
__init__
(
self
,
**
data
:
Any
):
"""
Initialize fields based on user input conditions.
"""
super
().
__init__
(
**
data
)
if
initial_user_input
.
layer_2_circuit_type
==
Layer2CircuitType
.
TAGGED
:
self
.
vlan_range_label
=
Field
(
"
Please set a VLAN range, bounds including.
"
,
exclude
=
True
)
self
.
vlan_range_lower_bound
=
VLAN_ID
()
self
.
vlan_range_upper_bound
=
VLAN_ID
()
else
:
self
.
vlan_range_lower_bound
=
ReadOnlyField
(
None
,
default_type
=
int
)
self
.
vlan_range_upper_bound
=
ReadOnlyField
(
None
,
default_type
=
int
)
if
initial_user_input
.
policer_enabled
:
self
.
policer_bandwidth
=
BandwidthString
()
else
:
self
.
policer_bandwidth
=
ReadOnlyField
(
None
,
default_type
=
int
)
layer_2_circuit_input
=
yield
Layer2CircuitServiceSidesPage
layer_2_circuit_input
=
yield
Layer2CircuitServiceSidesPage
return
{
"
product_name
"
:
product_name
}
|
initial_user_input
.
model_dump
()
|
layer_2_circuit_input
.
model_dump
()
return
{
"
product_name
"
:
product_name
}
|
initial_user_input
.
model_dump
()
|
layer_2_circuit_input
.
model_dump
()
...
...
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