pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14414


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

WIP: bscnat: Introduce test TC_ctrl_location

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, 49 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/14/14414/1

diff --git a/bsc-nat/BSCNAT_Tests.ttcn b/bsc-nat/BSCNAT_Tests.ttcn
index 81afcfa..39b0cf9 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,24 @@
        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, "bts.0.location-state",
+                       
"1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01");
+
+       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 fe12305..f5e2a3e 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;
@@ -32,6 +35,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;

@@ -70,6 +75,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,
@@ -97,6 +111,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));
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: 1
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to