Skip to content
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
6 changes: 3 additions & 3 deletions nrfcache/nrfcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (npq NfProfilePriorityQ) at(index int) *NfProfileItem {

// push - adds an entry to the priority queue. Invokes heap api to
// push the entry to the correct location in the queue
func (npq *NfProfilePriorityQ) push(item interface{}) {
func (npq *NfProfilePriorityQ) push(item *NfProfileItem) {
heap.Push(npq, item)
}

Expand All @@ -98,15 +98,15 @@ func (npq *NfProfilePriorityQ) remove(item *NfProfileItem) {
}

// Push - implemented for heap interface. appends an element to the priority queue
func (npq *NfProfilePriorityQ) Push(item interface{}) {
func (npq *NfProfilePriorityQ) Push(item any) {
n := len(*npq)
entry := item.(*NfProfileItem)
entry.index = n
*npq = append(*npq, entry)
}

// Pop - implemented for heap interface. Removes the entry with expiry time
func (npq *NfProfilePriorityQ) Pop() interface{} {
func (npq *NfProfilePriorityQ) Pop() any {
old := *npq
n := len(old)
item := old[n-1]
Expand Down
17 changes: 7 additions & 10 deletions nrfcache/nrfcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,15 +1111,12 @@ func TestCacheKeyBehavior(t *testing.T) {
// Check if the MatchAmfProfile function is working correctly
func TestAmfProfileMatching(t *testing.T) {
// Create a test AMF profile
amfProfile := models.NFProfileDiscovery{
NfInstanceId: "9f7d5a3f-88ab-4525-b31e-334da7faedab",
NfType: models.NFTYPE_AMF,
PlmnList: []models.PlmnId{{Mcc: "208", Mnc: "93"}},
AmfInfo: &models.AmfInfo{
AmfRegionId: "ca",
AmfSetId: "3f8",
},
}
amfProfile := models.NewNFProfileDiscovery("9f7d5a3f-88ab-4525-b31e-334da7faedab", models.NFTYPE_AMF, models.NFSTATUS_REGISTERED)
amfProfile.SetPlmnList([]models.PlmnId{{Mcc: "208", Mnc: "93"}})
amfProfile.SetAmfInfo(models.AmfInfo{
AmfRegionId: "ca",
AmfSetId: "3f8",
})

testCases := []struct {
param Nnrf_NFDiscovery.ApiSearchNFInstancesRequest
Expand All @@ -1140,7 +1137,7 @@ func TestAmfProfileMatching(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
match, err := MatchAmfProfile(&amfProfile, tc.param)
match, err := MatchAmfProfile(amfProfile, tc.param)
if err != nil {
t.Fatalf("MatchAmfProfile failed: %v", err)
}
Expand Down
Loading