Skip to content
Snippets Groups Projects
Commit ef314f9b authored by Thodoris Vasilopoulos's avatar Thodoris Vasilopoulos
Browse files

finalize checks

parent a85e583c
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,7 @@
- "{{ verb }}.{{ check_id }}.ethernet_fec_statistics.fec_ccw_error_rate.0.data == {{ fec_ccw_error_rate_threshold }}"
- "{{ verb }}.{{ check_id }}.ethernet_fec_statistics.fec_nccw_count.0.data == {{ fec_nccw_count_threshold }}"
- "{{ verb }}.{{ check_id }}.ethernet_fec_statistics.fec_nccw_error_rate.0.data == {{ fec_nccw_error_rate_threshold }}"
fail_msg: "FAIL: FEC statistics errors detected"
fail_msg: "FAIL: FEC statistics errors detected or FEC statistics not found - please check results in relevant yaml file"
success_msg: "PASS: no FEC statistics errors detected"
failed_when: false
......@@ -65,7 +65,6 @@
ansible.builtin.assert:
that:
- "{{ verb }}.{{ check_id }}.output_power_dbm > {{ min_tx_power_dbm }}"
- "{{ verb }}.{{ check_id }}.output_power_dbm != false"
fail_msg: "FAIL: Low Tx output power detected (dBm)"
success_msg: "PASS: Tx Output power above minimum threshold (dBm) "
failed_when: false
......@@ -74,7 +73,6 @@
ansible.builtin.assert:
that:
- "{{ verb }}.{{ check_id }}.output_power_dbm < {{ max_tx_power_dbm }}"
- "{{ verb }}.{{ check_id }}.output_power_dbm != false"
fail_msg: "FAIL: High Tx output power detected (dBm)"
success_msg: "PASS: Tx Output power below maximum threshold (dBm) "
failed_when: false
......@@ -83,7 +81,6 @@
ansible.builtin.assert:
that:
- "{{ verb }}.{{ check_id }}.rx_signal_avg_power_dbm > {{ min_rx_power_dbm }}"
- "{{ verb }}.{{ check_id }}.rx_signal_avg_power_dbm != false"
fail_msg: "FAIL: Low Rx signal power detected (dBm)"
success_msg: "PASS: Rx signal power above minimum threshold (dBm) "
failed_when: false
......@@ -92,7 +89,6 @@
ansible.builtin.assert:
that:
- "{{ verb }}.{{ check_id }}.rx_signal_avg_power_dbm < {{ max_rx_power_dbm }}"
- "{{ verb }}.{{ check_id }}.rx_signal_avg_power_dbm != false"
fail_msg: "FAIL: High Rx signal power detected (dBm)"
success_msg: "PASS: Rx signal power below maximum threshold (dBm) "
failed_when: false
\ No newline at end of file
---
- name: Get output file information
ansible.builtin.stat:
path: roles/check_demarcation_point/vars/{{ check_id }}.yml
register: file_status
- name: Load variables from pre and post check results
ansible.builtin.include_vars:
dir: vars
files_matching: "{{ check_id }}.yml"
- name: Check if PRE and POST measurements exist prior to compare command
ansible.builtin.assert:
that:
- "pre_check.{{ check_id }} is defined"
- "post_check.{{ check_id }} is defined"
fail_msg: "FAIL: PRE and POST measurements have not been performed before COMPARE"
success_msg: "PASS: PRE and POST values exist "
- name: Compare PRE and POST interface status
ansible.builtin.assert:
that:
- "pre_check.{{ check_id }}.interface_status == post_check.{{ check_id }}.interface_status"
fail_msg: "FAIL: Interface status on PRE and post POST is not equal"
success_msg: "PASS: Interface status PRE and POST check is equal "
- name: Compare PRE and POST interface input errors
ansible.builtin.assert:
that:
- "{{ pre_check[check_id].input_error_count | int }} <= {{ post_check[check_id].input_error_count | int }}"
fail_msg: "WARNING: Interface input errors have been increased"
success_msg: "PASS: Interface input errors have not been increased "
failed_when: false
- name: Compare PRE and POST interface output errors
ansible.builtin.assert:
that:
- "{{ pre_check[check_id].output_error_count | int }} <= {{ post_check[check_id].output_error_count | int }}"
fail_msg: "WARNING: Interface output errors have been increased"
success_msg: "PASS: Interface output errors have not been increased "
failed_when: false
- name: Set facts
ansible.builtin.set_fact:
tx_power_dbm_post: "{{ post_check[check_id].output_power_dbm }}"
tx_power_dbm_pre: "{{ pre_check[check_id].output_power_dbm }}"
rx_power_dbm_post: "{{ post_check[check_id].rx_signal_avg_power_dbm }}"
rx_power_dbm_pre: "{{ pre_check[check_id].rx_signal_avg_power_dbm }}"
input_error_count_post: "{{ post_check[check_id].input_error_count }}"
input_error_count_pre: "{{ pre_check[check_id].input_error_count }}"
output_error_count_post: "{{ post_check[check_id].output_error_count }}"
output_error_count_pre: "{{ pre_check[check_id].output_error_count }}"
when:
- pre_check[check_id] is defined
- post_check[check_id] is defined
- name: Set facts calculate diffs
ansible.builtin.set_fact:
tx_power_dbm_diff: "{{ '{:0.2f}'.format(tx_power_dbm_post | float - tx_power_dbm_pre | float) }}"
rx_power_dbm_diff: "{{ '{:0.2f}'.format(rx_power_dbm_post | float - rx_power_dbm_pre | float) }}"
input_error_count_diff: "{{ input_error_count_post | int - input_error_count_pre | int }}"
output_error_count_diff: "{{ output_error_count_post | int - output_error_count_pre | int }}"
- name: Add PRE and POST comparison values to yaml
ansible.builtin.blockinfile:
path: "roles/check_demarcation_point/vars/{{ check_id }}.yml"
marker: "# {mark} -------------- DIFFS (POST - PRE) ----------------------------- #"
block: |
{{ verb + ':' }}
{{ check_id + ':' }}
{{ 'tx_power_diff:' }} {{ tx_power_dbm_diff }}
{{ 'rx_power_diff:' }} {{ rx_power_dbm_diff }}
{{ 'input_error_count_diff:' }} {{ input_error_count_diff }}
{{ 'output_error_count_diff:' }} {{ output_error_count_diff }}
when:
- pre_check[check_id] is defined
- post_check[check_id] is defined
- file_status.stat.exists
\ No newline at end of file
......@@ -5,7 +5,7 @@
path: roles/check_demarcation_point/vars/{{ check_id }}.yml
register: file_status
- name: Creating a file with results content
- name: Creating a yaml file with pre_check results content
ansible.builtin.copy:
content: |
{{ '---' }}
......@@ -46,4 +46,4 @@
{{ 'rx_signal_avg_power_dbm:' }} {{ rx_signal_avg_power_dbm }}
when:
- verb == 'post_check'
- file_status.stat.exists
- file_status.stat.exists
\ No newline at end of file
......@@ -15,27 +15,27 @@
when:
- (verb is not defined) or (interface is not defined) or (vendor is not defined) or (check_id is not defined)
- name: Include task
- name: Include task get_ifstatus
ansible.builtin.include_tasks: get_ifstatus.yaml
when:
- verb in ['pre_check','post_check']
- name: Include task
- name: Include task get_optical_levels
ansible.builtin.include_tasks: get_optical_levels.yaml
when:
- verb in ['pre_check','post_check']
- name: Include task
- name: Include task create_file
ansible.builtin.include_tasks: create_file.yaml
when:
- verb in ['pre_check','post_check']
- name: Include task
- name: Include task checks
ansible.builtin.include_tasks: checks.yaml
when:
- verb in ['pre_check','post_check']
- name: Include task
- name: Include task compare
ansible.builtin.include_tasks: compare.yaml
when:
- verb == 'compare'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment