diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml index 1a31076c5e2f25a42e619311f46cb25138986011..74842b76c7c56a6580a31d0f192e74002fa695cd 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/bfd_update.yaml @@ -1,24 +1,59 @@ --- - name: Update Trunk interface BFD on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] + when: > + verb == "update" + and + remaining_side.vendor == "juniper" + and + dry_run | ansible.builtin.bool 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] + when: > + verb == "update" + and + remaining_side.vendor == "juniper" + and + not (dry_run | ansible.builtin.bool) junipernetworks.junos.junos_config: update: 'replace' src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true + +- name: Update Trunk interface BFD on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] + when: > + verb == "update" + and + remaining_side.vendor == "nokia" + and + dry_run | ansible.builtin.bool + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', '{{ remaining_side.vendor }}/{{ config_object }}.j2') }}" + commit: true + diff: true + check_mode: true + +- name: Update Trunk interface BFD on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] when: > - verb == "update" and - remaining_side.vendor == "juniper" and + verb == "update" + and + remaining_side.vendor == "nokia" + and not (dry_run | ansible.builtin.bool) + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', '{{ remaining_side.vendor }}/{{ config_object }}.j2') }}" + commit: true + commit_comment: "{{ commit_comment }}" + diff: true + check_mode: false diff --git a/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml b/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml index afeecf91c17e7ae9abc517847bfea195f10eeba1..a368daf9c2d5c3a76a9a7122185ba9b88248f419 100644 --- a/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml +++ b/geant/gap_ansible/roles/iptrunk_migration/tasks/deactivate_trunk_side.yaml @@ -1,24 +1,59 @@ --- - name: Deactivate Trunk interface on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] + when: > + verb == "deactivate" + and + local_side.iptrunk_side_node.vendor == "juniper" + and + dry_run | ansible.builtin.bool 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 == "deactivate" and - local_side.iptrunk_side_node.vendor == "juniper" and - dry_run | ansible.builtin.bool - name: Deactivate Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] + when: > + verb == "deactivate" + and + local_side.iptrunk_side_node.vendor == "juniper" + and + not (dry_run | ansible.builtin.bool) junipernetworks.junos.junos_config: update: 'replace' src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src_format: set comment: "{{ commit_comment }}" diff: true + +- name: Deactivate Trunk interface on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] + when: > + verb == "deactivate" + and + local_side.iptrunk_side_node.vendor == "nokia" + and + dry_run | ansible.builtin.bool + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}" + commit: true + diff: true + check_mode: true + +- name: Deactivate Trunk interface on "{{ inventory_hostname }}" [AND COMMIT][NOKIA] when: > - verb == "deactivate" and - local_side.iptrunk_side_node.vendor == "juniper" and + verb == "deactivate" + and + local_side.iptrunk_side_node.vendor == "nokia" + and not (dry_run | ansible.builtin.bool) + geant.gap_ansible.nokia_netconf_config: + format: xml + default_operation: merge + content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}" + commit: true + commit_comment: "{{ commit_comment }}" + diff: true + check_mode: false diff --git a/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/bfd_update.j2 b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/bfd_update.j2 new file mode 100644 index 0000000000000000000000000000000000000000..7bbc7131807aee25f0c11e483f5ae5be4a1bfc45 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/bfd_update.j2 @@ -0,0 +1,14 @@ +<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"> + + <lag 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"> + <lag-name>{{ remaining_side.ae_name | lower }}</lag-name> + <bfd-liveness> + <ipv4> + <remote-ip-address alu:operation="replace">{{ new_node.router.router_lo_ipv4_address }}</remote-ip-address> + </ipv4> + </bfd-liveness> + </lag> + </configure> +</config> + diff --git a/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/deactivate.j2 b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/deactivate.j2 new file mode 100644 index 0000000000000000000000000000000000000000..d48d361cb0b778889a0114cce897fce86a740812 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_migration/templates/nokia/deactivate.j2 @@ -0,0 +1,27 @@ + +<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> + <interface> + <interface-name>{{ local_side.iptrunk_side_ae_iface | lower }}.0</interface-name> + <admin-state>disable</admin-state> + </interface> + </router> + +{% for iface in local_side.iptrunk_side_ae_members %} + <port 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"> + <port-id>{{ iface.interface_name }}</port-id> + <admin-state>disable</admin-state> + </port> +{% endfor %} + + <lag 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"> + <lag-name>{{ local_side.iptrunk_side_ae_iface | lower }}</lag-name> + <admin-state>disable</admin-state> + </lag> + + </configure> +</config> +