mirror of https://gerrit.osmocom.org/libosmocore
ns2: nse: add a uptime/downtime to track the last state change
To show adminstrator the last state change of a nse add a timestamp and show it on the vty > show ns nse 1234 NSEI 01234: UDP, ALIVE since 0d 0h 0m 16s FSM Instance Name: 'GPRS-NS2-SNS-SGSN(NSE01234-SNS)[0x6120000012a0]', ID: 'NSE01234-SNS' Log-Level: 'DEBUG', State: 'CONFIGURED' Timer: 4 Maximum number of remote NS-VCs: 8, IPv4 Endpoints: 2, IPv6 Endpoints: 0 [...] Related: OS#5028 Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
This commit is contained in:
parent
06929166de
commit
2c64c257c8
|
@ -838,6 +838,7 @@ struct gprs_ns2_nse *gprs_ns2_create_nse2(struct gprs_ns2_inst *nsi, uint16_t ns
|
||||||
nse->mtu = 0;
|
nse->mtu = 0;
|
||||||
llist_add_tail(&nse->list, &nsi->nse);
|
llist_add_tail(&nse->list, &nsi->nse);
|
||||||
INIT_LLIST_HEAD(&nse->nsvc);
|
INIT_LLIST_HEAD(&nse->nsvc);
|
||||||
|
osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);
|
||||||
|
|
||||||
return nse;
|
return nse;
|
||||||
}
|
}
|
||||||
|
@ -1400,6 +1401,7 @@ void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked)
|
||||||
/* wait until both data_weight and sig_weight are != 0 before declaring NSE as alive */
|
/* wait until both data_weight and sig_weight are != 0 before declaring NSE as alive */
|
||||||
if (unblocked && nse->sum_data_weight && nse->sum_sig_weight) {
|
if (unblocked && nse->sum_data_weight && nse->sum_sig_weight) {
|
||||||
nse->alive = true;
|
nse->alive = true;
|
||||||
|
osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);
|
||||||
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_RECOVERY);
|
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_RECOVERY);
|
||||||
nse->first = false;
|
nse->first = false;
|
||||||
return;
|
return;
|
||||||
|
@ -1408,6 +1410,7 @@ void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked)
|
||||||
if (nse->alive && (nse->sum_data_weight == 0 || nse->sum_sig_weight == 0)) {
|
if (nse->alive && (nse->sum_data_weight == 0 || nse->sum_sig_weight == 0)) {
|
||||||
/* nse became unavailable */
|
/* nse became unavailable */
|
||||||
nse->alive = false;
|
nse->alive = false;
|
||||||
|
osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);
|
||||||
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_FAILURE);
|
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,9 @@ struct gprs_ns2_nse {
|
||||||
|
|
||||||
/*! recursive anchor */
|
/*! recursive anchor */
|
||||||
bool freed;
|
bool freed;
|
||||||
|
|
||||||
|
/*! when the NSE became alive or dead */
|
||||||
|
struct timespec ts_alive_change;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Structure representing a single NS-VC */
|
/*! Structure representing a single NS-VC */
|
||||||
|
|
|
@ -1900,8 +1900,10 @@ static void dump_nse(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats
|
||||||
if (persistent_only && !nse->persistent)
|
if (persistent_only && !nse->persistent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vty_out(vty, "NSEI %05u: %s, %s%s", nse->nsei, gprs_ns2_lltype_str(nse->ll),
|
vty_out(vty, "NSEI %05u: %s, %s since ", nse->nsei, gprs_ns2_lltype_str(nse->ll),
|
||||||
nse->alive ? "ALIVE" : "DEAD", VTY_NEWLINE);
|
nse->alive ? "ALIVE" : "DEAD");
|
||||||
|
vty_out_uptime(vty, &nse->ts_alive_change);
|
||||||
|
vty_out_newline(vty);
|
||||||
|
|
||||||
ns2_sns_dump_vty(vty, " ", nse, stats);
|
ns2_sns_dump_vty(vty, " ", nse, stats);
|
||||||
llist_for_each_entry(nsvc, &nse->nsvc, list) {
|
llist_for_each_entry(nsvc, &nse->nsvc, list) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ OsmoNSdummy(config-ns)# nse 1234
|
||||||
OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.15 9496
|
OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.15 9496
|
||||||
OsmoNSdummy(config-ns-nse)# end
|
OsmoNSdummy(config-ns-nse)# end
|
||||||
OsmoNSdummy# show ns
|
OsmoNSdummy# show ns
|
||||||
NSEI 01234: UDP, DEAD
|
NSEI 01234: UDP, DEAD since 0d 0h 0m 0s
|
||||||
1 NS-VC:
|
1 NS-VC:
|
||||||
RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
|
RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
|
||||||
UDP bind: 127.0.0.14:42999 DSCP: 0 Priority: 0
|
UDP bind: 127.0.0.14:42999 DSCP: 0 Priority: 0
|
||||||
|
@ -52,7 +52,7 @@ OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.16 9496 signalling-weight 0 dat
|
||||||
OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.17 9496 signalling-weight 0 data-weight 0
|
OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.17 9496 signalling-weight 0 data-weight 0
|
||||||
OsmoNSdummy(config-ns-nse)# end
|
OsmoNSdummy(config-ns-nse)# end
|
||||||
OsmoNSdummy# show ns
|
OsmoNSdummy# show ns
|
||||||
NSEI 01234: UDP, DEAD
|
NSEI 01234: UDP, DEAD since 0d 0h 0m 0s
|
||||||
3 NS-VC:
|
3 NS-VC:
|
||||||
RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
|
RECOVERING PERSIST sig_weight=1 data_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
|
||||||
RECOVERING PERSIST sig_weight=0 data_weight=9 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496
|
RECOVERING PERSIST sig_weight=0 data_weight=9 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496
|
||||||
|
|
Loading…
Reference in New Issue