From ca0e48988a0b8fbef04aba568cf07ebdd7deceb6 Mon Sep 17 00:00:00 2001
From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342-AKURBATOV.local>
Date: Wed, 21 Aug 2024 18:21:12 +0100
Subject: [PATCH] Remove hard-coded BGP groups names

---
 .../roles/ibgp_update/templates/juniper/add_p_to_pe.j2    | 4 ++--
 .../ibgp_update/templates/juniper/remove_p_from_pe.j2     | 4 ++--
 .../ibgp_update/templates/juniper/remove_pe_from_pe.j2    | 4 ++--
 .../roles/ibgp_update/templates/nokia/add_pe_to_p.j2      | 4 ++--
 .../ibgp_update/templates/nokia/remove_pe_from_pe.j2      | 4 ++--
 .../roles/ibgp_update/templates/nokia/verify_p_ibgp.j2    | 8 ++++----
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_p_to_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_p_to_pe.j2
index f8ca8a8d..9308bdc2 100644
--- a/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_p_to_pe.j2
+++ b/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_p_to_pe.j2
@@ -1,2 +1,2 @@
-set protocols bgp group iGEANT6-P-ONLY neighbor {{ p_lo_ipv6_address }} description {{ p_router_fqdn }}
-set protocols bgp group iGEANT-P-ONLY neighbor {{ p_lo_ipv4_address }} description {{ p_router_fqdn }}
+set protocols bgp group {{ geant_bgp_groups.p_only.ipv6 }} neighbor {{ p_lo_ipv6_address }} description {{ p_router_fqdn }}
+set protocols bgp group {{ geant_bgp_groups.p_only.ipv4 }} neighbor {{ p_lo_ipv4_address }} description {{ p_router_fqdn }}
diff --git a/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_p_from_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_p_from_pe.j2
index 0a139d34..b40bf1f9 100644
--- a/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_p_from_pe.j2
+++ b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_p_from_pe.j2
@@ -1,2 +1,2 @@
-delete protocols bgp group iGEANT6-P-ONLY neighbor {{ p_lo_ipv6_address }}
-delete protocols bgp group iGEANT-P-ONLY neighbor {{ p_lo_ipv4_address }}
+delete protocols bgp group {{ geant_bgp_groups.p_only.ipv6 }} neighbor {{ p_lo_ipv6_address }}
+delete protocols bgp group {{ geant_bgp_groups.p_only.ipv4 }} neighbor {{ p_lo_ipv4_address }}
diff --git a/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_pe.j2
index 9bd780dd..79f83bd3 100644
--- a/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_pe.j2
+++ b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_pe.j2
@@ -1,2 +1,2 @@
-delete protocols bgp group iGEANT6 neighbor {{ subscription.router.router_lo_ipv6_address }}
-delete protocols bgp group iGEANT neighbor {{ subscription.router.router_lo_ipv4_address }}
+delete protocols bgp group {{ geant_bgp_groups.pe_mesh.ipv6 }} neighbor {{ subscription.router.router_lo_ipv6_address }}
+delete protocols bgp group {{ geant_bgp_groups.pe_mesh.ipv4 }} neighbor {{ subscription.router.router_lo_ipv4_address }}
diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_p.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_p.j2
index 198b8878..11e210f4 100644
--- a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_p.j2
+++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_p.j2
@@ -7,12 +7,12 @@
             <neighbor 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">
               <ip-address>{{ pe_ipadd.lo4 }}</ip-address>
               <description>{{ pe_fqdn }}</description>
-              <group>iGEANT-P-ONLY</group>
+              <group>{{ geant_bgp_groups.p_only.ipv4 }}</group>
             </neighbor>
             <neighbor 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">
               <ip-address>{{ pe_ipadd.lo6 }}</ip-address>
               <description>{{ pe_fqdn }}</description>
-              <group>iGEANT6-P-ONLY</group>
+              <group>{{ geant_bgp_groups.p_only.ipv6 }}</group>
             </neighbor>
           {% endfor %}
         </bgp>
diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_pe.j2
index 48242b15..56b34207 100644
--- a/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_pe.j2
+++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_pe.j2
@@ -5,11 +5,11 @@
         <bgp 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">
             <neighbor alu:operation="delete">
               <ip-address>{{ subscription.router.router_lo_ipv4_address }}</ip-address>
-              <group>iGEANT</group>
+              <group>{{ geant_bgp_groups.pe_mesh.ipv4 }}</group>
             </neighbor>
             <neighbor alu:operation="delete">
               <ip-address>{{ subscription.router.router_lo_ipv6_address }}</ip-address>
-              <group>iGEANT6</group>
+              <group>{{ geant_bgp_groups.pe_mesh.ipv6 }}</group>
             </neighbor>
         </bgp>
     </router>
diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/verify_p_ibgp.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/verify_p_ibgp.j2
index 3c30bba2..3f3f8d44 100644
--- a/geant/gap_ansible/roles/ibgp_update/templates/nokia/verify_p_ibgp.j2
+++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/verify_p_ibgp.j2
@@ -11,7 +11,7 @@
                     <as-number>{{ geant_re_as_number }}</as-number>
                 </local-as>
                 <group alu:operation="replace">
-                    <group-name>iGEANT-P-ONLY</group-name>
+                    <group-name>{{ geant_bgp_groups.p_only.ipv4 }}</group-name>
                     <admin-state>enable</admin-state>
                     <next-hop-self>true</next-hop-self>
                     <type>internal</type>
@@ -23,7 +23,7 @@
                     </family>
                 </group>
                 <group alu:operation="replace">
-                    <group-name>iGEANT6-P-ONLY</group-name>
+                    <group-name>{{ geant_bgp_groups.p_only.ipv6 }}</group-name>
                     <next-hop-self>true</next-hop-self>
                     <type>internal</type>
                     <peer-as>{{ geant_re_as_number }}</peer-as>
@@ -37,12 +37,12 @@
                 <neighbor 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">
                   <ip-address>{{ pe_ipadd.lo4 }}</ip-address>
                   <description>{{ pe_fqdn }}</description>
-                  <group>iGEANT-P-ONLY</group>
+                  <group>{{ geant_bgp_groups.p_only.ipv4 }}</group>
                 </neighbor>
                 <neighbor 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">
                   <ip-address>{{ pe_ipadd.lo6 }}</ip-address>
                   <description>{{ pe_fqdn }}</description>
-                  <group>iGEANT6-P-ONLY</group>
+                  <group><{{ geant_bgp_groups.p_only.ipv6 }}/group>
                 </neighbor>
               {% endfor %}
             </bgp>
-- 
GitLab