@@ -182,40 +182,27 @@ func TestMobilityReg_GetOperatorInfoError(t *testing.T) {
182182 }
183183}
184184
185- func TestMobilityReg_NilCapability5GMM_Mobility_SendsReject (t * testing.T ) {
185+ // A mobility registration update with no 5GMM capability IE is valid: the IE
186+ // is optional and re-sent only on change (TS 24.501 §5.5.1.3.2, §7.7.1), so the
187+ // AMF accepts rather than rejecting.
188+ func TestMobilityReg_NilCapability5GMM_Mobility_Continues (t * testing.T ) {
186189 ue , ngapSender , _ , amfInstance := buildMobilityRegUeAndAMF (t )
187190
188191 ue .NasConn ().RegistrationRequest .Capability5GMM = nil
189192 ue .NasConn ().RegistrationType5GS = nasMessage .RegistrationType5GSMobilityRegistrationUpdating
190193
191194 err := HandleMobilityAndPeriodicRegistrationUpdating (context .TODO (), amfInstance , ue )
192- if err == nil {
193- t .Fatal ("expected error for nil Capability5GMM, got nil" )
194- }
195-
196- if err .Error () != "Capability5GMM is nil" {
197- t .Fatalf ("unexpected error: %v" , err )
195+ if err != nil {
196+ t .Fatalf ("expected no error for mobility reg with nil Capability5GMM, got: %v" , err )
198197 }
199198
200199 if len (ngapSender .SentDownlinkNASTransport ) != 1 {
201- t .Fatalf ("expected 1 DownlinkNASTransport (RegistrationReject), got %d" , len (ngapSender .SentDownlinkNASTransport ))
202- }
203-
204- resp := ngapSender .SentDownlinkNASTransport [0 ]
205- nm := new (nas.Message )
206- nm .SecurityHeaderType = nas .GetSecurityHeaderType (resp .NasPdu ) & 0x0f
207-
208- if nm .SecurityHeaderType != nas .SecurityHeaderTypePlainNas {
209- t .Fatalf ("expected plain NAS, got security header type %d" , nm .SecurityHeaderType )
210- }
211-
212- err = nm .PlainNasDecode (& resp .NasPdu )
213- if err != nil {
214- t .Fatalf ("could not decode NAS message: %v" , err )
200+ t .Fatalf ("expected 1 DownlinkNASTransport, got %d" , len (ngapSender .SentDownlinkNASTransport ))
215201 }
216202
217- if nm .GmmHeader .GetMessageType () != nas .MsgTypeRegistrationReject {
218- t .Fatalf ("expected RegistrationReject, got %v" , nm .GmmHeader .GetMessageType ())
203+ nm := decryptAndDecodeNasPdu (t , ue , ngapSender .SentDownlinkNASTransport [0 ].NasPdu , 0 )
204+ if nm .GmmHeader .GetMessageType () != nas .MsgTypeRegistrationAccept {
205+ t .Fatalf ("expected RegistrationAccept, got %v" , nm .GmmHeader .GetMessageType ())
219206 }
220207}
221208
0 commit comments