Change in osmo-ttcn3-hacks[master]: stp: Support testing multi-home SCTP features with IPv4+IPv6

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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 27 08:13:44 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19770 )

Change subject: stp: Support testing multi-home SCTP features with IPv4+IPv6
......................................................................

stp: Support testing multi-home SCTP features with IPv4+IPv6

The IP addr module parameter is split now, IPA module has its own set
of configurable addresses, and M3UA its own. Moreover, in M3UA the
single address is transformed to be an array of addresses, to support
multi-homing with both IPv4 and IPv6 addresses.

Related: SYS#4915
Change-Id: Ib1925ed1df5cea3fa66f28b5625532d454a2c338
---
M stp/STP_Tests_Common.ttcn
M stp/STP_Tests_IPA.ttcn
M stp/STP_Tests_M3UA.ttcn
3 files changed, 67 insertions(+), 21 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/stp/STP_Tests_Common.ttcn b/stp/STP_Tests_Common.ttcn
index aee5a88..a540b10 100644
--- a/stp/STP_Tests_Common.ttcn
+++ b/stp/STP_Tests_Common.ttcn
@@ -19,19 +19,6 @@
 
 import from IPL4asp_Types all;
 
-modulepar {
-	charstring mp_stp_ip := "127.0.0.1";
-	charstring mp_local_ip := "127.0.0.1";
-}
-
-friend template (value) SctpTuple ts_SCTP(template (omit) integer ppid := 3,
-					   template (omit) integer stream := 0) := {
-	sinfo_stream := stream,
-	sinfo_ppid := ppid,
-	remSocks := omit,
-	assocId := omit
-}
-
 type component Test_CT {
 	port TELNETasp_PT VTY;
 	timer g_Tguard := 30.0;
diff --git a/stp/STP_Tests_IPA.ttcn b/stp/STP_Tests_IPA.ttcn
index c67bc4a..26abc80 100644
--- a/stp/STP_Tests_IPA.ttcn
+++ b/stp/STP_Tests_IPA.ttcn
@@ -38,6 +38,8 @@
 type record of charstring AspNameArray;
 
 modulepar {
+	charstring mp_stp_ipa_ip := "127.0.0.1";
+	charstring mp_local_ipa_ip := "127.0.0.1";
 	integer mp_stp_ipa_port := 5000;
 	integer mp_local_ipa_port := 20000;
 	AspNameArray mp_ipa_as_names := {"ipa-as-loadshare-sender",
@@ -113,7 +115,7 @@
 		  ASP only up to NR_IPA are configured. */
 		port_offset := 100;
 	}
-	vc_IPA[idx].start(IPA_Emulation.main_client(mp_stp_ip, mp_stp_ipa_port, mp_local_ip,
+	vc_IPA[idx].start(IPA_Emulation.main_client(mp_stp_ipa_ip, mp_stp_ipa_port, mp_local_ipa_ip,
 			mp_local_ipa_port + idx + port_offset, g_ccm_pars[idx]));
 }
 
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn
index 68cea2a..22272f3 100644
--- a/stp/STP_Tests_M3UA.ttcn
+++ b/stp/STP_Tests_M3UA.ttcn
@@ -35,6 +35,8 @@
 import from STP_Tests_Common all;
 
 modulepar {
+	HostList mp_stp_m3ua_ip := { "127.0.0.1", "::1" };
+	HostList mp_local_m3ua_ip := { "127.0.0.1", "::1" };
 	integer mp_stp_m3ua_port := 2905;
 	integer mp_stp_m3ua_clnt_port := 2906;
 	integer mp_local_m3ua_port := 9999;
@@ -92,14 +94,54 @@
 	}
 }
 
+private template (value) Socket ts_Socket(HostName hostName, PortNumber portNumber) := {
+	hostName := hostName,
+        portNumber := portNumber
+};
+
+private template (value) SctpTuple ts_SCTP(template (omit) integer ppid := 3,
+					   template (omit) integer stream := 0,
+					   template (omit) SocketList remSocks := omit) := {
+	sinfo_stream := stream,
+	sinfo_ppid := ppid,
+	remSocks := remSocks,
+	assocId := omit
+};
+
 friend function f_M3UA_connect(integer i) runs on RAW_M3UA_CT {
 	var Result res;
-	res := M3UA_CodecPort_CtrlFunct.f_IPL4_connect(M3UA[i], mp_stp_ip, mp_stp_m3ua_port,
-						       mp_local_ip, mp_local_m3ua_port+i, 0,
-							{sctp:=valueof(ts_SCTP)});
+	var Option opt_add_local_addrs;
+	var OptionList opt_list := {};
+	var template SocketList opt_add_remote_addrs;
+
+	if (lengthof(mp_local_m3ua_ip) == 0 or lengthof(mp_stp_m3ua_ip) == 0) {
+		setverdict(fail, "Empty local or remote address trying to connect SCTP socket: ",
+			   mp_local_m3ua_ip, " / ", mp_stp_m3ua_ip);
+		mtc.stop;
+	}
+
+	if (lengthof(mp_local_m3ua_ip) > 1) {
+		opt_add_local_addrs.sctpAdditionalLocalAddresses := substr(mp_local_m3ua_ip, 1,
+								           lengthof(mp_local_m3ua_ip) - 1); //{mp_local_m3ua_ip};
+		opt_list := {opt_add_local_addrs};
+	}
+
+	if (lengthof(mp_stp_m3ua_ip) > 1) {
+		for (var integer j := 1; j < lengthof(mp_stp_m3ua_ip); j := j + 1) {
+			var Socket sk := valueof(ts_Socket(mp_stp_m3ua_ip[j], mp_stp_m3ua_port));
+			opt_add_remote_addrs[j - 1] := sk;
+		}
+	} else {
+		opt_add_remote_addrs := omit;
+	}
+
+	res := M3UA_CodecPort_CtrlFunct.f_IPL4_connect(M3UA[i], mp_stp_m3ua_ip[0], mp_stp_m3ua_port,
+						       mp_local_m3ua_ip[0], mp_local_m3ua_port+i, 0,
+						       {sctp:=valueof(ts_SCTP(3, 0, opt_add_remote_addrs))},
+						       opt_list);
 	if (not ispresent(res.connId)) {
 		setverdict(fail, "Could not connect M3UA socket, check your configuration");
-	mtc.stop;
+		mtc.stop;
 	}
 	g_m3ua_conn_id[i] := res.connId;
 }
@@ -112,11 +154,26 @@
 
 friend function f_M3UA_listen(integer i) runs on RAW_M3UA_CT {
 	var Result res;
-	res := M3UA_CodecPort_CtrlFunct.f_IPL4_listen(M3UA[i], mp_local_ip, mp_local_m3ua_port+i,
-							{sctp:=valueof(ts_SCTP)});
+	var Option opt_add_local_addrs;
+	var OptionList opt_list := {};
+
+	if (lengthof(mp_local_m3ua_ip) == 0 ) {
+		setverdict(fail, "Empty local address trying to bind SCTP socket: ",
+			   mp_local_m3ua_ip);
+		mtc.stop;
+	}
+
+	if (lengthof(mp_local_m3ua_ip) > 1) {
+		opt_add_local_addrs.sctpAdditionalLocalAddresses := substr(mp_local_m3ua_ip, 1,
+								           lengthof(mp_local_m3ua_ip) - 1); //{mp_local_m3ua_ip};
+		opt_list := {opt_add_local_addrs};
+	}
+
+	res := M3UA_CodecPort_CtrlFunct.f_IPL4_listen(M3UA[i], mp_local_m3ua_ip[0], mp_local_m3ua_port+i,
+						      {sctp:=valueof(ts_SCTP)}, opt_list);
 	if (not ispresent(res.connId)) {
 		setverdict(fail, "Could not bind M3UA socket, check your configuration");
-	mtc.stop;
+		mtc.stop;
 	}
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19770
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib1925ed1df5cea3fa66f28b5625532d454a2c338
Gerrit-Change-Number: 19770
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20200827/a83ded91/attachment.htm>


More information about the gerrit-log mailing list