Alarm is not raised in case PTP GM is lost

"No lock" PTP alarm is raised only when GM is and was not present
in a network. Current logic only reaises this alarm in case MAC
address of GM is the same as local MAC address. But it is only
the case when no external GM ever appeared in a PTP setup.
In case GM was present in a network and then lost we need to check
port status instead. PTP MAC address still points to an external GM.
But port status is changed from SLAVE to LISTENING state.

Change-Id: I30365685e6f44566702cc82534ab6ebf0613a731
Closes-bug: 1836884
Signed-off-by: Alex Kozyrev <alex.kozyrev@windriver.com>
This commit is contained in:
Alex Kozyrev 2019-08-02 16:12:57 -04:00
parent c57df403ce
commit d11ccac73f
1 changed files with 17 additions and 1 deletions

View File

@ -809,6 +809,22 @@ def read_func():
obj.phase = RUN_PHASE__SAMPLING
obj.log_throttle_count = 0
# Let's read the port status information
#
# sudo /usr/sbin/pmc -u -b 0 'GET PORT_DATA_SET'
#
data = subprocess.check_output([PLUGIN_STATUS_QUERY_EXEC,
'-u', '-b', '0', 'GET PORT_DATA_SET'])
port_locked = False
obj.resp = data.split('\n')
for line in obj.resp:
if 'portState' in line:
collectd.debug("%s portState : %s" % (PLUGIN, line.split()[1]))
port_state = line.split()[1]
if port_state == 'SLAVE':
port_locked = True
# Let's read the clock info, Grand Master sig and skew
#
# sudo /usr/sbin/pmc -u -b 0 'GET TIME_STATUS_NP'
@ -840,7 +856,7 @@ def read_func():
# Handle case where this host is the Grand Master
# ... or assumes it is.
if my_identity == gm_identity:
if my_identity == gm_identity or port_locked is False:
if obj.controller is False: