From 706ce6a600614480189a2ca83e0725f5226dc3df Mon Sep 17 00:00:00 2001 From: Aleksandr Kurbatov <aleksandr.kurbatov@GL1342-AKURBATOV.local> Date: Tue, 23 Jul 2024 20:49:20 +0100 Subject: [PATCH] ibgp_update modifications - rename of the tasks (`modify_pe_mesh`) - adding templates to remove P from PE and PE from net --- .../roles/ibgp_update/tasks/main.yml | 5 +++++ .../{add_p_to_pe.yaml => modify_pe_mesh.yaml} | 2 +- .../templates/juniper/remove_p_from_pe.j2 | 2 ++ .../templates/juniper/remove_pe_from_net.j2 | 2 ++ .../templates/nokia/remove_pe_from_net.j2 | 17 +++++++++++++++++ .../templates/nokia/remove_pe_from_p.j2 | 17 +++++++++++++++++ .../gap_ansible/roles/ibgp_update/vars/main.yml | 3 ++- 7 files changed, 46 insertions(+), 2 deletions(-) rename geant/gap_ansible/roles/ibgp_update/tasks/{add_p_to_pe.yaml => modify_pe_mesh.yaml} (92%) create mode 100644 geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_p_from_pe.j2 create mode 100644 geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_net.j2 create mode 100644 geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_net.j2 create mode 100644 geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_p.j2 diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml index 3fe51947..eb64cdb2 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml @@ -27,6 +27,11 @@ ansible.builtin.include_tasks: add_p_to_pe.yaml when: verb == "add_p_to_pe" +- name: Include PE mesh modification tasks + ansible.builtin.include_tasks: modify_pe_mesh.yaml + when: > + verb in [ "add_p_to_pe", "remove_pe_from_net", "remove_p_from_pe" ] + - name: Include PE into P tasks if selected ansible.builtin.include_tasks: add_pe_to_p.yaml when: > diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/add_p_to_pe.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/modify_pe_mesh.yaml similarity index 92% rename from geant/gap_ansible/roles/ibgp_update/tasks/add_p_to_pe.yaml rename to geant/gap_ansible/roles/ibgp_update/tasks/modify_pe_mesh.yaml index b63274a3..7b8bcaff 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/add_p_to_pe.yaml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/modify_pe_mesh.yaml @@ -7,7 +7,7 @@ # - name: Set variable to connect to nokia ansible.legacy.set_fact: - ansible_network_os: nokia.sros.md + ansible_network_os: geant.gap_ansible.sros ansible_connection: netconf when: vendor == "nokia" 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 new file mode 100644 index 00000000..0a139d34 --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_p_from_pe.j2 @@ -0,0 +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 }} diff --git a/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_net.j2 b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_net.j2 new file mode 100644 index 00000000..9bd780dd --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/juniper/remove_pe_from_net.j2 @@ -0,0 +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 }} diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_net.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_net.j2 new file mode 100644 index 00000000..3fddd5f6 --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_net.j2 @@ -0,0 +1,17 @@ +<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0"> + <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"> + <router> + <router-name>Base</router-name> + <bgp> + <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="delete"> + <ip-address>{{ subscription.router.router_lo_ipv4_address }}</ip-address> + <group>iGEANT</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="delete"> + <ip-address>{{ subscription.router.router_lo_ipv6_address }}</ip-address> + <group>iGEANT6</group> + </neighbor> + </bgp> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_p.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_p.j2 new file mode 100644 index 00000000..088de3ea --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_p.j2 @@ -0,0 +1,17 @@ +<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:alu="urn:ietf:params:xml:ns:netconf:base:1.0"> + <configure xmlns="urn:nokia.com:sros:ns:yang:sr:conf"> + <router> + <router-name>Base</router-name> + <bgp> + <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="delete"> + <ip-address>{{ subscription.router.router_lo_ipv4_address }}</ip-address> + <group>iGEANT-P-ONLY</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="delete"> + <ip-address>{{ subscription.router.router_lo_ipv6_address }}</ip-address> + <group>iGEANT6-P-ONLY</group> + </neighbor> + </bgp> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/ibgp_update/vars/main.yml b/geant/gap_ansible/roles/ibgp_update/vars/main.yml index e118a3ef..caaa1231 100644 --- a/geant/gap_ansible/roles/ibgp_update/vars/main.yml +++ b/geant/gap_ansible/roles/ibgp_update/vars/main.yml @@ -8,9 +8,10 @@ verbs: - check_p_ibgp - verify_p_ibgp # Validates the config of BGP stanza including neighbors - remove_p_from_pe # placeholder for future use | Removes the P that is going to be promoted to PE from the P-GROUP on all PEs + - remove_pe_from_p # PE router termination workflow + - remove_pe_from_net # When decommissiong a PE we remove it from PE-GROUP and P-GROUP on all the PE and P routers - add_pe_to_pe # placeholder for future use | Adds the newly installed PE (could be an EX-P or a new PE) to the PE-GROUP on all the other PEs - add_new_pe_to_p # placeholder for future use | Adds the newly installed PE (could be an EX-P or a new PE) the P-GROUP on all the Ps - - remove_pe_from_net # placeholder for future use | When decommissiong a PE we remove it from PE-GROUP and P-GROUP on all the PE and P routers - promote_p_to_pe # placeholder for future use | Deletes P-GROUP and adds wfo_router: "{{ subscription }}" p_lo_ipv4_address: "{{ wfo_router.router.router_lo_ipv4_address }}" -- GitLab