diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1a31076c5e2f25a42e619311f46cb25138986011 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml @@ -0,0 +1,24 @@ +--- +- name: Update Trunk interface BFD on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] + junipernetworks.junos.junos_config: + update: 'replace' + src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src_format: set + check_commit: true + diff: true + when: > + verb == "update" and + remaining_side.vendor == "juniper" and + dry_run | ansible.builtin.bool + +- name: Update Trunk interface BFD on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] + junipernetworks.junos.junos_config: + update: 'replace' + src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + src_format: set + comment: "{{ commit_comment }}" + diff: true + when: > + verb == "update" and + remaining_side.vendor == "juniper" and + not (dry_run | ansible.builtin.bool) diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml index da370805d4f18cdf6f6c4241d59b1a3762bdd53a..80e59fe72ce21a8147d987979f5b2261ab9a647e 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/compile_template.yaml @@ -40,6 +40,16 @@ delegate_to: localhost when: (verb == "deploy") and inventory_hostname == new_node.router.router_fqdn +- name: Print template for the remaining node in "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + ansible.builtin.template: + src: "{{ remaining_side.vendor }}/{{ config_object }}.j2" + dest: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" + lstrip_blocks: true + trim_blocks: true + mode: '0755' + delegate_to: localhost + when: (verb == "update") and inventory_hostname == remaining_side.name + - name: Set netconf connection for trunk nodes ansible.builtin.include_tasks: set_netconf_connection.yaml when: verb == "delete" or verb == "deactivate" diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml index 9474d27a6c5024cbd1a740214478f5911dd07577..1ca1cd481f901475e058a24485912f34c940aee5 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/main.yml @@ -35,11 +35,11 @@ - name: Calculate local side ansible.builtin.include_tasks: calculate_local_side.yaml - when: (verb == "delete" or verb == "deactivate") and inventory_hostname != new_node.router.router_fqdn + when: (verb in ["delete", "deactivate", "update"]) and inventory_hostname != new_node.router.router_fqdn - name: Set netconf connection for trunk nodes ansible.builtin.include_tasks: set_netconf_connection.yaml - when: (verb == "delete" or verb == "deactivate") and inventory_hostname != new_node.router.router_fqdn + when: (verb in ["delete", "deactivate", "update"]) and inventory_hostname != new_node.router.router_fqdn - name: Set ansible_host connection for new side ansible.builtin.set_fact: @@ -80,3 +80,11 @@ - name: Include the deployment tasks if specified ansible.builtin.include_tasks: deploy_object.yaml when: verb == "deploy" and inventory_hostname == new_node.router.router_fqdn + +- name: Compile update for the remaining node (BFD update) + ansible.builtin.include_tasks: compile_template.yaml + when: verb == "update" and inventory_hostname == remaining_side.name + +- name: Include update for the remaining node (BFD update) + ansible.builtin.include_tasks: bfd_update.yaml + when: verb == "update" and inventory_hostname == remaining_side.name diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/set_netconf_connection.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/set_netconf_connection.yaml index 47f7abadc1424f30e2052306fdf0ec743c7d6f6e..c5f887050b78fbc6e0766fd4302d6d2f3cdf2aae 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/set_netconf_connection.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/set_netconf_connection.yaml @@ -3,4 +3,4 @@ ansible_host: "{{ local_side.iptrunk_side_node.router_site.site_ts_address }}" ansible_port: "{{ local_side.iptrunk_side_node.router_ts_port }}" when: - ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true + local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool diff --git a/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/bfd_update.j2 b/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/bfd_update.j2 new file mode 100644 index 0000000000000000000000000000000000000000..69dc5039d546ec132ac306b516c54f30c11e6cde --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/templates/juniper/bfd_update.j2 @@ -0,0 +1,2 @@ + +set interfaces {{ remaining_side.ae_name }} aggregated-ether-options bfd-liveness-detection neighbor {{ new_node.router.router_lo_ipv4_address }} diff --git a/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml b/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml index 565ba579ab88b5cc77ba5c00c60453c13574ad0d..36c89b858847f5efa3b76729e00db0808ba479a2 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk_migration/vars/main.yml @@ -6,6 +6,7 @@ verbs: - "deactivate" - "deploy" - "delete" + - "update" config_objects: - "deactivate" @@ -13,6 +14,7 @@ config_objects: - "trunk_interface" - "isis_interface" - "trunk_deprovision" + - "bfd_update" bfd_min_interval: 3000 mtu_phy: 9212 @@ -46,4 +48,6 @@ new_side: remaining_side: name: "{{ wfo_trunk.iptrunk.iptrunk_sides[1 - (replace_index | int)].iptrunk_side_node.router_fqdn }}" + vendor: "{{ wfo_trunk.iptrunk.iptrunk_sides[1 - (replace_index | int)].iptrunk_side_node.vendor }}" loopback: "{{ wfo_trunk.iptrunk.iptrunk_sides[1 - (replace_index | int)].iptrunk_side_node.router_lo_ipv4_address }}" + ae_name: "{{ wfo_trunk.iptrunk.iptrunk_sides[1 - (replace_index | int)].iptrunk_side_ae_iface }}"