gprs_ns2_vty: Print all relevant data on each NS-VC
After this patch, we can finally see the BLOCKED/UNBLOCKED state,
weights, persistence, etc. in the VTY.
Example:
OsmoGbProxy> show ns entities
NSEI 00101: UDP, DEAD
NSVCI 00101: RESET PERSIST data_weight=1 sig_wight=1 udp)[127.0.0.1]:23000<101>[127.0.0.1]:7777
NSEI 00001: FR, ALIVE
NSVCI 00001: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet1 dlci: 16
NSVCI 00002: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet2 dlci: 17
NSVCI 00003: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet3 dlci: 18
NSVCI 00004: UNBLOCKED PERSIST data_weight=1 sig_wight=1 fr)netif: hdlcnet4 dlci: 19
Change-Id: I1cf8fe55d1d0cecc46113532c8550880558b0155
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 17b8d96..b244a96 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -260,7 +260,18 @@
static void dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
{
- vty_out(vty, " NSVCI %05u %s%s", nsvc->nsvci, gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
+ char nsvci_str[32];
+
+ if (nsvc->nsvci_is_valid)
+ snprintf(nsvci_str, sizeof(nsvci_str), "%05u", nsvc->nsvci);
+ else
+ snprintf(nsvci_str, sizeof(nsvci_str), "none");
+
+ vty_out(vty, " NSVCI %s: %s %s data_weight=%u sig_weight=%u %s%s", nsvci_str,
+ osmo_fsm_inst_state_name(nsvc->fi),
+ nsvc->persistent ? "PERSIST" : "DYNAMIC",
+ nsvc->data_weight, nsvc->sig_weight,
+ gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
if (stats) {
vty_out_rate_ctr_group(vty, " ", nsvc->ctrg);