diff --git a/.golangci.yml b/.golangci.yml index cb211ee..b7ff14b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 diff --git a/context/context.go b/context/context.go index 7a283fe..60a3bb6 100644 --- a/context/context.go +++ b/context/context.go @@ -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 @@ -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 { @@ -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 { @@ -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 diff --git a/context/ue.go b/context/ue.go index 3acfa26..a07bdd1 100644 --- a/context/ue.go +++ b/context/ue.go @@ -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 @@ -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 { @@ -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 { @@ -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 @@ -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 @@ -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 diff --git a/factory/config.go b/factory/config.go index 399ecae..f8d98f1 100644 --- a/factory/config.go +++ b/factory/config.go @@ -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 { diff --git a/httpcallback/router.go b/httpcallback/router.go index 22eb80f..4ff07b3 100644 --- a/httpcallback/router.go +++ b/httpcallback/router.go @@ -7,7 +7,6 @@ package httpcallback import ( "net/http" - "strings" "github.com/gin-gonic/gin" @@ -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. @@ -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, }, } diff --git a/internal/notifyevent/send_smpolicy_termination.go b/internal/notifyevent/send_smpolicy_termination.go index 3f243ee..ea77686 100644 --- a/internal/notifyevent/send_smpolicy_termination.go +++ b/internal/notifyevent/send_smpolicy_termination.go @@ -19,8 +19,8 @@ import ( const SendSMpolicyTerminationNotifyEventName event.Name = "SendSMpolicyTerminationNotify" type SendSMpolicyTerminationNotifyEvent struct { - uri string request *models.TerminationNotification + uri string } func (e SendSMpolicyTerminationNotifyEvent) Handle() { diff --git a/internal/notifyevent/send_smpolicy_update.go b/internal/notifyevent/send_smpolicy_update.go index 775a966..7f76f34 100644 --- a/internal/notifyevent/send_smpolicy_update.go +++ b/internal/notifyevent/send_smpolicy_update.go @@ -19,8 +19,8 @@ import ( const SendSMpolicyUpdateNotifyEventName event.Name = "SendSMpolicyUpdateNotify" type SendSMpolicyUpdateNotifyEvent struct { - uri string request *models.SmPolicyNotification + uri string } func (e SendSMpolicyUpdateNotifyEvent) Handle() {