Skip to content

Commit

Permalink
Rearrange the log messages to start with lower case letters
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <gulsum.atici@canonical.com>
  • Loading branch information
gatici committed Aug 6, 2024
1 parent 10dfbf8 commit a484329
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
17 changes: 9 additions & 8 deletions nrfcache/match_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func MatchSmfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
var snssai models.Snssai
err := json.Unmarshal([]byte(reqSnssai), &snssai)
if err != nil {
fmt.Printf("error Unmarshaling nssai : %+v", err)
return false, err
}

Expand Down Expand Up @@ -112,7 +113,7 @@ func MatchSmfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
return false, nil
}
}
fmt.Printf("SMF match found, nfInstance Id %v", profile.NfInstanceId)
fmt.Printf("smf match found, nfInstance Id %v", profile.NfInstanceId)
return true, nil
}

Expand Down Expand Up @@ -142,12 +143,12 @@ func MatchAusfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNF
matchFound = MatchSupiRange(opts.Supi.Value(), profile.AusfInfo.SupiRanges)
}
}
fmt.Printf("Ausf match found = %v", matchFound)
fmt.Printf("ausf match found = %v", matchFound)
return matchFound, nil
}

func MatchNssfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFInstancesParamOpts) (bool, error) {
fmt.Println("Nssf match found ")
fmt.Println("nssf match found ")
return true, nil
}

Expand All @@ -163,7 +164,7 @@ func MatchAmfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
err := json.Unmarshal([]byte(targetPlmn), &plmn)

if err != nil {
fmt.Printf("Error Unmarshaling plmn : %+v", err)
fmt.Printf("error Unmarshaling plmn : %+v", err)
return false, err
}

Expand Down Expand Up @@ -191,7 +192,7 @@ func MatchAmfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
err := json.Unmarshal([]byte(guami), &guamiOpt)

if err != nil {
fmt.Printf("Error Unmarshaling guami : %+v", err)
fmt.Printf("error Unmarshaling guami : %+v", err)
return false, err
}

Expand Down Expand Up @@ -232,7 +233,7 @@ func MatchAmfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
}
}
}
fmt.Printf("Amf match found = %v", profile.NfInstanceId)
fmt.Printf("amf match found = %v", profile.NfInstanceId)
return true, nil
}

Expand All @@ -243,7 +244,7 @@ func MatchPcfProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
matchFound = MatchSupiRange(opts.Supi.Value(), profile.PcfInfo.SupiRanges)
}
}
fmt.Printf("PCF match found = %v", matchFound)
fmt.Printf("pcf match found = %v", matchFound)
return matchFound, nil
}

Expand All @@ -254,6 +255,6 @@ func MatchUdmProfile(profile *models.NfProfile, opts *Nnrf_NFDiscovery.SearchNFI
matchFound = MatchSupiRange(opts.Supi.Value(), profile.UdmInfo.SupiRanges)
}
}
fmt.Printf("UDM match found = %v", matchFound)
fmt.Printf("udm match found = %v", matchFound)
return matchFound, nil
}
7 changes: 3 additions & 4 deletions nrfcache/nrfcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (c *NrfCache) handleLookup(nrfUri string, targetNfType, requestNfType model
c.mutex.RUnlock()

if len(searchResult.NfInstances) == 0 {
fmt.Printf("Cache miss for nftype %s", targetNfType)
fmt.Printf("cache miss for nftype %s", targetNfType)
c.mutex.Lock()
defer c.mutex.Unlock()
searchResult.NfInstances = c.get(param)
Expand Down Expand Up @@ -297,7 +297,7 @@ func (c *NrfMasterCache) GetNrfCacheInstance(targetNfType models.NfType) *NrfCac

cache, exists := c.nfTypeToCacheMap[targetNfType]
if exists == false {
fmt.Printf("Creating cache for nftype %v", targetNfType)
fmt.Printf("creating cache for nftype %v", targetNfType)
cache = NewNrfCache(c.evictionInterval, c.nrfDiscoveryQueryCb)
c.nfTypeToCacheMap[targetNfType] = cache
}
Expand Down Expand Up @@ -346,15 +346,14 @@ func disableNrfCaching() {
}

func SearchNFInstances(nrfUri string, targetNfType, requestNfType models.NfType, param *Nnrf_NFDiscovery.SearchNFInstancesParamOpts) (models.SearchResult, error) {

var searchResult models.SearchResult
var err error

c := masterCache.GetNrfCacheInstance(targetNfType)
if c != nil {
searchResult, err = c.handleLookup(nrfUri, targetNfType, requestNfType, param)
} else {
fmt.Println("SearchNFInstances nrf cache")
fmt.Println("failed to find cache for nf type")

}
for _, np := range searchResult.NfInstances {
Expand Down
22 changes: 11 additions & 11 deletions nrfcache/nrfcache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ func MarshToJsonString(v interface{}) (result []string) {
for i := 0; i < val.Len(); i++ {
tmp, err := json.Marshal(val.Index(i).Interface())
if err != nil {
fmt.Printf("Marshal error: %+v", err)
fmt.Printf("marshal error: %+v", err)
}

result = append(result, string(tmp))
}
} else {
tmp, err := json.Marshal(v)
if err != nil {
fmt.Printf("Marshal error: %+v", err)
fmt.Printf("marshal error: %+v", err)
}

result = append(result, string(tmp))
Expand Down Expand Up @@ -572,7 +572,7 @@ func TestCacheMissAndHits(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

// Cache hit scenario
Expand All @@ -584,7 +584,7 @@ func TestCacheMissAndHits(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

// Cache Miss for dnn 'ims'
Expand All @@ -604,7 +604,7 @@ func TestCacheMissAndHits(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

// Cache Miss for dnn 'internet' sd '0a0b0c'
Expand All @@ -624,7 +624,7 @@ func TestCacheMissAndHits(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

disableNrfCaching()
Expand Down Expand Up @@ -823,7 +823,7 @@ func TestAusfMatchFilters(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

result, err = SearchNFInstances("testNrf", models.NfType_AUSF, models.NfType_AMF, &param)
Expand All @@ -835,7 +835,7 @@ func TestAusfMatchFilters(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

param = Nnrf_NFDiscovery.SearchNFInstancesParamOpts{
Expand All @@ -851,7 +851,7 @@ func TestAusfMatchFilters(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}
disableNrfCaching()
}
Expand All @@ -877,7 +877,7 @@ func TestAmfMatchFilters(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

param = Nnrf_NFDiscovery.SearchNFInstancesParamOpts{
Expand All @@ -895,7 +895,7 @@ func TestAmfMatchFilters(t *testing.T) {
t.Error("nrf search did not return any records")
}
if expectedCallCount != nrfDbCallbackCallCount {
t.Error("Unexpected nrfDbCallbackCallCount")
t.Error("unexpected nrfDbCallbackCallCount")
}

disableNrfCaching()
Expand Down

0 comments on commit a484329

Please sign in to comment.