Skip to content
Snippets Groups Projects
Commit c2fb8dad authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov
Browse files

Merge branch 'trunk_migration_checks' into 'develop'

iptrunk_checks: adding optical checks

See merge request !117
parents 070109a6 5f54c5c0
No related branches found
No related tags found
1 merge request!117iptrunk_checks: adding optical checks
Pipeline #85886 passed
---
###############################################################################################################
# The playbook does the following:
#
#
# - Runs the command 'show interfaces diagnostics optics {{ interface }} | no-more' and gets the json output
# - From json output it retrieves the apporpriate metrics for optical levels
# - Saves the metrics in relevant variable names
###############################################################################################################
- name: Get Junos attributes for optical levels of interface "{{ item }}"
when: local_side.iptrunk_side_node.vendor == "juniper"
block:
- name: Run Juniper Optical info
junipernetworks.junos.junos_command:
commands: "show interfaces diagnostics optics {{ item }} | no-more"
# display: json
register: optical_status
- name: Show optical levels on Juniper interface "{{ item }}"
ansible.builtin.debug:
msg: "{{ optical_status }}"
- name: Get Nokia optical levels on port "{{ item }}"
when: local_side.iptrunk_side_node.vendor == "nokia"
block:
- name: Prepare the connector var
ansible.builtin.set_fact:
connector: "{{ item | regex_search('[1-9]/[1-9]/c[1-9]+') }}"
- name: Run Nokia show command
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 port {{ connector }} optical</md-cli-input-line>
</md-cli-raw-command>
</global-operations>
display: json
register: output
- name: Show optical levels on Nokia port "{{ item }}"
ansible.builtin.debug:
# msg: "{{ output }}"
msg: "{{out.output['rpc-reply']['nokiaoper:results']['nokiaoper:md-cli-output-block'].split('\n')}}"
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
vars: vars:
query: "iptrunk.iptrunk_sides[?iptrunk_side_node.router_fqdn == '{{ inventory_hostname }}'] | [0]" query: "iptrunk.iptrunk_sides[?iptrunk_side_node.router_fqdn == '{{ inventory_hostname }}'] | [0]"
- name: Load remote info
ansible.builtin.set_fact:
remote_side: "{{ wfo_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 - name: Set ansible_host to terminal server when router is offline
ansible.builtin.set_fact: ansible.builtin.set_fact:
ansible_host: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_site.site_ts_address }}" ansible_host: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_site.site_ts_address }}"
...@@ -39,3 +45,8 @@ ...@@ -39,3 +45,8 @@
- name: Check ping - name: Check ping
ansible.builtin.include_tasks: check_trunk_interface.yaml ansible.builtin.include_tasks: check_trunk_interface.yaml
when: check == "ping" when: check == "ping"
- name: Check optical levels
ansible.builtin.include_tasks: check_optical_levels.yaml
when: check == "optical"
loop: "{{ local_side.iptrunk_side_ae_members }}"
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
checks: checks:
- isis - isis
- ping - ping
- lacp
- optical
wfo_trunk: "{{ wfo_ip_trunk_json }}" wfo_trunk: "{{ wfo_ip_trunk_json }}"
...@@ -19,7 +21,7 @@ trunks: ...@@ -19,7 +21,7 @@ trunks:
common: common:
description: "{{ wfo_trunk.iptrunk.iptrunk_description }}" description: "{{ wfo_trunk.iptrunk.iptrunk_description }}"
speed: "{{ wfo_trunk.iptrunk.iptrunk_speed }}" speed: "{{ wfo_trunk.iptrunk.iptrunk_speed }}"
is_leased_line: false ## Fix it to use iptrunk_type is_leased_line: false ## FIX: it to use iptrunk_type
isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}" isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}"
minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}" minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}"
nodeA: nodeA:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment