Change in ...osmo-ttcn3-hacks[master]: bscnat: Introduce test TC_ctrl_location

pespin gerrit-no-reply at lists.osmocom.org
Thu Jun 13 14:33:26 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14414 )

Change subject: bscnat: Introduce test TC_ctrl_location
......................................................................

bscnat: Introduce test TC_ctrl_location

It checks location-state TRAP is forwaded correctly in BSC-NAT from BSC
towards locally connected CTRL client, with variable names updated to
contain BSC/BTS indexes.
It also verifies commands can be applied (SET) in inverse direction.

Change-Id: If28aba011a1903788cacbc10c0b62954925d4b1f
---
M bsc-nat/BSCNAT_Tests.ttcn
M bsc-nat/BSC_MS_ConnectionHandler.ttcn
M bsc-nat/BSC_MS_Simulation.ttcn
M bsc-nat/gen_links.sh
M bsc-nat/regen_makefile.sh
5 files changed, 60 insertions(+), 6 deletions(-)

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



diff --git a/bsc-nat/BSCNAT_Tests.ttcn b/bsc-nat/BSCNAT_Tests.ttcn
index 81afcfa..9d2fc4b 100644
--- a/bsc-nat/BSCNAT_Tests.ttcn
+++ b/bsc-nat/BSCNAT_Tests.ttcn
@@ -20,6 +20,10 @@
 
 import from MTP3asp_Types all;
 
+import from Osmocom_CTRL_Functions all;
+import from Osmocom_CTRL_Types all;
+import from Osmocom_CTRL_Adapter all;
+
 import from SCCP_Types all;
 import from SCCPasp_Types all;
 import from SCCP_Emulation all;
@@ -48,7 +52,7 @@
 	SCCP_PAR_Address sccp_addr_own
 }
 
-type component test_CT {
+type component test_CT extends CTRL_Adapter_CT {
 	var MscState msc[NUM_MSC];
 	var BscState bsc[NUM_BSC];
 
@@ -65,6 +69,9 @@
 	PortNumber mp_msc_port := 5000;
 	charstring mp_msc_ip := "127.0.0.1";
 
+	/* port number to which to establish the IPA CTRL connection */
+	integer mp_nat_ctrl_port := 4250;
+	/* port number to which to establish the SCCPLite connection */
 	PortNumber mp_nat_port := 5000;
 	charstring mp_nat_ip := "127.0.0.1";
 
@@ -144,6 +151,7 @@
 
 	f_init_vty("VirtBSCNAT");
 	f_vty_allow_osmux(use_osmux);
+	f_ipa_ctrl_start(mp_nat_ip, mp_nat_ctrl_port);
 
 	for (i := 0; i < NUM_MSC; i := i+1) {
 		f_init_MscState(msc[i], mp_msc_pc +i, mp_bsc_pc, mp_msc_ssn, mp_bsc_ssn);
@@ -206,9 +214,26 @@
 	f_TC_recv_dump(true);
 }
 
+testcase TC_ctrl_location() runs on test_CT {
+	timer T := 30.0;
+
+	f_init(refers(bsc_ms_do_nothing),
+	       refers(bsc_ctrl_location),
+	       refers(CreateCallback_establish_fully),
+	       false);
+
+	f_ctrl_exp_trap(IPA_CTRL, "net.0.bsc.0.bts.0.location-state",
+			"1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01",
+			10.0);
+	f_ctrl_set(IPA_CTRL, "net.0.bsc.0.rf_locked", "1");
+
+	f_wait_finish(T);
+}
+
 control {
 	execute( TC_recv_dump() );
 	execute( TC_recv_dump_osmux() );
+	execute( TC_ctrl_location() );
 }
 
 }
diff --git a/bsc-nat/BSC_MS_ConnectionHandler.ttcn b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
index f7126fd..f011c39 100644
--- a/bsc-nat/BSC_MS_ConnectionHandler.ttcn
+++ b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
@@ -210,4 +210,8 @@
 	}
 }
 
+function bsc_ms_do_nothing(charstring id)
+runs on BSC_MS_ConnHdlr {
+}
+
 }
diff --git a/bsc-nat/BSC_MS_Simulation.ttcn b/bsc-nat/BSC_MS_Simulation.ttcn
index 7f23318..453f304 100644
--- a/bsc-nat/BSC_MS_Simulation.ttcn
+++ b/bsc-nat/BSC_MS_Simulation.ttcn
@@ -14,6 +14,9 @@
 
 import from IPA_Emulation all;
 
+import from Osmocom_CTRL_Functions all;
+import from Osmocom_CTRL_Types all;
+
 import from SCCP_Types all;
 import from SCCPasp_Types all;
 import from SCCP_Emulation all;
@@ -33,6 +36,8 @@
 	var RAN_Emulation_CT vc_BSSMAP;
 	/* test port to SCCP emulation */
 	port SCCPasp_PT SCCP;
+	/* test port to SCCPLite CTRL over IPA emulation */
+	port IPA_CTRL_PT SCCPLITE_IPA_CTRL;
 
 	var BSC_MS_TestHdlrParams g_pars;
 
@@ -71,6 +76,15 @@
 runs on BSC_CT {
 }
 
+/* Submit a location-state TRAP BSC->BSC-NAT */
+function bsc_ctrl_location(charstring id)
+runs on BSC_CT {
+	log("Starting main of BSC_CT");
+	f_ctrl_trap(SCCPLITE_IPA_CTRL, "bts.0.location-state",
+		    "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01");
+	f_ctrl_exp_set(SCCPLITE_IPA_CTRL, "rf_locked", "1", "1");
+}
+
 function main(charstring remote_ip, PortNumber remote_port,
 		charstring local_ip, PortNumber local_port,
 		MSC_SCCP_MTP3_parameters sccp_pars,
@@ -78,7 +92,7 @@
 		void_fn_bsc_ms fn_bsc_ms, void_fn_bsc fn_bsc, charstring id) runs on BSC_CT
 {
 	var integer i := 0;
-	timer T := 1.0;
+	timer T := 2.0;
 	var IPA_CCM_Parameters ccm_pars := IPA_Emulation.c_IPA_default_ccm_pars;
 	ccm_pars.name := id;
 	g_pars := pars;
@@ -98,6 +112,11 @@
 
 	/* connect BSSMAP dispatcher to IPA_Emulation MGCP */
 	connect(vc_BSSMAP:MGCP, vc_IPA:IPA_MGCP_PORT);
+	/* connect BSSMAP dispatcher to IPA_Emulation CTRL */
+	connect(vc_BSSMAP:CTRL, vc_IPA:IPA_CTRL_PORT);
+
+	/* connect BSSMAP dispatcher to IPA_Emulation CTRL */
+	connect(self:SCCPLITE_IPA_CTRL, vc_BSSMAP:CTRL_CLIENT);
 
 	/* start components */
 	vc_IPA.start(IPA_Emulation.main_client(remote_ip, remote_port, local_ip, local_port, ccm_pars));
@@ -105,8 +124,14 @@
 	vc_BSSMAP.start(RAN_Emulation.main(BSC_MS_ConnectionHandler.BSC_MS_RanOps, id));
 
 	/* Initial delay to wait for IPA connection establishment */
-	T.start(2.0);
-	T.timeout;
+	T.start;
+	alt {
+	[] SCCPLITE_IPA_CTRL.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) { }
+	[] T.timeout {
+		setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP");
+		mtc.stop;
+		}
+	}
 
 	var BSC_MS_ConnHdlrList vc_conns;
 	for (i := 0; i < mp_num_iterations; i := i+1) {
diff --git a/bsc-nat/gen_links.sh b/bsc-nat/gen_links.sh
index 01d4c7b..5da9d4e 100755
--- a/bsc-nat/gen_links.sh
+++ b/bsc-nat/gen_links.sh
@@ -52,7 +52,7 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp L3_Templates.ttcn BSSMAP_Templates.ttcn RAN_Emulation.ttcnpp MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc Osmocom_CTRL_Types.ttcn Osmocom_VTY_Functions.ttcn Osmocom_CTRL_Functions.ttcn BSSAP_CodecPort.ttcn"
+FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcnpp L3_Templates.ttcn BSSMAP_Templates.ttcn RAN_Emulation.ttcnpp MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc Osmocom_CTRL_Types.ttcn Osmocom_VTY_Functions.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn BSSAP_CodecPort.ttcn"
 gen_links $DIR $FILES
 
 ignore_pp_results
diff --git a/bsc-nat/regen_makefile.sh b/bsc-nat/regen_makefile.sh
index 0f3cfab..c9d744e 100755
--- a/bsc-nat/regen_makefile.sh
+++ b/bsc-nat/regen_makefile.sh
@@ -4,6 +4,6 @@
 
 FILES="*.ttcn *.ttcnpp SCCP_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc RTP_EncDec.cc SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc TELNETasp_PT.cc"
 
-export CPPFLAGS_TTCN3="-DIPA_EMULATION_SCCP -DIPA_EMULATION_MGCP -DRAN_EMULATION_BSSAP -DRAN_EMULATION_MGCP -DUSE_MTP3_DISTRIBUTOR"
+export CPPFLAGS_TTCN3="-DIPA_EMULATION_SCCP -DIPA_EMULATION_MGCP -DIPA_EMULATION_CTRL -DRAN_EMULATION_BSSAP -DRAN_EMULATION_MGCP -DRAN_EMULATION_CTRL -DUSE_MTP3_DISTRIBUTOR"
 
 ../regen-makefile.sh $MAIN $FILES

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14414
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: If28aba011a1903788cacbc10c0b62954925d4b1f
Gerrit-Change-Number: 14414
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at gnumonks.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/20190613/39f8a5c5/attachment.html>


More information about the gerrit-log mailing list