From 563c5f2a2e81eab887cfb61cf7b7d34c2cfd80b1 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <ak@geant.org>
Date: Mon, 7 Apr 2025 13:59:11 +0100
Subject: [PATCH] Fix trunk suffix calculation

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

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 651a4436..f7d17251 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,7 @@
     {# 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 %}
-    {% set trunk_suffix = '-'+wfo_trunk.iptrunk.iptrunk_description_suffix if wfo_trunk.iptrunk.iptrunk_description_suffix is string %}
+    {% set trunk_suffix = '-'+wfo_trunk.iptrunk.iptrunk_description_suffix if wfo_trunk.iptrunk.iptrunk_description_suffix|length > 0 %}
     {##}
     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 2659d43b..d567bc22 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,7 @@
     {% set trunk_direction_name = [ local.name.split(".")[1] | upper, remote.name.split(".")[1] | upper ] %}
     {% set trunk_direction_name_sorted = trunk_direction_name|sort %}
 
-    {% set trunk_suffix = '-'+wfo_trunk.iptrunk.iptrunk_description_suffix if wfo_trunk.iptrunk.iptrunk_description_suffix is string %}
+    {% set trunk_suffix = '-'+wfo_trunk.iptrunk.iptrunk_description_suffix if wfo_trunk.iptrunk.iptrunk_description_suffix|length > 0 %}
 {##}
 {% 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