Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/9674


Change subject: bsc: inter-BSC HO: add TC_ho_out_of_this_bsc, 
TC_ho_into_this_bsc
......................................................................

bsc: inter-BSC HO: add TC_ho_out_of_this_bsc, TC_ho_into_this_bsc

Change-Id: Id22852d4be7f127d827e7a8beeec55db27c07f03
---
M bsc/BSC_Tests.ttcn
M bsc/osmo-bsc.cfg
2 files changed, 330 insertions(+), 36 deletions(-)



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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 0107091..ca7b275 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -33,6 +33,8 @@
 import from RSL_Types all;
 import from RSL_Emulation all;
 import from MGCP_Emulation all;
+import from MGCP_Templates all;
+import from MGCP_Types all;

 import from Osmocom_CTRL_Functions all;
 import from Osmocom_CTRL_Types all;
@@ -43,6 +45,7 @@

 import from MobileL3_CommonIE_Types all;
 import from MobileL3_Types all;
+import from MobileL3_RRM_Types all;
 import from L3_Templates all;
 import from GSM_RR_Types all;

@@ -2067,41 +2070,6 @@
        f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, 
chan_nr);
 }

-/* intra-BSC hand-over between BTS0 and BTS1 */
-private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr {
-       g_pars := valueof(t_def_TestHdlrPars);
-       var template PDU_BSSAP exp_compl := f_gen_exp_compl();
-       var PDU_BSSAP ass_cmd := f_gen_ass_req();
-       const OCT8 kc := '0001020304050607'O;
-
-       ass_cmd.pdu.bssmap.assignmentRequest.channelType := 
valueof(ts_BSSMAP_IE_ChannelType);
-       ass_cmd.pdu.bssmap.assignmentRequest.codecList := 
valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
-
-       f_establish_fully(ass_cmd, exp_compl);
-
-       var HandoverState hs := {
-               rr_ho_cmpl_seen := false,
-               handover_done := false,
-               old_chan_nr := -
-       };
-       /* issue hand-over command on VTY */
-       f_vty_handover(0, 0, g_chan_nr, 1);
-       /* temporarily suspend DChan processing on BTS1 to avoid race with 
RSLEM_register */
-       f_rslem_suspend(RSL1_PROC);
-       alt {
-       [] as_handover(hs);
-       /* FIXME: somehow determine that the hand-over has completed, by MGCP 
MDCX? */
-       }
-}
-
-testcase TC_ho_int() runs on test_CT {
-       var MSC_ConnHdlr vc_conn;
-       f_init(2, true);
-       f_sleep(1.0);
-       vc_conn := f_start_handler(refers(f_tc_ho_int));
-       vc_conn.done;
-}
-
 /* OS#3041: Open and close N connections in a normal fashion, and expect no
  * BSSMAP Reset just because of that. */
 testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT {
@@ -2481,6 +2449,327 @@
    * is the info correct on delayed PCU (re)connect?
  */

+
+/***********************************************************************
+ * Handover
+ ***********************************************************************/
+
+/* intra-BSC hand-over between BTS0 and BTS1 */
+private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr {
+       g_pars := valueof(t_def_TestHdlrPars);
+       var template PDU_BSSAP exp_compl := f_gen_exp_compl();
+       var PDU_BSSAP ass_cmd := f_gen_ass_req();
+       const OCT8 kc := '0001020304050607'O;
+
+       ass_cmd.pdu.bssmap.assignmentRequest.channelType := 
valueof(ts_BSSMAP_IE_ChannelType);
+       ass_cmd.pdu.bssmap.assignmentRequest.codecList := 
valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+
+       f_establish_fully(ass_cmd, exp_compl);
+
+       var HandoverState hs := {
+               rr_ho_cmpl_seen := false,
+               handover_done := false,
+               old_chan_nr := -
+       };
+       /* issue hand-over command on VTY */
+       f_vty_handover(0, 0, g_chan_nr, 1);
+       /* temporarily suspend DChan processing on BTS1 to avoid race with 
RSLEM_register */
+       f_rslem_suspend(RSL1_PROC);
+       alt {
+       [] as_handover(hs);
+       /* FIXME: somehow determine that the hand-over has completed, by MGCP 
MDCX? */
+       }
+}
+
+testcase TC_ho_int() runs on test_CT {
+       var MSC_ConnHdlr vc_conn;
+       f_init(2, true);
+       f_sleep(1.0);
+       vc_conn := f_start_handler(refers(f_tc_ho_int));
+       vc_conn.done;
+}
+
+template PDU_BSSAP tr_BSSMAP_HandoverRequired modifies tr_BSSAP_BSSMAP := {
+       pdu := {
+               bssmap := {
+                       handoverRequired := {
+                               messageType := '11'O
+                       }
+               }
+       }
+}
+
+template PDU_BSSAP ts_BSSMAP_HandoverCommand(octetstring layer3info) modifies 
ts_BSSAP_BSSMAP := {
+       pdu := {
+               bssmap := {
+                       handoverCommand := {
+                               messageType := '13'O,
+                               layer3Information := {
+                                       elementIdentifier := '17'O,
+                                       lengthIndicator := 0,
+                                       layer3info := layer3info
+                               },
+                               cellIdentifier := omit,
+                               newBSSToOldBSSInfo := omit,
+                               talkerPriority := omit
+                       }
+               }
+       }
+}
+
+template PDU_ML3_NW_MS ts_RR_HandoverCommand := {
+       discriminator := '0110'B,
+       tiOrSkip := {
+               skipIndicator := '0000'B
+       },
+       msgs := {
+               rrm := {
+                       handoverCommand := {
+                               messageType := '00101011'B,
+                               cellDescription := {
+                                       bcc := '001'B,
+                                       ncc := '010'B,
+                                       BCCHArfcn_HighPart := '11'B,
+                                       BCCHArfcn_LowPart := '04'O
+                               },
+                               channelDescription2 := {
+                                       timeslotNumber := '110'B,
+                                       channelTypeandTDMAOffset := '00001'B,
+                                       octet3 := '00'O,
+                                       octet4 := '09'O
+                               },
+                               handoverReference := {
+                                       handoverReferenceValue := '00'O
+                               },
+                               powerCommandAndAccesstype := {
+                                       powerlevel := '00000'B,
+                                       fPC_EP := '0'B,
+                                       ePC_Mode := '0'B,
+                                       aTC := '0'B
+                               },
+                               synchronizationIndication := omit,
+                               frequencyShortListAfterTime := omit,
+                               frequencyListAfterTime := omit,
+                               cellChannelDescription := omit,
+                               multislotAllocation := omit,
+                               modeOfChannelSet1 := omit,
+                               modeOfChannelSet2 := omit,
+                               modeOfChannelSet3 := omit,
+                               modeOfChannelSet4 := omit,
+                               modeOfChannelSet5 := omit,
+                               modeOfChannelSet6 := omit,
+                               modeOfChannelSet7 := omit,
+                               modeOfChannelSet8 := omit,
+                               descrOf2ndCh_at := omit,
+                               modeOf2ndChannel := omit,
+                               frequencyChannelSequence_at := omit,
+                               mobileAllocation_at := omit,
+                               startingTime := omit,
+                               timeDifference := omit,
+                               timingAdvance := omit,
+                               frequencyShortListBeforeTime := omit,
+                               frequencyListBeforeTime := omit,
+                               descrOf1stCh_bt := omit,
+                               descrOf2ndCh_bt := omit,
+                               frequencyChannelSequence_bt := omit,
+                               mobileAllocation_bt := omit,
+                               cipherModeSetting := omit,
+                               vGCS_TargetModeIndication := omit,
+                               multiRateConfiguration := omit,
+                               dynamicARFCN_Mapping := omit,
+                               vGCS_Ciphering_Parameters := omit,
+                               dedicatedServiceInformation := omit,
+                               pLMNIndex := omit,
+                               extendedTSCSet_afterTime := omit,
+                               extendedTSCSet_beforeTime := omit
+                       }
+               }
+       }
+}
+
+private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr {
+       g_pars := valueof(t_def_TestHdlrPars);
+       var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, 
?);
+       var BSSMAP_IE_AoIP_TransportLayerAddress tla := 
valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342));
+       var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla));
+       var PDU_ML3_NW_MS rr_ho_cmd;
+       var octetstring rr_ho_cmd_enc;
+       var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL;
+       var BssmapCause cause := enum2int(cause_val);
+       var RSL_Message rsl_ho_cmd;
+       var RSL_IE_Body rsl_ho_cmd_l3;
+       var MgcpCommand mgcp;
+
+       ass_cmd.pdu.bssmap.assignmentRequest.channelType := 
valueof(ts_BSSMAP_IE_ChannelType);
+       ass_cmd.pdu.bssmap.assignmentRequest.codecList := 
valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+
+       f_establish_fully(ass_cmd, exp_compl);
+
+       f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any");
+
+       BSSAP.receive(tr_BSSMAP_HandoverRequired);
+
+       f_sleep(0.5);
+       /* The MSC negotiates Handover Request and Handover Request Ack with
+        * the other BSS and comes back with a BSSMAP Handover Command
+        * containing an RR Handover Command coming from the target BSS... */
+
+       rr_ho_cmd := valueof(ts_RR_HandoverCommand);
+       log("Remote cell's RR Handover Command passed through as L3 Info: ", 
rr_ho_cmd);
+       rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd);
+       log("Remote cell's RR Handover Command passed through as L3 Info, 
encoded: ", rr_ho_cmd_enc);
+       BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc));
+
+       /* expect the Handover Command to go out on RR */
+       RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd;
+       log("RSL Data Req went out to first BTS: ", rsl_ho_cmd);
+       if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) {
+               log("RSL message contains no L3 Info IE, expected RR Handover 
Command");
+               setverdict(fail);
+       } else {
+               log("Found L3 Info: ", rsl_ho_cmd_l3);
+               if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) {
+                       log("FAIL: the BSC sent out a different L3 Info, not 
matching the RR Handover Command the other BSS forwarded.");
+                       setverdict(fail);
+               } else {
+                       log("Success: the BSC sent out the same RR Handover 
Command the other BSS forwarded.");
+                       setverdict(pass);
+               }
+       }
+
+       /* When the other BSS has reported a completed handover, this side is
+        * torn down. */
+
+       BSSAP.send(ts_BSSMAP_ClearCommand(cause));
+
+       /* Expecting MGCP to DLCX the endpoint's two connections: towards BTS 
and towards MSC */
+       interleave {
+       [] BSSAP.receive(tr_BSSMAP_ClearComplete);
+       [] MGCP.receive(tr_DLCX()) -> value mgcp {
+                       log("Got first DLCX: ", mgcp);
+               }
+       [] MGCP.receive(tr_DLCX()) -> value mgcp {
+                       log("Got second DLCX: ", mgcp);
+               }
+       }
+       setverdict(pass);
+       f_sleep(1.0);
+}
+testcase TC_ho_out_of_this_bsc() runs on test_CT {
+       var MSC_ConnHdlr vc_conn;
+
+       f_init(1, true);
+       f_sleep(1.0);
+
+       vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc));
+       vc_conn.done;
+}
+
+template PDU_BSSAP ts_BSSMAP_HandoverRequest(
+               template BSSMAP_IE_CellIdentifier cell_id_target := 
ts_CellID_LAC_CI(1, 0),
+               template BSSMAP_IE_CellIdentifier cell_id_source := 
ts_CellID_LAC_CI(1, 1),
+               template BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := 
ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)
+               )
+modifies ts_BSSAP_BSSMAP := {
+       pdu := {
+               bssmap := {
+                       handoverRequest := {
+                               messageType := '10'O,
+                               channelType := 
valueof(ts_BSSMAP_IE_ChannelType),
+                               encryptionInformation :=
+                                       
valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)),
+                               classmarkInformationType := {
+                                       classmarkInformationType1 := {
+                                               elementIdentifier := '1D'O,
+                                               rf_PowerCapability := '000'B,
+                                               a5_1 := '0'B,
+                                               esind := '0'B,
+                                               revisionLevel := '10'B,
+                                               spare1_1 := '0'B
+                                       }
+                                       },
+                               cellIdentifierSource := cell_id_source,
+                               priority := omit,
+                               circuitIdentityCode := omit,
+                               downLinkDTX_Flag := omit,
+                               cellIdentifierTarget := cell_id_target,
+                               interferenceBandToBeUsed := omit,
+                               cause := omit,
+                               classmarkInformationType3 := omit,
+                               currentChannelType1 := omit,
+                               speechVersion := omit,
+                               groupCallReference := omit,
+                               talkerFlag := omit,
+                               configurationEvolutionIndication := omit,
+                               chosenEncryptionAlgorithm := omit,
+                               oldToNewBSSInfo := omit,
+                               lSAInformation := omit,
+                               lSAAccessControlSuppression := omit,
+                               serviceHandover := omit,
+                               iMSI_bssmap := omit,
+                               sourceToTargetRNCTransparentInfo := omit,
+                               sourceToTargetRNCTransparentInfoCDMA := omit,
+                               sNAAccessInformation := omit,
+                               talkerPriority := omit,
+                               aoIPTransportLayer := aoip_tla,
+                               codecList := omit,
+                               callIdentifier := omit,
+                               kC128 := omit,
+                               globalCallReference := omit,
+                               lCLS_Configuration := omit,
+                               connectionStatusControl := omit
+                       }
+               }
+       }
+}
+
+template PDU_BSSAP tr_BSSMAP_HandoverRequestAcknowledge(octetstring layer3info)
+modifies tr_BSSAP_BSSMAP := {
+       pdu := {
+               bssmap := {
+                       handoverRequestAck := {
+                               messageType := '12'O,
+                               layer3Information := {
+                                       elementIdentifier := '17'O,
+                                       lengthIndicator := 0,
+                                       layer3info := layer3info
+                               }
+                       }
+               }
+       }
+}
+
+private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr {
+       var BSSAP_N_DATA_ind rx_di;
+
+       BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, 2342,
+                       ts_BSSMAP_HandoverRequest()));
+       BSSAP.receive(tr_BSSAP_CONNECT_cfm(2342, omit));
+
+       BSSAP.receive(tr_BSSAP_DATA_ind(2342, 
tr_BSSMAP_HandoverRequestAcknowledge('1234'O)));
+
+       alt {
+       [] BSSAP.receive(tr_BSSAP_DATA_ind(2342, tr_BSSMAP_ClearRequest)) -> 
value rx_di {
+                       var BssmapCause cause := 
bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue);
+                       BSSAP.send(ts_BSSAP_DATA_req(2342, 
ts_BSSMAP_ClearCommand(cause)));
+                       repeat;
+               }
+       [] BSSAP.receive(tr_BSSAP_DATA_ind(2342, tr_BSSMAP_ClearComplete));
+       }
+
+       setverdict(pass);
+}
+
+testcase TC_ho_into_this_bsc() runs on test_CT {
+       var MSC_ConnHdlr vc_conn;
+
+       f_init(1, true);
+       f_sleep(1.0);
+
+       vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc));
+       vc_conn.done;
+}
+
 control {
        /* CTRL interface testing */
        execute( TC_ctrl_msc_connection_status() );
@@ -2566,7 +2855,6 @@
        execute( TC_unsol_ho_fail() );
        execute( TC_err_82_short_msg() );
        execute( TC_err_84_unknown_msg() );
-       execute( TC_ho_int() );

        execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() );
        execute( TC_bssmap_clear_does_not_cause_bssmap_reset() );
@@ -2577,6 +2865,10 @@
        execute( TC_dyn_pdch_osmo_act_deact() );
        execute( TC_dyn_pdch_osmo_act_nack() );

+       execute( TC_ho_int() );
+       execute( TC_ho_out_of_this_bsc() );
+       execute( TC_ho_into_this_bsc() );
+
        /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */
        execute( TC_early_conn_fail() );
        execute( TC_late_conn_fail() );
diff --git a/bsc/osmo-bsc.cfg b/bsc/osmo-bsc.cfg
index 1ccef09..b2409a5 100644
--- a/bsc/osmo-bsc.cfg
+++ b/bsc/osmo-bsc.cfg
@@ -88,6 +88,8 @@
   early-classmark-sending forbidden
   ip.access unit_id 1234 0
   oml ip.access stream_id 255 line 0
+  # remote-BSS neighbor:
+  neighbor add lac 99 arfcn 123 bsic any
   neighbor-list mode manual-si5
   neighbor-list add arfcn 100
   neighbor-list add arfcn 200

--
To view, visit https://gerrit.osmocom.org/9674
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id22852d4be7f127d827e7a8beeec55db27c07f03
Gerrit-Change-Number: 9674
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to