forked from free5gc/amf
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.go
More file actions
2380 lines (2161 loc) · 87.8 KB
/
Copy pathhandler.go
File metadata and controls
2380 lines (2161 loc) · 87.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package ngap
import (
"encoding/hex"
"fmt"
"strconv"
"time"
"github.com/free5gc/amf/internal/context"
gmm_common "github.com/free5gc/amf/internal/gmm/common"
gmm_message "github.com/free5gc/amf/internal/gmm/message"
business_metrics "github.com/free5gc/amf/internal/metrics/business"
amf_nas "github.com/free5gc/amf/internal/nas"
"github.com/free5gc/amf/internal/nas/nas_security"
ngap_message "github.com/free5gc/amf/internal/ngap/message"
"github.com/free5gc/amf/internal/sbi/consumer"
"github.com/free5gc/amf/pkg/factory"
"github.com/free5gc/aper"
"github.com/free5gc/nas"
"github.com/free5gc/nas/nasMessage"
libngap "github.com/free5gc/ngap"
"github.com/free5gc/ngap/ngapConvert"
"github.com/free5gc/ngap/ngapType"
"github.com/free5gc/openapi/models"
"github.com/free5gc/util/metrics/ngap"
"github.com/free5gc/util/metrics/utils"
)
func handleNGSetupRequestMain(ran *context.AmfRan,
globalRANNodeID *ngapType.GlobalRANNodeID,
rANNodeName *ngapType.RANNodeName,
supportedTAList *ngapType.SupportedTAList,
pagingDRX *ngapType.PagingDRX,
iesCriticalityDiagnostics *ngapType.CriticalityDiagnosticsIEList,
) {
var cause ngapType.Cause
ran.SetRanId(globalRANNodeID)
if rANNodeName != nil {
ran.Name = rANNodeName.Value
}
if pagingDRX != nil {
ran.Log.Tracef("PagingDRX[%d]", pagingDRX.Value)
}
for i := 0; i < len(supportedTAList.List); i++ {
supportedTAItem := supportedTAList.List[i]
tac := hex.EncodeToString(supportedTAItem.TAC.Value)
capOfSupportTai := cap(ran.SupportedTAList)
for j := 0; j < len(supportedTAItem.BroadcastPLMNList.List); j++ {
supportedTAI := context.NewSupportedTAI()
supportedTAI.Tai.Tac = tac
broadcastPLMNItem := supportedTAItem.BroadcastPLMNList.List[j]
plmnId := ngapConvert.PlmnIdToModels(broadcastPLMNItem.PLMNIdentity)
supportedTAI.Tai.PlmnId = &plmnId
capOfSNssaiList := cap(supportedTAI.SNssaiList)
for k := 0; k < len(broadcastPLMNItem.TAISliceSupportList.List); k++ {
tAISliceSupportItem := broadcastPLMNItem.TAISliceSupportList.List[k]
if len(supportedTAI.SNssaiList) < capOfSNssaiList {
supportedTAI.SNssaiList = append(supportedTAI.SNssaiList, ngapConvert.SNssaiToModels(tAISliceSupportItem.SNSSAI))
} else {
break
}
}
ran.Log.Tracef("PLMN_ID[MCC:%s MNC:%s] TAC[%s]", plmnId.Mcc, plmnId.Mnc, tac)
if len(ran.SupportedTAList) < capOfSupportTai {
ran.SupportedTAList = append(ran.SupportedTAList, supportedTAI)
} else {
break
}
}
}
if len(ran.SupportedTAList) == 0 {
ran.Log.Warn("NG-Setup failure: No supported TA exist in NG-Setup request")
cause.Present = ngapType.CausePresentMisc
cause.Misc = &ngapType.CauseMisc{
Value: ngapType.CauseMiscPresentUnspecified,
}
} else {
var found bool
for i, tai := range ran.SupportedTAList {
if context.InTaiList(tai.Tai, context.GetSelf().SupportTaiLists) {
ran.Log.Tracef("SERVED_TAI_INDEX[%d]", i)
found = true
break
}
}
if !found {
ran.Log.Warn("NG-Setup failure: Cannot find Served TAI in AMF")
cause.Present = ngapType.CausePresentMisc
cause.Misc = &ngapType.CauseMisc{
Value: ngapType.CauseMiscPresentUnknownPLMN,
}
}
}
var criticalityDiagnostics ngapType.CriticalityDiagnostics
if len(iesCriticalityDiagnostics.List) > 0 {
procedureCode := ngapType.ProcedureCodeNGSetup
triggeringMessage := ngapType.TriggeringMessagePresentInitiatingMessage
procedureCriticality := ngapType.CriticalityPresentNotify
criticalityDiagnostics = buildCriticalityDiagnostics(
&procedureCode,
&triggeringMessage,
&procedureCriticality,
iesCriticalityDiagnostics,
)
}
if cause.Present == ngapType.CausePresentNothing {
ngap_message.SendNGSetupResponse(ran, &criticalityDiagnostics)
} else {
ngap_message.SendNGSetupFailure(ran, cause, &criticalityDiagnostics)
}
}
func handleUplinkNASTransportMain(ran *context.AmfRan,
ranUe *context.RanUe,
nASPDU *ngapType.NASPDU,
userLocationInformation *ngapType.UserLocationInformation,
) {
amfUe := ranUe.AmfUe
if amfUe == nil {
err := ranUe.Remove()
if err != nil {
ran.Log.Error(err)
}
ran.Log.Errorf("No UE Context of RanUe with RANUENGAPID[%d] AMFUENGAPID[%d] ",
ranUe.RanUeNgapId, ranUe.AmfUeNgapId)
return
}
if userLocationInformation != nil {
ranUe.UpdateLocation(userLocationInformation)
}
amf_nas.HandleNAS(ranUe, ngapType.ProcedureCodeUplinkNASTransport, nASPDU.Value, false)
}
func handleNGResetMain(ran *context.AmfRan,
cause *ngapType.Cause,
resetType *ngapType.ResetType,
) {
if cause != nil {
printAndGetCause(ran, cause)
}
switch resetType.Present {
case ngapType.ResetTypePresentNGInterface:
ran.Log.Trace("ResetType Present: NG Interface")
ran.RemoveAllRanUe(false)
ngap_message.SendNGResetAcknowledge(ran, nil, nil)
case ngapType.ResetTypePresentPartOfNGInterface:
ran.Log.Trace("ResetType Present: Part of NG Interface")
partOfNGInterface := resetType.PartOfNGInterface
if partOfNGInterface == nil {
ran.Log.Error("PartOfNGInterface is nil")
return
}
var ranUe *context.RanUe
for _, ueAssociatedLogicalNGConnectionItem := range partOfNGInterface.List {
if ueAssociatedLogicalNGConnectionItem.AMFUENGAPID != nil {
ran.Log.Tracef("AmfUeNgapID[%d]", ueAssociatedLogicalNGConnectionItem.AMFUENGAPID.Value)
ranUe = ran.FindRanUeByAmfUeNgapID(ueAssociatedLogicalNGConnectionItem.AMFUENGAPID.Value)
} else if ueAssociatedLogicalNGConnectionItem.RANUENGAPID != nil {
ran.Log.Tracef("RanUeNgapID[%d]", ueAssociatedLogicalNGConnectionItem.RANUENGAPID.Value)
ranUe = ran.RanUeFindByRanUeNgapID(ueAssociatedLogicalNGConnectionItem.RANUENGAPID.Value)
}
if ranUe == nil {
ran.Log.Warn("Cannot not find UE Context")
if ueAssociatedLogicalNGConnectionItem.AMFUENGAPID != nil {
ran.Log.Warnf("AmfUeNgapID[%d]", ueAssociatedLogicalNGConnectionItem.AMFUENGAPID.Value)
}
if ueAssociatedLogicalNGConnectionItem.RANUENGAPID != nil {
ran.Log.Warnf("RanUeNgapID[%d]", ueAssociatedLogicalNGConnectionItem.RANUENGAPID.Value)
}
}
err := ranUe.Remove()
if err != nil {
ran.Log.Error(err.Error())
}
}
ngap_message.SendNGResetAcknowledge(ran, partOfNGInterface, nil)
default:
ran.Log.Warnf("Invalid ResetType[%d]", resetType.Present)
}
}
func handleNGResetAcknowledgeMain(ran *context.AmfRan,
uEAssociatedLogicalNGConnectionList *ngapType.UEAssociatedLogicalNGConnectionList,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
if uEAssociatedLogicalNGConnectionList != nil {
ran.Log.Tracef("%d UE association(s) has been reset", len(uEAssociatedLogicalNGConnectionList.List))
for i, item := range uEAssociatedLogicalNGConnectionList.List {
if item.AMFUENGAPID != nil && item.RANUENGAPID != nil {
ran.Log.Tracef("%d: AmfUeNgapID[%d] RanUeNgapID[%d]", i+1, item.AMFUENGAPID.Value, item.RANUENGAPID.Value)
} else if item.AMFUENGAPID != nil {
ran.Log.Tracef("%d: AmfUeNgapID[%d] RanUeNgapID[-1]", i+1, item.AMFUENGAPID.Value)
} else if item.RANUENGAPID != nil {
ran.Log.Tracef("%d: AmfUeNgapID[-1] RanUeNgapID[%d]", i+1, item.RANUENGAPID.Value)
}
}
}
if criticalityDiagnostics != nil {
printCriticalityDiagnostics(ran, criticalityDiagnostics)
}
}
func handleUEContextReleaseCompleteMain(ran *context.AmfRan,
ranUe *context.RanUe,
userLocationInformation *ngapType.UserLocationInformation,
infoOnRecommendedCellsAndRANNodesForPaging *ngapType.InfoOnRecommendedCellsAndRANNodesForPaging,
pDUSessionResourceList *ngapType.PDUSessionResourceListCxtRelCpl,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
if ranUe == nil {
ran.Log.Error("ranUe is nil")
return
}
if userLocationInformation != nil {
ranUe.UpdateLocation(userLocationInformation)
}
if criticalityDiagnostics != nil {
printCriticalityDiagnostics(ran, criticalityDiagnostics)
}
amfUe := ranUe.AmfUe
if amfUe == nil {
ran.Log.Infof("Release UE Context : RanUe[AmfUeNgapId: %d]", ranUe.AmfUeNgapId)
err := ranUe.Remove()
if err != nil {
ran.Log.Errorln(err.Error())
}
return
}
// TODO: AMF shall, if supported, store it and may use it for subsequent paging
if infoOnRecommendedCellsAndRANNodesForPaging != nil {
amfUe.InfoOnRecommendedCellsAndRanNodesForPaging = new(context.InfoOnRecommendedCellsAndRanNodesForPaging)
recommendedCells := &amfUe.InfoOnRecommendedCellsAndRanNodesForPaging.RecommendedCells
for _, item := range infoOnRecommendedCellsAndRANNodesForPaging.RecommendedCellsForPaging.RecommendedCellList.List {
recommendedCell := context.RecommendedCell{}
switch item.NGRANCGI.Present {
case ngapType.NGRANCGIPresentNRCGI:
recommendedCell.NgRanCGI.Present = context.NgRanCgiPresentNRCGI
recommendedCell.NgRanCGI.NRCGI = new(models.Ncgi)
plmnID := ngapConvert.PlmnIdToModels(item.NGRANCGI.NRCGI.PLMNIdentity)
recommendedCell.NgRanCGI.NRCGI.PlmnId = &plmnID
recommendedCell.NgRanCGI.NRCGI.NrCellId = ngapConvert.BitStringToHex(&item.NGRANCGI.NRCGI.NRCellIdentity.Value)
case ngapType.NGRANCGIPresentEUTRACGI:
recommendedCell.NgRanCGI.Present = context.NgRanCgiPresentEUTRACGI
recommendedCell.NgRanCGI.EUTRACGI = new(models.Ecgi)
plmnID := ngapConvert.PlmnIdToModels(item.NGRANCGI.EUTRACGI.PLMNIdentity)
recommendedCell.NgRanCGI.EUTRACGI.PlmnId = &plmnID
recommendedCell.NgRanCGI.EUTRACGI.EutraCellId = ngapConvert.BitStringToHex(
&item.NGRANCGI.EUTRACGI.EUTRACellIdentity.Value)
}
if item.TimeStayedInCell != nil {
recommendedCell.TimeStayedInCell = new(int64)
*recommendedCell.TimeStayedInCell = *item.TimeStayedInCell
}
*recommendedCells = append(*recommendedCells, recommendedCell)
}
recommendedRanNodes := &amfUe.InfoOnRecommendedCellsAndRanNodesForPaging.RecommendedRanNodes
ranNodeList := infoOnRecommendedCellsAndRANNodesForPaging.RecommendRANNodesForPaging.RecommendedRANNodeList.List
for _, item := range ranNodeList {
recommendedRanNode := context.RecommendRanNode{}
switch item.AMFPagingTarget.Present {
case ngapType.AMFPagingTargetPresentGlobalRANNodeID:
recommendedRanNode.Present = context.RecommendRanNodePresentRanNode
recommendedRanNode.GlobalRanNodeId = new(models.GlobalRanNodeId)
// TODO: recommendedRanNode.GlobalRanNodeId = ngapConvert.RanIdToModels(item.AMFPagingTarget.GlobalRANNodeID)
case ngapType.AMFPagingTargetPresentTAI:
recommendedRanNode.Present = context.RecommendRanNodePresentTAI
tai := ngapConvert.TaiToModels(*item.AMFPagingTarget.TAI)
recommendedRanNode.Tai = &tai
}
*recommendedRanNodes = append(*recommendedRanNodes, recommendedRanNode)
}
}
// for each pduSessionID invoke Nsmf_PDUSession_UpdateSMContext Request
var cause context.CauseAll
if tmp, exist := amfUe.ReleaseCause[ran.AnType]; exist {
cause = *tmp
}
state := amfUe.State[ran.AnType]
if state == nil {
ranUe.Log.Warnf("UE state is nil (accessType=%q); skip GMM-Registered branch", ran.AnType)
} else if state.Is(context.Registered) {
ranUe.Log.Info("Release Ue Context in GMM-Registered")
// If this release cause by handover, no needs deactivate CN tunnel
if cause.NgapCause != nil && pDUSessionResourceList != nil {
for _, pduSessionReourceItem := range pDUSessionResourceList.List {
pduSessionID := int32(pduSessionReourceItem.PDUSessionID.Value)
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
// TODO: Check if doing error handling here
continue
}
response, _, _, err := consumer.GetConsumer().SendUpdateSmContextDeactivateUpCnxState(amfUe, smContext, cause)
if err != nil {
ran.Log.Errorf("Send Update SmContextDeactivate UpCnxState Error[%s]", err.Error())
} else if response == nil {
ran.Log.Errorln("Send Update SmContextDeactivate UpCnxState Error")
}
}
}
}
// TODO: stop timer and release RanUe context
// Remove UE N2 Connection
delete(amfUe.ReleaseCause, ran.AnType)
switch ranUe.ReleaseAction {
case context.UeContextN2NormalRelease:
ran.Log.Infof("Release UE[%s] Context : N2 Connection Release", amfUe.Supi)
// amfUe.DetachRanUe(ran.AnType)
err := ranUe.Remove()
if err != nil {
ran.Log.Errorln(err.Error())
}
case context.UeContextReleaseUeContext:
ran.Log.Infof("Release UE[%s] Context : Release Ue Context", amfUe.Supi)
amfUe.Lock.Lock()
gmm_common.RemoveAmfUe(amfUe, false)
amfUe.Lock.Unlock()
case context.UeContextReleaseHandover:
ran.Log.Infof("Release UE[%s] Context : Release for Handover", amfUe.Supi)
// TODO: it's a workaround, need to fix it.
targetRanUe := context.GetSelf().RanUeFindByAmfUeNgapID(ranUe.TargetUe.AmfUeNgapId)
context.DetachSourceUeTargetUe(ranUe)
err := ranUe.Remove()
if err != nil {
ran.Log.Errorln(err.Error())
}
gmm_common.AttachRanUeToAmfUeAndReleaseOldIfAny(amfUe, targetRanUe)
// Todo: remove indirect tunnel
default:
ran.Log.Errorf("Invalid Release Action[%d]", ranUe.ReleaseAction)
}
}
func handlePDUSessionResourceReleaseResponseMain(ran *context.AmfRan,
ranUe *context.RanUe,
pDUSessionResourceReleasedList *ngapType.PDUSessionResourceReleasedListRelRes,
userLocationInformation *ngapType.UserLocationInformation,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
if ranUe == nil {
ran.Log.Error("ranUe is nil")
return
}
if userLocationInformation != nil {
ranUe.UpdateLocation(userLocationInformation)
}
if criticalityDiagnostics != nil {
printCriticalityDiagnostics(ran, criticalityDiagnostics)
}
amfUe := ranUe.AmfUe
if amfUe == nil {
ranUe.Log.Error("amfUe is nil")
return
}
if pDUSessionResourceReleasedList != nil {
ranUe.Log.Infof("Send PDUSessionResourceReleaseResponseTransfer to SMF")
for _, item := range pDUSessionResourceReleasedList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceReleaseResponseTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
// TODO: Check if NAS (PDU Session Release Complete) comes before PDUSesstionResourceRelease
ranUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
// TODO: Check if doing error handling here
continue
}
_, responseErr, problemDetail, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_REL_RSP, transfer)
// TODO: error handling
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceReleaseResponse] Error: %+v", err)
} else if responseErr != nil && responseErr.JsonData.Error != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceReleaseResponse] Error: %+v",
responseErr.JsonData.Error.Cause)
} else if problemDetail != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceReleaseResponse] Failed: %+v", problemDetail)
}
}
}
}
func handleUERadioCapabilityCheckResponseMain(ran *context.AmfRan,
ranUe *context.RanUe,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
// TODO: handle iMSVoiceSupportIndicator
if criticalityDiagnostics != nil {
printCriticalityDiagnostics(ran, criticalityDiagnostics)
}
}
func handleLocationReportingFailureIndicationMain(ran *context.AmfRan,
ranUe *context.RanUe,
cause *ngapType.Cause,
) {
if cause != nil {
printAndGetCause(ran, cause)
}
}
func handleInitialUEMessageMain(ran *context.AmfRan,
message *ngapType.NGAPPDU,
rANUENGAPID *ngapType.RANUENGAPID,
nASPDU *ngapType.NASPDU,
userLocationInformation *ngapType.UserLocationInformation,
rRCEstablishmentCause *ngapType.RRCEstablishmentCause,
fiveGSTMSI *ngapType.FiveGSTMSI,
uEContextRequest *ngapType.UEContextRequest,
) {
ranUe := ran.RanUeFindByRanUeNgapID(rANUENGAPID.Value)
if ranUe != nil {
amfUe := ranUe.AmfUe
if amfUe != nil {
// The fact that an amfUe having N2 connection (ranUE) is receiving
// an Initial UE Message indicates there is something wrong,
// so the ranUe with wrong RAN-UE-NGAP-IP should be cleared and detached from the amfUe.
gmm_common.StopAll5GSMMTimers(amfUe)
amfUe.DetachRanUe(ran.AnType)
ranUe.DetachAmfUe()
}
err := ranUe.Remove()
if err != nil {
ran.Log.Errorln(err.Error())
}
}
var err error
ranUe, err = ran.NewRanUe(rANUENGAPID.Value)
if err != nil {
ran.Log.Errorf("NewRanUe Error: %+v", err)
}
ran.Log.Debugf("New RanUe [RanUeNgapID: %d]", ranUe.RanUeNgapId)
// Try to get identity from 5G-S-TMSI IE first; if not available, try to get identity from the plain NAS.
var id, idType string
var gmmMessage *nas.GmmMessage
var nasMsgType, regReqType uint8
// Get nasMsgType to send corresponding NAS reject to UE when amfUe is not found.
nasMsg, err := nas_security.DecodePlainNasNoIntegrityCheck(nASPDU.Value)
if err == nil && nasMsg.GmmMessage != nil {
gmmMessage = nasMsg.GmmMessage
nasMsgType = gmmMessage.GmmHeader.GetMessageType()
if gmmMessage.RegistrationRequest != nil {
regReqType = gmmMessage.RegistrationRequest.NgksiAndRegistrationType5GS.GetRegistrationType5GS()
}
}
if fiveGSTMSI != nil {
// <5G-S-TMSI> := <AMF Set ID><AMF Pointer><5G-TMSI>
// GUAMI := <MCC><MNC><AMF Region ID><AMF Set ID><AMF Pointer>
// 5G-GUTI := <GUAMI><5G-TMSI>
amfSetPtrID := hex.EncodeToString([]byte{
fiveGSTMSI.AMFSetID.Value.Bytes[0],
(fiveGSTMSI.AMFSetID.Value.Bytes[1] & 0xc0) | (fiveGSTMSI.AMFPointer.Value.Bytes[0] >> 2),
})
tmsi := hex.EncodeToString(fiveGSTMSI.FiveGTMSI.Value)
id = amfSetPtrID + tmsi
idType = "5G-S-TMSI"
ranUe.Log.Infof("Find 5G-S-TMSI [%q] in InitialUEMessage", id)
} else if regReqType == nasMessage.RegistrationType5GSInitialRegistration {
// NGAP 5G-S-TMSI IE might not be present in InitialUEMessage carrying Initial Registration.
// Need to get 5GSMobileIdentity from Initial Registration.
id, idType, err = amf_nas.GetNas5GSMobileIdentity(gmmMessage)
ran.Log.Infof("5GSMobileIdentity [%q:%q, err: %v]", idType, id, err)
} else {
// Missing NGAP 5G-S-TMSI IE
var iesCriticalityDiagnostics ngapType.CriticalityDiagnosticsIEList
ranUe.Log.Warnf("Missing 5G-S-TMSI IE in InitialUEMessage; send ErrorIndication")
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
ngapType.ProtocolIEIDFiveGSTMSI, ngapType.TypeOfErrorPresentMissing)
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
sendErrorMessage(ran, nil, rANUENGAPID, iesCriticalityDiagnostics)
ngap_message.SendUEContextReleaseCommand(ranUe, context.UeContextN2NormalRelease,
ngapType.CausePresentProtocol, ngapType.CauseProtocolPresentUnspecified)
return
}
// If id type is GUTI, since MAC can't be checked here (no amfUe context), the GUTI may not direct to the right amfUe.
// In this case, create a new amfUe to handle the following registration procedure.
isInvalidGUTI := (idType == "5G-GUTI")
amfUe, ok := findAmfUe(ran, id, idType)
if ok && !isInvalidGUTI {
// TODO: invoke Namf_Communication_UEContextTransfer if serving AMF has changed since
// last Registration Request procedure
// Described in TS 23.502 4.2.2.2.2 step 4 (without UDSF deployment)
ranUe.Log.Infof("find AmfUe [%q:%q]", idType, id)
// TODO: Redesign overlapping ongoing procedures before narrowing this to SMC-vs-N2 handover.
if procedure := amfUe.OnGoing(ran.AnType).Procedure; procedure == context.OnGoingProcedureN2Handover {
ranUe.Log.Warn("Reject InitialUEMessage because N2 handover is ongoing")
gmm_message.SendRegistrationReject(ranUe, nasMessage.Cause5GMMCongestion, "")
ngap_message.SendUEContextReleaseCommand(ranUe, context.UeContextN2NormalRelease,
ngapType.CausePresentNas, ngapType.CauseNasPresentNormalRelease)
return
}
ranUe.Log.Debugf("AmfUe Attach RanUe [RanUeNgapID: %d]", ranUe.RanUeNgapId)
ranUe.HoldingAmfUe = amfUe
} else if regReqType != nasMessage.RegistrationType5GSInitialRegistration {
if regReqType == nasMessage.RegistrationType5GSPeriodicRegistrationUpdating ||
regReqType == nasMessage.RegistrationType5GSMobilityRegistrationUpdating {
gmm_message.SendRegistrationReject(
ranUe, nasMessage.Cause5GMMImplicitlyDeregistered, "")
ranUe.Log.Warn("Send RegistrationReject [Cause5GMMImplicitlyDeregistered]")
} else if nasMsgType == nas.MsgTypeServiceRequest {
gmm_message.SendServiceReject(
ranUe, nil, nasMessage.Cause5GMMImplicitlyDeregistered)
ranUe.Log.Warn("Send ServiceReject [Cause5GMMImplicitlyDeregistered]")
}
ngap_message.SendUEContextReleaseCommand(ranUe, context.UeContextN2NormalRelease,
ngapType.CausePresentNas, ngapType.CauseNasPresentNormalRelease)
return
}
if userLocationInformation != nil {
ranUe.UpdateLocation(userLocationInformation)
}
if rRCEstablishmentCause != nil {
ranUe.Log.Tracef("[Initial UE Message] RRC Establishment Cause[%d]", rRCEstablishmentCause.Value)
ranUe.RRCEstablishmentCause = strconv.Itoa(int(rRCEstablishmentCause.Value))
}
if uEContextRequest != nil {
ran.Log.Debug("Trigger initial Context Setup procedure")
ranUe.UeContextRequest = true
// TODO: Trigger Initial Context Setup procedure
} else {
ranUe.UeContextRequest = factory.AmfConfig.Configuration.DefaultUECtxReq
}
// TS 23.502 4.2.2.2.3 step 6a Nnrf_NFDiscovery_Request (NF type, AMF Set)
// if aMFSetID != nil {
// TODO: This is a rerouted message
// TS 38.413: AMF shall, if supported, use the IE as described in TS 23.502
// }
// ng-ran propagate allowedNssai in the rerouted initial ue message (TS 38.413 8.6.5)
// TS 23.502 4.2.2.2.3 step 4a Nnssf_NSSelection_Get
// if allowedNSSAI != nil {
// TODO: AMF should use it as defined in TS 23.502
// }
pdu, err := libngap.Encoder(*message)
if err != nil {
ran.Log.Errorf("libngap Encoder Error: %+v", err)
}
ranUe.InitialUEMessage = pdu
amf_nas.HandleNAS(ranUe, ngapType.ProcedureCodeInitialUEMessage, nASPDU.Value, true)
}
func findAmfUe(ran *context.AmfRan, id, idType string) (*context.AmfUe, bool) {
var amfUe *context.AmfUe
var ok bool
amfSelf := context.GetSelf()
servedGuami := amfSelf.ServedGuamiList[0]
tmpRegionID, _, _ := ngapConvert.AmfIdToNgap(servedGuami.AmfId)
switch idType {
case "SUPI":
ran.Log.Debugf("SUPI %s", id)
amfUe, ok = amfSelf.AmfUeFindBySupi(id)
case "SUCI":
ran.Log.Debugf("SUCI %s", id)
amfUe, ok = amfSelf.AmfUeFindBySuci(id)
case "5G-GUTI":
ran.Log.Debugf("5G-GUTI %s", id)
amfUe, ok = amfSelf.AmfUeFindByGuti(id)
case "5G-S-TMSI":
id = servedGuami.PlmnId.Mcc + servedGuami.PlmnId.Mnc + ngapConvert.BitStringToHex(&tmpRegionID) + id
ran.Log.Debugf("5G-S-TMSI %s", id)
amfUe, ok = amfSelf.AmfUeFindByGuti(id)
}
return amfUe, ok
}
func sendErrorMessage(ran *context.AmfRan, amfUeNgapId *ngapType.AMFUENGAPID, ranUeNgapId *ngapType.RANUENGAPID,
iesCriticalityDiagnostics ngapType.CriticalityDiagnosticsIEList,
) {
ran.Log.Trace("Has missing reject IE(s)")
procedureCode := ngapType.ProcedureCodeInitialUEMessage
triggeringMessage := ngapType.TriggeringMessagePresentInitiatingMessage
procedureCriticality := ngapType.CriticalityPresentIgnore
criticalityDiagnostics := buildCriticalityDiagnostics(&procedureCode, &triggeringMessage, &procedureCriticality,
&iesCriticalityDiagnostics)
ngap_message.SendErrorIndication(ran, amfUeNgapId, ranUeNgapId, nil, &criticalityDiagnostics)
}
func handlePDUSessionResourceSetupResponseMain(ran *context.AmfRan,
ranUe *context.RanUe,
pDUSessionResourceSetupResponseList *ngapType.PDUSessionResourceSetupListSURes,
pDUSessionResourceFailedToSetupList *ngapType.PDUSessionResourceFailedToSetupListSURes,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
if ranUe == nil {
ran.Log.Error("ranUe is nil")
return
}
amfUe := ranUe.AmfUe
if amfUe == nil {
ranUe.Log.Error("amfUe is nil")
return
}
if pDUSessionResourceSetupResponseList != nil {
ranUe.Log.Trace("Send PDUSessionResourceSetupResponseTransfer to SMF")
for _, item := range pDUSessionResourceSetupResponseList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceSetupResponseTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Errorf("SmContext[PDU Session ID:%d] not found", pduSessionID)
continue
}
_, _, _, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_SETUP_RSP, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceSetupResponseTransfer] Error: %+v", err)
}
// RAN initiated QoS Flow Mobility in subclause 5.2.2.3.7
// if response != nil && response.BinaryDataN2SmInformation != nil {
// TODO: n2SmInfo send to RAN
// } else if response == nil {
// TODO: error handling
// }
}
}
if pDUSessionResourceFailedToSetupList != nil {
ranUe.Log.Trace("Send PDUSessionResourceSetupUnsuccessfulTransfer to SMF")
for _, item := range pDUSessionResourceFailedToSetupList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceSetupUnsuccessfulTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Errorf("SmContext[PDU Session ID:%d] not found", pduSessionID)
continue
}
_, _, _, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_SETUP_FAIL, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceSetupUnsuccessfulTransfer] Error: %+v", err)
}
// if response != nil && response.BinaryDataN2SmInformation != nil {
// TODO: n2SmInfo send to RAN
// } else if response == nil {
// TODO: error handling
// }
}
}
if criticalityDiagnostics != nil {
printCriticalityDiagnostics(ran, criticalityDiagnostics)
}
}
func handlePDUSessionResourceModifyResponseMain(ran *context.AmfRan,
ranUe *context.RanUe,
pduSessionResourceModifyResponseList *ngapType.PDUSessionResourceModifyListModRes,
pduSessionResourceFailedToModifyList *ngapType.PDUSessionResourceFailedToModifyListModRes,
userLocationInformation *ngapType.UserLocationInformation,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
if ranUe == nil {
ran.Log.Error("ranUe is nil")
return
}
amfUe := ranUe.AmfUe
if amfUe == nil {
ranUe.Log.Error("amfUe is nil")
return
}
if pduSessionResourceModifyResponseList != nil {
ranUe.Log.Trace("Send PDUSessionResourceModifyResponseTransfer to SMF")
for _, item := range pduSessionResourceModifyResponseList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceModifyResponseTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Errorf("SmContext[PDU Session ID:%d] not found", pduSessionID)
continue
}
_, _, _, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_MOD_RSP, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceModifyResponseTransfer] Error: %+v", err)
}
// if response != nil && response.BinaryDataN2SmInformation != nil {
// TODO: n2SmInfo send to RAN
// } else if response == nil {
// TODO: error handling
// }
}
}
if pduSessionResourceFailedToModifyList != nil {
ranUe.Log.Trace("Send PDUSessionResourceModifyUnsuccessfulTransfer to SMF")
for _, item := range pduSessionResourceFailedToModifyList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceModifyUnsuccessfulTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Errorf("SmContext[PDU Session ID:%d] not found", pduSessionID)
continue
}
_, _, _, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_MOD_FAIL, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceModifyUnsuccessfulTransfer] Error: %+v", err)
}
// if response != nil && response.BinaryDataN2SmInformation != nil {
// TODO: n2SmInfo send to RAN
// } else if response == nil {
// TODO: error handling
// }
}
}
if userLocationInformation != nil {
ranUe.UpdateLocation(userLocationInformation)
}
if criticalityDiagnostics != nil {
printCriticalityDiagnostics(ran, criticalityDiagnostics)
}
}
func handlePDUSessionResourceNotifyMain(ran *context.AmfRan,
ranUe *context.RanUe,
pDUSessionResourceNotifyList *ngapType.PDUSessionResourceNotifyList,
pDUSessionResourceReleasedListNot *ngapType.PDUSessionResourceReleasedListNot,
userLocationInformation *ngapType.UserLocationInformation,
) {
amfUe := ranUe.AmfUe
if amfUe == nil {
ranUe.Log.Error("amfUe is nil")
return
}
if userLocationInformation != nil {
ranUe.UpdateLocation(userLocationInformation)
}
if pDUSessionResourceNotifyList != nil {
ranUe.Log.Infof("Send PDUSessionResourceNotifyTransfer to SMF")
for _, item := range pDUSessionResourceNotifyList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceNotifyTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Errorf("SmContext[PDU Session ID:%d] not found", pduSessionID)
continue
}
response, errResponse, problemDetail, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_NTY, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceNotifyTransfer] Error: %+v", err)
}
if response != nil {
responseData := response.JsonData
n2Info := response.BinaryDataN1SmMessage
n1Msg := response.BinaryDataN2SmInformation
if n2Info != nil {
switch responseData.N2SmInfoType {
case models.N2SmInfoType_PDU_RES_MOD_REQ:
ranUe.Log.Debugln("AMF Transfer NGAP PDU Resource Modify Req from SMF")
var nasPdu []byte
if n1Msg != nil {
pduSessionId := uint8(pduSessionID)
nasPdu, err = gmm_message.BuildDLNASTransport(amfUe, ran.AnType, nasMessage.PayloadContainerTypeN1SMInfo,
n1Msg, pduSessionId, nil, nil, 0)
if err != nil {
ranUe.Log.Warnf("GMM Message build DL NAS Transport filaed: %v", err)
}
}
list := ngapType.PDUSessionResourceModifyListModReq{}
ngap_message.AppendPDUSessionResourceModifyListModReq(&list, pduSessionID, nasPdu, n2Info)
ngap_message.SendPDUSessionResourceModifyRequest(ranUe, list)
default:
}
}
} else if errResponse != nil {
errJSON := errResponse.JsonData
n1Msg := errResponse.BinaryDataN2SmInformation
ranUe.Log.Warnf("PDU Session Modification is rejected by SMF[pduSessionId:%d], Error[%s]\n",
pduSessionID, errJSON.Error.Cause)
if n1Msg != nil {
gmm_message.SendDLNASTransport(
ranUe, nasMessage.PayloadContainerTypeN1SMInfo, errResponse.BinaryDataN1SmMessage, pduSessionID, 0, nil, 0)
}
// TODO: handle n2 info transfer
} else if err != nil {
return
} else {
// TODO: error handling
ranUe.Log.Errorf("Failed to Update smContext[pduSessionID: %d], Error[%v]", pduSessionID, problemDetail)
return
}
}
}
if pDUSessionResourceReleasedListNot != nil {
ranUe.Log.Infof("Send PDUSessionResourceNotifyReleasedTransfer to SMF")
for _, item := range pDUSessionResourceReleasedListNot.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceNotifyReleasedTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
// TODO: Check if doing error handling here
continue
}
response, errResponse, problemDetail, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_NTY_REL, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceNotifyReleasedTransfer] Error: %+v", err)
}
if response != nil {
responseData := response.JsonData
n2Info := response.BinaryDataN1SmMessage
n1Msg := response.BinaryDataN2SmInformation
if n2Info != nil {
if responseData.N2SmInfoType == models.N2SmInfoType_PDU_RES_REL_CMD {
ranUe.Log.Debugln("AMF Transfer NGAP PDU Session Resource Rel Co from SMF")
var nasPdu []byte
if n1Msg != nil {
nasPdu, err = gmm_message.BuildDLNASTransport(
amfUe, ran.AnType, nasMessage.PayloadContainerTypeN1SMInfo, n1Msg,
uint8(pduSessionID), nil, nil, 0)
if err != nil {
ranUe.Log.Warnf("GMM Message build DL NAS Transport filaed: %v", err)
}
}
list := ngapType.PDUSessionResourceToReleaseListRelCmd{}
ngap_message.AppendPDUSessionResourceToReleaseListRelCmd(&list, pduSessionID, n2Info)
ngap_message.SendPDUSessionResourceReleaseCommand(ranUe, nasPdu, list)
}
}
} else if errResponse != nil {
errJSON := errResponse.JsonData
n1Msg := errResponse.BinaryDataN2SmInformation
ranUe.Log.Warnf("PDU Session Release is rejected by SMF[pduSessionID:%d], Error[%s]\n",
pduSessionID, errJSON.Error.Cause)
if n1Msg != nil {
gmm_message.SendDLNASTransport(
ranUe, nasMessage.PayloadContainerTypeN1SMInfo, errResponse.BinaryDataN1SmMessage, pduSessionID, 0, nil, 0)
}
} else if err != nil {
return
} else {
// TODO: error handling
ranUe.Log.Errorf("Failed to Update smContext[pduSessionID: %d], Error[%v]", pduSessionID, problemDetail)
return
}
}
}
}
func handlePDUSessionResourceModifyIndicationMain(ran *context.AmfRan,
ranUe *context.RanUe,
pduSessionResourceModifyIndicationList *ngapType.PDUSessionResourceModifyListModInd,
) {
amfUe := ranUe.AmfUe
if amfUe == nil {
ran.Log.Error("AmfUe is nil")
return
}
pduSessionResourceModifyListModCfm := ngapType.PDUSessionResourceModifyListModCfm{}
pduSessionResourceFailedToModifyListModCfm := ngapType.PDUSessionResourceFailedToModifyListModCfm{}
if pduSessionResourceModifyIndicationList != nil {
ran.Log.Infof("Send PDUSessionResourceModifyIndicationTransfer to SMF")
for _, item := range pduSessionResourceModifyIndicationList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceModifyIndicationTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
// TODO: Check if doing error handling here
continue
}
response, errResponse, _, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_MOD_IND, transfer)
if err != nil {
ran.Log.Errorf("SendUpdateSmContextN2Info Error:\n%s", err.Error())
}
if response != nil && response.BinaryDataN2SmInformation != nil {
ngap_message.AppendPDUSessionResourceModifyListModCfm(
&pduSessionResourceModifyListModCfm,
int64(pduSessionID), response.BinaryDataN2SmInformation)
}
if errResponse != nil && errResponse.BinaryDataN2SmInformation != nil {
ngap_message.AppendPDUSessionResourceFailedToModifyListModCfm(
&pduSessionResourceFailedToModifyListModCfm,
int64(pduSessionID), errResponse.BinaryDataN2SmInformation)
}
}
}
ngap_message.SendPDUSessionResourceModifyConfirm(ranUe, pduSessionResourceModifyListModCfm,
pduSessionResourceFailedToModifyListModCfm, nil)
}
func handleInitialContextSetupResponseMain(ran *context.AmfRan,
ranUe *context.RanUe,
pDUSessionResourceSetupResponseList *ngapType.PDUSessionResourceSetupListCxtRes,
pDUSessionResourceFailedToSetupList *ngapType.PDUSessionResourceFailedToSetupListCxtRes,
criticalityDiagnostics *ngapType.CriticalityDiagnostics,
) {
if ranUe == nil {
ran.Log.Error("ranUe is nil")
return
}
amfUe := ranUe.AmfUe
if amfUe == nil {
ran.Log.Error("amfUe is nil")
return
}
ran.Log.Tracef("RanUeNgapID[%d] AmfUeNgapID[%d]", ranUe.RanUeNgapId, ranUe.AmfUeNgapId)
ranUe.InitialContextSetup = true
if pDUSessionResourceSetupResponseList != nil {
ranUe.Log.Infof("Send PDUSessionResourceSetupResponseTransfer to SMF")
for _, item := range pDUSessionResourceSetupResponseList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceSetupResponseTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)
if !ok {
ranUe.Log.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
// TODO: Check if doing error handling here
continue
}
_, _, _, err := consumer.GetConsumer().SendUpdateSmContextN2Info(amfUe, smContext,
models.N2SmInfoType_PDU_RES_SETUP_RSP, transfer)
if err != nil {
ranUe.Log.Errorf("SendUpdateSmContextN2Info[PDUSessionResourceSetupResponseTransfer] Error: %+v", err)
}
// RAN initiated QoS Flow Mobility in subclause 5.2.2.3.7
// if response != nil && response.BinaryDataN2SmInformation != nil {
// TODO: n2SmInfo send to RAN
// } else if response == nil {
// TODO: error handling
// }
}
}
if pDUSessionResourceFailedToSetupList != nil {
ranUe.Log.Infof("Send PDUSessionResourceSetupUnsuccessfulTransfer to SMF")
for _, item := range pDUSessionResourceFailedToSetupList.List {
pduSessionID := int32(item.PDUSessionID.Value)
transfer := item.PDUSessionResourceSetupUnsuccessfulTransfer
smContext, ok := amfUe.SmContextFindByPDUSessionID(pduSessionID)