def test_attach_detach_security_algo_eea0_eia0(self): """ Basic attach/detach test case with following security algorithms: Encryption algorithm type : EEA0 (Null Ciphering algorithm) Integrity algorithm type : EIA0 (Null Integrity algorithm) The preferred Encryption/Integrity algorythms to be selected by the network can be changed by manually modifying the order of preference of algorithms in mme.conf.template file """ num_ues = 2 detach_type = [ s1ap_types.ueDetachType_t.UE_NORMAL_DETACH.value, s1ap_types.ueDetachType_t.UE_SWITCHOFF_DETACH.value, ] wait_for_s1 = [True, False] # Configure Encryption/Integrity algorithms for UE Network Capabilities config_list = [] for i in range(num_ues): config_list.append(s1ap_types.ueConfig_t()) config_list[i].ueNwCap_pr.pres = 1 config_list[i].ueNwCap_pr.eea2_128 = 0 config_list[i].ueNwCap_pr.eea1_128 = 0 config_list[i].ueNwCap_pr.eea0 = 1 config_list[i].ueNwCap_pr.eia2_128 = 0 config_list[i].ueNwCap_pr.eia1_128 = 0 config_list[i].ueNwCap_pr.eia0 = 1 self._s1ap_wrapper.configUEDevice(num_ues, req_data=config_list) for i in range(num_ues): req = self._s1ap_wrapper.ue_req print( "************************* Running End to End attach for ", "UE id ", req.ue_id, ) # Now actually complete the attach 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() print( "************************* Running UE detach for UE id ", req.ue_id, ) # Now detach the UE self._s1ap_wrapper.s1_util.detach( req.ue_id, detach_type[i], wait_for_s1[i], )
def _get_s1ap_sub(self, sid): """ Get the subscriber data in s1aptester format. Args: The string representation of the subscriber id """ ue_cfg = s1ap_types.ueConfig_t() ue_cfg.ue_id = self._ue_id ue_cfg.auth_key = 1 # Some s1ap silliness, the char field is modelled as an int and then # cast into a uint8. for i in range(0, 15): ue_cfg.imsi[i] = ctypes.c_ubyte(int(sid[4 + i])) ue_cfg.imei[i] = ctypes.c_ubyte(int("1")) ue_cfg.imei[15] = ctypes.c_ubyte(int("1")) ue_cfg.imsiLen = self.IMSI_LEN self._ue_cfgs.append(ue_cfg) self._ue_id += 1 return ue_cfg