Change in libosmocore[master]: gprs_ns2: always use the same method to print NSVCs

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Wed Mar 24 15:42:46 UTC 2021


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/23450 )

Change subject: gprs_ns2: always use the same method to print NSVCs
......................................................................

gprs_ns2: always use the same method to print NSVCs

The binds also print a list of associated NSVC when
dumping the bind.
However the binds using their own representation of
printing the NSVC which is different to `show ns entities`.
Use the same function to print NS-VC.

Before:
  NSVCI 00000: udp)[127.0.0.1]:23000<>[127.0.0.1]:22000
After:
  NSVCI none: UNCONFIGURED DYNAMIC data_weight=1 sig_weight=1 udp)[127.0.0.1]:23000<>[127.0.0.1]:22000

Change-Id: If31ec6c1c07dc134ab1ddeb915bc89747c7be048
---
M src/gb/gprs_ns2_fr.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_udp.c
M src/gb/gprs_ns2_vty.c
M tests/gb/gprs_ns2_vty.vty
5 files changed, 13 insertions(+), 12 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index 6ba2268..84f3784 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -135,7 +135,7 @@
 	nsvc->priv = NULL;
 }
 
-static void dump_vty(const struct gprs_ns2_vc_bind *bind, struct vty *vty, bool _stats)
+static void dump_vty(const struct gprs_ns2_vc_bind *bind, struct vty *vty, bool stats)
 {
 	struct priv_bind *priv;
 	struct gprs_ns2_vc *nsvc;
@@ -151,7 +151,7 @@
 		osmo_fr_role_str(fr_link->role), priv->if_running ? "UP" : "DOWN", VTY_NEWLINE);
 
 	llist_for_each_entry(nsvc, &bind->nsvc, blist) {
-		vty_out(vty, "    NSVCI %05u: %s%s", nsvc->nsvci, gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
+		ns2_vty_dump_nsvc(vty, nsvc, stats);
 	}
 
 	priv = bind->priv;
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index df51ff5..6cfef44 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -396,6 +396,7 @@
 int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
 int ns2_vc_block(struct gprs_ns2_vc *nsvc);
 int ns2_vc_unblock(struct gprs_ns2_vc *nsvc);
+void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats);
 
 /* nse */
 void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked);
diff --git a/src/gb/gprs_ns2_udp.c b/src/gb/gprs_ns2_udp.c
index 5765c77..4c986a2 100644
--- a/src/gb/gprs_ns2_udp.c
+++ b/src/gb/gprs_ns2_udp.c
@@ -85,7 +85,7 @@
 }
 
 static void dump_vty(const struct gprs_ns2_vc_bind *bind,
-		     struct vty *vty, bool _stats)
+		     struct vty *vty, bool stats)
 {
 	struct priv_bind *priv;
 	struct gprs_ns2_vc *nsvc;
@@ -109,7 +109,7 @@
 	vty_out(vty, "  %lu NS-VC: %s", nsvcs, VTY_NEWLINE);
 
 	llist_for_each_entry(nsvc, &bind->nsvc, blist) {
-		vty_out(vty, "    NSVCI %05u: %s%s", nsvc->nsvci, gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
+		ns2_vty_dump_nsvc(vty, nsvc, stats);
 	}
 }
 
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 681d1cb..7cb9ed9 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1845,7 +1845,7 @@
 }
 
 /* non-config commands */
-static void dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
+void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
 {
 	char nsvci_str[32];
 
@@ -1877,9 +1877,9 @@
 	llist_for_each_entry(nsvc, &nse->nsvc, list) {
 		if (persistent_only) {
 			if (nsvc->persistent)
-				dump_nsvc(vty, nsvc, stats);
+				ns2_vty_dump_nsvc(vty, nsvc, stats);
 		} else {
-			dump_nsvc(vty, nsvc, stats);
+			ns2_vty_dump_nsvc(vty, nsvc, stats);
 		}
 	}
 }
@@ -1989,7 +1989,7 @@
 			return CMD_WARNING;
 		}
 
-		dump_nsvc(vty, nsvc, show_stats);
+		ns2_vty_dump_nsvc(vty, nsvc, show_stats);
 	}
 
 	return CMD_SUCCESS;
diff --git a/tests/gb/gprs_ns2_vty.vty b/tests/gb/gprs_ns2_vty.vty
index f344bf3..15e541d 100644
--- a/tests/gb/gprs_ns2_vty.vty
+++ b/tests/gb/gprs_ns2_vty.vty
@@ -43,7 +43,7 @@
 UDP bind: 127.0.0.14:42999 DSCP: 0
   IP-SNS signalling weight: 1 data weight: 1
   1 NS-VC: 
-    NSVCI 00000: udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
+ NSVCI none: RECOVERING PERSIST data_weight=1 sig_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
 OsmoNSdummy# configure terminal
 OsmoNSdummy(config)# ns
 OsmoNSdummy(config-ns)# nse 1234
@@ -58,9 +58,9 @@
 UDP bind: 127.0.0.14:42999 DSCP: 0
   IP-SNS signalling weight: 1 data weight: 1
   3 NS-VC: 
-    NSVCI 00000: udp)[127.0.0.14]:42999<>[127.0.0.17]:9496
-    NSVCI 00000: udp)[127.0.0.14]:42999<>[127.0.0.16]:9496
-    NSVCI 00000: udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
+ NSVCI none: RECOVERING PERSIST data_weight=0 sig_weight=0 udp)[127.0.0.14]:42999<>[127.0.0.17]:9496
+ NSVCI none: RECOVERING PERSIST data_weight=9 sig_weight=0 udp)[127.0.0.14]:42999<>[127.0.0.16]:9496
+ NSVCI none: RECOVERING PERSIST data_weight=1 sig_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
 OsmoNSdummy# configure terminal
 OsmoNSdummy(config)# ns
 OsmoNSdummy(config-ns)# nse 1234

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/23450
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If31ec6c1c07dc134ab1ddeb915bc89747c7be048
Gerrit-Change-Number: 23450
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210324/bc18c9bd/attachment.htm>


More information about the gerrit-log mailing list