From 80cb3065ea9ba2d3dc0d7a09f5244e2d4afc5317 Mon Sep 17 00:00:00 2001 From: Ubuntu <jorge.sasiain@ehu.eus> Date: Fri, 17 Mar 2023 17:46:42 +0000 Subject: [PATCH] Make members field in each side of the trunk be a drop down list --- .gitignore | 1 + README.md | 1 - .../create_trunk_config_side.py | 21 ++++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2cedd2b1..71e1def9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ __pycache__/ *.egg-info .coverage coverage.xml +.tox/ diff --git a/README.md b/README.md index 24da4021..e976492b 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,6 @@ Is process the same as subscription? If not, what’s the endpoint/way to create ## TODO - Fix flake8 errors for main.py products and workflows imports -- The current input form for the members list in create_trunk_config_side is not apprpriate for a list - Integrate provision step (in CreateTrunkConfigSide) with IPAM/Infoblox ## Resources diff --git a/geant_service_orchestrator/workflows/trunk_config_side/create_trunk_config_side.py b/geant_service_orchestrator/workflows/trunk_config_side/create_trunk_config_side.py index 625f7b4d..fa35bc65 100644 --- a/geant_service_orchestrator/workflows/trunk_config_side/create_trunk_config_side.py +++ b/geant_service_orchestrator/workflows/trunk_config_side/create_trunk_config_side.py @@ -43,6 +43,25 @@ def trunk_config_selector() -> list: ) +def member_selector() -> list: + interfaces_dict = { + "ge-0/0/1": "ge-0/0/1", + "ge-0/0/2": "ge-0/0/2", + "ge-0/0/3": "ge-0/0/3", + "ge-0/0/4": "ge-0/0/4", + "ge-0/0/5": "ge-0/0/5" + } + + return choice_list( + Choice("Member Interfaces", zip( + interfaces_dict.keys(), + interfaces_dict.items())), # type:ignore + min_items=1, + max_items=4, + unique_items=True, + ) + + def initial_input_form_generator(product_name: str) -> FormGenerator: class CreateTrunkConfigSideForm(FormPage): class Config: @@ -53,7 +72,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: geant_a_sid: str ipv4_address: Optional[str] ipv6_address: Optional[str] - members: List[str] + members: member_selector() # type:ignore trunk_config_ids: trunk_config_selector() # type:ignore user_input = yield CreateTrunkConfigSideForm -- GitLab