laforge submitted this change.

View Change


Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve
vty: Print the uptime during 'show hnb' output

Change-Id: Ic414fe301b3fa5c357bd1cd8a7842b7d6333c709
---
M include/osmocom/hnbgw/hnbgw.h
M src/osmo-hnbgw/hnbgw.c
M src/osmo-hnbgw/hnbgw_vty.c
3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/include/osmocom/hnbgw/hnbgw.h b/include/osmocom/hnbgw/hnbgw.h
index 069dca2..23c1239 100644
--- a/include/osmocom/hnbgw/hnbgw.h
+++ b/include/osmocom/hnbgw/hnbgw.h
@@ -430,3 +430,5 @@
struct msgb *hnbgw_ranap_msg_alloc(const char *name);

int hnbgw_peek_l3_ul(struct hnbgw_context_map *map, struct msgb *ranap_msg);
+
+unsigned long long hnb_get_updowntime(const struct hnb_context *ctx);
diff --git a/src/osmo-hnbgw/hnbgw.c b/src/osmo-hnbgw/hnbgw.c
index 418742e..c2d86e8 100644
--- a/src/osmo-hnbgw/hnbgw.c
+++ b/src/osmo-hnbgw/hnbgw.c
@@ -441,6 +441,13 @@
return difftime(tp.tv_sec, hnbp->updowntime);
}

+unsigned long long hnb_get_updowntime(const struct hnb_context *ctx)
+{
+ if (!ctx->persistent)
+ return 0;
+ return hnbp_get_updowntime(ctx->persistent);
+}
+
/* timer call-back: Update the HNB_STAT_UPTIME_SECONDS stat item of each hnb_persistent */
static void hnbgw_store_hnb_uptime(void *data)
{
diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c
index 1870f5d..c5af249 100644
--- a/src/osmo-hnbgw/hnbgw_vty.c
+++ b/src/osmo-hnbgw/hnbgw_vty.c
@@ -204,6 +204,7 @@
struct hnbgw_context_map *map;
unsigned int map_count[2] = {};
unsigned int state_count[2][MAP_S_NUM_STATES + 1] = {};
+ unsigned long long sec;

vty_out(vty, "HNB ");
vty_out_ofd_addr(vty, hnb->conn? osmo_stream_srv_get_ofd(hnb->conn) : NULL);
@@ -218,6 +219,12 @@
}
vty_dump_hnb_info__map_states(vty, "IuCS", map_count[0], state_count[0]);
vty_dump_hnb_info__map_states(vty, "IuPS", map_count[1], state_count[1]);
+
+ sec = hnb_get_updowntime(hnb);
+ if (sec) {
+ vty_out(vty, " Iuh Uptime: %llu days %llu hours %llu min. %llu sec.%s",
+ OSMO_SEC2DAY(sec), OSMO_SEC2HRS(sec), OSMO_SEC2MIN(sec), sec % 60, VTY_NEWLINE);
+ }
}

static void vty_dump_ue_info(struct vty *vty, struct ue_context *ue)

To view, visit change 36251. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: Ic414fe301b3fa5c357bd1cd8a7842b7d6333c709
Gerrit-Change-Number: 36251
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-MessageType: merged