From ba4224dffbc5feb19bef0f12a4518a22a8640192 Mon Sep 17 00:00:00 2001 From: CTFang Date: Wed, 24 Apr 2024 15:12:16 +0800 Subject: [PATCH 1/8] chore: create commit-msg-check.yml --- .github/workflows/commit-msg-check.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/commit-msg-check.yml diff --git a/.github/workflows/commit-msg-check.yml b/.github/workflows/commit-msg-check.yml new file mode 100644 index 0000000..deac704 --- /dev/null +++ b/.github/workflows/commit-msg-check.yml @@ -0,0 +1,15 @@ +name: 'Commit Message Check' + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: webiny/action-conventional-commits@v1.3.0 From 835a6e4ed02b379aa07c8d948ed9e231bf40bfb8 Mon Sep 17 00:00:00 2001 From: CTFang Date: Wed, 24 Apr 2024 15:15:30 +0800 Subject: [PATCH 2/8] fix: fix golangci-lint.yml typo --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 148550b..4fdc07a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,4 +1,4 @@ -go langname: golangci-lint +name: golangci-lint on: push: From a17b106c78a6fb93b8aa2aea1e80a677d98cd4ac Mon Sep 17 00:00:00 2001 From: CTFang Date: Wed, 24 Apr 2024 15:23:21 +0800 Subject: [PATCH 3/8] fix: Update .golangci.yml --- .golangci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 02ed57d..95b8615 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -44,7 +44,7 @@ run: # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: colored-line-number + formats: colored-line-number # print lines of code with issue, default is true print-issued-lines: true # print linter name in the end of issue text, default is true @@ -161,9 +161,8 @@ linters-settings: # enable or disable analyzers by name enable: - atomicalign - enable-all: false - disable: - shadow + enable-all: false disable-all: false depguard: list-type: blacklist From 30d7126bb3a983bd54bd17af4544ec11ddb370d9 Mon Sep 17 00:00:00 2001 From: CTFang Date: Wed, 24 Apr 2024 15:25:50 +0800 Subject: [PATCH 4/8] fix: fix linter error --- internal/nas/nas_security/security.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/nas/nas_security/security.go b/internal/nas/nas_security/security.go index a7d993c..1d08c4c 100644 --- a/internal/nas/nas_security/security.go +++ b/internal/nas/nas_security/security.go @@ -211,7 +211,6 @@ func Decode(ue *context.AmfUe, accessType models.AccessType, payload []byte, } err = msg.PlainNasDecode(&payload) - if err != nil { return nil, false, err } From 067f07f69c81bf9cc47e459929f3be910e40762b Mon Sep 17 00:00:00 2001 From: donald1218 Date: Wed, 24 Apr 2024 08:40:50 +0000 Subject: [PATCH 5/8] fix: NewApp slice parameter to func(*AmfApp) --- cmd/main.go | 2 +- pkg/service/init.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 43a5d50..7e17408 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -187,7 +187,7 @@ func action(cliCtx *cli.Context) error { callback.SendAmfStatusChangeNotify((string)(models.StatusChange_UNAVAILABLE), amfSelf.ServedGuamiList) } - amf, err := service.NewApp(cfg, ([]func(*service.AmfApp){appStart, appStop})) + amf, err := service.NewApp(cfg, appStart, appStop) if err != nil { return err } diff --git a/pkg/service/init.go b/pkg/service/init.go index 1089d7e..22b947b 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -32,11 +32,11 @@ func GetApp() *AmfApp { return AMF } -func NewApp(cfg *factory.Config, funcs []func(*AmfApp)) (*AmfApp, error) { +func NewApp(cfg *factory.Config, startFunc, terminateFunc func(*AmfApp)) (*AmfApp, error) { amf := &AmfApp{ cfg: cfg, - start: funcs[0], - stop: funcs[1], + start: startFunc, + stop: terminateFunc, } amf.SetLogEnable(cfg.GetLogEnable()) amf.SetLogLevel(cfg.GetLogLevel()) From 3a37c66c5a27dd0fdcbcd210c3d080b3d5043385 Mon Sep 17 00:00:00 2001 From: donald1218 Date: Wed, 24 Apr 2024 12:40:07 +0000 Subject: [PATCH 6/8] fix: fix fuzzy test --- .gitignore | 3 + go.mod | 1 + go.sum | 4 +- internal/nas/fuzz_test.go | 14 +++ internal/sbi/consumer/ausf_service.go | 3 + pkg/service/init.go | 15 +++- pkg/service/mock.go | 123 ++++++++++++++++++++++++++ 7 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 pkg/service/mock.go diff --git a/.gitignore b/.gitignore index c294e4d..b24c208 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ cscope.* # Debug *.log *.pcap + +# R17 +openapi \ No newline at end of file diff --git a/go.mod b/go.mod index bb1737d..6295348 100644 --- a/go.mod +++ b/go.mod @@ -57,6 +57,7 @@ require ( github.com/tim-ywliu/nested-logrus-formatter v1.3.2 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + go.uber.org/mock v0.4.0 // indirect golang.org/x/arch v0.7.0 // indirect golang.org/x/crypto v0.22.0 // indirect golang.org/x/net v0.24.0 // indirect diff --git a/go.sum b/go.sum index 91b6473..dbef3cc 100644 --- a/go.sum +++ b/go.sum @@ -127,6 +127,8 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc= golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= @@ -156,4 +158,4 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= \ No newline at end of file +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/nas/fuzz_test.go b/internal/nas/fuzz_test.go index 8c533d6..22c593a 100644 --- a/internal/nas/fuzz_test.go +++ b/internal/nas/fuzz_test.go @@ -7,10 +7,13 @@ import ( "testing" "github.com/stretchr/testify/require" + "go.uber.org/mock/gomock" amf_context "github.com/free5gc/amf/internal/context" "github.com/free5gc/amf/internal/logger" amf_nas "github.com/free5gc/amf/internal/nas" + "github.com/free5gc/amf/internal/sbi/consumer" + "github.com/free5gc/amf/pkg/service" "github.com/free5gc/nas" "github.com/free5gc/nas/nasMessage" "github.com/free5gc/nas/nasType" @@ -129,6 +132,7 @@ func FuzzHandleNAS2(f *testing.F) { Tac: "1", } amfSelf.SupportTaiLists = []models.Tai{tai} + amfSelf.NrfUri = "test" msg := nas.NewMessage() msg.GmmMessage = nas.NewGmmMessage() @@ -211,6 +215,16 @@ func FuzzHandleNAS2(f *testing.F) { f.Add(buf) f.Fuzz(func(t *testing.T, d []byte) { + ctrl := gomock.NewController(t) + m := service.NewMockApp(ctrl) + service.AMF = m + c, err := consumer.NewConsumer(m) + require.NoError(t, err) + m.EXPECT(). + Consumer(). + AnyTimes(). + Return(c) + ue := new(amf_context.RanUe) ue.Ran = new(amf_context.AmfRan) ue.Ran.AnType = models.AccessType__3_GPP_ACCESS diff --git a/internal/sbi/consumer/ausf_service.go b/internal/sbi/consumer/ausf_service.go index e9427b4..daea7cd 100644 --- a/internal/sbi/consumer/ausf_service.go +++ b/internal/sbi/consumer/ausf_service.go @@ -51,6 +51,9 @@ func (s *nausfService) SendUEAuthenticationAuthenticateRequest(ue *amf_context.A resynchronizationInfo *models.ResynchronizationInfo, ) (*models.UeAuthenticationCtx, *models.ProblemDetails, error) { client := s.getUEAuthenticationClient(ue.AusfUri) + if client == nil { + return nil, nil, openapi.ReportError("ausf not found") + } amfSelf := amf_context.GetSelf() servedGuami := amfSelf.ServedGuamiList[0] diff --git a/pkg/service/init.go b/pkg/service/init.go index 22b947b..6a2fad6 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -13,6 +13,17 @@ import ( "github.com/free5gc/amf/pkg/factory" ) +var _ App = &AmfApp{} + +type App interface { + Start(tlsKeyLogPath string) + Terminate() + Config() *factory.Config + Context() *amf_context.AMFContext + CancelContext() context.Context + Consumer() *consumer.Consumer +} + type AmfApp struct { cfg *factory.Config amfCtx *amf_context.AMFContext @@ -26,9 +37,9 @@ type AmfApp struct { stop func(*AmfApp) } -var AMF *AmfApp +var AMF App -func GetApp() *AmfApp { +func GetApp() App { return AMF } diff --git a/pkg/service/mock.go b/pkg/service/mock.go new file mode 100644 index 0000000..1a9635c --- /dev/null +++ b/pkg/service/mock.go @@ -0,0 +1,123 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: init.go +// +// Generated by this command: +// +// mockgen -source=init.go -package=service -destination interface.go +// + +// Package service is a generated GoMock package. +package service + +import ( + context "context" + reflect "reflect" + + context0 "github.com/free5gc/amf/internal/context" + consumer "github.com/free5gc/amf/internal/sbi/consumer" + factory "github.com/free5gc/amf/pkg/factory" + gomock "go.uber.org/mock/gomock" +) + +// MockApp is a mock of App interface. +type MockApp struct { + ctrl *gomock.Controller + recorder *MockAppMockRecorder +} + +// MockAppMockRecorder is the mock recorder for MockApp. +type MockAppMockRecorder struct { + mock *MockApp +} + +// NewMockApp creates a new mock instance. +func NewMockApp(ctrl *gomock.Controller) *MockApp { + mock := &MockApp{ctrl: ctrl} + mock.recorder = &MockAppMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockApp) EXPECT() *MockAppMockRecorder { + return m.recorder +} + +// CancelContext mocks base method. +func (m *MockApp) CancelContext() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelContext") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// CancelContext indicates an expected call of CancelContext. +func (mr *MockAppMockRecorder) CancelContext() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelContext", reflect.TypeOf((*MockApp)(nil).CancelContext)) +} + +// Config mocks base method. +func (m *MockApp) Config() *factory.Config { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Config") + ret0, _ := ret[0].(*factory.Config) + return ret0 +} + +// Config indicates an expected call of Config. +func (mr *MockAppMockRecorder) Config() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Config", reflect.TypeOf((*MockApp)(nil).Config)) +} + +// Consumer mocks base method. +func (m *MockApp) Consumer() *consumer.Consumer { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Consumer") + ret0, _ := ret[0].(*consumer.Consumer) + return ret0 +} + +// Consumer indicates an expected call of Consumer. +func (mr *MockAppMockRecorder) Consumer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Consumer", reflect.TypeOf((*MockApp)(nil).Consumer)) +} + +// Context mocks base method. +func (m *MockApp) Context() *context0.AMFContext { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(*context0.AMFContext) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockAppMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockApp)(nil).Context)) +} + +// Start mocks base method. +func (m *MockApp) Start(tlsKeyLogPath string) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Start", tlsKeyLogPath) +} + +// Start indicates an expected call of Start. +func (mr *MockAppMockRecorder) Start(tlsKeyLogPath any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*MockApp)(nil).Start), tlsKeyLogPath) +} + +// Terminate mocks base method. +func (m *MockApp) Terminate() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "Terminate") +} + +// Terminate indicates an expected call of Terminate. +func (mr *MockAppMockRecorder) Terminate() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Terminate", reflect.TypeOf((*MockApp)(nil).Terminate)) +} From bc8b9c75e865b76e31b0cda5b7a31c61fce7b3f0 Mon Sep 17 00:00:00 2001 From: "CTFang@WireLab" Date: Thu, 25 Apr 2024 04:23:43 +0000 Subject: [PATCH 7/8] fix: get client check not nil --- internal/gmm/handler.go | 7 ++-- internal/sbi/consumer/amf_service.go | 16 ++++++++- internal/sbi/consumer/ausf_service.go | 6 ++++ internal/sbi/consumer/nrf_service.go | 16 ++++++--- internal/sbi/consumer/nssf_service.go | 6 ++++ internal/sbi/consumer/pcf_service.go | 22 ++++++++++--- internal/sbi/consumer/smf_service.go | 11 ++++++- internal/sbi/consumer/udm_service.go | 47 ++++++++++++++++++++++----- pkg/service/init.go | 13 ++++---- 9 files changed, 114 insertions(+), 30 deletions(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index 7312358..214027f 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -17,7 +17,10 @@ import ( "github.com/pkg/errors" "github.com/free5gc/amf/internal/context" + gmm_common "github.com/free5gc/amf/internal/gmm/common" + gmm_message "github.com/free5gc/amf/internal/gmm/message" "github.com/free5gc/amf/internal/logger" + ngap_message "github.com/free5gc/amf/internal/ngap/message" "github.com/free5gc/amf/internal/sbi/producer/callback" "github.com/free5gc/amf/internal/util" "github.com/free5gc/amf/pkg/factory" @@ -33,10 +36,6 @@ import ( "github.com/free5gc/openapi/Nnrf_NFDiscovery" "github.com/free5gc/openapi/models" "github.com/free5gc/util/fsm" - - gmm_common "github.com/free5gc/amf/internal/gmm/common" - gmm_message "github.com/free5gc/amf/internal/gmm/message" - ngap_message "github.com/free5gc/amf/internal/ngap/message" ) const psiArraySize = 16 diff --git a/internal/sbi/consumer/amf_service.go b/internal/sbi/consumer/amf_service.go index bea75a8..ef25044 100644 --- a/internal/sbi/consumer/amf_service.go +++ b/internal/sbi/consumer/amf_service.go @@ -128,7 +128,9 @@ func (s *namfService) BuildUeContextModel(ue *amf_context.AmfUe) (ueContext mode return ueContext } -func (s *namfService) buildAmPolicyReqTriggers(triggers []models.RequestTrigger) (amPolicyReqTriggers []models.AmPolicyReqTrigger) { +func (s *namfService) buildAmPolicyReqTriggers( + triggers []models.RequestTrigger, +) (amPolicyReqTriggers []models.AmPolicyReqTrigger) { for _, trigger := range triggers { switch trigger { case models.RequestTrigger_LOC_CH: @@ -148,6 +150,9 @@ func (s *namfService) CreateUEContextRequest(ue *amf_context.AmfUe, ueContextCre ueContextCreatedData *models.UeContextCreatedData, problemDetails *models.ProblemDetails, err error, ) { client := s.getComClient(ue.TargetAmfUri) + if client == nil { + return nil, nil, openapi.ReportError("amf not found") + } req := models.CreateUeContextRequest{ JsonData: &ueContextCreateData, @@ -185,6 +190,9 @@ func (s *namfService) ReleaseUEContextRequest(ue *amf_context.AmfUe, ngapCause m problemDetails *models.ProblemDetails, err error, ) { client := s.getComClient(ue.TargetAmfUri) + if client == nil { + return nil, openapi.ReportError("amf not found") + } var ueContextId string if ue.Supi != "" { @@ -234,6 +242,9 @@ func (s *namfService) UEContextTransferRequest( ueContextTransferRspData *models.UeContextTransferRspData, problemDetails *models.ProblemDetails, err error, ) { client := s.getComClient(ue.TargetAmfUri) + if client == nil { + return nil, nil, openapi.ReportError("amf not found") + } ueContextTransferReqData := models.UeContextTransferReqData{ Reason: transferReason, @@ -289,6 +300,9 @@ func (s *namfService) RegistrationStatusUpdate(ue *amf_context.AmfUe, request mo regStatusTransferComplete bool, problemDetails *models.ProblemDetails, err error, ) { client := s.getComClient(ue.TargetAmfUri) + if client == nil { + return false, nil, openapi.ReportError("amf not found") + } ueContextId := fmt.Sprintf("5g-guti-%s", ue.Guti) diff --git a/internal/sbi/consumer/ausf_service.go b/internal/sbi/consumer/ausf_service.go index daea7cd..8ba38b2 100644 --- a/internal/sbi/consumer/ausf_service.go +++ b/internal/sbi/consumer/ausf_service.go @@ -106,6 +106,9 @@ func (s *nausfService) SendAuth5gAkaConfirmRequest(ue *amf_context.AmfUe, resSta } client := s.getUEAuthenticationClient(ausfUri) + if client == nil { + return nil, nil, openapi.ReportError("ausf not found") + } confirmData := &Nausf_UEAuthentication.UeAuthenticationsAuthCtxId5gAkaConfirmationPutParamOpts{ ConfirmationData: optional.NewInterface(models.ConfirmationData{ @@ -154,6 +157,9 @@ func (s *nausfService) SendEapAuthConfirmRequest(ue *amf_context.AmfUe, eapMsg n ausfUri := fmt.Sprintf("%s://%s", confirmUri.Scheme, confirmUri.Host) client := s.getUEAuthenticationClient(ausfUri) + if client == nil { + return nil, nil, openapi.ReportError("ausf not found") + } eapSessionReq := &Nausf_UEAuthentication.EapAuthMethodParamOpts{ EapSession: optional.NewInterface(models.EapSession{ diff --git a/internal/sbi/consumer/nrf_service.go b/internal/sbi/consumer/nrf_service.go index d2b1d0a..1bf4e8b 100644 --- a/internal/sbi/consumer/nrf_service.go +++ b/internal/sbi/consumer/nrf_service.go @@ -77,6 +77,9 @@ func (s *nnrfService) SendSearchNFInstances(nrfUri string, targetNfType, request ) (*models.SearchResult, error) { // Set client and set url client := s.getNFDiscClient(nrfUri) + if client == nil { + return nil, openapi.ReportError("nrf not found") + } ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_DISC, models.NfType_NRF) if err != nil { @@ -238,6 +241,9 @@ func (s *nnrfService) SendRegisterNFInstance(nrfUri, nfInstanceId string, profil ) { // Set client and set url client := s.getNFManagementClient(nrfUri) + if client == nil { + return "", "", openapi.ReportError("nrf not found") + } var res *http.Response var nf models.NfProfile @@ -290,16 +296,18 @@ func (s *nnrfService) SendRegisterNFInstance(nrfUri, nfInstanceId string, profil func (s *nnrfService) SendDeregisterNFInstance() (problemDetails *models.ProblemDetails, err error) { logger.ConsumerLog.Infof("[AMF] Send Deregister NFInstance") + amfContext := s.consumer.amf.Context() + + client := s.getNFManagementClient(amfContext.NrfUri) + if client == nil { + return nil, openapi.ReportError("nrf not found") + } ctx, pd, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NNRF_NFM, models.NfType_NRF) if err != nil { return pd, err } - amfContext := s.consumer.amf.Context() - // Set client and set url - client := s.getNFManagementClient(amfContext.NrfUri) - var res *http.Response res, err = client.NFInstanceIDDocumentApi.DeregisterNFInstance(ctx, amfContext.NfId) diff --git a/internal/sbi/consumer/nssf_service.go b/internal/sbi/consumer/nssf_service.go index 4bef7a7..7f778d5 100644 --- a/internal/sbi/consumer/nssf_service.go +++ b/internal/sbi/consumer/nssf_service.go @@ -47,6 +47,9 @@ func (s *nssfService) NSSelectionGetForRegistration(ue *amf_context.AmfUe, reque *models.ProblemDetails, error, ) { client := s.getNSSelectionClient(ue.NssfUri) + if client == nil { + return nil, openapi.ReportError("nssf not found") + } amfSelf := amf_context.GetSelf() ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NNSSF_NSSELECTION, models.NfType_NSSF) @@ -107,6 +110,9 @@ func (s *nssfService) NSSelectionGetForPduSession(ue *amf_context.AmfUe, snssai *models.AuthorizedNetworkSliceInfo, *models.ProblemDetails, error, ) { client := s.getNSSelectionClient(ue.NssfUri) + if client == nil { + return nil, nil, openapi.ReportError("nssf not found") + } amfSelf := amf_context.GetSelf() sliceInfoForPduSession := models.SliceInfoForPduSession{ diff --git a/internal/sbi/consumer/pcf_service.go b/internal/sbi/consumer/pcf_service.go index 7c7fc78..49de3b4 100644 --- a/internal/sbi/consumer/pcf_service.go +++ b/internal/sbi/consumer/pcf_service.go @@ -42,9 +42,13 @@ func (s *npcfService) getAMPolicyClient(uri string) *Npcf_AMPolicy.APIClient { return client } -func (s *npcfService) AMPolicyControlCreate(ue *amf_context.AmfUe, anType models.AccessType) (*models.ProblemDetails, error) { +func (s *npcfService) AMPolicyControlCreate( + ue *amf_context.AmfUe, anType models.AccessType, +) (*models.ProblemDetails, error) { client := s.getAMPolicyClient(ue.PcfUri) - + if client == nil { + return nil, openapi.ReportError("pcf not found") + } amfSelf := amf_context.GetSelf() ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NPCF_AM_POLICY_CONTROL, models.NfType_PCF) if err != nil { @@ -112,10 +116,14 @@ func (s *npcfService) AMPolicyControlCreate(ue *amf_context.AmfUe, anType models return nil, nil } -func (s *npcfService) AMPolicyControlUpdate(ue *amf_context.AmfUe, updateRequest models.PolicyAssociationUpdateRequest) ( - problemDetails *models.ProblemDetails, err error, -) { +func (s *npcfService) AMPolicyControlUpdate( + ue *amf_context.AmfUe, updateRequest models.PolicyAssociationUpdateRequest, +) (problemDetails *models.ProblemDetails, err error) { client := s.getAMPolicyClient(ue.PcfUri) + if client == nil { + return nil, openapi.ReportError("pcf not found") + } + ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NPCF_AM_POLICY_CONTROL, models.NfType_PCF) if err != nil { return nil, err @@ -164,6 +172,10 @@ func (s *npcfService) AMPolicyControlUpdate(ue *amf_context.AmfUe, updateRequest func (s *npcfService) AMPolicyControlDelete(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { client := s.getAMPolicyClient(ue.PcfUri) + if client == nil { + return nil, openapi.ReportError("pcf not found") + } + ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NPCF_AM_POLICY_CONTROL, models.NfType_PCF) if err != nil { return nil, err diff --git a/internal/sbi/consumer/smf_service.go b/internal/sbi/consumer/smf_service.go index aede58e..f5f1d36 100644 --- a/internal/sbi/consumer/smf_service.go +++ b/internal/sbi/consumer/smf_service.go @@ -13,7 +13,6 @@ import ( "github.com/free5gc/amf/internal/logger" "github.com/free5gc/amf/internal/util" "github.com/free5gc/amf/pkg/factory" - "github.com/free5gc/nas/nasMessage" "github.com/free5gc/openapi" "github.com/free5gc/openapi/Nnrf_NFDiscovery" @@ -159,6 +158,10 @@ func (s *nsmfService) SendCreateSmContextRequest(ue *amf_context.AmfUe, smContex } client := s.getPDUSessionClient(smContext.SmfUri()) + if client == nil { + return nil, "", nil, nil, openapi.ReportError("smf not found") + } + ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NSMF_PDUSESSION, models.NfType_SMF) if err != nil { return nil, "", nil, nil, err @@ -459,6 +462,9 @@ func (s *nsmfService) SendUpdateSmContextRequest(smContext *amf_context.SmContex problemDetail *models.ProblemDetails, err1 error, ) { client := s.getPDUSessionClient(smContext.SmfUri()) + if client == nil { + return nil, nil, nil, openapi.ReportError("smf not found") + } var updateSmContextRequest models.UpdateSmContextRequest updateSmContextRequest.JsonData = &updateData @@ -508,6 +514,9 @@ func (s *nsmfService) SendReleaseSmContextRequest(ue *amf_context.AmfUe, smConte n2Info []byte, ) (detail *models.ProblemDetails, err error) { client := s.getPDUSessionClient(smContext.SmfUri()) + if client == nil { + return nil, openapi.ReportError("smf not found") + } releaseData := s.buildReleaseSmContextRequest(ue, cause, n2SmInfoType, n2Info) releaseSmContextRequest := models.ReleaseSmContextRequest{ diff --git a/internal/sbi/consumer/udm_service.go b/internal/sbi/consumer/udm_service.go index b301d9f..c88c04d 100644 --- a/internal/sbi/consumer/udm_service.go +++ b/internal/sbi/consumer/udm_service.go @@ -71,6 +71,9 @@ func (s *nudmService) getUEContextMngmntClient(uri string) *Nudm_UEContextManage func (s *nudmService) PutUpuAck(ue *amf_context.AmfUe, upuMacIue string) error { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return openapi.ReportError("udm not found") + } ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_SDM, models.NfType_UDM) if err != nil { @@ -98,6 +101,9 @@ func (s *nudmService) PutUpuAck(ue *amf_context.AmfUe, upuMacIue string) error { func (s *nudmService) SDMGetAmData(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } getAmDataParamOpt := Nudm_SubscriberDataManagement.GetAmDataParamOpts{ PlmnId: optional.NewInterface(openapi.MarshToJsonString(ue.PlmnId)), @@ -136,6 +142,9 @@ func (s *nudmService) SDMGetAmData(ue *amf_context.AmfUe) (problemDetails *model func (s *nudmService) SDMGetSmfSelectData(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } paramOpt := Nudm_SubscriberDataManagement.GetSmfSelectDataParamOpts{ PlmnId: optional.NewInterface(openapi.MarshToJsonString(ue.PlmnId)), @@ -172,8 +181,13 @@ func (s *nudmService) SDMGetSmfSelectData(ue *amf_context.AmfUe) (problemDetails return problemDetails, err } -func (s *nudmService) SDMGetUeContextInSmfData(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { +func (s *nudmService) SDMGetUeContextInSmfData( + ue *amf_context.AmfUe, +) (problemDetails *models.ProblemDetails, err error) { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_SDM, models.NfType_UDM) if err != nil { @@ -208,6 +222,9 @@ func (s *nudmService) SDMGetUeContextInSmfData(ue *amf_context.AmfUe) (problemDe func (s *nudmService) SDMSubscribe(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } amfSelf := amf_context.GetSelf() sdmSubscription := models.SdmSubscription{ @@ -246,8 +263,13 @@ func (s *nudmService) SDMSubscribe(ue *amf_context.AmfUe) (problemDetails *model return problemDetails, err } -func (s *nudmService) SDMGetSliceSelectionSubscriptionData(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { +func (s *nudmService) SDMGetSliceSelectionSubscriptionData( + ue *amf_context.AmfUe, +) (problemDetails *models.ProblemDetails, err error) { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } paramOpt := Nudm_SubscriberDataManagement.GetNssaiParamOpts{ PlmnId: optional.NewInterface(openapi.MarshToJsonString(ue.PlmnId)), @@ -304,6 +326,9 @@ func (s *nudmService) SDMGetSliceSelectionSubscriptionData(ue *amf_context.AmfUe func (s *nudmService) SDMUnsubscribe(ue *amf_context.AmfUe) (problemDetails *models.ProblemDetails, err error) { client := s.getSubscriberDMngmntClients(ue.NudmSDMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_SDM, models.NfType_UDM) if err != nil { @@ -334,10 +359,13 @@ func (s *nudmService) SDMUnsubscribe(ue *amf_context.AmfUe) (problemDetails *mod return problemDetails, err } -func (s *nudmService) UeCmRegistration(ue *amf_context.AmfUe, accessType models.AccessType, initialRegistrationInd bool) ( - *models.ProblemDetails, error, -) { +func (s *nudmService) UeCmRegistration( + ue *amf_context.AmfUe, accessType models.AccessType, initialRegistrationInd bool, +) (*models.ProblemDetails, error) { client := s.getUEContextMngmntClient(ue.NudmUECMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } amfSelf := amf_context.GetSelf() ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_UEAU, models.NfType_UDM) @@ -419,10 +447,13 @@ func (s *nudmService) UeCmRegistration(ue *amf_context.AmfUe, accessType models. return nil, nil } -func (s *nudmService) UeCmDeregistration(ue *amf_context.AmfUe, accessType models.AccessType) ( - *models.ProblemDetails, error, -) { +func (s *nudmService) UeCmDeregistration( + ue *amf_context.AmfUe, accessType models.AccessType, +) (*models.ProblemDetails, error) { client := s.getUEContextMngmntClient(ue.NudmUECMUri) + if client == nil { + return nil, openapi.ReportError("udm not found") + } amfSelf := amf_context.GetSelf() ctx, _, err := amf_context.GetSelf().GetTokenCtx(models.ServiceName_NUDM_UECM, models.NfType_UDM) diff --git a/pkg/service/init.go b/pkg/service/init.go index 6a2fad6..7316dcb 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -32,9 +32,8 @@ type AmfApp struct { consumer *consumer.Consumer - // ngap - start func(*AmfApp) - stop func(*AmfApp) + start func(*AmfApp) + terminate func(*AmfApp) } var AMF App @@ -45,9 +44,9 @@ func GetApp() App { func NewApp(cfg *factory.Config, startFunc, terminateFunc func(*AmfApp)) (*AmfApp, error) { amf := &AmfApp{ - cfg: cfg, - start: startFunc, - stop: terminateFunc, + cfg: cfg, + start: startFunc, + terminate: terminateFunc, } amf.SetLogEnable(cfg.GetLogEnable()) amf.SetLogLevel(cfg.GetLogLevel()) @@ -119,7 +118,7 @@ func (a *AmfApp) Start(tlsKeyLogPath string) { func (a *AmfApp) Terminate() { logger.InitLog.Infof("Terminating AMF...") a.cancel() - a.stop(a) + a.terminate(a) logger.InitLog.Infof("AMF terminated") } From 9529486288a4cc27bb78e257aacd3c41bc5c6b17 Mon Sep 17 00:00:00 2001 From: "CTFang@WireLab" Date: Thu, 25 Apr 2024 04:28:12 +0000 Subject: [PATCH 8/8] fix: fix linter error --- internal/gmm/handler.go | 44 ++++++++++++++++------------ internal/ngap/handler.go | 10 +++---- internal/sbi/consumer/nrf_service.go | 6 ++-- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/internal/gmm/handler.go b/internal/gmm/handler.go index 214027f..adf4fdc 100644 --- a/internal/gmm/handler.go +++ b/internal/gmm/handler.go @@ -260,7 +260,8 @@ func CreatePDUSession(ulNasTransport *nasMessage.ULNASTransport, } } - if newSmContext, cause, err := service.GetApp().Consumer().SelectSmf(ue, anType, pduSessionID, snssai, dnn); err != nil { + if newSmContext, cause, err := service.GetApp().Consumer().SelectSmf( + ue, anType, pduSessionID, snssai, dnn); err != nil { ue.GmmLog.Errorf("Select SMF failed: %+v", err) gmm_message.SendDLNASTransport(ue.RanUe[anType], nasMessage.PayloadContainerTypeN1SMInfo, smMessage, pduSessionID, cause, nil, 0) @@ -591,15 +592,16 @@ func contextTransferFromOldAmf(ue *context.AmfUe, anType models.AccessType, oldA case nasMessage.RegistrationType5GSPeriodicRegistrationUpdating: transferReason = models.TransferReason_MOBI_REG } - ueContextTransferRspData, problemDetails, err := service.GetApp().Consumer().UEContextTransferRequest(ue, anType, transferReason) - if problemDetails != nil { - if problemDetails.Cause == "INTEGRITY_CHECK_FAIL" || problemDetails.Cause == "CONTEXT_NOT_FOUND" { + + ueContextTransferRspData, pd, err := service.GetApp().Consumer().UEContextTransferRequest(ue, anType, transferReason) + if pd != nil { + if pd.Cause == "INTEGRITY_CHECK_FAIL" || pd.Cause == "CONTEXT_NOT_FOUND" { // TODO 9a. After successful authentication in new AMF, which is triggered by the integrity check failure // in old AMF at step 5, the new AMF invokes step 4 above again and indicates that the UE is validated //(i.e. through the reason parameter as specified in clause 5.2.2.2.2). - return fmt.Errorf("Can not retrieve UE Context from old AMF[Cause: %s]", problemDetails.Cause) + return fmt.Errorf("Can not retrieve UE Context from old AMF[Cause: %s]", pd.Cause) } - return fmt.Errorf("UE Context Transfer Request Failed Problem[%+v]", problemDetails) + return fmt.Errorf("UE Context Transfer Request Failed Problem[%+v]", pd) } else if err != nil { return fmt.Errorf("UE Context Transfer Request Error[%+v]", err) } else { @@ -701,7 +703,8 @@ func HandleInitialRegistration(ue *context.AmfUe, anType models.AccessType) erro // } for { - resp, err := service.GetApp().Consumer().SendSearchNFInstances(amfSelf.NrfUri, models.NfType_PCF, models.NfType_AMF, ¶m) + resp, err := service.GetApp().Consumer().SendSearchNFInstances( + amfSelf.NrfUri, models.NfType_PCF, models.NfType_AMF, ¶m) if err != nil { ue.GmmLog.Error("AMF can not select an PCF by NRF") } else { @@ -1006,7 +1009,8 @@ func communicateWithUDM(ue *context.AmfUe, accessType models.AccessType) error { param := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{ Supi: optional.NewString(ue.Supi), } - resp, err := service.GetApp().Consumer().SendSearchNFInstances(amfSelf.NrfUri, models.NfType_UDM, models.NfType_AMF, ¶m) + resp, err := service.GetApp().Consumer().SendSearchNFInstances( + amfSelf.NrfUri, models.NfType_UDM, models.NfType_AMF, ¶m) if err != nil { return errors.Errorf("AMF can not select an UDM by NRF: SendSearchNFInstances failed") } @@ -1075,7 +1079,8 @@ func getSubscribedNssai(ue *context.AmfUe) { Supi: optional.NewString(ue.Supi), } for { - err := service.GetApp().Consumer().SearchUdmSdmInstance(ue, amfSelf.NrfUri, models.NfType_UDM, models.NfType_AMF, ¶m) + err := service.GetApp().Consumer().SearchUdmSdmInstance( + ue, amfSelf.NrfUri, models.NfType_UDM, models.NfType_AMF, ¶m) if err != nil { ue.GmmLog.Errorf("AMF can not select an Nudm_SDM Instance by NRF[Error: %+v]", err) time.Sleep(2 * time.Second) @@ -1138,7 +1143,8 @@ func handleRequestedNssai(ue *context.AmfUe, anType models.AccessType) error { if needSliceSelection { if ue.NssfUri == "" { for { - err := service.GetApp().Consumer().SearchNssfNSSelectionInstance(ue, amfSelf.NrfUri, models.NfType_NSSF, models.NfType_AMF, nil) + err := service.GetApp().Consumer().SearchNssfNSSelectionInstance( + ue, amfSelf.NrfUri, models.NfType_NSSF, models.NfType_AMF, nil) if err != nil { ue.GmmLog.Errorf("AMF can not select an NSSF Instance by NRF[Error: %+v]", err) time.Sleep(2 * time.Second) @@ -1647,7 +1653,8 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b // TODO: consider ausf group id, Routing ID part of SUCI param := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{} - resp, err := service.GetApp().Consumer().SendSearchNFInstances(amfSelf.NrfUri, models.NfType_AUSF, models.NfType_AMF, ¶m) + resp, err := service.GetApp().Consumer().SendSearchNFInstances( + amfSelf.NrfUri, models.NfType_AUSF, models.NfType_AMF, ¶m) if err != nil { ue.GmmLog.Error("AMF can not select an AUSF by NRF") gmm_message.SendRegistrationReject(ue.RanUe[accessType], nasMessage.Cause5GMMCongestion, "") @@ -1983,7 +1990,8 @@ func HandleAuthenticationResponse(ue *context.AmfUe, accessType models.AccessTyp } } - response, problemDetails, err := service.GetApp().Consumer().SendAuth5gAkaConfirmRequest(ue, hex.EncodeToString(resStar[:])) + response, problemDetails, err := service.GetApp().Consumer().SendAuth5gAkaConfirmRequest( + ue, hex.EncodeToString(resStar[:])) if err != nil { return err } else if problemDetails != nil { @@ -2017,11 +2025,11 @@ func HandleAuthenticationResponse(ue *context.AmfUe, accessType models.AccessTyp } } case models.AuthType_EAP_AKA_PRIME: - response, problemDetails, err := service.GetApp().Consumer().SendEapAuthConfirmRequest(ue, *authenticationResponse.EAPMessage) + response, pd, err := service.GetApp().Consumer().SendEapAuthConfirmRequest(ue, *authenticationResponse.EAPMessage) if err != nil { return err - } else if problemDetails != nil { - ue.GmmLog.Debugf("EapAuthConfirm Error[Problem Detail: %+v]", problemDetails) + } else if pd != nil { + ue.GmmLog.Debugf("EapAuthConfirm Error[Problem Detail: %+v]", pd) return nil } @@ -2152,11 +2160,11 @@ func HandleAuthenticationFailure(ue *context.AmfUe, anType models.AccessType, Rand: av5gAka.Rand, } - response, problemDetails, err := service.GetApp().Consumer().SendUEAuthenticationAuthenticateRequest(ue, resynchronizationInfo) + response, pd, err := service.GetApp().Consumer().SendUEAuthenticationAuthenticateRequest(ue, resynchronizationInfo) if err != nil { return err - } else if problemDetails != nil { - ue.GmmLog.Errorf("Nausf_UEAU Authenticate Request Error[Problem Detail: %+v]", problemDetails) + } else if pd != nil { + ue.GmmLog.Errorf("Nausf_UEAU Authenticate Request Error[Problem Detail: %+v]", pd) return nil } ue.AuthenticationCtx = response diff --git a/internal/ngap/handler.go b/internal/ngap/handler.go index 53a8e5d..87b21f7 100644 --- a/internal/ngap/handler.go +++ b/internal/ngap/handler.go @@ -1093,10 +1093,10 @@ func handleUEContextReleaseRequestMain(ran *context.AmfRan, // TODO: Check if doing error handling here continue } - response, _, _, err := service.GetApp().Consumer().SendUpdateSmContextDeactivateUpCnxState(amfUe, smContext, causeAll) + rsp, _, _, err := service.GetApp().Consumer().SendUpdateSmContextDeactivateUpCnxState(amfUe, smContext, causeAll) if err != nil { ranUe.Log.Errorf("Send Update SmContextDeactivate UpCnxState Error[%s]", err.Error()) - } else if response == nil { + } else if rsp == nil { ranUe.Log.Errorln("Send Update SmContextDeactivate UpCnxState Error") } } @@ -1406,7 +1406,7 @@ func handleHandoverRequestAcknowledgeMain(ran *context.AmfRan, // TODO: Check if doing error handling here continue } - response, errResponse, problemDetails, err := service.GetApp().Consumer().SendUpdateSmContextN2HandoverPrepared(amfUe, + resp, errResponse, problemDetails, err := service.GetApp().Consumer().SendUpdateSmContextN2HandoverPrepared(amfUe, smContext, models.N2SmInfoType_HANDOVER_REQ_ACK, transfer) if err != nil { targetUe.Log.Errorf("Send HandoverRequestAcknowledgeTransfer error: %v", err) @@ -1414,10 +1414,10 @@ func handleHandoverRequestAcknowledgeMain(ran *context.AmfRan, if problemDetails != nil { targetUe.Log.Warnf("ProblemDetails[status: %d, Cause: %s]", problemDetails.Status, problemDetails.Cause) } - if response != nil && response.BinaryDataN2SmInformation != nil { + if resp != nil && resp.BinaryDataN2SmInformation != nil { handoverItem := ngapType.PDUSessionResourceHandoverItem{} handoverItem.PDUSessionID = item.PDUSessionID - handoverItem.HandoverCommandTransfer = response.BinaryDataN2SmInformation + handoverItem.HandoverCommandTransfer = resp.BinaryDataN2SmInformation pduSessionResourceHandoverList.List = append(pduSessionResourceHandoverList.List, handoverItem) targetUe.SuccessPduSessionId = append(targetUe.SuccessPduSessionId, pduSessionID) } diff --git a/internal/sbi/consumer/nrf_service.go b/internal/sbi/consumer/nrf_service.go index 1bf4e8b..230ac26 100644 --- a/internal/sbi/consumer/nrf_service.go +++ b/internal/sbi/consumer/nrf_service.go @@ -103,7 +103,8 @@ func (s *nnrfService) SendSearchNFInstances(nrfUri string, targetNfType, request return &result, err } -func (s *nnrfService) SearchUdmSdmInstance(ue *amf_context.AmfUe, nrfUri string, targetNfType, requestNfType models.NfType, +func (s *nnrfService) SearchUdmSdmInstance( + ue *amf_context.AmfUe, nrfUri string, targetNfType, requestNfType models.NfType, param *Nnrf_NFDiscovery.SearchNFInstancesParamOpts, ) error { resp, localErr := s.SendSearchNFInstances(nrfUri, targetNfType, requestNfType, param) @@ -129,7 +130,8 @@ func (s *nnrfService) SearchUdmSdmInstance(ue *amf_context.AmfUe, nrfUri string, return nil } -func (s *nnrfService) SearchNssfNSSelectionInstance(ue *amf_context.AmfUe, nrfUri string, targetNfType, requestNfType models.NfType, +func (s *nnrfService) SearchNssfNSSelectionInstance( + ue *amf_context.AmfUe, nrfUri string, targetNfType, requestNfType models.NfType, param *Nnrf_NFDiscovery.SearchNFInstancesParamOpts, ) error { resp, localErr := s.SendSearchNFInstances(nrfUri, targetNfType, requestNfType, param)