From 2a0452ae25c3b89076c40d00b6c04e505867943d Mon Sep 17 00:00:00 2001 From: Vini Gajjar Date: Thu, 24 Mar 2022 19:59:23 +0530 Subject: [PATCH] SDCORE-850: Adding support for NW requested PDU Sess Release (#45) --- common/procedures.go | 2 ++ config/gnbsim.yaml | 9 +++++++++ profile/profile.go | 42 ++++++++++++++++++++++++++++++------------ simue/handler.go | 12 ++++++++---- 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/common/procedures.go b/common/procedures.go index 8e718e86..c98f7b84 100644 --- a/common/procedures.go +++ b/common/procedures.go @@ -18,6 +18,7 @@ const ( UE_TRIGGERED_SERVICE_REQUEST_PROCEDURE NW_TRIGGERED_UE_DEREGISTRATION_PROCEDURE AMF_RELEASE_PROCEDURE + NW_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE ) var procStrMap = map[ProcedureType]string{ @@ -30,6 +31,7 @@ var procStrMap = map[ProcedureType]string{ NW_TRIGGERED_UE_DEREGISTRATION_PROCEDURE: "NW-TRIGGERED-UE-DEREGISTRATION-PROCEDURE", AMF_RELEASE_PROCEDURE: "AMF-RELEASE-PROCEDURE", UE_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE: "UE-REQUESTED-PDU-SESSION-RELEASE-PROCEDURE", + NW_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE: "NW-REQUESTED-PDU-SESSION-RELEASE-PROCEDURE", } func (id ProcedureType) String() string { diff --git a/config/gnbsim.yaml b/config/gnbsim.yaml index 8aae6594..306907b0 100644 --- a/config/gnbsim.yaml +++ b/config/gnbsim.yaml @@ -110,6 +110,15 @@ configuration: plmnId: # Public Land Mobile Network ID, = . Should match startImsi mcc: 208 # Mobile Country Code (3 digits string, digit: 0~9) mnc: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9) + - profileType: nwreqpdusessrelease # profile type + profileName: profile8 # uniqely identifies a profile within application + enable: false # Set true to execute the profile, false otherwise. + gnbName: gnb1 # gNB to be used for this profile + startImsi: 208930100007497 # First IMSI. Subsequent values will be used if ueCount is more than 1 + ueCount: 1 # Number of UEs for for which the profile will be executed + plmnId: # Public Land Mobile Network ID, = . Should match startImsi + mcc: 208 # Mobile Country Code (3 digits string, digit: 0~9) + mnc: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9) logger: logLevel: info # how detailed the log will be, values: trace, debug, info, warn, error, fatal, panic diff --git a/profile/profile.go b/profile/profile.go index f3ae3dd9..03b8ed5b 100644 --- a/profile/profile.go +++ b/profile/profile.go @@ -20,13 +20,14 @@ import ( //profile names const ( - REGISTER string = "register" - PDU_SESS_EST string = "pdusessest" - DEREGISTER string = "deregister" - AN_RELEASE string = "anrelease" - UE_TRIGG_SERVICE_REQ string = "uetriggservicereq" - NW_TRIGG_UE_DEREG_REQ string = "nwtriggeruedereg" - UE_REQ_PDU_SESS_REL string = "uereqpdusessrelease" + REGISTER string = "register" + PDU_SESS_EST string = "pdusessest" + DEREGISTER string = "deregister" + AN_RELEASE string = "anrelease" + UE_TRIGG_SERVICE_REQ string = "uetriggservicereq" + NW_TRIGG_UE_DEREG string = "nwtriggeruedereg" + UE_REQ_PDU_SESS_RELEASE string = "uereqpdusessrelease" + NW_REQ_PDU_SESS_RELEASE string = "nwreqpdusessrelease" ) func InitializeAllProfiles() { @@ -122,7 +123,7 @@ func initEventMap(profile *profctx.Profile) { common.PDU_SESS_EST_ACCEPT_EVENT: common.PDU_SESS_EST_ACCEPT_EVENT, common.PROFILE_PASS_EVENT: common.QUIT_EVENT, } - case UE_REQ_PDU_SESS_REL: + case UE_REQ_PDU_SESS_RELEASE: profile.Events = map[common.EventType]common.EventType{ common.REG_REQUEST_EVENT: common.AUTH_REQUEST_EVENT, common.AUTH_REQUEST_EVENT: common.AUTH_RESPONSE_EVENT, @@ -168,7 +169,7 @@ func initEventMap(profile *profctx.Profile) { common.TRIGGER_AN_RELEASE_EVENT: common.CONNECTION_RELEASE_REQUEST_EVENT, common.PROFILE_PASS_EVENT: common.QUIT_EVENT, } - case NW_TRIGG_UE_DEREG_REQ: + case NW_TRIGG_UE_DEREG: profile.Events = map[common.EventType]common.EventType{ common.REG_REQUEST_EVENT: common.AUTH_REQUEST_EVENT, common.AUTH_REQUEST_EVENT: common.AUTH_RESPONSE_EVENT, @@ -177,9 +178,19 @@ func initEventMap(profile *profctx.Profile) { common.PDU_SESS_EST_REQUEST_EVENT: common.PDU_SESS_EST_ACCEPT_EVENT, common.PDU_SESS_EST_ACCEPT_EVENT: common.PDU_SESS_EST_ACCEPT_EVENT, common.DEREG_REQUEST_UE_TERM_EVENT: common.DEREG_ACCEPT_UE_TERM_EVENT, - common.TRIGGER_AN_RELEASE_EVENT: common.CONNECTION_RELEASE_REQUEST_EVENT, common.PROFILE_PASS_EVENT: common.QUIT_EVENT, } + case NW_REQ_PDU_SESS_RELEASE: + profile.Events = map[common.EventType]common.EventType{ + common.REG_REQUEST_EVENT: common.AUTH_REQUEST_EVENT, + common.AUTH_REQUEST_EVENT: common.AUTH_RESPONSE_EVENT, + common.SEC_MOD_COMMAND_EVENT: common.SEC_MOD_COMPLETE_EVENT, + common.REG_ACCEPT_EVENT: common.REG_COMPLETE_EVENT, + common.PDU_SESS_EST_REQUEST_EVENT: common.PDU_SESS_EST_ACCEPT_EVENT, + common.PDU_SESS_EST_ACCEPT_EVENT: common.PDU_SESS_EST_ACCEPT_EVENT, + common.PDU_SESS_REL_COMMAND_EVENT: common.PDU_SESS_REL_COMPLETE_EVENT, + common.PROFILE_PASS_EVENT: common.QUIT_EVENT, + } } } @@ -216,19 +227,26 @@ func initProcedureList(profile *profctx.Profile) { common.AN_RELEASE_PROCEDURE, common.UE_TRIGGERED_SERVICE_REQUEST_PROCEDURE, } - case NW_TRIGG_UE_DEREG_REQ: + case NW_TRIGG_UE_DEREG: profile.Procedures = []common.ProcedureType{ common.REGISTRATION_PROCEDURE, common.PDU_SESSION_ESTABLISHMENT_PROCEDURE, common.USER_DATA_PKT_GENERATION_PROCEDURE, common.NW_TRIGGERED_UE_DEREGISTRATION_PROCEDURE, } - case UE_REQ_PDU_SESS_REL: + case UE_REQ_PDU_SESS_RELEASE: profile.Procedures = []common.ProcedureType{ common.REGISTRATION_PROCEDURE, common.PDU_SESSION_ESTABLISHMENT_PROCEDURE, common.USER_DATA_PKT_GENERATION_PROCEDURE, common.UE_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE, } + case NW_REQ_PDU_SESS_RELEASE: + profile.Procedures = []common.ProcedureType{ + common.REGISTRATION_PROCEDURE, + common.PDU_SESSION_ESTABLISHMENT_PROCEDURE, + common.USER_DATA_PKT_GENERATION_PROCEDURE, + common.NW_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE, + } } } diff --git a/simue/handler.go b/simue/handler.go index c2bec805..d087e8c4 100644 --- a/simue/handler.go +++ b/simue/handler.go @@ -221,10 +221,12 @@ func HandlePduSessReleaseCommandEvent(ue *simuectx.SimUe, intfcMsg common.InterfaceMessage) (err error) { msg := intfcMsg.(*common.UeMessage) - err = ue.ProfileCtx.CheckCurrentEvent(common.PDU_SESS_REL_REQUEST_EVENT, msg.Event) - if err != nil { - ue.Log.Errorln("CheckCurrentEvent returned:", err) - return err + if ue.Procedure == common.UE_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE { + err = ue.ProfileCtx.CheckCurrentEvent(common.PDU_SESS_REL_REQUEST_EVENT, msg.Event) + if err != nil { + ue.Log.Errorln("CheckCurrentEvent returned:", err) + return err + } } nextEvent, err := ue.ProfileCtx.GetNextEvent(msg.Event) if err != nil { @@ -481,5 +483,7 @@ func HandleProcedure(ue *simuectx.SimUe) { SendToRealUe(ue, msg) case common.NW_TRIGGERED_UE_DEREGISTRATION_PROCEDURE: ue.Log.Infoln("Waiting for N/W Triggered De-registration Procedure") + case common.NW_REQUESTED_PDU_SESSION_RELEASE_PROCEDURE: + ue.Log.Infoln("Waiting for N/W Requested PDU Session Release Procedure") } }