Skip to content
Snippets Groups Projects
Commit f9578dcb authored by Adam Wujek's avatar Adam Wujek :speech_balloon:
Browse files

userspace/snmpd: add wrsSlaveLinksStatus to wrsTimingStatusGroup


Additionally update MIB

Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 7db37bba
Branches
Tags
No related merge requests found
...@@ -175,6 +175,21 @@ wrsSoftPLLStatus OBJECT-TYPE ...@@ -175,6 +175,21 @@ wrsSoftPLLStatus OBJECT-TYPE
bug - bug in checking conditions of wrsSpllState, please report" bug - bug in checking conditions of wrsSpllState, please report"
::= { wrsTimingStatusGroup 2 } ::= { wrsTimingStatusGroup 2 }
wrsSlaveLinksStatus OBJECT-TYPE
SYNTAX INTEGER {
na(0),
ok(1),
error(2)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Grouped status of slave link statuses
ok - when every slave port is up when switch is in slave mode
and when every slave port is down when switch in master/grandmaster mode
don't care about non-wr and auto ports"
::= { wrsTimingStatusGroup 3 }
-- wrsNetworkingStatusGroup (.6.1.3) -- wrsNetworkingStatusGroup (.6.1.3)
wrsNetworkingStatusGroup OBJECT IDENTIFIER ::= { wrsDetailedStatusesGroup 3 } wrsNetworkingStatusGroup OBJECT IDENTIFIER ::= { wrsDetailedStatusesGroup 3 }
......
#include "wrsSnmp.h" #include "wrsSnmp.h"
#include "wrsSpllStatusGroup.h" #include "wrsSpllStatusGroup.h"
#include "wrsPortStatusTable.h"
#include "wrsTimingStatusGroup.h" #include "wrsTimingStatusGroup.h"
static struct pickinfo wrsTimingStatus_pickinfo[] = { static struct pickinfo wrsTimingStatus_pickinfo[] = {
...@@ -15,11 +16,17 @@ time_t wrsTimingStatus_data_fill(void) ...@@ -15,11 +16,17 @@ time_t wrsTimingStatus_data_fill(void)
{ {
static time_t time_update; /* time of last update */ static time_t time_update; /* time of last update */
time_t time_spll; /* time when softPLL data was updated */ time_t time_spll; /* time when softPLL data was updated */
time_t time_port_status; /* time when port status table was updated */
unsigned int port_status_nrows; /* number of rows in PortStatusTable */
int i;
struct wrsSpllStatus_s *s; struct wrsSpllStatus_s *s;
struct wrsPortStatusTable_s *p_a;
time_spll = wrsSpllStatus_data_fill(); time_spll = wrsSpllStatus_data_fill();
time_port_status = wrsPortStatusTable_data_fill(&port_status_nrows);
if (time_spll <= time_update) { if (time_spll <= time_update
&& time_port_status <= time_update) {
/* cache not updated, return last update time */ /* cache not updated, return last update time */
return time_update; return time_update;
} }
...@@ -76,6 +83,46 @@ time_t wrsTimingStatus_data_fill(void) ...@@ -76,6 +83,46 @@ time_t wrsTimingStatus_data_fill(void)
WRS_SOFTPLL_STATUS_BUG; WRS_SOFTPLL_STATUS_BUG;
} }
/*********************************************************************\
|************************ wrsSlaveLinksStatus ************************|
\*********************************************************************/
/*
* ok when every slave port is up when switch is in slave mode
* and when every slave port is down when switch in master/grandmaster
* mode. Don't care about non-wr and auto ports.
*/
p_a = wrsPortStatusTable_array;
wrsTimingStatus_s.wrsSlaveLinksStatus = WRS_SLAVE_LINK_STATUS_OK;
for (i = 0; i < port_status_nrows; i++) {
/* warning N/A */
if (s->wrsSpllMode == 0
|| p_a[i].port_mode == 0
|| p_a[i].link_up == 0){
wrsTimingStatus_s.wrsSlaveLinksStatus =
WRS_SLAVE_LINK_STATUS_WARNING_NA;
}
/* error when slave port is down when switch is in slave mode
*/
if (s->wrsSpllMode == WRS_SPLL_MODE_SLAVE
&& (p_a[i].port_mode == WRS_PORT_STATUS_CONFIGURED_MODE_SLAVE)
&& (p_a[i].link_up == WRS_PORT_STATUS_LINK_DOWN)) {
wrsTimingStatus_s.wrsSlaveLinksStatus =
WRS_SLAVE_LINK_STATUS_ERROR;
snmp_log(LOG_ERR, "SNMP: wrsSlaveLinksStatus (slave) "
"failed for port %d\n", i);
}
/* error when slave port is up when switch is in master or
* grandmaster mode */
if (((s->wrsSpllMode == WRS_SPLL_MODE_GRAND_MASTER) || (s->wrsSpllMode == WRS_SPLL_MODE_MASTER))
&& (p_a[i].port_mode == WRS_PORT_STATUS_CONFIGURED_MODE_SLAVE)
&& (p_a[i].link_up == WRS_PORT_STATUS_LINK_UP)) {
wrsTimingStatus_s.wrsSlaveLinksStatus =
WRS_SLAVE_LINK_STATUS_ERROR;
snmp_log(LOG_ERR, "SNMP: wrsSlaveLinksStatus (master) "
"failed for port %d\n", i);
}
}
/* there was an update, return current time */ /* there was an update, return current time */
return time_update; return time_update;
} }
......
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
* normal operation */ * normal operation */
#define WRS_SOFTPLL_STATUS_BUG 5 /* warning */ #define WRS_SOFTPLL_STATUS_BUG 5 /* warning */
#define WRS_SLAVE_LINK_STATUS_OK 1 /* ok */
#define WRS_SLAVE_LINK_STATUS_ERROR 2 /* error */
#define WRS_SLAVE_LINK_STATUS_WARNING_NA 4 /* warning, at least one field is
* equal to 0 (NA),shouldn't happen in
* normal operation */
struct wrsTimingStatus_s { struct wrsTimingStatus_s {
int wrsPTPStatus; int wrsPTPStatus;
int wrsSoftPLLStatus; int wrsSoftPLLStatus;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment