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
8b7046d1
Commit
8b7046d1
authored
4 months ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Add policer_burst_rate field to the creation and modification WF.
parent
b4ab4186
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!307
Feature/l2circuits
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gso/workflows/l2_circuit/create_layer_2_circuit.py
+8
-3
8 additions, 3 deletions
gso/workflows/l2_circuit/create_layer_2_circuit.py
gso/workflows/l2_circuit/modify_layer_2_circuit.py
+4
-0
4 additions, 0 deletions
gso/workflows/l2_circuit/modify_layer_2_circuit.py
with
12 additions
and
3 deletions
gso/workflows/l2_circuit/create_layer_2_circuit.py
+
8
−
3
View file @
8b7046d1
...
...
@@ -52,6 +52,10 @@ def initial_input_generator(product_name: str) -> FormGenerator:
"""
Return the appropriate field type based on whether the circuit is tagged.
"""
return
VLAN_ID
if
is_tagged
else
ReadOnlyField
(
None
,
default_type
=
int
)
def
_policer_field
(
*
,
policer_enabled
:
bool
)
->
BandwidthString
:
"""
Return the appropriate field type based on whether the policer is enabled.
"""
return
BandwidthString
if
policer_enabled
else
ReadOnlyField
(
None
,
default_type
=
str
)
class
Layer2CircuitServiceSidesPage
(
FormPage
):
model_config
=
ConfigDict
(
title
=
f
"
{
product_name
}
- Configure Edge Ports
"
)
...
...
@@ -63,9 +67,8 @@ def initial_input_generator(product_name: str) -> FormGenerator:
is_tagged
=
initial_user_input
.
layer_2_circuit_type
==
Layer2CircuitType
.
TAGGED
)
vlan_divider
:
Divider
=
Field
(
None
,
exclude
=
True
)
policer_bandwidth
:
(
# type: ignore[valid-type]
BandwidthString
if
initial_user_input
.
policer_enabled
else
ReadOnlyField
(
None
,
default_type
=
str
)
)
policer_bandwidth
:
_policer_field
(
policer_enabled
=
initial_user_input
.
policer_enabled
)
# type: ignore[valid-type]
policer_burst_rate
:
_policer_field
(
policer_enabled
=
initial_user_input
.
policer_enabled
)
# type: ignore[valid-type]
geant_sid
:
str
layer_2_circuit_side_a
:
Layer2CircuitSideSelection
...
...
@@ -102,6 +105,7 @@ def initialize_subscription(
vlan_range_upper_bound
:
VLAN_ID
|
None
,
policer_enabled
:
bool
,
# noqa: FBT001
policer_bandwidth
:
BandwidthString
|
None
,
policed_burst_rate
:
BandwidthString
|
None
,
geant_sid
:
str
,
)
->
State
:
"""
Build a subscription object from all user input.
"""
...
...
@@ -125,6 +129,7 @@ def initialize_subscription(
subscription
.
layer_2_circuit
.
vlan_range_upper_bound
=
vlan_range_upper_bound
subscription
.
layer_2_circuit
.
policer_enabled
=
policer_enabled
subscription
.
layer_2_circuit
.
bandwidth
=
policer_bandwidth
subscription
.
layer_2_circuit
.
policer_burst_rate
=
policed_burst_rate
subscription
.
description
=
f
"
{
subscription
.
product
.
name
}
-
{
subscription
.
layer_2_circuit
.
virtual_circuit_id
}
"
subscription
=
Layer2Circuit
.
from_other_lifecycle
(
subscription
,
SubscriptionLifecycle
.
PROVISIONING
)
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/l2_circuit/modify_layer_2_circuit.py
+
4
−
0
View file @
8b7046d1
...
...
@@ -49,8 +49,10 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
vlan_divider
:
Divider
=
Field
(
None
,
exclude
=
True
)
if
layer_2_circuit_input
.
policer_enabled
:
policer_bandwidth
:
BandwidthString
=
subscription
.
layer_2_circuit
.
bandwidth
# type: ignore[assignment]
policer_burst_rate
:
BandwidthString
=
subscription
.
layer_2_circuit
.
policer_burst_rate
# type: ignore[assignment]
else
:
policer_bandwidth
:
ReadOnlyField
(
None
,
default_type
=
str
)
# type: ignore[no-redef, valid-type]
policer_burst_rate
:
ReadOnlyField
(
None
,
default_type
=
str
)
# type: ignore[no-redef, valid-type]
policer_divider
:
Divider
=
Field
(
None
,
exclude
=
True
)
layer_2_circuit_side_a
:
ReadOnlyField
(
# type: ignore[valid-type]
...
...
@@ -80,6 +82,7 @@ def modify_layer_2_circuit_subscription(
vlan_range_upper_bound
:
VLAN_ID
|
None
,
policer_enabled
:
bool
,
# noqa: FBT001
policer_bandwidth
:
BandwidthString
|
None
,
policer_burst_rate
:
BandwidthString
|
None
,
)
->
dict
:
"""
Update the Layer 2 Circuit subscription with the new values.
"""
subscription
.
layer_2_circuit
.
layer_2_circuit_type
=
layer_2_circuit_type
...
...
@@ -87,6 +90,7 @@ def modify_layer_2_circuit_subscription(
subscription
.
layer_2_circuit
.
vlan_range_upper_bound
=
vlan_range_upper_bound
subscription
.
layer_2_circuit
.
policer_enabled
=
policer_enabled
subscription
.
layer_2_circuit
.
bandwidth
=
policer_bandwidth
subscription
.
layer_2_circuit
.
policer_burst_rate
=
policer_burst_rate
for
layer_2_circuit_side
in
subscription
.
layer_2_circuit
.
layer_2_circuit_sides
:
layer_2_circuit_side
.
sbp
.
is_tagged
=
layer_2_circuit_type
==
Layer2CircuitType
.
TAGGED
...
...
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