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
7038fa1c
Verified
Commit
7038fa1c
authored
7 months ago
by
Neda Moeini
Committed by
Karel van Klink
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Introduce new rules for calculating recommended minimum links. #NAT-749
parent
6958d950
No related branches found
No related tags found
No related merge requests found
Pipeline
#88541
failed
7 months ago
Stage: tox
Stage: documentation
Stage: sonarqube
Changes
3
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/utils/helpers.py
+16
-1
16 additions, 1 deletion
gso/utils/helpers.py
gso/workflows/iptrunk/create_iptrunk.py
+6
-4
6 additions, 4 deletions
gso/workflows/iptrunk/create_iptrunk.py
gso/workflows/iptrunk/modify_trunk_interface.py
+9
-5
9 additions, 5 deletions
gso/workflows/iptrunk/modify_trunk_interface.py
with
31 additions
and
10 deletions
gso/utils/helpers.py
+
16
−
1
View file @
7038fa1c
...
...
@@ -12,7 +12,7 @@ from pydantic_core.core_schema import ValidationInfo
from
pydantic_forms.validators
import
Choice
from
gso
import
settings
from
gso.products.product_blocks.iptrunk
import
IptrunkInterfaceBlock
from
gso.products.product_blocks.iptrunk
import
IptrunkInterfaceBlock
,
PhysicalPortCapacity
from
gso.products.product_blocks.router
import
RouterRole
from
gso.products.product_blocks.site
import
LatitudeCoordinate
,
LongitudeCoordinate
,
SiteTier
from
gso.products.product_types.router
import
Router
...
...
@@ -332,3 +332,18 @@ def generate_inventory_for_active_routers(
}
}
}
def
calculate_recommended_minimum_links
(
iptrunk_number_of_members
:
int
,
iptrunk_speed
:
PhysicalPortCapacity
)
->
int
:
"""
Calculate the recommended minimum number of links for an IP trunk based on the number of members and speed.
If the IP trunk speed is 400G, the recommended minimum number of links is the number of members minus 1.
Otherwise, the recommended minimum number of links is the number of members.
:param int iptrunk_number_of_members: The number of members in the IP trunk.
:param PhysicalPortCapacity iptrunk_speed: The speed of the IP trunk.
:return: The recommended minimum number of links for the IP trunk.
"""
if
iptrunk_speed
==
PhysicalPortCapacity
.
FOUR_HUNDRED_GIGABIT_PER_SECOND
:
return
iptrunk_number_of_members
-
1
return
iptrunk_number_of_members
This diff is collapsed.
Click to expand it.
gso/workflows/iptrunk/create_iptrunk.py
+
6
−
4
View file @
7038fa1c
...
...
@@ -35,6 +35,7 @@ from gso.utils.helpers import (
LAGMember
,
available_interfaces_choices
,
available_lags_choices
,
calculate_recommended_minimum_links
,
get_router_vendor
,
validate_interface_name_list
,
validate_iptrunk_unique_interface
,
...
...
@@ -70,12 +71,13 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
return
validate_tt_number
(
tt_number
)
initial_user_input
=
yield
CreateIptrunkForm
recommended_minimum_links
=
calculate_recommended_minimum_links
(
initial_user_input
.
iptrunk_number_of_members
,
initial_user_input
.
iptrunk_speed
)
class
VerifyMinimumLinksForm
(
FormPage
):
info_label
:
Label
=
(
f
"
This is the calculated minimum-links for this LAG:
"
f
"
{
initial_user_input
.
iptrunk_number_of_members
-
1
}
"
)
iptrunk_minimum_links
:
int
=
initial_user_input
.
iptrunk_number_of_members
-
1
info_label
:
Label
=
f
"
This is the calculated minimum-links for this LAG:
{
recommended_minimum_links
}
"
iptrunk_minimum_links
:
int
=
recommended_minimum_links
info_label2
:
Label
=
"
Please confirm or modify.
"
verify_minimum_links
=
yield
VerifyMinimumLinksForm
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/iptrunk/modify_trunk_interface.py
+
9
−
5
View file @
7038fa1c
...
...
@@ -28,6 +28,7 @@ from gso.utils.helpers import (
LAGMember
,
available_interfaces_choices
,
available_interfaces_choices_including_current_members
,
calculate_recommended_minimum_links
,
get_router_vendor
,
validate_interface_name_list
,
validate_iptrunk_unique_interface
,
...
...
@@ -108,12 +109,15 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
initial_user_input
=
yield
ModifyIptrunkForm
recommended_minimum_links
=
calculate_recommended_minimum_links
(
initial_user_input
.
iptrunk_number_of_members
,
initial_user_input
.
iptrunk_speed
)
class
VerifyMinimumLinksForm
(
FormPage
):
info_label
:
Label
=
(
f
"
This is the calculated minimum-links for this LAG:
"
f
"
{
initial_user_input
.
iptrunk_number_of_members
-
1
}
"
)
iptrunk_minimum_links
:
int
=
initial_user_input
.
iptrunk_number_of_members
-
1
info_label2
:
Label
=
"
Please confirm or modify.
"
info_label
:
Label
=
f
"
Current value of minimum-links :
{
subscription
.
iptrunk
.
iptrunk_minimum_links
}
"
info_label1
:
Label
=
f
"
Recommended minimum-links for this LAG:
{
recommended_minimum_links
}
"
iptrunk_minimum_links
:
int
=
recommended_minimum_links
info_label2
:
Label
=
"
Please review the recommended value and adjust if necessary.
"
verify_minimum_links
=
yield
VerifyMinimumLinksForm
ae_members_side_a
=
initialize_ae_members
(
subscription
,
initial_user_input
.
model_dump
(),
0
)
...
...
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