Change in libosmocore[master]: gprs_ns2_vty: add optional argument signalling and data weights to `n...

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 Feb 15 01:15:11 UTC 2021


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/22900 )


Change subject: gprs_ns2_vty: add optional argument signalling and data weights to `nsvc udp`
......................................................................

gprs_ns2_vty: add optional argument signalling and data weights to `nsvc udp`

A static configured UDP NSVC can have signalling and data weights.

Related: SYS#5354
Change-Id: Id363937c64e786c55e3136401ebdb44052415e0f
---
M src/gb/gprs_ns2_vty.c
M tests/gb/gprs_ns2_vty.vty
2 files changed, 43 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/22900/1

diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 211f056..a0d0ec3 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1031,12 +1031,16 @@
 }
 
 DEFUN(cfg_ns_nse_nsvc_udp, cfg_ns_nse_nsvc_udp_cmd,
-      "nsvc udp BIND " VTY_IPV46_CMD " <1-65535>",
+      "nsvc udp BIND " VTY_IPV46_CMD " <1-65535> [signalling-weight <0-254> data-weight <0-254>]",
       "NS Virtual Connection\n"
       "NS over UDP\n"
       "A unique bind identifier created by ns bind\n"
       "Remote IPv4 Address\n" "Remote IPv6 Address\n"
       "Remote UDP Port\n"
+      "Signalling weight of the NSVC\n"
+      "Signalling weight of the NSVC\n"
+      "Data weight of the NSVC\n"
+      "Data weight of the NSVC\n"
       )
 {
 	struct gprs_ns2_vc_bind *bind;
@@ -1049,6 +1053,13 @@
 	struct osmo_sockaddr_str remote_str;
 	struct osmo_sockaddr remote;
 	uint16_t port = atoi(argv[2]);
+	uint16_t sig_weight = 1;
+	uint16_t data_weight = 1;
+
+	if (argc > 3) {
+		sig_weight = atoi(argv[3]);
+		data_weight = atoi(argv[4]);
+	}
 
 	if (nse->ll == GPRS_NS2_LL_UNDEF) {
 		nse->ll = GPRS_NS2_LL_UDP;
@@ -1098,6 +1109,8 @@
 		vty_out(vty, "Can not create NS-VC.%s", VTY_NEWLINE);
 		goto err;
 	}
+	nsvc->sig_weight = sig_weight;
+	nsvc->data_weight = data_weight;
 	nsvc->persistent = true;
 
 	return CMD_SUCCESS;
diff --git a/tests/gb/gprs_ns2_vty.vty b/tests/gb/gprs_ns2_vty.vty
index a748f13..437b997 100644
--- a/tests/gb/gprs_ns2_vty.vty
+++ b/tests/gb/gprs_ns2_vty.vty
@@ -32,3 +32,32 @@
 UDP bind: 127.0.0.14:42999 DSCP: 0
   IP-SNS signalling weight: 1 data weight: 1
   0 NS-VC: 
+OsmoNSdummy# configure terminal
+OsmoNSdummy(config)# ns
+OsmoNSdummy(config-ns)# nse 1234
+OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.15 9496
+OsmoNSdummy(config-ns-nse)# end
+OsmoNSdummy# show ns
+NSEI 01234: UDP, DEAD
+ NSVCI none: RECOVERING PERSIST data_weight=1 sig_weight=1 udp)[127.0.0.14]:42999<>[127.0.0.15]:9496
+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
+OsmoNSdummy# configure terminal
+OsmoNSdummy(config)# ns
+OsmoNSdummy(config-ns)# nse 1234
+OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.16 9496 signalling-weigh 0 data-weight 9
+OsmoNSdummy(config-ns-nse)# nsvc udp abc 127.0.0.17 9496 signalling-weigh 0 data-weight 0
+OsmoNSdummy(config-ns-nse)# end
+OsmoNSdummy# show ns
+NSEI 01234: UDP, DEAD
+ 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=0 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
+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

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id363937c64e786c55e3136401ebdb44052415e0f
Gerrit-Change-Number: 22900
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/20210215/67991609/attachment.htm>


More information about the gerrit-log mailing list