diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2 index d7d5ff5e2fff092bef5fa09f3a4d5435c7eae225..3fc1919ea6b5275211dda574a0b7eb4bb73d8cb8 100644 --- a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2 +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/base_static_routes.j2 @@ -1,4 +1,4 @@ - {% if router_role == 'pe' or is_pe_promotion_wf %} + {% if router_role == 'pe' %} {% with static_routes_obj=nokia_pe_static_routes %} {% include 'router/static_routes.j2' %} {% endwith %} diff --git a/geant/gap_ansible/roles/bc_templates/routers/nokia/router/pe_promotion_static_routes.j2 b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/pe_promotion_static_routes.j2 new file mode 100644 index 0000000000000000000000000000000000000000..d609858616e32a59cb380a9034071dea89f7d058 --- /dev/null +++ b/geant/gap_ansible/roles/bc_templates/routers/nokia/router/pe_promotion_static_routes.j2 @@ -0,0 +1,10 @@ +{% with static_routes_obj=nokia_pe_static_routes %} +<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 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"> + <router-name>Base</router-name> + {% include './static_routes.j2' %} + </router> + </configure> +</config> +{% endwith %} diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml index adb563a7a6e278620b3a6107240426d4427188de..5303efd345a44a711b932bb80c0e919d8e879dce 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/compile.yaml @@ -55,6 +55,16 @@ mode: '0755' delegate_to: localhost +- name: Print the template in "/var/tmp/ansible_run_{{ opid }}/pe_promotion_static_routes.conf" + when: verb == "add_pe_static_routes" + ansible.builtin.template: + src: "routers/{{ subscription.router.vendor }}/router/pe_promotion_static_routes.j2" + dest: "/var/tmp/ansible_run_{{ opid }}/pe_promotion_static_routes.conf" + lstrip_blocks: true + trim_blocks: true + mode: '0755' + delegate_to: localhost + - name: Set back ansible_host to target terminal server if needed when: subscription.router.router_access_via_ts | ansible.builtin.bool and diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml index 8d7019f0c4396e969340743ae8a0bb566361d3be..54e6ef8f85d7088623ac1d6b6525c811b4f2df83 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/deploy.yaml @@ -58,6 +58,21 @@ register: output check_mode: true +- name: Add PE static routes on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] + when: >- + dry_run | ansible.builtin.bool + and verb == "add_pe_static_routes" + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/router/pe_promotion_static_routes.j2') }}" + commit: true + validate: true + config_mode: private + diff: true + register: output + check_mode: true + # - name: Fail if there is any diff # ansible.builtin.fail: # msg: Base config drift detected!!! @@ -121,3 +136,17 @@ config_mode: private diff: true check_mode: false + +- name: Add PE static routes on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] + when: >- + not (dry_run | ansible.builtin.bool) + and verb == "add_pe_static_routes" + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', 'routers/{{ subscription.router.vendor }}/router/pe_promotion_static_routes.j2') }}" + commit: true + commit_comment: "{{ commit_comment }}" + config_mode: private + diff: true + check_mode: false diff --git a/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml b/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml index 0b6df2e126858443f06b5708874e43a4c4e4113f..c31c8db5370dc25ccb42f15d01c06c7a0dab4cfd 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml +++ b/geant/gap_ansible/roles/promote_p_to_pe/tasks/main.yml @@ -50,11 +50,11 @@ # ansible.builtin.include_tasks: configure_isis_overload.yaml - name: Include templates compilation - when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh' , 'deploy_routing_instances', 'delete_default_routes' ] + when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh', 'deploy_routing_instances', 'delete_default_routes', 'add_pe_static_routes' ] ansible.builtin.include_tasks: compile.yaml - name: Include deploy if selected - when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh', 'deploy_routing_instances', 'delete_default_routes' ] + when: verb in [ 'deploy_pe_base_config', 'update_sdp_mesh', 'deploy_routing_instances', 'delete_default_routes', 'add_pe_static_routes' ] ansible.builtin.include_tasks: deploy.yaml - name: PRE checks diff --git a/geant/gap_ansible/roles/promote_p_to_pe/vars/main.yml b/geant/gap_ansible/roles/promote_p_to_pe/vars/main.yml index b6ad21f819ad82071996a31bf303d55a77fe2abe..0dae5d110551baabcbfce331982980b13df269c5 100644 --- a/geant/gap_ansible/roles/promote_p_to_pe/vars/main.yml +++ b/geant/gap_ansible/roles/promote_p_to_pe/vars/main.yml @@ -13,6 +13,7 @@ verbs: - check_base_ris # Check BGP summary for base VPRNs - pre_checks - post_checks + - add_pe_static_routes # Add PE-specific static routes as a separate WF step to avoid blackholing lo_ipv4_address: "{{ subscription.router.router_lo_ipv4_address }}" lo_ipv6_address: "{{ subscription.router.router_lo_ipv6_address }}"