Skip to content

Commit

Permalink
fix: missing nf res in registernf and type assertion in smf
Browse files Browse the repository at this point in the history
  • Loading branch information
donald1218 committed Oct 24, 2024
1 parent db8f201 commit bafc221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/sbi/consumer/nrf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func (s *nnrfService) SendRegisterNFInstance(ctx context.Context, nrfUri, nfInst
} else {
// NFRegister
resourceUri := res.Location
nf = res.NrfNfManagementNfProfile
index := strings.Index(resourceUri, "/nnrf-nfm/")
if index >= 0 {
resouceNrfUri = resourceUri[:index]
Expand Down Expand Up @@ -322,10 +323,14 @@ func (s *nnrfService) SendDeregisterNFInstance() (problemDetails *models.Problem

_, err = client.NFInstanceIDDocumentApi.DeregisterNFInstance(ctx, request)
if err != nil {
logger.CommLog.Error("test0")
if apiErr, ok := err.(openapi.GenericOpenAPIError); ok {
// API error
logger.CommLog.Error("test1")
derigister_err := apiErr.Model().(Nnrf_NFManagement.DeregisterNFInstanceError)
problemDetails = &derigister_err.ProblemDetails
logger.CommLog.Error("test2")
logger.CommLog.Error(problemDetails)
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/consumer/smf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (s *nsmfService) SendCreateSmContextRequest(ue *amf_context.AmfUe, smContex
err1 = localErr
if apiErr, ok := localErr.(openapi.GenericOpenAPIError); ok {
// API error
posterr := apiErr.Model().(*Nsmf_PDUSession.PostSmContextsError)
posterr := apiErr.Model().(Nsmf_PDUSession.PostSmContextsError)
problemDetail = &posterr.ProblemDetails
errorResponse = &posterr.PostSmContextsError
}
Expand Down

0 comments on commit bafc221

Please sign in to comment.