Change in osmo-ttcn3-hacks[master]: library/RSL_Types: use OCT4 for local/remote address fields

laforge gerrit-no-reply at lists.osmocom.org
Mon Jul 5 12:09:07 UTC 2021


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

Change subject: library/RSL_Types: use OCT4 for local/remote address fields
......................................................................

library/RSL_Types: use OCT4 for local/remote address fields

This way functions like f_inet_addr() and f_inet6_addr() can be
used directly without converting between bytes and integers.

Change-Id: I389a8cb95c025c9dddc751789223621c15d9b48f
---
M bsc/BSC_Tests_LCLS.ttcn
M bsc/BSC_Tests_VAMOS.ttcn
M bsc/MSC_ConnectionHandler.ttcn
M bts/BTS_Tests.ttcn
M library/RSL_Types.ttcn
5 files changed, 26 insertions(+), 26 deletions(-)

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



diff --git a/bsc/BSC_Tests_LCLS.ttcn b/bsc/BSC_Tests_LCLS.ttcn
index 72fb525..9771087 100644
--- a/bsc/BSC_Tests_LCLS.ttcn
+++ b/bsc/BSC_Tests_LCLS.ttcn
@@ -303,7 +303,7 @@
 
         /* mandatory fields */
 	fixme_unused := f_rsl_find_ie(rsl_msg, RSL_IE_IPAC_REMOTE_IP, ie);
-	host := f_inet_ntoa(int2oct(ie.ipa_remote_ip, 4));
+	host := f_inet_ntoa(ie.ipa_remote_ip);
 
         fixme_unused := f_rsl_find_ie(rsl_msg, RSL_IE_IPAC_REMOTE_PORT, ie);
 	port_num := ie.ipa_remote_port;
@@ -315,9 +315,9 @@
 	}
 
 	if (send_on_a == true) {
-		CONN_A.send(ts_RSL_IPA_MDCX_ACK(chan_nr, conn_id, oct2int(f_inet_addr(host)), port_num, rtp_pt));
+		CONN_A.send(ts_RSL_IPA_MDCX_ACK(chan_nr, conn_id, f_inet_addr(host), port_num, rtp_pt));
 	} else {
-		CONN_B.send(ts_RSL_IPA_MDCX_ACK(chan_nr, conn_id, oct2int(f_inet_addr(host)), port_num, rtp_pt));
+		CONN_B.send(ts_RSL_IPA_MDCX_ACK(chan_nr, conn_id, f_inet_addr(host), port_num, rtp_pt));
 	}
 }
 
diff --git a/bsc/BSC_Tests_VAMOS.ttcn b/bsc/BSC_Tests_VAMOS.ttcn
index 9ecb255..25dee23 100644
--- a/bsc/BSC_Tests_VAMOS.ttcn
+++ b/bsc/BSC_Tests_VAMOS.ttcn
@@ -425,7 +425,7 @@
 			rtp_pt := ie.ipa_rtp_pt;
 		}
 		RSL.send(ts_RSL_IPA_CRCX_ACK(new_chan_nr, 123,
-						oct2int(f_inet_addr("1.2.3.4")),
+						f_inet_addr("1.2.3.4"),
 						4321,
 						rtp_pt));
 		}
@@ -436,7 +436,7 @@
 		/* mandatory */
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_IP, ie);
 		var HostPort peer;
-		peer.host := f_inet_ntoa(int2oct(ie.ipa_remote_ip, 4));
+		peer.host := f_inet_ntoa(ie.ipa_remote_ip);
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_PORT, ie);
 		peer.port_nr := ie.ipa_remote_port;
 		var uint7_t rtp_pt := 0;
@@ -445,7 +445,7 @@
 			rtp_pt := ie.ipa_rtp_pt;
 		}
 		RSL.send(ts_RSL_IPA_MDCX_ACK(new_chan_nr, conn_id,
-						oct2int(f_inet_addr(peer.host)),
+						f_inet_addr(peer.host),
 						peer.port_nr,
 						rtp_pt));
 		}
@@ -535,7 +535,7 @@
 			rtp_pt := ie.ipa_rtp_pt;
 		}
 		RSL.send(ts_RSL_IPA_CRCX_ACK(new_chan_nr, 123,
-						oct2int(f_inet_addr("1.2.3.4")),
+						f_inet_addr("1.2.3.4"),
 						4321,
 						rtp_pt));
 		}
@@ -546,7 +546,7 @@
 		/* mandatory */
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_IP, ie);
 		var HostPort peer;
-		peer.host := f_inet_ntoa(int2oct(ie.ipa_remote_ip, 4));
+		peer.host := f_inet_ntoa(ie.ipa_remote_ip);
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_PORT, ie);
 		peer.port_nr := ie.ipa_remote_port;
 		var uint7_t rtp_pt := 0;
@@ -555,7 +555,7 @@
 			rtp_pt := ie.ipa_rtp_pt;
 		}
 		RSL.send(ts_RSL_IPA_MDCX_ACK(new_chan_nr, conn_id,
-						oct2int(f_inet_addr(peer.host)),
+						f_inet_addr(peer.host),
 						peer.port_nr,
 						rtp_pt));
 		}
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 2d0bd27..3e2e4f7 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -200,7 +200,7 @@
 			g_media.bts.rtp_pt := ie.ipa_rtp_pt2;
 		}
 		RSL.send(ts_RSL_IPA_CRCX_ACK(g_chan_nr, g_media.bts.conn_id,
-						oct2int(f_inet_addr(g_media.bts.bts.host)),
+						f_inet_addr(g_media.bts.bts.host),
 						g_media.bts.bts.port_nr,
 						g_media.bts.rtp_pt));
 		g_media.bts.ipa_crcx_seen := true;
@@ -214,7 +214,7 @@
 		}
 		/* mandatory */
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_IP, ie);
-		g_media.bts.peer.host := f_inet_ntoa(int2oct(ie.ipa_remote_ip, 4));
+		g_media.bts.peer.host := f_inet_ntoa(ie.ipa_remote_ip);
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_PORT, ie);
 		g_media.bts.peer.port_nr := ie.ipa_remote_port;
 		/* optional */
@@ -225,7 +225,7 @@
 			g_media.bts.rtp_pt := ie.ipa_rtp_pt2;
 		}
 		RSL.send(ts_RSL_IPA_MDCX_ACK(g_chan_nr, g_media.bts.conn_id,
-						oct2int(f_inet_addr(g_media.bts.peer.host)),
+						f_inet_addr(g_media.bts.peer.host),
 						g_media.bts.peer.port_nr,
 						g_media.bts.rtp_pt));
 		g_media.bts.ipa_mdcx_seen := true;
@@ -242,7 +242,7 @@
 			g_media.bts1.rtp_pt := ie.ipa_rtp_pt2;
 		}
 		RSL1.send(ts_RSL_IPA_CRCX_ACK(g_chan_nr, g_media.bts1.conn_id,
-						oct2int(f_inet_addr(g_media.bts1.bts.host)),
+						f_inet_addr(g_media.bts1.bts.host),
 						g_media.bts1.bts.port_nr,
 						g_media.bts1.rtp_pt));
 		g_media.bts1.ipa_crcx_seen := true;
@@ -257,7 +257,7 @@
 		}
 		/* mandatory */
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_IP, ie);
-		g_media.bts1.peer.host := f_inet_ntoa(int2oct(ie.ipa_remote_ip, 4));
+		g_media.bts1.peer.host := f_inet_ntoa(ie.ipa_remote_ip);
 		b_unused := f_rsl_find_ie(rsl, RSL_IE_IPAC_REMOTE_PORT, ie);
 		g_media.bts1.peer.port_nr := ie.ipa_remote_port;
 		/* optional */
@@ -268,7 +268,7 @@
 			g_media.bts1.rtp_pt := ie.ipa_rtp_pt2;
 		}
 		RSL1.send(ts_RSL_IPA_MDCX_ACK(g_chan_nr, g_media.bts1.conn_id,
-						oct2int(f_inet_addr(g_media.bts1.peer.host)),
+						f_inet_addr(g_media.bts1.peer.host),
 						g_media.bts1.peer.port_nr,
 						g_media.bts1.rtp_pt));
 		g_media.bts1.ipa_mdcx_seen := true;
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 06085c6..a7fdf16 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -4611,7 +4611,7 @@
 private function f_TC_ipa_crcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr {
 	f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
 			 "IPA CRCX ACK");
-	var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX);
+	var OCT4 remote_ip := f_rnd_octstring(4);
 	var uint16_t remote_port := f_rnd_int(c_UINT16_MAX);
 	var uint7_t rtp_pt2 := f_rnd_int(127);
 	var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */
@@ -4632,7 +4632,7 @@
 private function f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr {
 	f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
 			 "IPA CRCX ACK");
-	var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX);
+	var OCT4 remote_ip := f_rnd_octstring(4);
 	var uint16_t remote_port := f_rnd_int(c_UINT16_MAX);
 	var uint7_t rtp_pt2 := f_rnd_int(127);
 	var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */
@@ -4640,7 +4640,7 @@
 			 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
 			 "IPA MDCX ACK");
 	/* Second MDCX */
-	remote_ip := f_rnd_int(c_UINT32_MAX);
+	remote_ip := f_rnd_octstring(4);
 	remote_port := f_rnd_int(c_UINT16_MAX);
 	f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
 			 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index 4e25189..aa206a3 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -919,8 +919,8 @@
 		uint16_t		ipa_conn_id,
 		uint16_t		ipa_local_port,
 		uint16_t		ipa_remote_port,
-		uint32_t		ipa_local_ip,
-		uint32_t		ipa_remote_ip,
+		OCT4			ipa_local_ip,
+		OCT4			ipa_remote_ip,
 		uint8_t			ipa_rtp_pt,
 		uint8_t			ipa_rtp_pt2,
 		RSL_IE_IPA_ConnectionStats ipa_stats,
@@ -2005,7 +2005,7 @@
 	}
 	template (value) RSL_Message
 	ts_RSL_IPA_CRCX(template (value) RslChannelNr chan_nr,
-			template (value) uint32_t remote_ip := oct2int('7F000001'O),
+			template (value) OCT4 remote_ip := '7F000001'O,
 			template (value) uint16_t remote_port := 6766) := {
 		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_IPACCESS, false),
 		msg_type := RSL_MT_IPAC_CRCX,
@@ -2018,7 +2018,7 @@
 
 
 	template (value) RSL_Message ts_RSL_IPA_CRCX_ACK(template (value) RslChannelNr chan_nr,
-							 uint16_t ipa_conn_id, uint32_t local_ip,
+							 uint16_t ipa_conn_id, OCT4 local_ip,
 							 uint16_t local_port, uint7_t rtp_pt2) := {
 		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_IPACCESS, false),
 		msg_type := RSL_MT_IPAC_CRCX_ACK,
@@ -2032,7 +2032,7 @@
 	}
 	template RSL_Message tr_RSL_IPA_CRCX_ACK(template RslChannelNr chan_nr,
 						 template uint16_t ipa_conn_id,
-						 template uint32_t local_ip,
+						 template OCT4 local_ip,
 						 template uint16_t local_port) := {
 		msg_disc := tr_RSL_MsgDisc(RSL_MDISC_IPACCESS, false),
 		msg_type := RSL_MT_IPAC_CRCX_ACK,
@@ -2066,7 +2066,7 @@
 
 	template (value) RSL_Message ts_RSL_IPA_MDCX(template (value) RslChannelNr chan_nr,
 						     uint16_t ipa_conn_id,
-						     uint32_t remote_ip, uint16_t remote_port,
+						     OCT4 remote_ip, uint16_t remote_port,
 						     uint7_t rtp_pt2) := {
 		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_IPACCESS, false),
 		msg_type := RSL_MT_IPAC_MDCX,
@@ -2092,7 +2092,7 @@
 
 	template (value) RSL_Message ts_RSL_IPA_MDCX_ACK(template (value) RslChannelNr chan_nr,
 							 uint16_t ipa_conn_id,
-							 uint32_t local_ip, uint16_t local_port,
+							 OCT4 local_ip, uint16_t local_port,
 							 uint7_t rtp_pt2) := {
 		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_IPACCESS, false),
 		msg_type := RSL_MT_IPAC_MDCX_ACK,
@@ -2108,7 +2108,7 @@
 	}
 	template RSL_Message tr_RSL_IPA_MDCX_ACK(template RslChannelNr chan_nr,
 						 template uint16_t ipa_conn_id,
-						 template uint32_t local_ip,
+						 template OCT4 local_ip,
 						 template uint16_t local_port,
 						 template uint7_t rtp_pt2) := {
 		msg_disc := tr_RSL_MsgDisc(RSL_MDISC_IPACCESS, false),

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24839
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: I389a8cb95c025c9dddc751789223621c15d9b48f
Gerrit-Change-Number: 24839
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy 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/20210705/c996f3d5/attachment.htm>


More information about the gerrit-log mailing list