def test_attach_detach_multienb_multiue(self): """ Multi Enb Multi UE attach detach """ num_of_enbs = 5 # column is a enb parameter, row is a number of enbs """ Cell Id, Tac, EnbType, PLMN Id """ enb_list = list([[1, 1, 1, "001010"], [2, 1, 1, "001010"], [3, 1, 1, "001010"], [4, 1, 1, "001010"], [5, 1, 1, "001010"]]) assert (num_of_enbs == len(enb_list)), "Number of enbs configured" "not equal to enbs in the list!!!" self._s1ap_wrapper.multiEnbConfig(num_of_enbs, enb_list) time.sleep(2) ue_ids = [] # UEs will attach to the ENBs in a round-robin fashion # each ENBs will be connected with 32UEs num_ues = 5 self._s1ap_wrapper.configUEDevice(num_ues) for _ in range(num_ues): req = self._s1ap_wrapper.ue_req print("******************** Calling attach for UE id ", req.ue_id) self._s1ap_wrapper.s1_util.attach( req.ue_id, s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, s1ap_types.ueAttachAccept_t) # Wait on EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() ue_ids.append(req.ue_id) # Trigger eNB Reset # Add delay to ensure S1APTester sends attach complete before sending # eNB Reset Request time.sleep(0.5) print("************************* Sending eNB Reset Request") reset_req = s1ap_types.ResetReq() reset_req.rstType = s1ap_types.resetType.COMPLETE_RESET.value reset_req.cause = s1ap_types.ResetCause() reset_req.cause.causeType = \ s1ap_types.NasNonDelCauseType.TFW_CAUSE_MISC.value # Set the cause to MISC.hardware-failure reset_req.cause.causeVal = 3 reset_req.r = s1ap_types.R() reset_req.r.completeRst = s1ap_types.CompleteReset() reset_req.r.completeRst.enbId = 2 self._s1ap_wrapper.s1_util.issue_cmd(s1ap_types.tfwCmd.RESET_REQ, reset_req) response = self._s1ap_wrapper.s1_util.get_response() self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) time.sleep(1) for ue in ue_ids: print("************************* Calling detach for UE id ", ue) self._s1ap_wrapper.s1_util.detach( ue, s1ap_types.ueDetachType_t.UE_NORMAL_DETACH.value)
def test_enb_complete_reset(self): """ENB Complete Reset: 1) Attach 32 UEs 2) Send complete reset 3) Detach all the 32 UEs """ ue_ids = [] num_ues = 32 self._s1ap_wrapper.configUEDevice(num_ues) for _ in range(num_ues): req = self._s1ap_wrapper.ue_req print( "************************* Calling attach for UE id ", req.ue_id, ) self._s1ap_wrapper.s1_util.attach( req.ue_id, s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, s1ap_types.ueAttachAccept_t, ) ue_ids.append(req.ue_id) # Wait on EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() # Trigger eNB Reset # Add delay to ensure S1APTester sends attach complete before sending # eNB Reset Request time.sleep(0.5) print("************************* Sending eNB Reset Request") reset_req = s1ap_types.ResetReq() reset_req.rstType = s1ap_types.resetType.COMPLETE_RESET.value reset_req.cause = s1ap_types.ResetCause() reset_req.cause.causeType = ( s1ap_types.NasNonDelCauseType.TFW_CAUSE_MISC.value) # Set the cause to MISC.hardware-failure reset_req.cause.causeVal = 3 reset_req.r = s1ap_types.R() reset_req.r.completeRst = s1ap_types.CompleteReset() self._s1ap_wrapper.s1_util.issue_cmd( s1ap_types.tfwCmd.RESET_REQ, reset_req, ) response = self._s1ap_wrapper.s1_util.get_response() self.assertEqual(response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) # Sleep for 3 seconds to ensure that MME has cleaned up all S1 state # before proceeding time.sleep(3) for ue in ue_ids: print("************************* Calling detach for UE id ", ue) self._s1ap_wrapper.s1_util.detach( ue, s1ap_types.ueDetachType_t.UE_NORMAL_DETACH.value, wait_for_s1_ctxt_release=True, )
def test_enb_complete_reset(self): """ attach 32 UEs """ ue_ids = [] num_ues = 32 self._s1ap_wrapper.configUEDevice(num_ues) for _ in range(num_ues): req = self._s1ap_wrapper.ue_req print("************************* Calling attach for UE id ", req.ue_id) self._s1ap_wrapper.s1_util.attach( req.ue_id, s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, s1ap_types.ueAttachAccept_t) ue_ids.append(req.ue_id) # Wait on EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() # Trigger eNB Reset # Add delay to ensure S1APTester sends attach complete before sending # eNB Reset Request time.sleep(0.5) print("************************* Sending eNB Reset Request") reset_req = s1ap_types.ResetReq() reset_req.rstType = s1ap_types.resetType.COMPLETE_RESET.value reset_req.cause = s1ap_types.ResetCause() reset_req.cause.causeType = \ s1ap_types.NasNonDelCauseType.TFW_CAUSE_MISC.value # Set the cause to MISC.hardware-failure reset_req.cause.causeVal = 3 reset_req.u = s1ap_types.U() reset_req.u.completeRst = s1ap_types.CompleteReset() self._s1ap_wrapper.s1_util.issue_cmd( s1ap_types.tfwCmd.RESET_REQ, reset_req) response = self._s1ap_wrapper.s1_util.get_response() self.assertEqual( response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) # Note - S1APTester is not sending detach after receiving reset. # Reported the issue to S1APTester team. for ue in ue_ids: print("************************* Calling detach for UE id ", ue) self._s1ap_wrapper.s1_util.detach( ue, s1ap_types.ueDetachType_t.UE_NORMAL_DETACH.value, True)
def test_attach_detach_multienb_multiue_complete_reset(self): """ Multi Enb Multi UE attach detach + complete reset """ """ Note: Before execution of this test case, make sure that following steps are correct 1. Configure same plmn and tac in both MME and s1ap tester 2. How to configure plmn and tac in MME: a. Set mcc and mnc in gateway.mconfig for mme service b. Set tac in gateway.mconfig for mme service c. Restart MME service 3. How to configure plmn and tac in s1ap tester, a. For multi-eNB test case, configure plmn and tac from test case. In each multi-eNB test case, set plmn, plmn length and tac in enb_list b. For single eNB test case, configure plmn and tac in nbAppCfg.txt """ # column is an enb parameter, row is number of enbs """ Cell Id, Tac, EnbType, PLMN Id, PLMN length """ enb_list = [[1, 1, 1, "00101", 5], [2, 1, 1, "00101", 5], [3, 1, 1, "00101", 5], [4, 1, 1, "00101", 5], [5, 1, 1, "00101", 5]] self._s1ap_wrapper.multiEnbConfig(len(enb_list), enb_list) time.sleep(2) ue_ids = [] # UEs will attach to the ENBs in a round-robin fashion # each ENBs will be connected with 32UEs num_ues = 5 self._s1ap_wrapper.configUEDevice(num_ues) for _ in range(num_ues): req = self._s1ap_wrapper.ue_req print("******************** Calling attach for UE id ", req.ue_id) self._s1ap_wrapper.s1_util.attach( req.ue_id, s1ap_types.tfwCmd.UE_END_TO_END_ATTACH_REQUEST, s1ap_types.tfwCmd.UE_ATTACH_ACCEPT_IND, s1ap_types.ueAttachAccept_t) # Wait on EMM Information from MME self._s1ap_wrapper._s1_util.receive_emm_info() ue_ids.append(req.ue_id) # Trigger eNB Reset # Add delay to ensure S1APTester sends attach complete before sending # eNB Reset Request time.sleep(0.5) print("************************* Sending eNB Reset Request") reset_req = s1ap_types.ResetReq() reset_req.rstType = s1ap_types.resetType.COMPLETE_RESET.value reset_req.cause = s1ap_types.ResetCause() reset_req.cause.causeType = \ s1ap_types.NasNonDelCauseType.TFW_CAUSE_MISC.value # Set the cause to MISC.hardware-failure reset_req.cause.causeVal = 3 reset_req.r = s1ap_types.R() reset_req.r.completeRst = s1ap_types.CompleteReset() reset_req.r.completeRst.enbId = 2 self._s1ap_wrapper.s1_util.issue_cmd( s1ap_types.tfwCmd.RESET_REQ, reset_req) response = self._s1ap_wrapper.s1_util.get_response() self.assertEqual( response.msg_type, s1ap_types.tfwCmd.RESET_ACK.value) time.sleep(1) for ue in ue_ids: print("************************* Calling detach for UE id ", ue) self._s1ap_wrapper.s1_util.detach( ue, s1ap_types.ueDetachType_t.UE_NORMAL_DETACH.value)