Skip to content

Commit 8b127d5

Browse files
jeffjeff
authored andcommitted
fix: recover go.mod & linter fix
1 parent cc20ecb commit 8b127d5

4 files changed

Lines changed: 33 additions & 23 deletions

File tree

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ require (
2424
gopkg.in/yaml.v2 v2.4.0
2525
)
2626

27-
replace github.com/free5gc/amf => ../amf
28-
2927
require (
3028
github.com/aead/cmac v0.0.0-20160719120800-7af84192f0b1 // indirect
3129
github.com/bytedance/sonic v1.11.5 // indirect

internal/ngap/handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,8 @@ func handleHandoverRequestAcknowledgeMain(ran *context.AmfRan,
14841484
}
14851485
for _, eventSub := range amfUe.EventSubscriptionsInfo {
14861486
if eventSub.EventSubscription != nil {
1487-
ueContextCreatedData.UeContext.EventSubscriptionList = append(ueContextCreatedData.UeContext.EventSubscriptionList, *eventSub.EventSubscription)
1487+
ueContextCreatedData.UeContext.EventSubscriptionList = append(
1488+
ueContextCreatedData.UeContext.EventSubscriptionList, *eventSub.EventSubscription)
14881489
}
14891490
}
14901491
if amfUe.TraceData != nil {
@@ -1664,7 +1665,8 @@ func handleHandoverRequiredMain(ran *context.AmfRan,
16641665
ueContextCreateData.SourceToTargetData.NgapData.ContentId = "N2SmInfo"
16651666

16661667
ueContextCreateData.N2NotifyUri = ""
1667-
ueContextCreatedData, targetToSourceTransparentContainer, problemDetails, err := consumer.GetConsumer().CreateUEContextRequest(amfUe, ueContextCreateData)
1668+
ueContextCreatedData, targetToSourceTransparentContainer,
1669+
problemDetails, err := consumer.GetConsumer().CreateUEContextRequest(amfUe, ueContextCreateData)
16681670

16691671
if problemDetails != nil {
16701672
// get UeContextCreateError (HANDOVER FAILURE) from target AMF.

internal/sbi/consumer/amf_service.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ func (s *namfService) buildAmPolicyReqTriggers(
153153
}
154154

155155
func (s *namfService) CreateUEContextRequest(ue *amf_context.AmfUe, ueContextCreateData models.UeContextCreateData) (
156-
ueContextCreatedData *models.UeContextCreatedData, targetToSourceTransparentContainer *ngapType.TargetToSourceTransparentContainer, problemDetails *models.ProblemDetails, err error,
156+
ueContextCreatedData *models.UeContextCreatedData,
157+
targetToSourceTransparentContainer *ngapType.TargetToSourceTransparentContainer,
158+
problemDetails *models.ProblemDetails,
159+
err error,
157160
) {
158161
client := s.getComClient(ue.TargetAmfUri)
159162
if client == nil {
@@ -179,19 +182,18 @@ func (s *namfService) CreateUEContextRequest(ue *amf_context.AmfUe, ueContextCre
179182
logger.ConsumerLog.Debugf("UeContextCreatedData: %+v", *ueContextCreatedData)
180183

181184
if res.CreateUeContextResponse201.BinaryDataN2Information != nil {
182-
pdu, err := ngap.Decoder(res.CreateUeContextResponse201.BinaryDataN2Information)
183-
if err != nil &&
185+
pdu, errNgapDecoder := ngap.Decoder(res.CreateUeContextResponse201.BinaryDataN2Information)
186+
if errNgapDecoder != nil &&
184187
pdu.Present == ngapType.NGAPPDUPresentSuccessfulOutcome &&
185188
pdu.SuccessfulOutcome.ProcedureCode.Value == ngapType.ProcedureCodeHandoverResourceAllocation {
186189
handoverRequestAcknowledge := pdu.SuccessfulOutcome.Value.HandoverRequestAcknowledge
187190
for _, ie := range handoverRequestAcknowledge.ProtocolIEs.List {
188-
switch ie.Id.Value {
189-
case ngapType.ProtocolIEIDTargetToSourceTransparentContainer:
191+
if ie.Id.Value == ngapType.ProtocolIEIDTargetToSourceTransparentContainer {
190192
targetToSourceTransparentContainer = ie.Value.TargetToSourceTransparentContainer
191193
}
192194
}
193-
} else if err != nil {
194-
return nil, nil, nil, err
195+
} else if errNgapDecoder != nil {
196+
return nil, nil, nil, errNgapDecoder
195197
}
196198
}
197199
} else {

internal/sbi/processor/ue_context.go

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ func (p *Processor) CreateUEContextProcedure(ueContextID string, createUeContext
323323
logger.CommLog.Warnf("Not comprehended IE ID 0x%04x (criticality: notify)", ie.Id.Value)
324324
}
325325
if ie.Criticality.Value != ngapType.CriticalityPresentIgnore {
326-
item := buildCriticalityDiagnosticsIEItem(ie.Criticality.Value, ie.Id.Value, ngapType.TypeOfErrorPresentNotUnderstood)
326+
item := buildCriticalityDiagnosticsIEItem(
327+
ie.Criticality.Value, ie.Id.Value, ngapType.TypeOfErrorPresentNotUnderstood)
327328
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
328329
if ie.Criticality.Value == ngapType.CriticalityPresentReject {
329330
abort = true
@@ -334,37 +335,43 @@ func (p *Processor) CreateUEContextProcedure(ueContextID string, createUeContext
334335

335336
if aMFUENGAPID == nil {
336337
logger.CommLog.Error("Missing IE AMF-UE-NGAP-ID")
337-
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject, ngapType.ProtocolIEIDAMFUENGAPID, ngapType.TypeOfErrorPresentMissing)
338+
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
339+
ngapType.ProtocolIEIDAMFUENGAPID, ngapType.TypeOfErrorPresentMissing)
338340
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
339341
abort = true
340342
}
341343
if rANUENGAPID == nil {
342344
logger.CommLog.Error("Missing IE RAN-UE-NGAP-ID")
343-
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject, ngapType.ProtocolIEIDRANUENGAPID, ngapType.TypeOfErrorPresentMissing)
345+
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
346+
ngapType.ProtocolIEIDRANUENGAPID, ngapType.TypeOfErrorPresentMissing)
344347
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
345348
abort = true
346349
}
347350
if handoverType == nil {
348351
logger.CommLog.Error("Missing IE HandoverType")
349-
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject, ngapType.ProtocolIEIDHandoverType, ngapType.TypeOfErrorPresentMissing)
352+
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
353+
ngapType.ProtocolIEIDHandoverType, ngapType.TypeOfErrorPresentMissing)
350354
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
351355
abort = true
352356
}
353357
if targetID == nil {
354358
logger.CommLog.Error("Missing IE TargetID")
355-
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject, ngapType.ProtocolIEIDTargetID, ngapType.TypeOfErrorPresentMissing)
359+
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
360+
ngapType.ProtocolIEIDTargetID, ngapType.TypeOfErrorPresentMissing)
356361
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
357362
abort = true
358363
}
359364
if pDUSessionResourceListHORqd == nil {
360365
logger.CommLog.Error("Missing IE PDUSessionResourceListHORqd")
361-
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject, ngapType.ProtocolIEIDPDUSessionResourceListHORqd, ngapType.TypeOfErrorPresentMissing)
366+
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
367+
ngapType.ProtocolIEIDPDUSessionResourceListHORqd, ngapType.TypeOfErrorPresentMissing)
362368
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
363369
abort = true
364370
}
365371
if sourceToTargetTransparentContainer == nil {
366372
logger.CommLog.Error("Missing IE SourceToTarget-TransparentContainer")
367-
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject, ngapType.ProtocolIEIDSourceToTargetTransparentContainer, ngapType.TypeOfErrorPresentMissing)
373+
item := buildCriticalityDiagnosticsIEItem(ngapType.CriticalityPresentReject,
374+
ngapType.ProtocolIEIDSourceToTargetTransparentContainer, ngapType.TypeOfErrorPresentMissing)
368375
iesCriticalityDiagnostics.List = append(iesCriticalityDiagnostics.List, item)
369376
abort = true
370377
}
@@ -405,16 +412,16 @@ func (p *Processor) CreateUEContextProcedure(ueContextID string, createUeContext
405412
continue
406413
}
407414

408-
smContext, ok := ue.SmContextFindByPDUSessionID(pduSessionID)
409-
if !ok {
415+
smContext, okSmContextFound := ue.SmContextFindByPDUSessionID(pduSessionID)
416+
if !okSmContextFound {
410417
logger.CommLog.Warnf("SmContext[PDU Session ID:%d] not found", pduSessionID)
411418
// TODO: Check if doing error handling here
412419
continue
413420
}
414421

415-
updateSmContextResponse200, _, _, err := p.Consumer().
422+
updateSmContextResponse200, _, _, errSendUpdateSmContext := p.Consumer().
416423
SendUpdateSmContextHandoverBetweenAMF(ue, smContext, amfSelf.Name, &amfSelf.ServedGuamiList[0], false)
417-
if err != nil {
424+
if errSendUpdateSmContext != nil {
418425
logger.CommLog.Errorf("consumer.GetConsumer().SendUpdateSmContextN2HandoverPreparing Error: %+v", err)
419426
}
420427
if updateSmContextResponse200 == nil {
@@ -447,7 +454,8 @@ func (p *Processor) CreateUEContextProcedure(ueContextID string, createUeContext
447454
},
448455
}
449456
}
450-
ngap_message.SendHandoverRequest(ue.RanUe[ue.GetAnType()], targetRan, *cause, pduSessionReqList, *sourceToTargetTransparentContainer, false)
457+
ngap_message.SendHandoverRequest(
458+
ue.RanUe[ue.GetAnType()], targetRan, *cause, pduSessionReqList, *sourceToTargetTransparentContainer, false)
451459

452460
// waiting for handover request acknowledge handler to finish.
453461
var createUeContextResponse context.PendingHandoverResponse

0 commit comments

Comments
 (0)