Skip to content

Commit

Permalink
chore(deps): bump golang from 1.22.6-bookworm to 1.23.0-bookworm (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] committed Aug 19, 2024
1 parent 6ed06bf commit ab66c60
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 35 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 consumer/nf_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func SendSearchNFInstances(nrfUri string, targetNfType, requestNfType models.NfT
var res *http.Response
result, res, err := client.NFInstancesStoreApi.SearchNFInstances(context.TODO(), targetNfType, requestNfType, &param)
if res != nil && res.StatusCode == http.StatusTemporaryRedirect {
err = fmt.Errorf("Temporary Redirect For Non NRF Consumer")
err = fmt.Errorf("temporary Redirect For Non NRF Consumer")
}
defer func() {
if rspCloseErr := res.Body.Close(); rspCloseErr != nil {
Expand Down
2 changes: 1 addition & 1 deletion factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func CheckConfigVersion() error {
currentVersion := UdrConfig.GetVersion()

if currentVersion != UDR_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, UDR_EXPECTED_CONFIG_VERSION)
}

Expand Down
60 changes: 29 additions & 31 deletions service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import (
"github.com/omec-project/openapi/models"
"github.com/omec-project/udr/consumer"
"github.com/omec-project/udr/context"
udr_context "github.com/omec-project/udr/context"
"github.com/omec-project/udr/datarepository"
"github.com/omec-project/udr/factory"
"github.com/omec-project/udr/logger"
"github.com/omec-project/udr/metrics"
"github.com/omec-project/udr/producer"
"github.com/omec-project/udr/util"
"github.com/omec-project/util/http2_util"
logger_util "github.com/omec-project/util/logger"
mongoDBLibLogger "github.com/omec-project/util/logger"
loggerUtil "github.com/omec-project/util/logger"
"github.com/omec-project/util/path_util"
pathUtilLogger "github.com/omec-project/util/path_util/logger"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -140,17 +138,17 @@ func (udr *UDR) setLogLevel() {
if factory.UdrConfig.Logger.MongoDBLibrary != nil {
if factory.UdrConfig.Logger.MongoDBLibrary.DebugLevel != "" {
if level, err := logrus.ParseLevel(factory.UdrConfig.Logger.MongoDBLibrary.DebugLevel); err != nil {
mongoDBLibLogger.AppLog.Warnf("MongoDBLibrary Log level [%s] is invalid, set to [info] level",
loggerUtil.AppLog.Warnf("MongoDBLibrary Log level [%s] is invalid, set to [info] level",
factory.UdrConfig.Logger.MongoDBLibrary.DebugLevel)
mongoDBLibLogger.SetLogLevel(logrus.InfoLevel)
loggerUtil.SetLogLevel(logrus.InfoLevel)
} else {
mongoDBLibLogger.SetLogLevel(level)
loggerUtil.SetLogLevel(level)
}
} else {
mongoDBLibLogger.AppLog.Warnln("MongoDBLibrary Log level not set. Default set to [info] level")
mongoDBLibLogger.SetLogLevel(logrus.InfoLevel)
loggerUtil.AppLog.Warnln("MongoDBLibrary Log level not set. Default set to [info] level")
loggerUtil.SetLogLevel(logrus.InfoLevel)
}
mongoDBLibLogger.SetReportCaller(factory.UdrConfig.Logger.MongoDBLibrary.ReportCaller)
loggerUtil.SetReportCaller(factory.UdrConfig.Logger.MongoDBLibrary.ReportCaller)
}
}

Expand All @@ -171,21 +169,21 @@ func (udr *UDR) Start() {
// get config file info
config := factory.UdrConfig
mongodb := config.Configuration.Mongodb
initLog.Infof("UDR Config Info: Version[%s] Description[%s]", config.Info.Version, config.Info.Description)
initLog.Infof("udr config info: Version[%s] Description[%s]", config.Info.Version, config.Info.Description)

// Connect to MongoDB
producer.ConnectMongo(mongodb.Url, mongodb.Name, mongodb.AuthUrl, mongodb.AuthKeysDbName)
initLog.Infoln("Server started")
initLog.Infoln("server started")

router := logger_util.NewGinWithLogrus(logger.GinLog)
router := loggerUtil.NewGinWithLogrus(logger.GinLog)

datarepository.AddService(router)

go metrics.InitMetrics()

udrLogPath := util.UdrLogPath

self := udr_context.UDR_Self()
self := context.UDR_Self()
util.InitUdrContext(self)

addr := fmt.Sprintf("%s:%d", self.BindingIPv4, self.SBIPort)
Expand All @@ -203,12 +201,12 @@ func (udr *UDR) Start() {

server, err := http2_util.NewServer(addr, udrLogPath, router)
if server == nil {
initLog.Errorf("Initialize HTTP server failed: %+v", err)
initLog.Errorf("initialize HTTP server failed: %+v", err)
return
}

if err != nil {
initLog.Warnf("Initialize HTTP server: %+v", err)
initLog.Warnf("initialize HTTP server: %+v", err)
}

serverScheme := factory.UdrConfig.Configuration.Sbi.Scheme
Expand All @@ -219,7 +217,7 @@ func (udr *UDR) Start() {
}

if err != nil {
initLog.Fatalf("HTTP server setup failed: %+v", err)
initLog.Fatalf("http server setup failed: %+v", err)
}
}

Expand Down Expand Up @@ -279,22 +277,22 @@ func (udr *UDR) Exec(c *cli.Context) error {
}

func (udr *UDR) Terminate() {
logger.InitLog.Infof("Terminating UDR...")
logger.InitLog.Infof("terminating UDR...")
// deregister with NRF
problemDetails, err := consumer.SendDeregisterNFInstance()
if problemDetails != nil {
logger.InitLog.Errorf("Deregister NF instance Failed Problem[%+v]", problemDetails)
logger.InitLog.Errorf("deregister NF instance Failed Problem[%+v]", problemDetails)
} else if err != nil {
logger.InitLog.Errorf("Deregister NF instance Error[%+v]", err)
logger.InitLog.Errorf("deregister NF instance Error[%+v]", err)
} else {
logger.InitLog.Infof("Deregister from NRF successfully")
logger.InitLog.Infof("deregister from NRF successfully")
}
logger.InitLog.Infof("UDR terminated")
logger.InitLog.Infof("udr terminated")
}

func (udr *UDR) configUpdateDb() {
for msg := range factory.ConfigUpdateDbTrigger {
initLog.Infof("Config update DB trigger")
initLog.Infof("config update DB trigger")
err := producer.AddEntrySmPolicyTable(
msg.SmPolicyTable.Imsi,
msg.SmPolicyTable.Dnn,
Expand All @@ -314,14 +312,14 @@ func (udr *UDR) StartKeepAliveTimer(nfProfile models.NfProfile) {
if nfProfile.HeartBeatTimer == 0 {
nfProfile.HeartBeatTimer = 60
}
logger.InitLog.Infof("Started KeepAlive Timer: %v sec", nfProfile.HeartBeatTimer)
logger.InitLog.Infof("started KeepAlive Timer: %v sec", nfProfile.HeartBeatTimer)
// AfterFunc starts timer and waits for KeepAliveTimer to elapse and then calls udr.UpdateNF function
KeepAliveTimer = time.AfterFunc(time.Duration(nfProfile.HeartBeatTimer)*time.Second, udr.UpdateNF)
}

func (udr *UDR) StopKeepAliveTimer() {
if KeepAliveTimer != nil {
logger.InitLog.Infof("Stopped KeepAlive Timer.")
logger.InitLog.Infof("stopped KeepAlive Timer.")
KeepAliveTimer.Stop()
KeepAliveTimer = nil
}
Expand All @@ -330,7 +328,7 @@ func (udr *UDR) StopKeepAliveTimer() {
func (udr *UDR) BuildAndSendRegisterNFInstance() (prof models.NfProfile, err error) {
self := context.UDR_Self()
profile := consumer.BuildNFInstance(self)
initLog.Infof("Pcf Profile Registering to NRF: %v", profile)
initLog.Infof("pcf Profile Registering to NRF: %v", profile)
// Indefinite attempt to register until success
profile, _, self.NfId, err = consumer.SendRegisterNFInstance(self.NrfUri, self.NfId, profile)
return profile, err
Expand All @@ -341,7 +339,7 @@ func (udr *UDR) UpdateNF() {
KeepAliveTimerMutex.Lock()
defer KeepAliveTimerMutex.Unlock()
if KeepAliveTimer == nil {
initLog.Warnf("KeepAlive timer has been stopped.")
initLog.Warnf("keepAlive timer has been stopped.")
return
}
// setting default value 30 sec
Expand Down Expand Up @@ -377,25 +375,25 @@ func (udr *UDR) UpdateNF() {
// use hearbeattimer value with received timer value from NRF
heartBeatTimer = nfProfile.HeartBeatTimer
}
logger.InitLog.Debugf("Restarted KeepAlive Timer: %v sec", heartBeatTimer)
logger.InitLog.Debugf("restarted KeepAlive Timer: %v sec", heartBeatTimer)
// restart timer with received HeartBeatTimer value
KeepAliveTimer = time.AfterFunc(time.Duration(heartBeatTimer)*time.Second, udr.UpdateNF)
}

func (udr *UDR) registerNF() {
for msg := range factory.ConfigPodTrigger {
initLog.Infof("Minimum configuration from config pod available %v", msg)
self := udr_context.UDR_Self()
initLog.Infof("minimum configuration from config pod available %v", msg)
self := context.UDR_Self()
profile := consumer.BuildNFInstance(self)
var err error
var prof models.NfProfile
// send registration with updated PLMN Ids.
prof, _, self.NfId, err = consumer.SendRegisterNFInstance(self.NrfUri, profile.NfInstanceId, profile)
if err == nil {
udr.StartKeepAliveTimer(prof)
logger.CfgLog.Infoln("Sent Register NF Instance with updated profile")
logger.CfgLog.Infoln("sent Register NF Instance with updated profile")
} else {
initLog.Errorf("Send Register NFInstance Error[%s]", err.Error())
initLog.Errorf("send Register NFInstance Error[%s]", err.Error())
}
}
}
2 changes: 1 addition & 1 deletion udr.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
func action(c *cli.Context) error {
if err := UDR.Initialize(c); err != nil {
logger.CfgLog.Errorf("%+v", err)
return fmt.Errorf("Failed to initialize !!")
return fmt.Errorf("failed to initialize")
}

UDR.Start()
Expand Down

0 comments on commit ab66c60

Please sign in to comment.