From 2c6362e31537522504535b1a5f7e02f540a92296 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <ak@geant.org>
Date: Tue, 15 Apr 2025 09:45:44 +0100
Subject: [PATCH] Update calculation of `trunk_suffix`

---
 .../roles/iptrunk/templates/juniper/trunk_interface.j2         | 3 +++
 .../roles/iptrunk/templates/nokia/trunk_interface.j2           | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/geant/gap_ansible/roles/iptrunk/templates/juniper/trunk_interface.j2 b/geant/gap_ansible/roles/iptrunk/templates/juniper/trunk_interface.j2
index f7d17251..156b2bcb 100644
--- a/geant/gap_ansible/roles/iptrunk/templates/juniper/trunk_interface.j2
+++ b/geant/gap_ansible/roles/iptrunk/templates/juniper/trunk_interface.j2
@@ -25,7 +25,10 @@
     {# I need to sort the source and the destination alfabetically #}
     {% set trunk_direction_name = [ local.name.split(".")[1] | upper, remote.name.split(".")[1] | upper ] %}
     {% set trunk_direction_name_sorted = trunk_direction_name|sort %}
+
+    {% if wfo_trunk.iptrunk.iptrunk_description_suffix is not none %}
     {% set trunk_suffix = '-'+wfo_trunk.iptrunk.iptrunk_description_suffix if wfo_trunk.iptrunk.iptrunk_description_suffix|length > 0 %}
+    {% endif %}
     {##}
     interfaces {
     replace: {{local.ae_name}} {
diff --git a/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2 b/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2
index d567bc22..f34d21e8 100644
--- a/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2
+++ b/geant/gap_ansible/roles/iptrunk/templates/nokia/trunk_interface.j2
@@ -26,7 +26,9 @@
     {% set trunk_direction_name = [ local.name.split(".")[1] | upper, remote.name.split(".")[1] | upper ] %}
     {% set trunk_direction_name_sorted = trunk_direction_name|sort %}
 
+    {% if wfo_trunk.iptrunk.iptrunk_description_suffix is not none %}
     {% set trunk_suffix = '-'+wfo_trunk.iptrunk.iptrunk_description_suffix if wfo_trunk.iptrunk.iptrunk_description_suffix|length > 0 %}
+    {% endif %}
 {##}
 {% for member in local.members %}
       <port xmlns="urn:nokia.com:sros:ns:yang:sr:conf" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nokia-attr="urn:nokia.com:sros:ns:yang:sr:attributes" alu:operation="replace">
-- 
GitLab