Change in osmo-ttcn3-hacks[master]: library/PCUIF_Types: version 10: support IPv6 NSVC addr

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
Fri Sep 11 10:35:56 UTC 2020


lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19420 )

Change subject: library/PCUIF_Types: version 10: support IPv6 NSVC addr
......................................................................

library/PCUIF_Types: version 10: support IPv6 NSVC addr

Change-Id: I13b03c380edc2dc609c5e4053462a3cd6f78ce72
Tweaked-By: Vadim Yanitskiy <vyanitskiy at sysmocom.de>
Related: SYS#4915
---
M library/NS_Emulation.ttcn
M library/PCUIF_Types.ttcn
M pcu/PCU_Tests.ttcn
M pcu/SGSN_Components.ttcn
M sgsn/gen_links.sh
5 files changed, 59 insertions(+), 4 deletions(-)

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



diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn
index 697a482..6f9bc39 100644
--- a/library/NS_Emulation.ttcn
+++ b/library/NS_Emulation.ttcn
@@ -16,6 +16,7 @@
 	import from NS_CodecPort all;
 	import from NS_CodecPort_CtrlFunct all;
 	import from IPL4asp_Types all;
+	import from PCUIF_Types all;
 
 	type record NsUnitdataRequest {
 		BssgpBvci	bvci,
@@ -124,6 +125,7 @@
 	}
 
 	type record NSConfiguration {
+		PCUIF_AddrType remote_proto,
 		PortNumber local_udp_port,
 		charstring local_ip,
 		PortNumber remote_udp_port,
diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index f0200af..b400267 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -13,6 +13,7 @@
 
 import from General_Types all;
 import from Osmocom_Types all;
+import from Native_Functions all;
 
 modulepar {
 	/* PCUIF version supported by the IUT */
@@ -212,13 +213,34 @@
 	record length(2) of uint16_t	nsvci,
 	record length(2) of uint16_t	local_port,
 	record length(2) of uint16_t	remote_port,
-	record length(2) of OCT4	remote_ip
+	PCUIF_RemoteAddr		remote_addr
 } with {
 	/* NOTE: TITAN is not smart enough to handle 'version < 10' and 'version > 9',
 	 * so we cannot support more than two versions at the same time here. Sigh. */
 	variant (trx) "CROSSTAG(v09, version = 9; v10, version = 10)"
+	variant (remote_addr) "CROSSTAG(v09, version = 9; v10, version = 10)"
 };
 
+type union PCUIF_RemoteAddr {
+	PCUIF_RemoteAddrV09		v09,
+	PCUIF_RemoteAddrV10		v10
+} with { variant "" };
+
+type record PCUIF_RemoteAddrV09 {
+	record length(2) of OCT4	addr
+} with { variant "" };
+
+type enumerated PCUIF_AddrType {
+	PCUIF_ADDR_TYPE_UNSPEC		('00'O),
+	PCUIF_ADDR_TYPE_IPV4		('04'O),
+	PCUIF_ADDR_TYPE_IPV6		('29'O)
+} with { variant "FIELDLENGTH(8)" };
+
+type record PCUIF_RemoteAddrV10 {
+	record length(2) of PCUIF_AddrType	addr_type,
+	record length(2) of octetstring		addr length(16)
+} with { variant "" };
+
 type record PCUIF_act_req {
 	uint8_t		is_activate,
 	uint8_t		trx_nr,
@@ -839,7 +861,7 @@
 			nsvci := ?,
 			local_port := ?,
 			remote_port := ?,
-			remote_ip := ?
+			remote_addr := ?
 		}
 	}
 }
@@ -947,5 +969,34 @@
 	}
 }
 
+/* TODO: second (redundant) NSVC connection is not (yet) supported */
+function f_PCUIF_ver_INFO_RemoteAddr(PCUIF_AddrType addr_type,
+				     charstring addr)
+return PCUIF_RemoteAddr {
+	var PCUIF_RemoteAddr remote_addr;
+
+	if (PCUIF_Types.mp_pcuif_version >= 10) {
+		remote_addr.v10.addr_type[0] := addr_type;
+		if (addr_type == PCUIF_ADDR_TYPE_IPV4)  {
+			remote_addr.v10.addr[0] := f_inet_addr(addr);
+		} else {
+			remote_addr.v10.addr[0] := f_inet6_addr(addr);
+		}
+		remote_addr.v10.addr_type[1] := PCUIF_ADDR_TYPE_UNSPEC;
+		remote_addr.v10.addr[1] := f_pad_oct(''O, 16, '00'O);
+	} else {
+		if (addr_type != PCUIF_ADDR_TYPE_IPV4) {
+			testcase.stop("NSVC address type := ", addr_type,
+				      "is not supported in version := ",
+				      PCUIF_Types.mp_pcuif_version);
+		}
+		/* v9 requires the IP in host byte order */
+		remote_addr.v09.addr[0] := f_inet_haddr(addr);
+		remote_addr.v09.addr[0] := f_pad_oct(''O, 4, '00'O);
+	}
+
+	return remote_addr;
+}
+
 
 } with { encode "RAW" variant "BYTEORDER(first)" };
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index df2964c..f5176d4 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -92,7 +92,8 @@
 	nsvci := { mp_nsconfig.nsvci, 0 },
 	local_port := { mp_nsconfig.remote_udp_port, 0 },
 	remote_port := { mp_nsconfig.local_udp_port, 0 },
-	remote_ip := { f_inet_haddr(mp_nsconfig.local_ip) , '00000000'O }
+	remote_addr := f_PCUIF_ver_INFO_RemoteAddr(
+		mp_nsconfig.remote_proto, mp_nsconfig.local_ip)
 }
 
 type record lqual_range {
diff --git a/pcu/SGSN_Components.ttcn b/pcu/SGSN_Components.ttcn
index 4bbd18c..7bf8705 100644
--- a/pcu/SGSN_Components.ttcn
+++ b/pcu/SGSN_Components.ttcn
@@ -35,6 +35,7 @@
 	};
 
 	NSConfiguration mp_nsconfig := {
+		remote_proto := PCUIF_ADDR_TYPE_IPV4,
 		local_udp_port := 23000,
 		local_ip := "127.0.0.1",
 		remote_udp_port := 21000,
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
index bd3a7ea..541670d 100755
--- a/sgsn/gen_links.sh
+++ b/sgsn/gen_links.sh
@@ -84,7 +84,7 @@
 
 DIR=../library
 FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
-FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
+FILES+="NS_Emulation.ttcn PCUIF_Types.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
 FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
 FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
 FILES+="Osmocom_VTY_Functions.ttcn "

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19420
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: I13b03c380edc2dc609c5e4053462a3cd6f78ce72
Gerrit-Change-Number: 19420
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
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/20200911/b0daae9a/attachment.htm>


More information about the gerrit-log mailing list