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

Merge branch 'fix_iptrunk_checks' into 'develop'

Fix iptrunk checks

See merge request !82
parents 09c636da 1425bb68
No related branches found
No related tags found
1 merge request!82Fix iptrunk checks
Pipeline #85370 passed
...@@ -8,7 +8,7 @@ namespace: geant ...@@ -8,7 +8,7 @@ namespace: geant
name: gap_ansible name: gap_ansible
# The version of the collection. Must be compatible with semantic versioning # 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 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md readme: README.md
......
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
local_side.iptrunk_side_node.vendor == "juniper" and local_side.iptrunk_side_node.vendor == "juniper" and
not (dry_run | ansible.builtin.bool) not (dry_run | ansible.builtin.bool)
- name: Show real diff of "{{ config_object }}" # - name: Show real diff of "{{ config_object }}"
ansible.builtin.debug: # ansible.builtin.debug:
msg: "{{ response }}" # msg: "{{ response }}"
when: > # when: >
verb == "deploy" and # verb == "deploy" and
local_side.iptrunk_side_node.vendor == "juniper" and # local_side.iptrunk_side_node.vendor == "juniper" and
not (dry_run | ansible.builtin.bool) # not (dry_run | ansible.builtin.bool)
- name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA] - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][NOKIA]
ansible.netcommon.netconf_config: ansible.netcommon.netconf_config:
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
default_operation: merge default_operation: merge
content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}" content: "{{ lookup('ansible.builtin.template', '{{ local_side.iptrunk_side_node.vendor }}/{{ config_object }}.j2') }}"
commit: true commit: true
diff: true # diff: true
check_mode: false check_mode: false
when: > when: >
verb == "deploy" and verb == "deploy" and
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
{% endif %} {% endif %}
{% if interface_name is defined %} {% 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 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> <admin-state>enable</admin-state>
<interface-type>point-to-point</interface-type> <interface-type>point-to-point</interface-type>
<level> <level>
......
- name: Get status of ISIS - name: Juniper ISIS check
juniper_junos_command: when: local_side.iptrunk_side_node.vendor == "juniper"
commands: block:
- show isis adjacency - name: Get status of ISIS
- show isis interface "{{ trunks[0].config.nodeA.ae_name }}".0 juniper_junos_command:
register: response commands:
- show isis adjacency
- show isis interface "{{ local_side.iptrunk_side_ae_iface }}".0
register: response
- name: Show status of ISIS djacencies - name: Show status of ISIS djacencies
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ response.results[0].stdout_lines }}" msg: "{{ response.results[0].stdout_lines }}"
- name: Show status of ISIS interfaces - name: Show status of ISIS interfaces
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ response.results[1].stdout_lines }}" 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')}}"
- 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"
- 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')}}"
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
ansible.builtin.include_vars: ansible.builtin.include_vars:
dir: /opt/ansible_inventory/group_vars/routers 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 - 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 }}"
...@@ -31,5 +37,5 @@ ...@@ -31,5 +37,5 @@
when: check == "isis" when: check == "isis"
- name: Check ping - name: Check ping
ansible.builtin.include_tasks: check_ping.yaml ansible.builtin.include_tasks: check_trunk_interface.yaml
when: check == "ping" when: check == "ping"
...@@ -30,7 +30,6 @@ trunks: ...@@ -30,7 +30,6 @@ trunks:
ipv4_address: "{{ side_a_ipv4_address }}" ipv4_address: "{{ side_a_ipv4_address }}"
ipv6_address: "{{ side_a_ipv6_address }}" ipv6_address: "{{ side_a_ipv6_address }}"
members: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_ae_members }}" 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 }}" port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_ae_geant_a_sid }}"
nodeB: nodeB:
name: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn }}" name: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn }}"
...@@ -40,5 +39,4 @@ trunks: ...@@ -40,5 +39,4 @@ trunks:
ipv4_address: "{{ side_b_ipv4_address }}" ipv4_address: "{{ side_b_ipv4_address }}"
ipv6_address: "{{ side_b_ipv6_address }}" ipv6_address: "{{ side_b_ipv6_address }}"
members: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_ae_members }}" 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 }}" port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[1].iptrunk_side_ae_geant_a_sid }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment