From 76fe316c995432290cbb52b0eb05ddc2089f2107 Mon Sep 17 00:00:00 2001 From: tvasilopo <tvasilopo@noc.grnet.gr> Date: Fri, 22 Sep 2023 10:08:59 +0000 Subject: [PATCH] Create assertions by comparing the diff values on pre-post checks with threshold values --- .../check_demarcation_point/tasks/checks.yaml | 6 ++-- .../tasks/compare.yaml | 32 +++++++++++++++++++ .../vars/optical_thresholds.yml | 4 ++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/roles/check_demarcation_point/tasks/checks.yaml b/roles/check_demarcation_point/tasks/checks.yaml index 66dfc008..ea9820ab 100644 --- a/roles/check_demarcation_point/tasks/checks.yaml +++ b/roles/check_demarcation_point/tasks/checks.yaml @@ -55,10 +55,10 @@ - name: Check the interface PCS statistics ansible.builtin.assert: that: - - "{{ verb }}.{{ check_id }}.ethernet_pcs_statistics_bit_error_secs <= {{ pcs_bit_error_seconds_threshold }}" - - "{{ verb }}.{{ check_id }}.ethernet_pcs_statistics_errored_blocks_secs <= {{ pcs_bit_error_blocks_seconds_threshold }}" + - "{{ verb }}.{{ check_id }}.ethernet_pcs_statistics_bit_error_secs | int <= {{ pcs_bit_error_seconds_threshold }}" + - "{{ verb }}.{{ check_id }}.ethernet_pcs_statistics_errored_blocks_secs | int <= {{ pcs_bit_error_blocks_seconds_threshold }}" fail_msg: "FAIL: PCS statistics errors detected" - success_msg: "PASS: PCS statistics errors detected" + success_msg: "PASS: PCS statistics errors are below threshold" failed_when: false - name: Check the optical levels output Tx power low threshold (dBm) diff --git a/roles/check_demarcation_point/tasks/compare.yaml b/roles/check_demarcation_point/tasks/compare.yaml index e378f71f..4d80857c 100644 --- a/roles/check_demarcation_point/tasks/compare.yaml +++ b/roles/check_demarcation_point/tasks/compare.yaml @@ -77,3 +77,35 @@ - pre_check[check_id] is defined - post_check[check_id] is defined - file_status.stat.exists + +- name: Check if Rx power in POST check is way lower than PRE check (above permitted threshold) + ansible.builtin.assert: + that: + - "{{ rx_power_dbm_diff | float }} > {{ rx_power_allowed_diff | float }} " + fail_msg: "WARNING: Rx Power (dBm) diff between pre/post check is bigger than allowed threshold." + success_msg: "PASS: Rx Power (dBm) diff between pre/post check is normal." + failed_when: false + +- name: Check if Tx power in POST check is way lower than PRE check (above permitted threshold) + ansible.builtin.assert: + that: + - "{{ tx_power_dbm_diff | float }} > {{ tx_power_allowed_diff | float }} " + fail_msg: "WARNING: Rx Power (dBm) diff between pre/post check is bigger than allowed threshold." + success_msg: "PASS: Rx Power (dBm) diff between pre/post check is normal." + failed_when: false + +- name: Check if input_errors increase diff between PRE and POST checks is above permitted threshold + ansible.builtin.assert: + that: + - "{{ input_error_count_diff | int }} < {{ input_error_count_threshold | int }} " + fail_msg: "WARNING: Input errors count in POST check have been increased above threshold." + success_msg: "PASS: Input errors count diffs between PRE and POST check is normal." + failed_when: false + +- name: Check if output_errors increase diff between PRE and POST checks is above permitted threshold + ansible.builtin.assert: + that: + - "{{ output_error_count_diff | int }} < {{ output_error_count_threshold | int }} " + fail_msg: "WARNING: Output errors count in POST check have been increased above threshold." + success_msg: "PASS: ASS: Output errors count diffs between PRE and POST check is normal." + failed_when: false \ No newline at end of file diff --git a/roles/check_demarcation_point/vars/optical_thresholds.yml b/roles/check_demarcation_point/vars/optical_thresholds.yml index 2c496bca..0c81c198 100644 --- a/roles/check_demarcation_point/vars/optical_thresholds.yml +++ b/roles/check_demarcation_point/vars/optical_thresholds.yml @@ -3,6 +3,8 @@ min_tx_power_dbm: -8 max_tx_power_dbm: 0 min_rx_power_dbm: -10 max_rx_power_dbm: -0.5 +rx_power_allowed_diff: -2 +tx_power_allowed_diff: -2 input_error_count_threshold: 3 output_error_count_threshold: 3 fec_ccw_count_threshold: 0 @@ -10,4 +12,4 @@ fec_ccw_error_rate_threshold: 0 fec_nccw_count_threshold: 0 fec_nccw_error_rate_threshold: 0 pcs_bit_error_seconds_threshold: 20 -pcs_bit_error_blocks_seconds_threshold: 20 +pcs_bit_error_blocks_seconds_threshold: 20 \ No newline at end of file -- GitLab