diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml index c6b85f77aef277864b8840f05158ba381bf1042d..71592e66aac6eda1fe47bb66c1f0fb29924dc7ee 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_optical_levels.yaml @@ -14,6 +14,7 @@ lanes: "{{ lanes | default([]) }}" - name: Populate the lanes data for "{{ ae_member.interface_name }}" + no_log: "{{ my_nolog }}" ansible.builtin.set_fact: lanes: "{{ lanes + [{ 'lane_id': iface_opt_lane['lane-index'][0]['data'], @@ -30,6 +31,7 @@ loop_var: iface_opt_lane - name: Set variable for the PHY interface + no_log: "{{ my_nolog }}" ansible.builtin.set_fact: ae_result: "{{ ae_result | combine({item.key: item.value}) }}" with_items: @@ -64,7 +66,7 @@ text: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" parser: name: ansible.netcommon.native - template_path: templates/sros_show_port_optical.yaml + template_path: "{{ role_path }}/templates/sros_show_port_optical.yaml" set_fact: lanes - name: Set variable for the PHY interface 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 index 7b62fd3cfe1fd0cdefc3caba68cf6da87bcb2828..25bf3e4121e28cb75757117aed6ad7b32105c853 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/check_trunk_interface.yaml +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/check_trunk_interface.yaml @@ -10,14 +10,23 @@ ansible.builtin.debug: var: response.stdout_lines - - name: Ping "{{ remote_side.iptrunk_side_node.router_fqdn }} on {{ side_b_ipv4_address.split('/')[0] }}" + - name: Rapid ping of {{ side_b_ipv4_address.split('/')[0] }}" junipernetworks.junos.junos_command: - commands: "ping {{ side_b_ipv4_address.split('/')[0] }} rapid size {{ ping_size }} count {{ ping_count }}" + commands: "ping {{ side_b_ipv4_address.split('/')[0] }} rapid size {{ rapid_ping_size }} count {{ rapid_ping_count }}" register: response - - name: Show ping resulst + - name: Show rapid ping resulst ansible.builtin.debug: - msg: "{{ response }}" + var: response.stdout_lines[0] + + - name: MTU ping of {{ side_b_ipv4_address.split('/')[0] }}" + junipernetworks.junos.junos_command: + commands: "ping {{ side_b_ipv4_address.split('/')[0] }} size {{ mtu_ping_size }} count {{ mtu_ping_count }} do-not-fragment" + register: response + + - name: Show MTU ping resulst + ansible.builtin.debug: + var: response.stdout_lines[0] - name: Nokia LACP check when: local_side.iptrunk_side_node.vendor == "nokia" @@ -39,14 +48,31 @@ ansible.builtin.debug: msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" - - name: Ping "{{ remote_side.iptrunk_side_node.router_fqdn }} on {{ side_b_ipv4_address.split('/')[0] }}" + - name: Rapid ping "{{ remote_side.iptrunk_side_node.router_fqdn }} on {{ side_b_ipv4_address.split('/')[0] }}" + 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>//ping count {{ rapid_ping_count }} size {{ rapid_ping_size }} rapid {{ side_b_ipv4_address.split('/')[0] }}</md-cli-input-line> + </md-cli-raw-command> + </global-operations> + display: json + register: out + + - name: Show ping results + ansible.builtin.debug: + msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}" + + - name: MTU ping "{{ remote_side.iptrunk_side_node.router_fqdn }} on {{ side_b_ipv4_address.split('/')[0] }}" 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>//ping count {{ ping_count }} size {{ ping_size }} rapid {{ side_b_ipv4_address.split('/')[0] }}</md-cli-input-line> + <md-cli-input-line>//ping count {{ mtu_ping_count }} size {{ mtu_ping_size }} {{ side_b_ipv4_address.split('/')[0] }} do-not-fragment</md-cli-input-line> </md-cli-raw-command> </global-operations> display: json diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/diff_optical_results.yaml b/geant/gap_ansible/roles/iptrunk_checks/tasks/diff_optical_results.yaml index 3d42a9e2967532f98bd4476d564b1e7283ad224e..2b509ce4db0cb313bf042f23545dde36d72154ab 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/diff_optical_results.yaml +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/diff_optical_results.yaml @@ -23,5 +23,5 @@ and post_file_stat is defined ansible.utils.fact_diff: - before: "{{ lookup('ansible.builtin.file', 'pre_file_name') }}" - after: "{{ lookup('ansible.builtin.file', 'post_file_name') }}" + before: "{{ lookup('ansible.builtin.file', pre_file_name) }}" + after: "{{ lookup('ansible.builtin.file', post_file_name) }}" diff --git a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml index 5dbcbc8e3da2ad03a444bafdaf72fd9ff19a3b56..dad62e1510993e63a5e6c2395979a9cc769289f5 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml +++ b/geant/gap_ansible/roles/iptrunk_checks/tasks/main.yml @@ -15,12 +15,20 @@ dir: /opt/ansible_inventory/group_vars/routers - name: Load local info + when: >- + inventory_hostname == wfo_ip_trunk_json.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn + or + inventory_hostname == wfo_ip_trunk_json.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn 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: Load remote info + when: >- + inventory_hostname == wfo_ip_trunk_json.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn + or + inventory_hostname == wfo_ip_trunk_json.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn ansible.builtin.set_fact: remote_side: "{{ wfo_ip_trunk_json | community.general.json_query(query) }}" vars: @@ -30,14 +38,41 @@ ansible.builtin.set_fact: 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 + when: >- + local_side is defined + and + local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool - name: Load netconf connection config + when: local_side is defined ansible.builtin.set_fact: ansible_connection: "{{ netconf_access[local_side.iptrunk_side_node.vendor].ansible_connection }}" ansible_network_os: "{{ netconf_access[local_side.iptrunk_side_node.vendor].ansible_network_os }}" +- name: Set local_side var when new_node is passed to use in optical_post + when: >- + new_node is defined + and + inventory_hostname == new_node.router.router_fqdn + ansible.builtin.set_fact: + ansible_connection: "{{ netconf_access[new_node.router.vendor].ansible_connection }}" + ansible_network_os: "{{ netconf_access[new_node.router.vendor].ansible_network_os }}" + local_side: + iptrunk_side_ae_members: "{{ new_lag_member_interfaces }}" + iptrunk_side_node: + vendor: "{{ new_node.router.vendor }}" + +- name: Set ansible_host when new_node is targeted + when: >- + new_node is defined + and + inventory_hostname == new_node.router.router_fqdn + and + new_node.router.router_access_via_ts | ansible.builtin.bool + ansible.builtin.set_fact: + ansible_host: "{{ new_node.router.router_site.site_ts_address }}" + ansible_port: "{{ new_node.router.router_ts_port }}" + - name: Check ISIS ansible.builtin.include_tasks: check_isis.yaml when: check == "isis" @@ -95,11 +130,14 @@ content: "{{ ae_result | to_nice_yaml }}" dest: "{{ opt_checks_file }}" -- name: Display "{{ check | upper }}" check results for "{{ inventory_hostname }}" +- name: Display "{{ check | upper }}" check results when: check == "optical_pre" or check == "optical_post" ansible.builtin.debug: msg: "{{ ae_result }}" - name: Produce the diff of optical check results on the "remaining" side - when: check == "optical_post" + when: >- + check == "optical_post" + and + inventory_hostname != new_node.router.router_fqdn ansible.builtin.include_tasks: diff_optical_results.yaml diff --git a/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml b/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml index c19b116ce29fbf598298c3cc9690fe0e3d84427f..cb53fc84bb373f4b44ebb3e11ce9ad65e724a090 100644 --- a/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml +++ b/geant/gap_ansible/roles/iptrunk_checks/vars/main.yml @@ -1,7 +1,6 @@ --- # vars file for iptrunks # - checks: - isis - ping @@ -9,8 +8,12 @@ checks: - optical_pre - optical_post -ping_count: 3 -ping_size: 9000 +my_nolog: true + +mtu_ping_count: 3 +mtu_ping_size: 8972 +rapid_ping_count: 100 +rapid_ping_size: 100 wfo_trunk: "{{ wfo_ip_trunk_json }}"