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
Mon Mar 22 12:21:17 UTC 2021


lynxis lazus has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/23450/1

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 e8fe696..4883efd 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -391,6 +391,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 a769ad1..d29ac6c 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1696,7 +1696,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];
 
@@ -1728,9 +1728,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);
 		}
 	}
 }
@@ -1840,7 +1840,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 f0253fc..67838e9 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: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210322/f46fbb80/attachment.htm>


More information about the gerrit-log mailing list