Skip to content

Commit

Permalink
chore(deps): Bump golang from 1.22.6-bookworm to 1.23.0-bookworm (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Aug 19, 2024
1 parent e263f46 commit 486f254
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 42 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ jobs:
- name: Build Docker image
run: make docker-build

staticcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: WillAbides/[email protected]
with:
go-version-file: 'go.mod'

- uses: dominikh/[email protected]
with:
version: latest
install-go: false

lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0
#

FROM golang:1.22.6-bookworm AS builder
FROM golang:1.23.0-bookworm AS builder

LABEL maintainer="Aether SD-Core <[email protected]>"

Expand Down
2 changes: 1 addition & 1 deletion factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func CheckConfigVersion() error {
currentVersion := NssfConfig.GetVersion()

if currentVersion != NSSF_EXPECTED_CONFIG_VERSION {
return fmt.Errorf("config version is [%s], but expected is [%s].",
return fmt.Errorf("config version is [%s], but expected is [%s]",
currentVersion, NSSF_EXPECTED_CONFIG_VERSION)
}

Expand Down
10 changes: 5 additions & 5 deletions nssaiavailability/api_subscriptions_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ import (
"github.com/omec-project/nssf/logger"
"github.com/omec-project/nssf/producer"
"github.com/omec-project/openapi"
. "github.com/omec-project/openapi/models"
"github.com/omec-project/openapi/models"
"github.com/omec-project/util/httpwrapper"
)

func HTTPNSSAIAvailabilityPost(c *gin.Context) {
var createData NssfEventSubscriptionCreateData
var createData models.NssfEventSubscriptionCreateData

requestBody, err := c.GetRawData()
if err != nil {
problemDetail := ProblemDetails{
problemDetail := models.ProblemDetails{
Title: "System failure",
Status: http.StatusInternalServerError,
Detail: err.Error(),
Expand All @@ -45,7 +45,7 @@ func HTTPNSSAIAvailabilityPost(c *gin.Context) {
err = openapi.Deserialize(&createData, requestBody, "application/json")
if err != nil {
problemDetail := "[Request Body] " + err.Error()
rsp := ProblemDetails{
rsp := models.ProblemDetails{
Title: "Malformed request syntax",
Status: http.StatusBadRequest,
Detail: problemDetail,
Expand All @@ -64,7 +64,7 @@ func HTTPNSSAIAvailabilityPost(c *gin.Context) {
responseBody, err := openapi.Serialize(rsp.Body, "application/json")
if err != nil {
logger.HandlerLog.Errorln(err)
problemDetails := ProblemDetails{
problemDetails := models.ProblemDetails{
Status: http.StatusInternalServerError,
Cause: "SYSTEM_FAILURE",
Detail: err.Error(),
Expand Down
2 changes: 1 addition & 1 deletion nssf.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
func action(c *cli.Context) error {
if err := NSSF.Initialize(c); err != nil {
logger.CfgLog.Errorf("%+v", err)
return fmt.Errorf("Failed to initialize !!")
return fmt.Errorf("failed to initialize")
}

NSSF.Start()
Expand Down
12 changes: 6 additions & 6 deletions plugin/nsselection_query_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
package plugin

import (
. "github.com/omec-project/openapi/models"
"github.com/omec-project/openapi/models"
)

type NsselectionQueryParameter struct {
NfType *NfType `json:"nf-type"`
NfType *models.NfType `json:"nf-type"`

NfId string `json:"nf-id"`

SliceInfoRequestForRegistration *SliceInfoForRegistration `json:"slice-info-request-for-registration,omitempty"`
SliceInfoRequestForRegistration *models.SliceInfoForRegistration `json:"slice-info-request-for-registration,omitempty"`

SliceInfoRequestForPduSession *SliceInfoForPduSession `json:"slice-info-request-for-pdu-session,omitempty"`
SliceInfoRequestForPduSession *models.SliceInfoForPduSession `json:"slice-info-request-for-pdu-session,omitempty"`

HomePlmnId *PlmnId `json:"home-plmn-id,omitempty"`
HomePlmnId *models.PlmnId `json:"home-plmn-id,omitempty"`

Tai *Tai `json:"tai,omitempty"`
Tai *models.Tai `json:"tai,omitempty"`

SupportedFeatures string `json:"supported-features,omitempty"`
}
4 changes: 2 additions & 2 deletions plugin/patch_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
package plugin

import (
. "github.com/omec-project/openapi/models"
"github.com/omec-project/openapi/models"
)

type PatchDocument []PatchItem
type PatchDocument []models.PatchItem
4 changes: 2 additions & 2 deletions producer/nssaiavailability_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func NSSAIAvailabilityPatchProcedure(nssaiAvailabilityUpdateInfo plugin.PatchDoc
}
patchJSON, err := json.Marshal(nssaiAvailabilityUpdateInfo)
if err != nil {
logger.Nssaiavailability.Errorf("Marshal error in NSSAIAvailabilityPatchProcedure: %+v", err)
logger.Nssaiavailability.Errorf("marshal error in NSSAIAvailabilityPatchProcedure: %+v", err)
}

patch, err := jsonpatch.DecodePatch(patchJSON)
Expand Down Expand Up @@ -212,7 +212,7 @@ func NSSAIAvailabilityPutProcedure(nssaiAvailabilityInfo models.NssaiAvailabilit
if err == nil {
response.AuthorizedNssaiAvailabilityData = append(response.AuthorizedNssaiAvailabilityData, authorizedNssaiAvailabilityData)
} else {
logger.Nssaiavailability.Warnf(err.Error())
logger.Nssaiavailability.Warnln(err.Error())
}
}

Expand Down
4 changes: 2 additions & 2 deletions producer/nssaiavailability_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func getUnusedSubscriptionID() (string, error) {
}
if uint32(tempID) == idx {
if idx == math.MaxUint32 {
return "", fmt.Errorf("No available subscription ID")
return "", fmt.Errorf("no available subscription ID")
}
idx = idx + 1
} else {
Expand All @@ -59,7 +59,7 @@ func NSSAIAvailabilityPostProcedure(createData models.NssfEventSubscriptionCreat
var subscription factory.Subscription
tempID, err := getUnusedSubscriptionID()
if err != nil {
logger.Nssaiavailability.Warnf(err.Error())
logger.Nssaiavailability.Warnln(err.Error())

problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Expand Down
17 changes: 8 additions & 9 deletions producer/nsselection_for_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func useDefaultSubscribedSnssai(
mappingOfSnssai = util.GetMappingOfPlmnFromConfig(*param.HomePlmnId)

if mappingOfSnssai == nil {
logger.Nsselection.Warnf("No S-NSSAI mapping of UE's HPLMN %+v in NSSF configuration", *param.HomePlmnId)
logger.Nsselection.Warnf("no S-NSSAI mapping of UE's HPLMN %+v in NSSF configuration", *param.HomePlmnId)
return
}
}
Expand All @@ -45,7 +45,7 @@ func useDefaultSubscribedSnssai(
targetMapping, found := util.FindMappingWithHomeSnssai(*subscribedSnssai.SubscribedSnssai, mappingOfSnssai)

if !found {
logger.Nsselection.Warnf("No mapping of Subscribed S-NSSAI %+v in PLMN %+v in NSSF configuration",
logger.Nsselection.Warnf("no mapping of Subscribed S-NSSAI %+v in PLMN %+v in NSSF configuration",
*subscribedSnssai.SubscribedSnssai,
*param.HomePlmnId)
continue
Expand Down Expand Up @@ -94,7 +94,7 @@ func useDefaultConfiguredNssai(
for _, requestedSnssai := range param.SliceInfoRequestForRegistration.RequestedNssai {
// Check whether the Default Configured S-NSSAI is standard, which could be commonly decided by all roaming partners
if !util.CheckStandardSnssai(requestedSnssai) {
logger.Nsselection.Infof("S-NSSAI %+v in Requested NSSAI which based on Default Configured NSSAI is not standard",
logger.Nsselection.Infof("s-nssai %+v in Requested NSSAI which based on Default Configured NSSAI is not standard",
requestedSnssai)
continue
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func setConfiguredNssai(
mappingOfSnssai = util.GetMappingOfPlmnFromConfig(*param.HomePlmnId)

if mappingOfSnssai == nil {
logger.Nsselection.Warnf("No S-NSSAI mapping of UE's HPLMN %+v in NSSF configuration", *param.HomePlmnId)
logger.Nsselection.Warnf("no S-NSSAI mapping of UE's HPLMN %+v in NSSF configuration", *param.HomePlmnId)
return
}
}
Expand All @@ -134,7 +134,7 @@ func setConfiguredNssai(
targetMapping, found := util.FindMappingWithHomeSnssai(*subscribedSnssai.SubscribedSnssai, mappingOfSnssai)

if !found {
logger.Nsselection.Warnf("No mapping of Subscribed S-NSSAI %+v in PLMN %+v in NSSF configuration",
logger.Nsselection.Warnf("no mapping of Subscribed S-NSSAI %+v in PLMN %+v in NSSF configuration",
*subscribedSnssai.SubscribedSnssai,
*param.HomePlmnId)
continue
Expand Down Expand Up @@ -222,7 +222,7 @@ func nsselectionForRegistration(param plugin.NsselectionQueryParameter,
targetMapping, found := util.FindMappingWithHomeSnssai(*subscribedSnssai.SubscribedSnssai, mappingOfSnssai)

if !found {
logger.Nsselection.Warnf("No mapping of Subscribed S-NSSAI %+v in PLMN %+v in NSSF configuration",
logger.Nsselection.Warnf("no mapping of Subscribed S-NSSAI %+v in PLMN %+v in NSSF configuration",
*subscribedSnssai.SubscribedSnssai,
*param.HomePlmnId)
continue
Expand Down Expand Up @@ -282,16 +282,15 @@ func nsselectionForRegistration(param plugin.NsselectionQueryParameter,
status = http.StatusOK
return status
} else {
logger.Nsselection.Warnf("No S-NSSAI mapping of UE's HPLMN %+v in NSSF configuration", *param.HomePlmnId)
logger.Nsselection.Warnf("no S-NSSAI mapping of UE's HPLMN %+v in NSSF configuration", *param.HomePlmnId)

status = http.StatusOK
return status
}
}

checkInvalidRequestedNssai := false
if param.SliceInfoRequestForRegistration.RequestedNssai != nil &&
len(param.SliceInfoRequestForRegistration.RequestedNssai) != 0 {
if len(param.SliceInfoRequestForRegistration.RequestedNssai) != 0 {
// Requested NSSAI is provided
// Verify which S-NSSAI(s) in the Requested NSSAI are permitted based on comparing the Subscribed S-NSSAI(s)

Expand Down
6 changes: 3 additions & 3 deletions test/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ package test
import (
"flag"

. "github.com/omec-project/nssf/plugin"
"github.com/omec-project/nssf/plugin"
"github.com/omec-project/util/path_util"
)

Expand All @@ -26,8 +26,8 @@ type TestingUtil struct {
}

type TestingNsselection struct {
GenerateNonRoamingQueryParameter func() NsselectionQueryParameter
GenerateRoamingQueryParameter func() NsselectionQueryParameter
GenerateNonRoamingQueryParameter func() plugin.NsselectionQueryParameter
GenerateRoamingQueryParameter func() plugin.NsselectionQueryParameter
ConfigFile string
}

Expand Down
4 changes: 2 additions & 2 deletions test/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ package test
import (
"reflect"

. "github.com/omec-project/openapi/models"
"github.com/omec-project/openapi/models"
)

func CheckAuthorizedNetworkSliceInfo(target AuthorizedNetworkSliceInfo, expectList []AuthorizedNetworkSliceInfo) bool {
func CheckAuthorizedNetworkSliceInfo(target models.AuthorizedNetworkSliceInfo, expectList []models.AuthorizedNetworkSliceInfo) bool {
for _, expectElement := range expectList {
if reflect.DeepEqual(target, expectElement) {
return true
Expand Down
16 changes: 8 additions & 8 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func GetRestrictedSnssaiListFromConfig(tai models.Tai) []models.RestrictedSnssai
defer factory.ConfigLock.RUnlock()
for _, taConfig := range factory.NssfConfig.Configuration.TaList {
if reflect.DeepEqual(*taConfig.Tai, tai) {
if taConfig.RestrictedSnssaiList != nil && len(taConfig.RestrictedSnssaiList) != 0 {
if len(taConfig.RestrictedSnssaiList) != 0 {
return taConfig.RestrictedSnssaiList
} else {
return nil
Expand Down Expand Up @@ -308,11 +308,11 @@ func AuthorizeOfAmfTaFromConfig(nfId string, tai models.Tai) (models.AuthorizedN
if err1 != nil {
logger.Util.Errorf("Marshal error in AuthorizeOfAmfTaFromConfig: %+v", err1)
}
err := fmt.Errorf("No supported S-NSSAI list by AMF %s under TAI %s in NSSF configuration", nfId, e)
err := fmt.Errorf("no supported S-NSSAI list by AMF %s under TAI %s in NSSF configuration", nfId, e)
return authorizedNssaiAvailabilityData, err
}
}
err := fmt.Errorf("No AMF configuration of %s", nfId)
err := fmt.Errorf("no AMF configuration of %s", nfId)
return authorizedNssaiAvailabilityData, err
}

Expand All @@ -336,7 +336,7 @@ func AuthorizeOfAmfFromConfig(nfId string) ([]models.AuthorizedNssaiAvailability
return authorizedNssaiAvailabilityDataList, nil
}
}
err := fmt.Errorf("No AMF configuration of %s", nfId)
err := fmt.Errorf("no AMF configuration of %s", nfId)
return authorizedNssaiAvailabilityDataList, err
}

Expand Down Expand Up @@ -407,7 +407,7 @@ func AddAllowedSnssai(allowedSnssai models.AllowedSnssai, accessType models.Acce
if authorizedNetworkSliceInfo.AllowedNssaiList[i].AccessType == accessType {
hitAllowedNssai = true
if len(authorizedNetworkSliceInfo.AllowedNssaiList[i].AllowedSnssaiList) == allowedNssaiNum {
logger.Util.Infof("Unable to add a new Allowed S-NSSAI since already eight S-NSSAIs in Allowed NSSAI")
logger.Util.Infof("unable to add a new Allowed S-NSSAI since already eight S-NSSAIs in Allowed NSSAI")
} else {
authorizedNetworkSliceInfo.AllowedNssaiList[i].AllowedSnssaiList = append(authorizedNetworkSliceInfo.AllowedNssaiList[i].AllowedSnssaiList, allowedSnssai)
}
Expand All @@ -428,7 +428,7 @@ func AddAllowedSnssai(allowedSnssai models.AllowedSnssai, accessType models.Acce
func AddAmfInformation(tai models.Tai, authorizedNetworkSliceInfo *models.AuthorizedNetworkSliceInfo) {
factory.ConfigLock.RLock()
defer factory.ConfigLock.RUnlock()
if authorizedNetworkSliceInfo.AllowedNssaiList == nil || len(authorizedNetworkSliceInfo.AllowedNssaiList) == 0 {
if len(authorizedNetworkSliceInfo.AllowedNssaiList) == 0 {
return
}

Expand Down Expand Up @@ -459,7 +459,7 @@ func AddAmfInformation(tai models.Tai, authorizedNetworkSliceInfo *models.Author
continue
} else {
// Add AMF Set to Authorized Network Slice Info
if amfSetConfig.AmfList != nil && len(amfSetConfig.AmfList) != 0 {
if len(amfSetConfig.AmfList) != 0 {
// List of candidate AMF(s) provided in configuration
authorizedNetworkSliceInfo.CandidateAmfList = append(authorizedNetworkSliceInfo.CandidateAmfList, amfSetConfig.AmfList...)
} else {
Expand Down Expand Up @@ -502,6 +502,6 @@ func AddAmfInformation(tai models.Tai, authorizedNetworkSliceInfo *models.Author
}

if !hitAmf {
logger.Util.Warnf("No candidate AMF or AMF Set can serve the UE")
logger.Util.Warnf("no candidate AMF or AMF Set can serve the UE")
}
}

0 comments on commit 486f254

Please sign in to comment.