Skip to content

Commit

Permalink
fix: ci error
Browse files Browse the repository at this point in the history
  • Loading branch information
ming-hsien committed May 8, 2024
1 parent c4d5932 commit 84af015
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 39 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/free5gc/smf/internal/logger"
"github.com/free5gc/smf/pkg/factory"
"github.com/free5gc/smf/pkg/service"
logger_util "github.com/free5gc/util/logger"
"github.com/free5gc/smf/pkg/utils"
logger_util "github.com/free5gc/util/logger"
"github.com/free5gc/util/version"
)

Expand Down
9 changes: 7 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,21 @@ require (
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/mapstructure v1.4.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.8.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
Expand All @@ -61,12 +62,16 @@ require (
github.com/ugorji/go/codec v1.2.11 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.17.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mvdan.cc/gofumpt v0.6.0 // indirect
)
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand Down Expand Up @@ -169,6 +171,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down Expand Up @@ -200,6 +204,9 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
Expand Down Expand Up @@ -281,6 +288,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -324,6 +333,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -405,6 +416,8 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -507,6 +520,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
mvdan.cc/gofumpt v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
mvdan.cc/gofumpt v0.6.0/go.mod h1:4L0wf+kgIPZtcCWXynNS2e6bhmj73umwnuXSZarixzA=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
Expand Down
2 changes: 1 addition & 1 deletion internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type SMFContext struct {
ListenAddr string

UDMProfile models.NfProfile
NfProfile NFProfile
NfProfile NFProfile

Key string
PEM string
Expand Down
6 changes: 3 additions & 3 deletions internal/context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
"time"

"github.com/antihax/optional"
"github.com/google/uuid"
"github.com/sirupsen/logrus"

"github.com/free5gc/nas/nasConvert"
"github.com/free5gc/nas/nasMessage"
"github.com/free5gc/ngap/ngapType"
Expand All @@ -21,10 +24,7 @@ import (
"github.com/free5gc/pfcp/pfcpType"
"github.com/free5gc/smf/internal/logger"
"github.com/free5gc/smf/pkg/factory"

"github.com/free5gc/util/idgenerator"
"github.com/google/uuid"
"github.com/sirupsen/logrus"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/consumer/chf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ func (s *nchfService) buildConvergedChargingRequest(smContext *smf_context.SMCon
return req
}

func (s *nchfService) SendConvergedChargingRequest(smContext *smf_context.SMContext, requestType smf_context.RequestType,
multipleUnitUsage []models.MultipleUnitUsage,
func (s *nchfService) SendConvergedChargingRequest(smContext *smf_context.SMContext,
requestType smf_context.RequestType, multipleUnitUsage []models.MultipleUnitUsage,
) (*models.ChargingDataResponse, *models.ProblemDetails, error) {
logger.ChargingLog.Info("Handle SendConvergedChargingRequest")

Expand Down
16 changes: 11 additions & 5 deletions internal/sbi/consumer/nrf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ func (s *nnrfService) SendSearchNFInstances(nrfUri string, targetNfType, request
return &result, err
}

func (s *nnrfService) NFDiscoveryUDM(ctx context.Context) (result models.SearchResult, httpResp *http.Response, localErr error) {
func (s *nnrfService) NFDiscoveryUDM(ctx context.Context) (result models.SearchResult,
httpResp *http.Response, localErr error,
) {
localVarOptionals := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{}

smfContext := s.consumer.Context()
Expand All @@ -284,7 +286,9 @@ func (s *nnrfService) NFDiscoveryUDM(ctx context.Context) (result models.SearchR
return result, httpResp, localErr
}

func (s *nnrfService) NFDiscoveryPCF(ctx context.Context) (result models.SearchResult, httpResp *http.Response, localErr error) {
func (s *nnrfService) NFDiscoveryPCF(ctx context.Context) (
result models.SearchResult, httpResp *http.Response, localErr error,
) {
localVarOptionals := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{}

smfContext := s.consumer.Context()
Expand All @@ -296,7 +300,9 @@ func (s *nnrfService) NFDiscoveryPCF(ctx context.Context) (result models.SearchR
return result, httpResp, localErr
}

func (s *nnrfService) NFDiscoveryAMF(smContext *smf_context.SMContext, ctx context.Context) (result models.SearchResult, httpResp *http.Response, localErr error) {
func (s *nnrfService) NFDiscoveryAMF(smContext *smf_context.SMContext, ctx context.Context) (
result models.SearchResult, httpResp *http.Response, localErr error,
) {
localVarOptionals := Nnrf_NFDiscovery.SearchNFInstancesParamOpts{}

localVarOptionals.TargetNfInstanceId = optional.NewInterface(smContext.ServingNfId)
Expand Down Expand Up @@ -326,8 +332,8 @@ func (s *nnrfService) SendNFDiscoveryUDM() (*models.ProblemDetails, error) {

for _, service := range *smfContext.UDMProfile.NfServices {
if service.ServiceName == models.ServiceName_NUDM_SDM {
smfContext.SubscriberDataManagementClient =
s.consumer.nudmService.getSubscribeDataManagementClient(service.ApiPrefix)
smfContext.SubscriberDataManagementClient = s.consumer.nudmService.
getSubscribeDataManagementClient(service.ApiPrefix)
}
}

Expand Down
4 changes: 3 additions & 1 deletion internal/sbi/consumer/pcf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func (s *npcfService) getSMPolicyControlClient(uri string) *Npcf_SMPolicyControl
}

// SendSMPolicyAssociationCreate create the session management association to the PCF
func (s *npcfService) SendSMPolicyAssociationCreate(smContext *smf_context.SMContext) (string, *models.SmPolicyDecision, error) {
func (s *npcfService) SendSMPolicyAssociationCreate(smContext *smf_context.SMContext) (
string, *models.SmPolicyDecision, error,
) {
var client *Npcf_SMPolicyControl.APIClient

// Create SMPolicyControl Client for this SM Context
Expand Down
4 changes: 3 additions & 1 deletion internal/sbi/processor/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ func (p *Processor) HandleChargingNotification(chargingNotifyRequest models.Char

// While receive Charging Notification from CHF, SMF will send Charging Information to CHF and update UPF
// The Charging Notification will be sent when CHF found the changes of the quota file.
func (p *Processor) chargingNotificationProcedure(req models.ChargingNotifyRequest, smContextRef string) *models.ProblemDetails {
func (p *Processor) chargingNotificationProcedure(
req models.ChargingNotifyRequest, smContextRef string,
) *models.ProblemDetails {
if smContext := smf_context.GetSMContextByRef(smContextRef); smContext != nil {
smContext.SMLock.Lock()
defer smContext.SMLock.Unlock()
Expand Down
8 changes: 6 additions & 2 deletions internal/sbi/processor/charging_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ func (p *Processor) CreateChargingSession(smContext *smf_context.SMContext) {
}
}

func (p *Processor) UpdateChargingSession(smContext *smf_context.SMContext, urrList []*smf_context.URR, trigger models.Trigger) {
func (p *Processor) UpdateChargingSession(
smContext *smf_context.SMContext, urrList []*smf_context.URR, trigger models.Trigger,
) {
var multipleUnitUsage []models.MultipleUnitUsage

for _, urr := range urrList {
Expand Down Expand Up @@ -242,7 +244,9 @@ func getUrrByRg(smContext *smf_context.SMContext, upfId string, rg int32) *smf_c
}

// Update the urr by the charging information renewed by chf
func (p *Processor) updateGrantedQuota(smContext *smf_context.SMContext, multipleUnitInformation []models.MultipleUnitInformation) {
func (p *Processor) updateGrantedQuota(
smContext *smf_context.SMContext, multipleUnitInformation []models.MultipleUnitInformation,
) {
for _, ui := range multipleUnitInformation {
trigger := pfcpType.ReportingTriggers{}

Expand Down
12 changes: 9 additions & 3 deletions internal/sbi/processor/pdu_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ func (p *Processor) HandlePDUSessionSMContextCreate(isDone <-chan struct{},
}
}

func (p *Processor) HandlePDUSessionSMContextUpdate(smContextRef string, body models.UpdateSmContextRequest) *httpwrapper.Response {
func (p *Processor) HandlePDUSessionSMContextUpdate(
smContextRef string, body models.UpdateSmContextRequest,
) *httpwrapper.Response {
// GSM State
// PDU Session Modification Reject(Cause Value == 43 || Cause Value != 43)/Complete
// PDU Session Release Command/Complete
Expand Down Expand Up @@ -867,7 +869,9 @@ func (p *Processor) HandlePDUSessionSMContextUpdate(smContextRef string, body mo
return httpResponse
}

func (p *Processor) HandlePDUSessionSMContextRelease(smContextRef string, body models.ReleaseSmContextRequest) *httpwrapper.Response {
func (p *Processor) HandlePDUSessionSMContextRelease(
smContextRef string, body models.ReleaseSmContextRequest,
) *httpwrapper.Response {
logger.PduSessLog.Infoln("In HandlePDUSessionSMContextRelease")
smContext := smf_context.GetSMContextByRef(smContextRef)

Expand Down Expand Up @@ -994,7 +998,9 @@ func (p *Processor) HandlePDUSessionSMContextRelease(smContextRef string, body m
return httpResponse
}

func (p *Processor) HandlePDUSessionSMContextLocalRelease(smContext *smf_context.SMContext, createData *models.SmContextCreateData) {
func (p *Processor) HandlePDUSessionSMContextLocalRelease(
smContext *smf_context.SMContext, createData *models.SmContextCreateData,
) {
smContext.SMLock.Lock()
defer smContext.SMLock.Unlock()

Expand Down
8 changes: 6 additions & 2 deletions internal/sbi/processor/pdu_session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,10 @@ func TestHandlePDUSessionSMContextCreate(t *testing.T) {
}

mockSmf := app.NewMockApp(gomock.NewController(t))
consumer, _ := consumer.NewConsumer(mockSmf)
consumer, err := consumer.NewConsumer(mockSmf)
if err != nil {
t.Fatalf("Failed to create consumer: %+v", err)
}
processor, err := processor.NewProcessor(mockSmf, consumer)
if err != nil {
t.Fatalf("Failed to create processor: %+v", err)
Expand All @@ -594,7 +597,8 @@ func TestHandlePDUSessionSMContextCreate(t *testing.T) {

createData := tc.request.JsonData
if createData != nil {
if ref, err := context.ResolveRef(createData.Supi,
var ref string
if ref, err = context.ResolveRef(createData.Supi,
createData.PduSessionId); err == nil {
context.RemoveSMContext(ref)
}
Expand Down
4 changes: 3 additions & 1 deletion internal/sbi/processor/sm_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ func (p *Processor) RemoveSMContextFromAllNF(smContext *smf_context.SMContext, s
go p.sendSMContextStatusNotificationAndRemoveSMContext(smContext, sendNotification)
}

func (p *Processor) sendSMContextStatusNotificationAndRemoveSMContext(smContext *smf_context.SMContext, sendNotification bool) {
func (p *Processor) sendSMContextStatusNotificationAndRemoveSMContext(
smContext *smf_context.SMContext, sendNotification bool,
) {
smContext.SMLock.Lock()
defer smContext.SMLock.Unlock()

Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package sbi
import (
"context"
"fmt"

"net/http"
"runtime/debug"
"sync"
"time"

"github.com/gin-gonic/gin"

"github.com/free5gc/openapi/models"
smf_context "github.com/free5gc/smf/internal/context"
"github.com/free5gc/smf/internal/logger"
Expand All @@ -19,7 +20,6 @@ import (
"github.com/free5gc/smf/pkg/factory"
"github.com/free5gc/util/httpwrapper"
logger_util "github.com/free5gc/util/logger"
"github.com/gin-gonic/gin"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type App interface {
SetLogLevel(level string)
SetReportCaller(reportCaller bool)

Start() error
Start()
Terminate()

Context() *smf_context.SMFContext
Expand Down
6 changes: 2 additions & 4 deletions pkg/app/mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func NewApp(
cfg *factory.Config, tlsKeyLogPath string, pfcpStart func(*SmfApp), pfcpTerminate func(),
) (*SmfApp, error) {
smf := &SmfApp{
cfg: cfg,
wg: sync.WaitGroup{},
pfcpStart: pfcpStart,
cfg: cfg,
wg: sync.WaitGroup{},
pfcpStart: pfcpStart,
pfcpTerminate: pfcpTerminate,
}
smf.SetLogEnable(cfg.GetLogEnable())
Expand Down Expand Up @@ -144,16 +144,18 @@ func (a *SmfApp) SetReportCaller(reportCaller bool) {
logger.Log.SetReportCaller(reportCaller)
}

func (a *SmfApp) Start() error {
func (a *SmfApp) Start() {
logger.InitLog.Infoln("Server started")

a.sbiServer.Run(context.Background(), &a.wg)
err := a.sbiServer.Run(context.Background(), &a.wg)
if err != nil {
logger.MainLog.Errorf("sbi server run error %+v", err)
}

go a.listenShutDownEvent()

// Initialize PFCP server
a.pfcpStart(a)

return nil
}

func (a *SmfApp) listenShutDownEvent() {
Expand Down
Loading

0 comments on commit 84af015

Please sign in to comment.