Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable fieldalignment go vet check #66

Merged
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
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ linters-settings:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
# enable all analyzers
enable-all: true
disable:
- fieldalignment
depguard:
list-type: blacklist
include-go-root: false
Expand Down
20 changes: 10 additions & 10 deletions context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type PCFContext struct {
UriScheme models.UriScheme
BindingIPv4 string
RegisterIPv4 string
SBIPort int
TimeFormat string
DefaultBdtRefId string
NfService map[models.ServiceName]models.NfService
Expand All @@ -58,14 +57,14 @@ type PCFContext struct {
// App Session related
AppSessionPool sync.Map
// AMF Status Change Subscription related
AMFStatusSubsData sync.Map // map[string]AMFStatusSubscriptionData; subscriptionID as key
AMFStatusSubsData sync.Map // map[string]AMFStatusSubscriptionData; subscriptionID as key
PcfSubscriberPolicyData map[string]*PcfSubscriberPolicyData // subscriberId is key

DnnList []string
PlmnList []factory.PlmnSupportItem
SBIPort int
// lock
DefaultUdrURILock sync.RWMutex

DnnList []string
PlmnList []factory.PlmnSupportItem
PcfSubscriberPolicyData map[string]*PcfSubscriberPolicyData // subscriberId is key
}

type SessionPolicy struct {
Expand All @@ -81,9 +80,9 @@ type PccPolicy struct {
IdGenerator *idgenerator.IDGenerator
}
type PcfSubscriberPolicyData struct {
Supi string
PccPolicy map[string]*PccPolicy // sst+sd is key
CtxLog *logrus.Entry
Supi string
}

type AMFStatusSubscriptionData struct {
Expand All @@ -93,16 +92,17 @@ type AMFStatusSubscriptionData struct {
}

type AppSessionData struct {
AppSessionId string
AppSessionContext *models.AppSessionContext
// (compN/compN-subCompN/appId-%s) map to PccRule
RelatedPccRuleIds map[string]string
PccRuleIdMapToCompId map[string]string
// related Session
SmPolicyData *UeSmPolicyData
// EventSubscription
Events map[models.AfEvent]models.AfNotifMethod
EventUri string
// related Session
SmPolicyData *UeSmPolicyData

AppSessionId string
}

// Create new PCF context
Expand Down
40 changes: 20 additions & 20 deletions context/ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ import (

// key is supi
type UeContext struct {
// Ue Context
Supi string
Gpsi string
Pei string
GroupIds []string
PolAssociationIDGenerator uint32
AMPolicyData map[string]*UeAMPolicyData // use PolAssoId(ue.Supi-numPolId) as key

// Udr Ref
UdrUri string
// SMPolicy
Expand All @@ -41,6 +33,14 @@ type UeContext struct {
AppSessionIdStore *AppSessionIdStore
PolicyDataSubscriptionStore *models.PolicyDataSubscription
PolicyDataChangeStore *models.PolicyDataChangeNotification

// Ue Context
Supi string
Gpsi string
Pei string
AMPolicyData map[string]*UeAMPolicyData // use PolAssoId(ue.Supi-numPolId) as key
GroupIds []string
PolAssociationIDGenerator uint32
}

type UeAMPolicyData struct {
Expand All @@ -55,19 +55,19 @@ type UeAMPolicyData struct {
Guami *models.Guami
ServiveName string
// TraceReq *TraceData
// Policy Association
Triggers []models.RequestTrigger
ServAreaRes *models.ServiceAreaRestriction
Rfsp int32
UserLoc *models.UserLocation
TimeZone string
SuppFeat string
// about AF request
Pras map[string]models.PresenceInfo
// related to UDR Subscription Data
AmPolicyData *models.AmPolicyData // Svbscription Data
// Corresponding UE
PcfUe *UeContext
// Policy Association
ServAreaRes *models.ServiceAreaRestriction
UserLoc *models.UserLocation
TimeZone string
SuppFeat string
Triggers []models.RequestTrigger
Rfsp int32
}

type UeSmPolicyData struct {
Expand All @@ -82,9 +82,6 @@ type UeSmPolicyData struct {
// SmfId string
// TraceReq *TraceData
// RecoveryTime *time.Time
PackFiltIdGenarator int32
PccRuleIdGenarator int32
ChargingIdGenarator int32
// FlowMapsToPackFiltIds map[string][]string // use Flow Description(in TS 29214) as key map to pcc rule ids
PackFiltMapToPccRuleId map[string]string // use PackFiltId as Key
// Related to GBR
Expand All @@ -98,7 +95,10 @@ type UeSmPolicyData struct {
// related to AppSession
AppSessions map[string]bool // related appSessionId
// Corresponding UE
PcfUe *UeContext
PcfUe *UeContext
PackFiltIdGenarator int32
PccRuleIdGenarator int32
ChargingIdGenarator int32
}

// NewUeAMPolicyData returns created UeAMPolicyData data and insert this data to Ue.AMPolicyData with assolId as key
Expand Down Expand Up @@ -464,8 +464,8 @@ func (ue *UeContext) SMPolicyFindByIdentifiersIpv6(v6 string, sNssai *models.Sns

// AppSessionIdStore -
type AppSessionIdStore struct {
AppSessionId string
AppSessionContext models.AppSessionContext
AppSessionId string
}

var AppSessionContextStore []AppSessionIdStore
Expand Down
19 changes: 10 additions & 9 deletions factory/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@ const (
)

type Configuration struct {
PcfName string `yaml:"pcfName,omitempty"`
Sbi *Sbi `yaml:"sbi,omitempty"`
TimeFormat string `yaml:"timeFormat,omitempty"`
DefaultBdtRefId string `yaml:"defaultBdtRefId,omitempty"`
NrfUri string `yaml:"nrfUri,omitempty"`
ServiceList []Service `yaml:"serviceList,omitempty"`
PlmnList []PlmnSupportItem `yaml:"plmnList,omitempty"`
Mongodb *Mongodb `yaml:"mongodb"`
PcfName string `yaml:"pcfName,omitempty"`
Sbi *Sbi `yaml:"sbi,omitempty"`
TimeFormat string `yaml:"timeFormat,omitempty"`
DefaultBdtRefId string `yaml:"defaultBdtRefId,omitempty"`
NrfUri string `yaml:"nrfUri,omitempty"`
ServiceList []Service `yaml:"serviceList,omitempty"`
Mongodb *Mongodb `yaml:"mongodb"`

/* below config received from RoC */
// config received from RoC
DnnList map[string][]string // sst+sd os key
SlicePlmn map[string]PlmnSupportItem

PlmnList []PlmnSupportItem `yaml:"plmnList,omitempty"`
}

type Service struct {
Expand Down
23 changes: 8 additions & 15 deletions httpcallback/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package httpcallback

import (
"net/http"
"strings"

"github.com/gin-gonic/gin"

Expand All @@ -17,14 +16,14 @@ import (

// Route is the information for every URI.
type Route struct {
// HandlerFunc is the handler function of this route.
HandlerFunc gin.HandlerFunc
// Name is the name of this Route.
Name string
// Method is the string for the HTTP method. ex) GET, POST etc..
Method string
// Pattern is the pattern of the URI.
Pattern string
// HandlerFunc is the handler function of this route.
HandlerFunc gin.HandlerFunc
}

// Routes is the list of the generated Route.
Expand Down Expand Up @@ -56,23 +55,17 @@ func Index(c *gin.Context) {

var routes = Routes{
{
"Index",
"GET",
"/",
Index,
Name: "Index", Method: "GET",
Pattern: "/", HandlerFunc: Index,
},

{
"HTTPNudrNotify",
strings.ToUpper("Post"),
"/nudr-notify/:supi",
HTTPNudrNotify,
Name: "HTTPNudrNotify", Method: "POST",
Pattern: "/nudr-notify/:supi", HandlerFunc: HTTPNudrNotify,
},

{
"HTTPAmfStatusChangeNotify",
strings.ToUpper("Post"),
"/amfstatus",
HTTPAmfStatusChangeNotify,
Name: "HTTPAmfStatusChangeNotify", Method: "POST",
Pattern: "/amfstatus", HandlerFunc: HTTPAmfStatusChangeNotify,
},
}
2 changes: 1 addition & 1 deletion internal/notifyevent/send_smpolicy_termination.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
const SendSMpolicyTerminationNotifyEventName event.Name = "SendSMpolicyTerminationNotify"

type SendSMpolicyTerminationNotifyEvent struct {
uri string
request *models.TerminationNotification
uri string
}

func (e SendSMpolicyTerminationNotifyEvent) Handle() {
Expand Down
2 changes: 1 addition & 1 deletion internal/notifyevent/send_smpolicy_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
const SendSMpolicyUpdateNotifyEventName event.Name = "SendSMpolicyUpdateNotify"

type SendSMpolicyUpdateNotifyEvent struct {
uri string
request *models.SmPolicyNotification
uri string
}

func (e SendSMpolicyUpdateNotifyEvent) Handle() {
Expand Down
Loading