Fix to prevent truncating IPv6 value when NTP alarm is triggered.
This fix is to allow the validation of IPv6 when ntpq command
output returns a invalid IPv6 format. In some cases the
truncated IPv6 only ends with single colon, internally the
a method is invoked to validate the IP family corresponding
to that format and since it is not a valid format, it fails.
This behavior causes the returned IP to always be a truncated IP.
The logic is corrected to validate only when the IP is version 4
only.
Test Plan:
PASS: Configure NTP with unreachable IPv6 peers to trigger the
NTP alarm
PASS: Configure NTP with reachable IPv6 peers to avoid alarms
PASS: Configure NTP with unreachable IPv4 peers to trigger the
NTP alarm
PASS: Configure NTP with reachable IPv4 peers to avoid alarms
Reviewed: https:/ /review. opendev. org/c/starlingx /monitoring/ +/881246 /opendev. org/starlingx/ monitoring/ commit/ 99c893e966b6f1f d0018107e8aa07e fa4a71866d
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit 99c893e966b6f1f d0018107e8aa07e fa4a71866d
Author: Cristian Mondo <email address hidden>
Date: Thu Apr 20 14:45:53 2023 -0300
Fix to prevent truncating IPv6 value when NTP alarm is triggered.
This fix is to allow the validation of IPv6 when ntpq command
output returns a invalid IPv6 format. In some cases the
truncated IPv6 only ends with single colon, internally the
a method is invoked to validate the IP family corresponding
to that format and since it is not a valid format, it fails.
This behavior causes the returned IP to always be a truncated IP.
The logic is corrected to validate only when the IP is version 4
only.
Test Plan:
PASS: Configure NTP with unreachable IPv6 peers to trigger the
NTP alarm
PASS: Configure NTP with reachable IPv6 peers to avoid alarms
PASS: Configure NTP with unreachable IPv4 peers to trigger the
NTP alarm
PASS: Configure NTP with reachable IPv4 peers to avoid alarms
Closes-Bug: 2004043
Review Ref: https:/ /review. opendev. org/c/starlingx /monitoring/ +/872036 c864a4bdd0a7e8a d558e18adfa
Change-Id: I8b5b0080a4714c
Signed-off-by: Cristian Mondo <email address hidden>