From bd9fc75c9472cbf423ec59566f9d15c19aee0c99 Mon Sep 17 00:00:00 2001
From: Neda Moeini <neda.moeini@geant.org>
Date: Wed, 4 Dec 2024 16:09:13 +0100
Subject: [PATCH] Rename EdgePort geant_ga_id to ga_id

---
 gso/cli/imports.py                                     |  2 +-
 gso/translations/en-GB.json                            |  2 +-
 gso/workflows/edge_port/create_edge_port.py            | 10 +++++-----
 gso/workflows/edge_port/create_imported_edge_port.py   |  8 ++++----
 gso/workflows/edge_port/modify_edge_port.py            |  8 ++++----
 test/cli/test_imports.py                               |  2 +-
 test/fixtures/edge_port_fixtures.py                    |  4 ++--
 test/workflows/edge_port/test_create_edge_port.py      |  4 ++--
 .../edge_port/test_create_imported_edge_port.py        |  2 +-
 test/workflows/edge_port/test_modify_edge_port.py      |  8 ++++----
 10 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/gso/cli/imports.py b/gso/cli/imports.py
index 9903d186..72fe0d38 100644
--- a/gso/cli/imports.py
+++ b/gso/cli/imports.py
@@ -197,7 +197,7 @@ class EdgePortImportModel(BaseModel):
     encapsulation: EncapsulationType
     name: str
     minimum_links: int
-    geant_ga_id: str | None
+    ga_id: str | None
     mac_address: str | None
     partner: str
     enable_lacp: bool
diff --git a/gso/translations/en-GB.json b/gso/translations/en-GB.json
index f1f66f07..2328bba2 100644
--- a/gso/translations/en-GB.json
+++ b/gso/translations/en-GB.json
@@ -40,7 +40,7 @@
 
             "enable_lacp": "Enable LACP",
             "mac_address": "MAC address",
-            "geant_ga_id": "GÉANT GA-ID"
+            "ga_id": "GÉANT GA-ID"
         }
     },
     "workflow": {
diff --git a/gso/workflows/edge_port/create_edge_port.py b/gso/workflows/edge_port/create_edge_port.py
index 2005d7c2..ccd022f6 100644
--- a/gso/workflows/edge_port/create_edge_port.py
+++ b/gso/workflows/edge_port/create_edge_port.py
@@ -52,7 +52,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
         minimum_links: int
         mac_address: str | None = None
         ignore_if_down: bool = False
-        geant_ga_id: str | None = None
+        ga_id: str | None = None
 
         @model_validator(mode="after")
         def validate_number_of_members(self) -> Self:
@@ -104,7 +104,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
         "minimum_links",
         "mac_address",
         "ignore_if_down",
-        "geant_ga_id",
+        "ga_id",
         "enable_lacp",
         "edge_port_name",
         "edge_port_description",
@@ -134,7 +134,7 @@ def initialize_subscription(
     encapsulation: EncapsulationType,
     name: str,
     minimum_links: int,
-    geant_ga_id: str | None,
+    ga_id: str | None,
     mac_address: str | None,
     partner: str,
     enable_lacp: bool,  # noqa: FBT001
@@ -152,10 +152,10 @@ def initialize_subscription(
     subscription.edge_port.edge_port_name = name
     subscription.edge_port.minimum_links = minimum_links
     subscription.edge_port.ignore_if_down = ignore_if_down
-    subscription.edge_port.geant_ga_id = geant_ga_id
+    subscription.edge_port.ga_id = ga_id
     subscription.edge_port.mac_address = mac_address
     partner_name = get_partner_by_id(partner).name
-    subscription.description = f"Edge Port {name} on {router.router_fqdn}, " f"{partner_name}, {geant_ga_id or ""}"
+    subscription.description = f"Edge Port {name} on {router.router_fqdn}, " f"{partner_name}, {ga_id or ""}"
     subscription.edge_port.edge_port_description = description
     for member in ae_members:
         subscription.edge_port.edge_port_ae_members.append(
diff --git a/gso/workflows/edge_port/create_imported_edge_port.py b/gso/workflows/edge_port/create_imported_edge_port.py
index 867965c7..07d4abf3 100644
--- a/gso/workflows/edge_port/create_imported_edge_port.py
+++ b/gso/workflows/edge_port/create_imported_edge_port.py
@@ -48,7 +48,7 @@ def initial_input_form_generator() -> FormGenerator:
         minimum_links: int
         mac_address: str | None = None
         ignore_if_down: bool = False
-        geant_ga_id: str | None = None
+        ga_id: str | None = None
         description: str | None = None
         name: str
         ae_members: Annotated[list[LAGMember], AfterValidator(validate_unique_list)]
@@ -67,7 +67,7 @@ def initialize_subscription(
     encapsulation: EncapsulationType,
     name: str,
     minimum_links: int,
-    geant_ga_id: str | None,
+    ga_id: str | None,
     mac_address: str | None,
     partner: str,
     enable_lacp: bool,  # noqa: FBT001
@@ -87,8 +87,8 @@ def initialize_subscription(
     subscription.edge_port.minimum_links = minimum_links
     subscription.edge_port.edge_port_type = service_type
     subscription.edge_port.ignore_if_down = ignore_if_down
-    subscription.edge_port.geant_ga_id = geant_ga_id
-    subscription.description = f"Edge Port {name} on {router.router_fqdn}, {partner}, {geant_ga_id or ""}"
+    subscription.edge_port.ga_id = ga_id
+    subscription.description = f"Edge Port {name} on {router.router_fqdn}, {partner}, {ga_id or ""}"
     for member in ae_members:
         subscription.edge_port.edge_port_ae_members.append(
             EdgePortAEMemberBlockInactive.new(subscription_id=uuid4(), **member)
diff --git a/gso/workflows/edge_port/modify_edge_port.py b/gso/workflows/edge_port/modify_edge_port.py
index bce56c74..94388984 100644
--- a/gso/workflows/edge_port/modify_edge_port.py
+++ b/gso/workflows/edge_port/modify_edge_port.py
@@ -43,7 +43,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
         minimum_links: int | None = subscription.edge_port.minimum_links or None
         mac_address: str | None = subscription.edge_port.mac_address or None
         ignore_if_down: bool = subscription.edge_port.ignore_if_down
-        geant_ga_id: str | None = subscription.edge_port.geant_ga_id or None
+        ga_id: str | None = subscription.edge_port.ga_id or None
 
         @model_validator(mode="after")
         def validate_number_of_members(self) -> Self:
@@ -117,7 +117,7 @@ def modify_edge_port_subscription(
     encapsulation: EncapsulationType,
     minimum_links: int,
     mac_address: str | None,
-    geant_ga_id: str | None,
+    ga_id: str | None,
     enable_lacp: bool,  # noqa: FBT001
     ae_members: list[dict[str, str]],
     ignore_if_down: bool,  # noqa: FBT001
@@ -138,12 +138,12 @@ def modify_edge_port_subscription(
     subscription.edge_port.minimum_links = minimum_links
     subscription.edge_port.mac_address = mac_address
     subscription.edge_port.ignore_if_down = ignore_if_down
-    subscription.edge_port.geant_ga_id = geant_ga_id
+    subscription.edge_port.ga_id = ga_id
     subscription.edge_port.edge_port_description = description
     subscription.description = (
         f"Edge Port {subscription.edge_port.edge_port_name} on"
         f" {subscription.edge_port.node.router_fqdn},"
-        f" {get_partner_by_id(subscription.customer_id).name}, {geant_ga_id or ""}"
+        f" {get_partner_by_id(subscription.customer_id).name}, {ga_id or ""}"
     )
     subscription.edge_port.edge_port_ae_members.clear()
     partner_name = get_partner_by_id(subscription.customer_id).name
diff --git a/test/cli/test_imports.py b/test/cli/test_imports.py
index fa378703..60c8acee 100644
--- a/test/cli/test_imports.py
+++ b/test/cli/test_imports.py
@@ -270,7 +270,7 @@ def edge_port_data(temp_file, faker, router_subscription_factory, partner_factor
             "encapsulation": EncapsulationType.DOT1Q,
             "name": "lag34",
             "minimum_links": 2,
-            "geant_ga_id": faker.geant_gid(),
+            "ga_id": faker.geant_gid(),
             "mac_address": faker.mac_address(),
             "partner": partner_factory()["name"],
             "enable_lacp": True,
diff --git a/test/fixtures/edge_port_fixtures.py b/test/fixtures/edge_port_fixtures.py
index 669d42ff..7ea6b8b9 100644
--- a/test/fixtures/edge_port_fixtures.py
+++ b/test/fixtures/edge_port_fixtures.py
@@ -30,7 +30,7 @@ def edge_port_subscription_factory(faker, partner_factory, router_subscription_f
         member_speed=PhysicalPortCapacity.HUNDRED_GIGABIT_PER_SECOND,
         minimum_links=None,
         edge_port_type=EdgePortType.PUBLIC,
-        geant_ga_id=None,
+        ga_id=None,
         edge_port_ae_members=None,
         status: SubscriptionLifecycle | None = None,
         *,
@@ -52,7 +52,7 @@ def edge_port_subscription_factory(faker, partner_factory, router_subscription_f
             )
 
         edge_port_subscription.edge_port.edge_port_description = description or faker.text(max_nb_chars=30)
-        edge_port_subscription.edge_port.geant_ga_id = geant_ga_id or faker.geant_sid()
+        edge_port_subscription.edge_port.ga_id = ga_id or faker.geant_gid()
         edge_port_subscription.edge_port.node = node or node
         edge_port_subscription.edge_port.edge_port_name = name or f"lag-{faker.pyint(21, 50)}"
         edge_port_subscription.edge_port.edge_port_description = edge_port_description or faker.sentence()
diff --git a/test/workflows/edge_port/test_create_edge_port.py b/test/workflows/edge_port/test_create_edge_port.py
index 8066c5e0..35cf2613 100644
--- a/test/workflows/edge_port/test_create_edge_port.py
+++ b/test/workflows/edge_port/test_create_edge_port.py
@@ -50,7 +50,7 @@ def input_form_wizard_data(request, router_subscription_factory, partner_factory
         "node": router_subscription_factory(vendor=Vendor.NOKIA),
         "partner": partner_factory(name="GAAR", email=faker.email())["partner_id"],
         "service_type": EdgePortType.PUBLIC,
-        "geant_ga_id": faker.geant_gid(),
+        "ga_id": faker.geant_gid(),
         "enable_lacp": True,
         "speed": PhysicalPortCapacity.HUNDRED_GIGABIT_PER_SECOND,
         "encapsulation": EncapsulationType.DOT1Q,
@@ -101,7 +101,7 @@ def test_successful_edge_port_creation(
     subscription = EdgePort.from_subscription(subscription_id)
 
     assert subscription.status == "active"
-    ga_id = input_form_wizard_data[0]["geant_ga_id"]
+    ga_id = input_form_wizard_data[0]["ga_id"]
     router_fqdn = Router.from_subscription(input_form_wizard_data[0]["node"]).router.router_fqdn
     assert subscription.description == f"Edge Port lag-21 on {router_fqdn}, GAAR, {ga_id}"
     assert len(subscription.edge_port.edge_port_ae_members) == 2
diff --git a/test/workflows/edge_port/test_create_imported_edge_port.py b/test/workflows/edge_port/test_create_imported_edge_port.py
index c5590fe4..838d330d 100644
--- a/test/workflows/edge_port/test_create_imported_edge_port.py
+++ b/test/workflows/edge_port/test_create_imported_edge_port.py
@@ -17,7 +17,7 @@ def imported_edge_port_creation_input_form_data(router_subscription_factory, par
         "encapsulation": EncapsulationType.DOT1Q,
         "name": "lag34",
         "minimum_links": 2,
-        "geant_ga_id": faker.geant_gid(),
+        "ga_id": faker.geant_gid(),
         "mac_address": faker.mac_address(),
         "partner": partner_factory()["name"],
         "enable_lacp": True,
diff --git a/test/workflows/edge_port/test_modify_edge_port.py b/test/workflows/edge_port/test_modify_edge_port.py
index a7c82428..6e16f73a 100644
--- a/test/workflows/edge_port/test_modify_edge_port.py
+++ b/test/workflows/edge_port/test_modify_edge_port.py
@@ -21,7 +21,7 @@ def input_form_wizard_data(request, faker, edge_port_subscription_factory, partn
         {"subscription_id": subscription_id},
         {
             "tt_number": faker.tt_number(),
-            "geant_ga_id": faker.geant_gid(),
+            "ga_id": faker.geant_gid(),
             "member_speed": PhysicalPortCapacity.FOUR_HUNDRED_GIGABIT_PER_SECOND,
             "number_of_members": 1,
         },
@@ -89,7 +89,7 @@ def test_modify_edge_port_with_changing_capacity(
     assert mocked_attach_interface_to_lag.call_count == 1
     assert mocked_free_interface.call_count == 2
     assert mocked_detach_interfaces_from_lag.call_count == 1
-    assert subscription.edge_port.geant_ga_id == input_form_wizard_data[1]["geant_ga_id"]
+    assert subscription.edge_port.ga_id == input_form_wizard_data[1]["ga_id"]
     assert len(subscription.edge_port.edge_port_ae_members) == 1
 
 
@@ -100,7 +100,7 @@ def input_form_wizard_without_changing_capacity(request, faker, edge_port_subscr
 
     return [
         {"subscription_id": subscription_id},
-        {"tt_number": faker.tt_number(), "geant_ga_id": faker.geant_gid()},
+        {"tt_number": faker.tt_number(), "ga_id": faker.geant_gid()},
         {
             "description": faker.sentence(),
             "ae_members": [
@@ -163,6 +163,6 @@ def test_modify_edge_port_without_changing_capacity(
     assert mocked_free_interface.call_count == 0
     assert mocked_detach_interfaces_from_lag.call_count == 0
 
-    assert subscription.edge_port.geant_ga_id == input_form_wizard_without_changing_capacity[1]["geant_ga_id"]
+    assert subscription.edge_port.ga_id == input_form_wizard_without_changing_capacity[1]["ga_id"]
     assert len(subscription.edge_port.edge_port_ae_members) == 2
     assert subscription.edge_port.edge_port_description == input_form_wizard_without_changing_capacity[2]["description"]
-- 
GitLab