diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/add_pe_to_p.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/add_pe_to_p.yaml index 0a41b8d9058b3624e30dd87884bfe2abe52979aa..5d23f4f2ba97676eeb737f0553c732aae229009d 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/add_pe_to_p.yaml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/add_pe_to_p.yaml @@ -5,18 +5,18 @@ # FIX: Load ansible_network_os via group_vars # - name: Set variable to connect to nokia - ansible.legacy.set_fact: + ansible.builtin.set_fact: ansible_network_os: geant.gap_ansible.sros ansible_connection: netconf - name: Set ansible_host to terminal server when router is offline - ansible.legacy.set_fact: + ansible.builtin.set_fact: ansible_host: "{{ subscription.router.router_site.site_ts_address }}" ansible_port: "{{ subscription.router.router_ts_port }}" when: ( subscription.router.router_access_via_ts | ansible.builtin.bool ) is true - name: Set the vendor variable to select correct template - ansible.legacy.set_fact: + ansible.builtin.set_fact: vendor: "{{ subscription.router.vendor }}" - name: Include compile tasks diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/check_p_ibgp.yaml b/geant/gap_ansible/roles/ibgp_update/tasks/check_nokia_ibgp.yaml similarity index 95% rename from geant/gap_ansible/roles/ibgp_update/tasks/check_p_ibgp.yaml rename to geant/gap_ansible/roles/ibgp_update/tasks/check_nokia_ibgp.yaml index bcfee22a5a74f2139b8075573171607f65eba4b1..8866ec46c43f21767856867f8dbcfff46b93d626 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/check_p_ibgp.yaml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/check_nokia_ibgp.yaml @@ -3,7 +3,7 @@ ansible_network_os: nokia.sros.md ansible_connection: netconf -- name: Nokia P - check BGP status +- name: Check BGP status block: - name: Get BGP group status ansible.netcommon.netconf_rpc: diff --git a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml index 6306f3171242a782a25666fcd2c3e85147ab53c6..a4450b05970e011a1e15060afb20e2bc037130ce 100644 --- a/geant/gap_ansible/roles/ibgp_update/tasks/main.yml +++ b/geant/gap_ansible/roles/ibgp_update/tasks/main.yml @@ -1,10 +1,18 @@ --- # tasks file for ibg_update - name: Print the usage + when: (verb is not defined) or (verb not in verbs) ansible.builtin.debug: msg: - - "Allowed verbs: 'add_pe_to_p' and 'add_p_to_pe'. Use: -e 'verb=$verb'." + - "'verb' keyword is mandatory. Usage: -e verb=$verb" + +- name: Print defined verbs when: (verb is not defined) or (verb not in verbs) + ansible.builtin.debug: + msg: + - "Allowed verb: {{ item }}" + loop: "{{ verbs }}" + - name: Fail if arguments are missing ansible.legacy.meta: end_play @@ -30,18 +38,18 @@ - name: Include PE mesh modification tasks ansible.builtin.include_tasks: modify_pe_mesh.yaml when: > - verb in [ "add_p_to_pe", "remove_pe_from_pe", "remove_p_from_pe" ] + verb in [ "add_p_to_pe", "add_pe_to_pe_mesh", "remove_pe_from_pe", "remove_p_from_pe" ] - name: Include PE into P tasks if selected ansible.builtin.include_tasks: add_pe_to_p.yaml when: > - verb in [ "add_pe_to_p", "verify_p_ibgp" ] + verb in [ "add_pe_to_p", "verify_p_ibgp", "add_pe_mesh_to_pe" ] - name: Include PE removal from P tasks if selected ansible.builtin.include_tasks: remove_pe_from_p.yaml when: > verb in [ "remove_pe_from_p" ] -- name: Check status of iBGP on P router - ansible.builtin.include_tasks: check_p_ibgp.yaml - when: verb == "check_p_ibgp" +- name: Check status of iBGP on Nokia router + ansible.builtin.include_tasks: check_nokia_ibgp.yaml + when: verb in [ "check_p_ibgp", "check_pe_ibgp" ] diff --git a/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_pe_to_pe_mesh.j2 b/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_pe_to_pe_mesh.j2 new file mode 100644 index 0000000000000000000000000000000000000000..94ec3f3ab8076c504dc77c72bae8f91dc12b3293 --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/juniper/add_pe_to_pe_mesh.j2 @@ -0,0 +1,2 @@ +set protocols bgp group {{ geant_bgp_groups.pe_mesh.ipv6 }} neighbor {{ subscription_lo_ipv6 }} description {{ subscription_fqdn }} +set protocols bgp group {{ geant_bgp_groups.pe_mesh.ipv4 }} neighbor {{ subscription_lo_ipv4 }} description {{ subscription_fqdn }} diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_all_p_to_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_all_p_to_pe.j2 new file mode 100644 index 0000000000000000000000000000000000000000..f25653e2175d2ac1bd718adf87b122667664c25a --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_all_p_to_pe.j2 @@ -0,0 +1,21 @@ +<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> + {% for p_fqdn, p_ipadd in p_router_list.items() %} + <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"> + <ip-address>{{ p_ipadd.lo4 }}</ip-address> + <description>{{ p_fqdn }}</description> + <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"> + <ip-address>{{ p_ipadd.lo4 }}</ip-address> + <description>{{ p_fqdn }}</description> + <group>{{ geant_bgp_groups.p_only.ipv6 }}</group> + </neighbor> + {% endfor %} + </bgp> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_p_to_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_p_to_pe.j2 index 76f0cbffad592a293d0aa971926f874d17dde4bc..21ee04e5dd3542535aca0c0232c303a1ba36f634 100644 --- a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_p_to_pe.j2 +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_p_to_pe.j2 @@ -1,14 +1,19 @@ -<router> - <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"> - <ip-address>{{ p_lo_ipv4_address }}</ip-address> - <description>{{ p_router_fqdn }}</description> - <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"> - <ip-address>{{ p_lo_ipv6_address }}</ip-address> - <description>{{ p_router_fqdn }}</description> - <group>iGEANT-P-ONLY-v6</group> - </neighbor> - </bgp> -</router> +<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"> + <ip-address>{{ p_lo_ipv4_address }}</ip-address> + <description>{{ p_router_fqdn }}</description> + <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"> + <ip-address>{{ p_lo_ipv6_address }}</ip-address> + <description>{{ p_router_fqdn }}</description> + <group>{{ geant_bgp_groups.p_only.ipv6 }}</group> + </neighbor> + </bgp> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_mesh_to_pe.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_mesh_to_pe.j2 new file mode 100644 index 0000000000000000000000000000000000000000..4a8a6e460bfa580e5e810d891cb14e47901f2a6f --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_mesh_to_pe.j2 @@ -0,0 +1,21 @@ +<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> + {% for pe_fqdn, pe_ipadd in pe_router_list.items() %} + <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>{{ geant_bgp_groups.pe_mesh.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>{{ geant_bgp_groups.pe_mesh.ipv6 }}</group> + </neighbor> + {% endfor %} + </bgp> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_all_p.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_all_p.j2 new file mode 100644 index 0000000000000000000000000000000000000000..b0a6ab02b11ac751bdbcf398f0f942e74bbf501e --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_all_p.j2 @@ -0,0 +1,19 @@ +<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="replace"> + <ip-address>{{ subscription_lo_ipv4 }}</ip-address> + <description>{{ subscription_fqdn }}</description> + <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>{{ subscription_lo_ipv6 }}</ip-address> + <description>{{ subscription_fqdn }}</description> + <group>{{ geant_bgp_groups.p_only.ipv6 }}</group> + </neighbor> + </bgp> + </router> + </configure> +</config> diff --git a/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_pe_mesh.j2 b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_pe_mesh.j2 new file mode 100644 index 0000000000000000000000000000000000000000..0ee4bf3ebf7e0bc904c01b043cdc87d58b94948f --- /dev/null +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/add_pe_to_pe_mesh.j2 @@ -0,0 +1,19 @@ +<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="replace"> + <ip-address>{{ subscription_lo_ipv4 }}</ip-address> + <description>{{ subscription_fqdn }}</description> + <group>{{ geant_bgp_groups.pe_mesh.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>{{ subscription_lo_ipv6 }}</ip-address> + <description>{{ subscription_fqdn }}</description> + <group>{{ geant_bgp_groups.pe_mesh.ipv6 }}</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_p_from_pe.j2 similarity index 87% rename from geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_p.j2 rename to geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_p_from_pe.j2 index 07672c2bfc3955686044a5b52893498681590dfa..a62c1d3ed9cc4908c42c619d5577dd7d45a58603 100644 --- a/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_pe_from_p.j2 +++ b/geant/gap_ansible/roles/ibgp_update/templates/nokia/remove_p_from_pe.j2 @@ -5,9 +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>{{ geant_bgp_groups.p_only.ipv4 }}</group> </neighbor> <neighbor alu:operation="delete"> <ip-address>{{ subscription.router.router_lo_ipv6_address }}</ip-address> + <group>{{ geant_bgp_groups.p_only.ipv6 }}</group> </neighbor> </bgp> </router> diff --git a/geant/gap_ansible/roles/ibgp_update/vars/main.yml b/geant/gap_ansible/roles/ibgp_update/vars/main.yml index 6b064e84bb607c60b346aaee9c191d74504472f6..24f0b97d6ef52dfb26c038f1e3939b667621d024 100644 --- a/geant/gap_ansible/roles/ibgp_update/vars/main.yml +++ b/geant/gap_ansible/roles/ibgp_update/vars/main.yml @@ -1,19 +1,24 @@ --- -# vars file for ibg_update +# vars file for ibgp_update dry_run: "True" is_verification_workflow: false verbs: - add_pe_to_p # Adds all the existing PEs in the P-GROUP on the newly installed P - add_p_to_pe # Adds the newly installed P to the P-GROUP in all the existing PEs - - 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_pe # 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 - - promote_p_to_pe # placeholder for future use | Deletes P-GROUP and adds + - add_pe_to_pe_mesh # 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_pe_mesh_to_pe # 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 + - check_p_ibgp # Check BGP status on the newly provisioned P router + - check_pe_ibgp # Check BGP status on the newly provisioned PE router + - add_all_p_to_pe # Add P routers to the newly promoted PE router + - add_pe_to_all_p # Add newly promoted PE to all existing P routers wfo_router: "{{ subscription }}" p_lo_ipv4_address: "{{ wfo_router.router.router_lo_ipv4_address }}" p_lo_ipv6_address: "{{ wfo_router.router.router_lo_ipv6_address }}" p_router_fqdn: "{{ wfo_router.router.router_fqdn }}" +subscription_lo_ipv4: "{{ subscription.router.router_lo_ipv4_address }}" +subscription_lo_ipv6: "{{ subscription.router.router_lo_ipv6_address }}" +subscription_fqdn: "{{ subscription.router.router_fqdn }}"