diff --git a/geant/gap_ansible/galaxy.yml b/geant/gap_ansible/galaxy.yml index 19a07c158f77bd16932bc8d208d69ed75ecdbc00..0e9f59ffc6b0126aae94d437478d6b987715badd 100644 --- a/geant/gap_ansible/galaxy.yml +++ b/geant/gap_ansible/galaxy.yml @@ -8,7 +8,7 @@ namespace: geant name: gap_ansible # The version of the collection. Must be compatible with semantic versioning -version: 1.0.26 +version: 1.0.33 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml index 53a0b11b7be92627c26297394604058e552e006c..ae4365cc7a7c517ec328a112c0e38d2001127347 100644 --- a/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml +++ b/geant/gap_ansible/roles/iptrunk/tasks/deploy_object.yaml @@ -35,13 +35,13 @@ local_side.iptrunk_side_node.vendor == "juniper" and not (dry_run | ansible.builtin.bool) -- name: Show real diff of "{{ config_object }}" - ansible.builtin.debug: - msg: "{{ response }}" - when: > - verb == "deploy" and - local_side.iptrunk_side_node.vendor == "juniper" and - not (dry_run | ansible.builtin.bool) +# - name: Show real diff of "{{ config_object }}" +# ansible.builtin.debug: +# msg: "{{ response }}" +# when: > +# verb == "deploy" and +# local_side.iptrunk_side_node.vendor == "juniper" and +# not (dry_run | ansible.builtin.bool) - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] ansible.netcommon.netconf_config: @@ -62,7 +62,7 @@ default_operation: merge content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}" commit: true - diff: true + # diff: true check_mode: false when: > verb == "deploy" and diff --git a/geant/gap_ansible/roles/iptrunk/templates/nokia/isis_interface.j2 b/geant/gap_ansible/roles/iptrunk/templates/nokia/isis_interface.j2 index 699bf525414d5f6aba5ce915129ef75e76558ede..8dac39e225dbd2c83a0c5f0158fd2a81d9b86596 100644 --- a/geant/gap_ansible/roles/iptrunk/templates/nokia/isis_interface.j2 +++ b/geant/gap_ansible/roles/iptrunk/templates/nokia/isis_interface.j2 @@ -15,7 +15,7 @@ {% endif %} {% if interface_name is defined %} <interface 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"> - <interface-name>{{ interface_name }}.0</interface-name> + <interface-name>{{ interface_name | lower }}.0</interface-name> <admin-state>enable</admin-state> <interface-type>point-to-point</interface-type> <level> diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_isis.yaml b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_isis.yaml index 3ce3528803d6ba42df98687007e2f16005d349c7..89b664a1fbcc42a9fa9008145e0d54f5262040b5 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_isis.yaml +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_isis.yaml @@ -1,14 +1,36 @@ -- name: Get status of ISIS - juniper_junos_command: - commands: - - show isis adjacency - - show isis interface "{{ trunks[0].config.nodeA.ae_name }}".0 - register: response +- name: Juniper ISIS check + when: local_side.iptrunk_side_node.vendor == "juniper" + block: + - name: Get status of ISIS + juniper_junos_command: + commands: + - show isis adjacency + - show isis interface "{{ local_side.iptrunk_side_ae_iface }}".0 + register: response -- name: Show status of ISIS djacencies - ansible.builtin.debug: - msg: "{{ response.results[0].stdout_lines }}" + - name: Show status of ISIS djacencies + ansible.builtin.debug: + msg: "{{ response.results[0].stdout_lines }}" -- name: Show status of ISIS interfaces - ansible.builtin.debug: - msg: "{{ response.results[1].stdout_lines }}" + - name: Show status of ISIS interfaces + ansible.builtin.debug: + msg: "{{ response.results[1].stdout_lines }}" + +- name: Nokia ISIS check + when: local_side.iptrunk_side_node.vendor == "nokia" + block: + - name: Get ISIS status + ansible.netcommon.netconf_rpc: + rpc: action + xmlns: "urn:ietf:params:xml:ns:yang:1" + content: | + <global-operations xmlns="urn:nokia.com:sros:ns:yang:sr:oper-global"> + <md-cli-raw-command> + <md-cli-input-line>show router "Base" isis interface {{ local_side.iptrunk_side_ae_iface | lower }}.0</md-cli-input-line> + </md-cli-raw-command> + </global-operations> + display: json + register: out + - name: Show ISIS status + ansible.builtin.debug: + msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_ping.yaml b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_ping.yaml deleted file mode 100644 index 072f4a0cfcb90728b816d7eb9b1ecb3264e4f9c6..0000000000000000000000000000000000000000 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_ping.yaml +++ /dev/null @@ -1,27 +0,0 @@ -- name: Show LACP status - juniper_junos_command: - command: "show lacp interface {{ trunks[0].config.nodeA.ae_name }}" - register: response - -- name: Print the LACP status. - ansible.builtin.debug: - var: response.stdout_lines - -- name: Ping "{{ trunks[0].config.nodeB.name }} on {{ side_b_ipv4_address.split('/')[0] }}" - # juniper_junos_ping: - # dest: "{{ side_b_ipv4_address.split('/')[0] }}" - # count: 1000 - # size: 9000 - # rapid: true - juniper_junos_command: - command: "ping {{ side_b_ipv4_address.split('/')[0] }} rapid size 9000 count 100" - register: response - -- name: Print the packet_loss percentage from the response. - ansible.builtin.debug: - var: response - -- name: If packet loss is not zero, than this check fails - ansible.builtin.fail: - msg: "{{ response.changed }}" - when: response.packet_loss != "0" diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_trunk_interface.yaml b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_trunk_interface.yaml new file mode 100644 index 0000000000000000000000000000000000000000..324ae18dc4e07fd5042355c5d3306ac7bf9f7372 --- /dev/null +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_trunk_interface.yaml @@ -0,0 +1,34 @@ +- name: Juniper LACP check + when: local_side.iptrunk_side_node.vendor == "juniper" + block: + - name: Show LACP status + juniper_junos_command: + command: "show lacp interface {{ local_side.iptrunk_side_ae_iface }}" + register: response + + - name: Print the LACP status. + ansible.builtin.debug: + var: response.stdout_lines + + # - name: Ping "{{ trunks[0].config.nodeB.name }} on {{ side_b_ipv4_address.split('/')[0] }}" + # juniper_junos_command: + # command: "ping {{ side_b_ipv4_address.split('/')[0] }} rapid size 9000 count 100" + # register: response +- name: Nokia LACP check + when: local_side.iptrunk_side_node.vendor == "nokia" + block: + - name: Get LACP status + ansible.netcommon.netconf_rpc: + rpc: action + xmlns: "urn:ietf:params:xml:ns:yang:1" + content: | + <global-operations xmlns="urn:nokia.com:sros:ns:yang:sr:oper-global"> + <md-cli-raw-command> + <md-cli-input-line>show lag {{ local_side.iptrunk_side_ae_iface | lower }} lacp-partner</md-cli-input-line> + </md-cli-raw-command> + </global-operations> + display: json + register: out + - name: Show LACP status + ansible.builtin.debug: + msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml index b2ddb06fa4fc1363bdd897242a868067e1216f12..f5da18ba9958c35a3c204a28b13bd3e3c772cc36 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml @@ -14,6 +14,12 @@ ansible.builtin.include_vars: dir: /opt/ansible_inventory/group_vars/routers +- name: Load local info + ansible.builtin.set_fact: + local_side: "{{ wfo_ip_trunk_json | community.general.json_query(query) }}" + vars: + query: "iptrunk.iptrunk_sides[?iptrunk_side_node.router_fqdn == '{{ inventory_hostname }}'] | [0]" + - name: Set ansible_host to terminal server when router is offline ansible.builtin.set_fact: ansible_host: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_site.site_ts_address }}" @@ -31,5 +37,5 @@ when: check == "isis" - name: Check ping - ansible.builtin.include_tasks: check_ping.yaml + ansible.builtin.include_tasks: check_trunk_interface.yaml when: check == "ping" diff --git a/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml b/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml index 088741369433de358fbe34ce80c3b1dc547f91c5..3b5859461aad26f49d859f79fc7924a94ae32fa6 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml @@ -30,7 +30,6 @@ trunks: ipv4_address: "{{ side_a_ipv4_address }}" ipv6_address: "{{ side_a_ipv6_address }}" members: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_ae_members }}" - members_descriptions: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_ae_members_description }}" port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_ae_geant_a_sid }}" nodeB: name: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn }}" @@ -40,5 +39,4 @@ trunks: ipv4_address: "{{ side_b_ipv4_address }}" ipv6_address: "{{ side_b_ipv6_address }}" members: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_ae_members }}" - members_descriptions: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_ae_members_description }}" port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_ae_geant_a_sid }}"