From 88b607bcdfb5072ce5a4b842813357e01b9d4acb Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <ak@geant.org>
Date: Wed, 25 Sep 2024 13:34:16 +0100
Subject: [PATCH] SDP mesh - if pe_router_list is empty

---
 geant/gap_ansible/roles/bc_templates/routers/nokia/sdp_mesh.j2 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/sdp_mesh.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/sdp_mesh.j2
index 4542edbc..07d3f151 100644
--- a/geant/gap_ansible/roles/bc_templates/routers/nokia/sdp_mesh.j2
+++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/sdp_mesh.j2
@@ -1,4 +1,5 @@
     <service 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">
+        {% if pe_router_list|length != 0 %}
             {% for pe_fqdn, pe_addr in pe_router_list.items() %}
             {% set sdp_id = pe_addr.lo4 | replace(sdp_prefix_regex, '') | replace('.', '') + sdp_type.id %}
         <sdp>
@@ -16,5 +17,6 @@
             </far-end>
         </sdp>
             {% endfor %}
+        {% endif %}
     </service>
 
-- 
GitLab