Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use nrfcache from openapi repository #281

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions amf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ func TestUpdateConfig(t *testing.T) {
}()

time.Sleep(2 * time.Second)
if factory.AmfConfig.Configuration.SupportTAIList != nil &&
len(factory.AmfConfig.Configuration.SupportTAIList) == 2 {
if len(factory.AmfConfig.Configuration.SupportTAIList) == 2 {
fmt.Printf("test passed")
} else {
t.Errorf("test failed")
Expand Down
6 changes: 3 additions & 3 deletions consumer/nf_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
amf_context "github.com/omec-project/amf/context"
"github.com/omec-project/amf/logger"
"github.com/omec-project/amf/util"
nrf_cache "github.com/omec-project/nrf/nrfcache"
"github.com/omec-project/openapi/Nnrf_NFDiscovery"
"github.com/omec-project/openapi/models"
nrfCache "github.com/omec-project/openapi/nrfcache"
)

func SendSearchNFInstances(nrfUri string, targetNfType, requestNfType models.NfType,
param *Nnrf_NFDiscovery.SearchNFInstancesParamOpts,
) (models.SearchResult, error) {
if amf_context.AMF_Self().EnableNrfCaching {
return nrf_cache.SearchNFInstances(nrfUri, targetNfType, requestNfType, param)
return nrfCache.SearchNFInstances(nrfUri, targetNfType, requestNfType, param)
} else {
return SendNfDiscoveryToNrf(nrfUri, targetNfType, requestNfType, param)
}
Expand Down Expand Up @@ -91,7 +91,7 @@ func SearchUdmSdmInstance(ue *amf_context.AmfUe, nrfUri string, targetNfType, re
ue.NudmSDMUri = sdmUri
if ue.NudmSDMUri == "" {
err := fmt.Errorf("AMF can not select an UDM by NRF")
logger.ConsumerLog.Errorf(err.Error())
logger.ConsumerLog.Errorln(err.Error())
return err
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion gmm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ func AuthenticationProcedure(ue *context.AmfUe, accessType models.AccessType) (b
}
if ausfUri == "" {
err = fmt.Errorf("AMF can not select an AUSF by NRF")
ue.GmmLog.Errorf(err.Error())
ue.GmmLog.Errorln(err.Error())
return false, err
}
ue.AusfUri = ausfUri
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ require (
github.com/omec-project/metricfunc v1.4.1
github.com/omec-project/nas v1.3.0
github.com/omec-project/ngap v1.2.2
github.com/omec-project/nrf v1.4.1
github.com/omec-project/openapi v1.2.0
github.com/omec-project/openapi v1.2.1
github.com/omec-project/util v1.1.0
github.com/prometheus/client_golang v1.19.1
github.com/sirupsen/logrus v1.9.3
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,8 @@ github.com/omec-project/nas v1.3.0 h1:zNqEQSNTsupT3qP6keSuOusOHKrqEYoC5ghKR8TpKE
github.com/omec-project/nas v1.3.0/go.mod h1:So4hpY95XZTpX0Joco/axIH4MlO0o13UT1rWQWZEuLQ=
github.com/omec-project/ngap v1.2.2 h1:TAeF2IvBL5FIBqJ/8HTRe63q9cAxjPBRhj3jodbxBhg=
github.com/omec-project/ngap v1.2.2/go.mod h1:sPvpU/ahwqoTvFi5IfnzHmJvIxQPnsVCmq7iU/L1lEo=
github.com/omec-project/nrf v1.4.1 h1:/5JaICgZ2URtTe7Bz9/xzEFgHaiaAHTbWcVGr9zek1I=
github.com/omec-project/nrf v1.4.1/go.mod h1:F4JBDAZ9uWUkSjk7fh1lvzuJs8Jxbn2CGIXK8SsiaDI=
github.com/omec-project/openapi v1.2.0 h1:7Wvi0HLvhvxMyQtqGcqtMCPC/0QCGAFP5htrXCfWxRc=
github.com/omec-project/openapi v1.2.0/go.mod h1:hjU13MB1m9MHTko87JfsUNCdeD6/m6VkNZDD8Vq5U9M=
github.com/omec-project/openapi v1.2.1 h1:7ccFadoGfoqZq4sw7twXatbRGmkg4pARe6sWmCVVmrs=
github.com/omec-project/openapi v1.2.1/go.mod h1:hjU13MB1m9MHTko87JfsUNCdeD6/m6VkNZDD8Vq5U9M=
github.com/omec-project/util v1.1.0 h1:TUuLmzqTLChIEXQlK9g5Ihgmw4FUm/UJnjfu0wT8Gz0=
github.com/omec-project/util v1.1.0/go.mod h1:BEv8nCokB4j0fgAQ6VVkKuQ2PSP3DJMEmz25pFMw5X8=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
Expand Down
2 changes: 1 addition & 1 deletion ngap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ func HandleUplinkNasTransport(ran *context.AmfRan, message *ngapType.NGAPPDU) {
if amfUe == nil {
err := ranUe.Remove()
if err != nil {
ran.Log.Errorf(err.Error())
ran.Log.Errorln(err.Error())
}
ran.Log.Errorf("No UE Context of RanUe with RANUENGAPID[%d] AMFUENGAPID[%d] ",
rANUENGAPID.Value, aMFUENGAPID.Value)
Expand Down
4 changes: 2 additions & 2 deletions producer/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/omec-project/nas/nasConvert"
"github.com/omec-project/nas/nasMessage"
"github.com/omec-project/ngap/ngapType"
nrf_cache "github.com/omec-project/nrf/nrfcache"
"github.com/omec-project/openapi/models"
nrfCache "github.com/omec-project/openapi/nrfcache"
"github.com/omec-project/util/httpwrapper"
)

Expand Down Expand Up @@ -472,7 +472,7 @@ func NfSubscriptionStatusNotifyProcedure(notificationData models.NotificationDat
// This will force the amf to do nf discovery and get the updated nf profile from the nrf.
if notificationData.Event == models.NotificationEventType_DEREGISTERED {
if amf_context.AMF_Self().EnableNrfCaching {
ok := nrf_cache.RemoveNfProfileFromNrfCache(nfInstanceId)
ok := nrfCache.RemoveNfProfileFromNrfCache(nfInstanceId)
logger.ProducerLog.Tracef("nfinstance %v deleted from cache: %v", nfInstanceId, ok)
}
if subscriptionId, ok := amf_context.AMF_Self().NfStatusSubscriptions.Load(nfInstanceId); ok {
Expand Down
2 changes: 1 addition & 1 deletion producer/oam.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func HandleOAMPurgeUEContextRequest(supi, reqUri string, msg interface{}) (inter
ueFsmState := ue.State[models.AccessType__3_GPP_ACCESS].Current()
switch ueFsmState {
case context.Deregistered:
logger.ProducerLog.Info("Removing the UE : ", fmt.Sprintf(ue.Supi))
logger.ProducerLog.Info("Removing the UE : ", fmt.Sprintln(ue.Supi))
ue.Remove()
case context.Registered:
logger.ProducerLog.Info("Deregistration triggered for the UE : ", ue.Supi)
Expand Down
4 changes: 2 additions & 2 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ import (
protos "github.com/omec-project/config5g/proto/sdcoreConfig"
nasLogger "github.com/omec-project/nas/logger"
ngapLogger "github.com/omec-project/ngap/logger"
nrf_cache "github.com/omec-project/nrf/nrfcache"
"github.com/omec-project/openapi/models"
nrfCache "github.com/omec-project/openapi/nrfcache"
"github.com/omec-project/util/fsm"
fsmLogger "github.com/omec-project/util/fsm/logger"
"github.com/omec-project/util/http2_util"
Expand Down Expand Up @@ -350,7 +350,7 @@ func (amf *AMF) Start() {

if self.EnableNrfCaching {
initLog.Infoln("Enable NRF caching feature")
nrf_cache.InitNrfCaching(self.NrfCacheEvictionInterval*time.Second, consumer.SendNfDiscoveryToNrf)
nrfCache.InitNrfCaching(self.NrfCacheEvictionInterval*time.Second, consumer.SendNfDiscoveryToNrf)
}

if self.EnableSctpLb {
Expand Down