diff --git a/README.md b/README.md index c1faed2..59011a6 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Under the hood, the SDK exposes through a RESTful API the Network Function you've built, according to the standard. The RESTful API is implemented using [Gin](https://github.com/gin-gonic/gin) framework. -At the moment, the APIs are implemented for the release 15 of the 3GPP specifications (3GPP TS 29.571 version 15.3.0 Release 15). +At the moment, the APIs are implemented for the release 18 of the 3GPP specifications. ## Getting Started @@ -41,13 +41,4 @@ Licensed under the MIT License. See the [LICENSE](LICENSE) file for details. ## Roadmap -- [x] Implement all the common Data Types from the [3GPP specifications - 3GPP TS 29.571 version 15.3.0 Release 15](https://www.etsi.org/deliver/etsi_ts/129500_129599/129571/15.03.00_60/ts_129571v150300p.pdf) -- [ ] Provides NAF API -- [ ] Provides NAMF API -- [ ] Provides NAUSF API -- [ ] Provides NNEF API -- [ ] Provides NNRF API -- [ ] Provides NNSSF API -- [ ] Provides NPCF API -- [ ] Provides NSMF API -- [ ] Provides NUDM API +TBD diff --git a/fivegc/config.go b/fivegc/config.go new file mode 100644 index 0000000..c95d096 --- /dev/null +++ b/fivegc/config.go @@ -0,0 +1,31 @@ +package fivegc + +import "net/http" + +// ClientConfiguration stores the configuration of the API client +type ClientConfiguration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +type ServerConfigurations []ServerConfiguration + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} diff --git a/fivegc/nlmf/broadcast.go b/fivegc/nlmf/broadcast.go new file mode 100644 index 0000000..d1f0cac --- /dev/null +++ b/fivegc/nlmf/broadcast.go @@ -0,0 +1,111 @@ +package nlmf + +import ( + "context" + "github.com/5GCoreNet/5GCoreNetSDK/fivegc" + "github.com/5GCoreNet/5GCoreNetSDK/internal/header" + openapinlmfbroadcastclient "github.com/5GCoreNet/client-openapi/Nlmf_Broadcast" + openapinlmfbroadcastserver "github.com/5GCoreNet/server-openapi/Nlmf_Broadcast" + "github.com/gin-gonic/gin" +) + +type Broadcast interface { + // Error returns a problem details, it is used to handle errors when unmarshalling the request. + Error(ctx context.Context, err error) openapinlmfbroadcastserver.ProblemDetails + // CipherKeyData returns a cipher response data, a problem details, a redirect response and a status code. + CipherKeyData(context.Context, openapinlmfbroadcastserver.CipherRequestData) (openapinlmfbroadcastserver.CipherResponseData, openapinlmfbroadcastserver.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) +} + +func attachBroadcastHandler(router *gin.RouterGroup, b Broadcast) { + group := router.Group("/nlmf-broadcast/v1") + { + group.POST("/cipher-key-data", func(c *gin.Context) { + var req openapinlmfbroadcastserver.CipherRequestData + if err := c.ShouldBindJSON(&req); err != nil { + problemDetails := b.Error(c, err) + c.JSON(int(problemDetails.Status), problemDetails) + return + } + res, problemDetails, redirectResponse, status := b.CipherKeyData(c, req) + switch status { + case fivegc.StatusOK: + c.JSON(status.ToInt(), res) + case fivegc.StatusTemporaryRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + case fivegc.StatusPermanentRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + default: + c.JSON(status.ToInt(), problemDetails) + } + return + }) + } +} + +// BroadcastClient is a client for the Nlmf_Broadcast service. +type BroadcastClient struct { + client *openapinlmfbroadcastclient.APIClient +} + +// NewBroadcastClient creates a new client for the Nlmf_Broadcast service. +func NewBroadcastClient(cfg fivegc.ClientConfiguration) *BroadcastClient { + openapiCfg := &openapinlmfbroadcastclient.Configuration{ + Host: cfg.Host, + Scheme: cfg.Scheme, + DefaultHeader: cfg.DefaultHeader, + UserAgent: cfg.UserAgent, + Debug: cfg.Debug, + Servers: []openapinlmfbroadcastclient.ServerConfiguration{}, + OperationServers: make(map[string]openapinlmfbroadcastclient.ServerConfigurations), + HTTPClient: cfg.HTTPClient, + } + for _, server := range cfg.Servers { + openapiServer := openapinlmfbroadcastclient.ServerConfiguration{ + URL: server.URL, + Description: server.Description, + Variables: make(map[string]openapinlmfbroadcastclient.ServerVariable), + } + for name, variable := range server.Variables { + openapiServer.Variables[name] = openapinlmfbroadcastclient.ServerVariable{ + Description: variable.Description, + DefaultValue: variable.DefaultValue, + EnumValues: variable.EnumValues, + } + } + openapiCfg.Servers = append(openapiCfg.Servers, openapiServer) + } + for name, servers := range cfg.OperationServers { + openapiServers := make(openapinlmfbroadcastclient.ServerConfigurations, len(servers)) + for i, server := range servers { + openapiServers[i] = openapinlmfbroadcastclient.ServerConfiguration{ + URL: server.URL, + Description: server.Description, + Variables: make(map[string]openapinlmfbroadcastclient.ServerVariable), + } + for name, variable := range server.Variables { + openapiServers[i].Variables[name] = openapinlmfbroadcastclient.ServerVariable{ + Description: variable.Description, + DefaultValue: variable.DefaultValue, + EnumValues: variable.EnumValues, + } + } + } + openapiCfg.OperationServers[name] = openapiServers + } + return &BroadcastClient{ + client: openapinlmfbroadcastclient.NewAPIClient(openapiCfg), + } +} + +// CipheringKeyData returns a cipher request. +func (c *BroadcastClient) CipheringKeyData(ctx context.Context) openapinlmfbroadcastclient.ApiCipheringKeyDataRequest { + return c.client.RequestCipheringKeyDataApi.CipheringKeyData(ctx) +} + +// CipheringKeyDataExecute executes a cipher request. +func (c *BroadcastClient) CipheringKeyDataExecute(r openapinlmfbroadcastclient.ApiCipheringKeyDataRequest) (*openapinlmfbroadcastclient.CipherResponseData, error) { + resp, _, err := r.Execute() + return resp, err +} diff --git a/fivegc/nlmf/location.go b/fivegc/nlmf/location.go new file mode 100644 index 0000000..afe05b2 --- /dev/null +++ b/fivegc/nlmf/location.go @@ -0,0 +1,181 @@ +package nlmf + +import ( + "context" + "github.com/5GCoreNet/5GCoreNetSDK/fivegc" + "github.com/5GCoreNet/5GCoreNetSDK/internal/header" + openapinlmflocationclient "github.com/5GCoreNet/client-openapi/Nlmf_Location" + openapinlmflocationserver "github.com/5GCoreNet/server-openapi/Nlmf_Location" + "github.com/gin-gonic/gin" + "net/http" +) + +type Location interface { + // Error returns a problem details, it is used to handle errors when unmarshalling the request. + Error(ctx context.Context, err error) openapinlmflocationserver.ProblemDetails + // CancelLocation cancels a location request. + CancelLocation(context.Context, openapinlmflocationserver.CancelLocData) (openapinlmflocationserver.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) + // DetermineLocation determines the location of a UE. + DetermineLocation(context.Context, openapinlmflocationserver.InputData) (openapinlmflocationserver.LocationData, openapinlmflocationserver.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) + // LocationContextTransfer transfers the location context of a UE. + LocationContextTransfer(context.Context, openapinlmflocationserver.LocContextData) (openapinlmflocationserver.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) +} + +func attachLocationHandler(router *gin.RouterGroup, l Location) { + group := router.Group("/nlmf-loc/v1") + { + group.POST("/cancel-location", func(c *gin.Context) { + var req openapinlmflocationserver.CancelLocData + if err := c.ShouldBindJSON(&req); err != nil { + problemDetails := l.Error(c, err) + c.JSON(int(problemDetails.Status), problemDetails) + return + } + problemDetails, redirectResponse, status := l.CancelLocation(c, req) + switch status { + case fivegc.StatusNoContent: + c.JSON(status.ToInt(), nil) + case fivegc.StatusTemporaryRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + case fivegc.StatusPermanentRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + default: + c.JSON(status.ToInt(), problemDetails) + } + return + }) + group.POST("/determine-location", func(c *gin.Context) { + var req openapinlmflocationserver.InputData + if err := c.ShouldBindJSON(&req); err != nil { + problemDetails := l.Error(c, err) + c.JSON(int(problemDetails.Status), problemDetails) + return + } + res, problemDetails, redirectResponse, status := l.DetermineLocation(c, req) + switch status { + case fivegc.StatusOK: + c.JSON(status.ToInt(), res) + case fivegc.StatusNoContent: + c.JSON(status.ToInt(), nil) + case fivegc.StatusTemporaryRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + case fivegc.StatusPermanentRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + default: + c.JSON(status.ToInt(), problemDetails) + } + return + }) + group.POST("/location-context-transfer", func(c *gin.Context) { + var req openapinlmflocationserver.LocContextData + if err := c.ShouldBindJSON(&req); err != nil { + problemDetails := l.Error(c, err) + c.JSON(int(problemDetails.Status), problemDetails) + return + } + problemDetails, redirectResponse, status := l.LocationContextTransfer(c, req) + switch status { + case fivegc.StatusNoContent: + c.JSON(status.ToInt(), nil) + case fivegc.StatusTemporaryRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + case fivegc.StatusPermanentRedirect: + header.BindRedirectHeader(c, redirectResponse.RedirectHeader) + c.JSON(status.ToInt(), redirectResponse) + default: + c.JSON(status.ToInt(), problemDetails) + } + return + }) + } +} + +// LocationClient is a client for the Nlmf_location service. +type LocationClient struct { + client *openapinlmflocationclient.APIClient +} + +// NewLocationClient creates a new client for the Nlmf_location service. +func NewLocationClient(cfg fivegc.ClientConfiguration) *LocationClient { + openapiCfg := &openapinlmflocationclient.Configuration{ + Host: cfg.Host, + Scheme: cfg.Scheme, + DefaultHeader: cfg.DefaultHeader, + UserAgent: cfg.UserAgent, + Debug: cfg.Debug, + Servers: []openapinlmflocationclient.ServerConfiguration{}, + OperationServers: make(map[string]openapinlmflocationclient.ServerConfigurations), + HTTPClient: cfg.HTTPClient, + } + for _, server := range cfg.Servers { + openapiServer := openapinlmflocationclient.ServerConfiguration{ + URL: server.URL, + Description: server.Description, + Variables: make(map[string]openapinlmflocationclient.ServerVariable), + } + for name, variable := range server.Variables { + openapiServer.Variables[name] = openapinlmflocationclient.ServerVariable{ + Description: variable.Description, + DefaultValue: variable.DefaultValue, + EnumValues: variable.EnumValues, + } + } + openapiCfg.Servers = append(openapiCfg.Servers, openapiServer) + } + for name, servers := range cfg.OperationServers { + openapiServers := make(openapinlmflocationclient.ServerConfigurations, len(servers)) + for i, server := range servers { + openapiServers[i] = openapinlmflocationclient.ServerConfiguration{ + URL: server.URL, + Description: server.Description, + Variables: make(map[string]openapinlmflocationclient.ServerVariable), + } + for name, variable := range server.Variables { + openapiServers[i].Variables[name] = openapinlmflocationclient.ServerVariable{ + Description: variable.Description, + DefaultValue: variable.DefaultValue, + EnumValues: variable.EnumValues, + } + } + } + openapiCfg.OperationServers[name] = openapiServers + } + return &LocationClient{ + client: openapinlmflocationclient.NewAPIClient(openapiCfg), + } +} + +// LocationContextTransfer returns location context transfer request +func (l LocationClient) LocationContextTransfer(ctx context.Context) openapinlmflocationclient.ApiLocationContextTransferRequest { + return l.client.LocationContextTransferApi.LocationContextTransfer(ctx) +} + +// LocationContextTransferExecute executes the location context transfer request +func (l LocationClient) LocationContextTransferExecute(r openapinlmflocationclient.ApiLocationContextTransferRequest) (*http.Response, error) { + return r.Execute() +} + +// DetermineLocation returns determine location request +func (l LocationClient) DetermineLocation(ctx context.Context) openapinlmflocationclient.ApiDetermineLocationRequest { + return l.client.DetermineLocationApi.DetermineLocation(ctx) +} + +// DetermineLocationExecute executes the determine location request +func (l LocationClient) DetermineLocationExecute(r openapinlmflocationclient.ApiDetermineLocationRequest) (*openapinlmflocationclient.LocationData, *http.Response, error) { + return r.Execute() +} + +// CancelLocation returns cancel location request +func (l LocationClient) CancelLocation(ctx context.Context) openapinlmflocationclient.ApiCancelLocationRequest { + return l.client.CancelLocationApi.CancelLocation(ctx) +} + +// CancelLocationExecute executes the cancel location request +func (l LocationClient) CancelLocationExecute(r openapinlmflocationclient.ApiCancelLocationRequest) (*http.Response, error) { + return r.Execute() +} diff --git a/fivegc/nlmf/mock/broadcast.go b/fivegc/nlmf/mock/broadcast.go new file mode 100644 index 0000000..1674573 --- /dev/null +++ b/fivegc/nlmf/mock/broadcast.go @@ -0,0 +1,60 @@ +package mock + +import ( + "context" + "github.com/5GCoreNet/5GCoreNetSDK/fivegc" + openapinlmfbroadcast "github.com/5GCoreNet/server-openapi/Nlmf_Broadcast" +) + +// BroadcastMock is a mock of the Broadcast interface +type BroadcastMock struct { + cipherResponseData openapinlmfbroadcast.CipherResponseData + problemDetails openapinlmfbroadcast.ProblemDetails + redirectResponse fivegc.RedirectResponse + statusCode fivegc.StatusCode +} + +// NewBroadcastMock creates a new mock of the Broadcast interface +func NewBroadcastMock( + cipherResponseData openapinlmfbroadcast.CipherResponseData, + problemDetails openapinlmfbroadcast.ProblemDetails, + redirectResponse fivegc.RedirectResponse, + statusCode fivegc.StatusCode, +) *BroadcastMock { + return &BroadcastMock{ + cipherResponseData: cipherResponseData, + problemDetails: problemDetails, + redirectResponse: redirectResponse, + statusCode: statusCode, + } +} + +// ProblemDetails allows to set the problem details of the mock +func (b *BroadcastMock) ProblemDetails(problemDetails openapinlmfbroadcast.ProblemDetails) { + b.problemDetails = problemDetails +} + +// CipherResponseData allows to set the cipher response data of the mock +func (b *BroadcastMock) CipherResponseData(cipherResponseData openapinlmfbroadcast.CipherResponseData) { + b.cipherResponseData = cipherResponseData +} + +// RedirectResponse allows to set the redirect response of the mock +func (b *BroadcastMock) RedirectResponse(redirectResponse fivegc.RedirectResponse) { + b.redirectResponse = redirectResponse +} + +// StatusCode allows to set the status code of the mock +func (b *BroadcastMock) StatusCode(statusCode fivegc.StatusCode) { + b.statusCode = statusCode +} + +// Error returns the problem details of the mock +func (b *BroadcastMock) Error(ctx context.Context, err error) openapinlmfbroadcast.ProblemDetails { + return b.problemDetails +} + +// CipherKeyData returns the cipher response data, the problem details, the redirect response and the status code of the mock +func (b *BroadcastMock) CipherKeyData(ctx context.Context, data openapinlmfbroadcast.CipherRequestData) (openapinlmfbroadcast.CipherResponseData, openapinlmfbroadcast.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) { + return b.cipherResponseData, b.problemDetails, b.redirectResponse, b.statusCode +} diff --git a/fivegc/nlmf/mock/location.go b/fivegc/nlmf/mock/location.go new file mode 100644 index 0000000..39adaa6 --- /dev/null +++ b/fivegc/nlmf/mock/location.go @@ -0,0 +1,70 @@ +package mock + +import ( + "context" + "github.com/5GCoreNet/5GCoreNetSDK/fivegc" + openapinlmflocation "github.com/5GCoreNet/server-openapi/Nlmf_Location" +) + +// LocationMock is a mock of the Location interface +type LocationMock struct { + locationData openapinlmflocation.LocationData + problemDetails openapinlmflocation.ProblemDetails + redirectResponse fivegc.RedirectResponse + statusCode fivegc.StatusCode +} + +// NewLocationMock creates a new mock of the Location interface +func NewLocationMock( + locationData openapinlmflocation.LocationData, + problemDetails openapinlmflocation.ProblemDetails, + redirectResponse fivegc.RedirectResponse, + statusCode fivegc.StatusCode, +) *LocationMock { + return &LocationMock{ + locationData: locationData, + problemDetails: problemDetails, + redirectResponse: redirectResponse, + statusCode: statusCode, + } +} + +// ProblemDetails allows to set the problem details of the mock +func (l *LocationMock) ProblemDetails(problemDetails openapinlmflocation.ProblemDetails) { + l.problemDetails = problemDetails +} + +// LocationData allows to set the location data of the mock +func (l *LocationMock) LocationData(locationData openapinlmflocation.LocationData) { + l.locationData = locationData +} + +// RedirectResponse allows to set the redirect response of the mock +func (l *LocationMock) RedirectResponse(redirectResponse fivegc.RedirectResponse) { + l.redirectResponse = redirectResponse +} + +// StatusCode allows to set the status code of the mock +func (l *LocationMock) StatusCode(statusCode fivegc.StatusCode) { + l.statusCode = statusCode +} + +// Error returns the problem details of the mock +func (l *LocationMock) Error(ctx context.Context, err error) openapinlmflocation.ProblemDetails { + return l.problemDetails +} + +// CancelLocation returns the problem details, the redirect response and the status code of the mock +func (l *LocationMock) CancelLocation(ctx context.Context, data openapinlmflocation.CancelLocData) (openapinlmflocation.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) { + return l.problemDetails, l.redirectResponse, l.statusCode +} + +// DetermineLocation returns the location data, the problem details, the redirect response and the status code of the mock +func (l *LocationMock) DetermineLocation(ctx context.Context, data openapinlmflocation.InputData) (openapinlmflocation.LocationData, openapinlmflocation.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) { + return l.locationData, l.problemDetails, l.redirectResponse, l.statusCode +} + +// LocationContextTransfer returns the problem details, the redirect response and the status code of the mock +func (l *LocationMock) LocationContextTransfer(ctx context.Context, data openapinlmflocation.LocContextData) (openapinlmflocation.ProblemDetails, fivegc.RedirectResponse, fivegc.StatusCode) { + return l.problemDetails, l.redirectResponse, l.statusCode +} diff --git a/fivegc/nlmf/nlmf.go b/fivegc/nlmf/nlmf.go new file mode 100644 index 0000000..4d30e37 --- /dev/null +++ b/fivegc/nlmf/nlmf.go @@ -0,0 +1,62 @@ +package nlmf + +import ( + "fmt" + "github.com/gin-gonic/gin" + "log" +) + +// Server represents a NLMF server. +type Server struct { + ip string + port string + apiRoot string + location Location + broadcast Broadcast + logger *log.Logger + router *gin.Engine + stop chan bool +} + +// NewServer creates a new Server NLMF server instance. +func NewServer(ip string, port string, apiRoot string, logger *log.Logger) *Server { + return &Server{ + ip: ip, + port: port, + apiRoot: apiRoot, + logger: logger, + stop: make(chan bool), + } +} + +// AttachLocation attaches a Location client to the NLMF Server. +func (n *Server) AttachLocation(l Location) { + n.location = l +} + +// AttachBroadcast attaches a Broadcast client to the NLMF Server. +func (n *Server) AttachBroadcast(b Broadcast) { + n.broadcast = b +} + +// Start starts the NLMF Server. +func (n *Server) Start() { + n.router = gin.Default() + n.router.Use(gin.Recovery()) + n.router.Use(gin.LoggerWithWriter(n.logger.Writer())) + root := n.router.Group(n.apiRoot) + if n.location != nil { + attachLocationHandler(root, n.location) + } + if n.broadcast != nil { + attachBroadcastHandler(root, n.broadcast) + } + go n.router.Run(fmt.Sprintf("%s:%s", n.ip, n.port)) + <-n.stop + return +} + +// Stop stops the NLMF Server. +func (n *Server) Stop() { + n.stop <- true +} diff --git a/fivegc/redirect.go b/fivegc/redirect.go new file mode 100644 index 0000000..c1cb29e --- /dev/null +++ b/fivegc/redirect.go @@ -0,0 +1,20 @@ +package fivegc + +// RedirectHeader represents the header of the HTTP response. +type RedirectHeader struct { + Location string `json:"Location"` + SbiTarget string `json:"3gpp-Sbi-Target-Nf-Id"` +} + +// RedirectResponse - The response shall include a Location header field containing a different URI (pointing to a different URI of an other service instance), or the same URI if a request is redirected to the same target resource via a different SCP. +type RedirectResponse struct { + RedirectHeader RedirectHeader `json:"redirectHeader"` + + Cause string `json:"cause,omitempty"` + + // String providing an URI formatted according to RFC 3986. + TargetScp string `json:"targetScp,omitempty"` + + // String providing an URI formatted according to RFC 3986. + TargetSepp string `json:"targetSepp,omitempty"` +} diff --git a/fivegc/status.go b/fivegc/status.go new file mode 100644 index 0000000..706e796 --- /dev/null +++ b/fivegc/status.go @@ -0,0 +1,407 @@ +package fivegc + +// StatusCode represents the status code of the HTTP response. +type StatusCode uint16 + +const ( + StatusContinue StatusCode = 100 // RFC 9110, 15.2.1 + + StatusSwitchingProtocols StatusCode = 101 // RFC 9110, 15.2.2 + + StatusProcessing StatusCode = 102 // RFC 2518, 10.1 + + StatusEarlyHints StatusCode = 103 // RFC 8297 + + StatusOK StatusCode = 200 // RFC 9110, 15.3.1 + + StatusCreated StatusCode = 201 // RFC 9110, 15.3.2 + + StatusAccepted StatusCode = 202 // RFC 9110, 15.3.3 + + StatusNonAuthoritativeInfo StatusCode = 203 // RFC 9110, 15.3.4 + + StatusNoContent StatusCode = 204 // RFC 9110, 15.3.5 + + StatusResetContent StatusCode = 205 // RFC 9110, 15.3.6 + + StatusPartialContent StatusCode = 206 // RFC 9110, 15.3.7 + + StatusMultiStatus StatusCode = 207 // RFC 4918, 11.1 + + StatusAlreadyReported StatusCode = 208 // RFC 5842, 7.1 + + StatusIMUsed StatusCode = 226 // RFC 3229, 10.4.1 + + StatusMultipleChoices StatusCode = 300 // RFC 9110, 15.4.1 + + StatusMovedPermanently StatusCode = 301 // RFC 9110, 15.4.2 + + StatusFound StatusCode = 302 // RFC 9110, 15.4.3 + + StatusSeeOther StatusCode = 303 // RFC 9110, 15.4.4 + + StatusNotModified StatusCode = 304 // RFC 9110, 15.4.5 + + StatusUseProxy StatusCode = 305 // RFC 9110, 15.4.6 + + _ StatusCode = 306 // RFC 9110, 15.4.7 (Unused) + + StatusTemporaryRedirect StatusCode = 307 // RFC 9110, 15.4.8 + + StatusPermanentRedirect StatusCode = 308 // RFC 9110, 15.4.9 + + StatusBadRequest StatusCode = 400 // RFC 9110, 15.5.1 + + StatusUnauthorized StatusCode = 401 // RFC 9110, 15.5.2 + + StatusPaymentRequired StatusCode = 402 // RFC 9110, 15.5.3 + + StatusForbidden StatusCode = 403 // RFC 9110, 15.5.4 + + StatusNotFound StatusCode = 404 // RFC 9110, 15.5.5 + + StatusMethodNotAllowed StatusCode = 405 // RFC 9110, 15.5.6 + + StatusNotAcceptable StatusCode = 406 // RFC 9110, 15.5.7 + + StatusProxyAuthRequired StatusCode = 407 // RFC 9110, 15.5.8 + + StatusRequestTimeout StatusCode = 408 // RFC 9110, 15.5.9 + + StatusConflict StatusCode = 409 // RFC 9110, 15.5.10 + + StatusGone StatusCode = 410 // RFC 9110, 15.5.11 + + StatusLengthRequired StatusCode = 411 // RFC 9110, 15.5.12 + + StatusPreconditionFailed StatusCode = 412 // RFC 9110, 15.5.13 + + StatusRequestEntityTooLarge StatusCode = 413 // RFC 9110, 15.5.14 + + StatusRequestURITooLong StatusCode = 414 // RFC 9110, 15.5.15 + + StatusUnsupportedMediaType StatusCode = 415 // RFC 9110, 15.5.16 + + StatusRequestedRangeNotSatisfiable StatusCode = 416 // RFC 9110, 15.5.17 + + StatusExpectationFailed StatusCode = 417 // RFC 9110, 15.5.18 + + StatusTeapot StatusCode = 418 // RFC 9110, 15.5.19 (Unused) + + StatusMisdirectedRequest StatusCode = 421 // RFC 9110, 15.5.20 + + StatusUnprocessableEntity StatusCode = 422 // RFC 9110, 15.5.21 + + StatusLocked StatusCode = 423 // RFC 4918, 11.3 + + StatusFailedDependency StatusCode = 424 // RFC 4918, 11.4 + + StatusTooEarly StatusCode = 425 // RFC 8470, 5.2. + + StatusUpgradeRequired StatusCode = 426 // RFC 9110, 15.5.22 + + StatusPreconditionRequired StatusCode = 428 // RFC 6585, 3 + + StatusTooManyRequests StatusCode = 429 // RFC 6585, 4 + + StatusRequestHeaderFieldsTooLarge StatusCode = 431 // RFC 6585, 5 + + StatusUnavailableForLegalReasons StatusCode = 451 // RFC 7725, 3 + + StatusInternalServerError StatusCode = 500 // RFC 9110, 15.6.1 + + StatusNotImplemented StatusCode = 501 // RFC 9110, 15.6.2 + + StatusBadGateway StatusCode = 502 // RFC 9110, 15.6.3 + + StatusServiceUnavailable StatusCode = 503 // RFC 9110, 15.6.4 + + StatusGatewayTimeout StatusCode = 504 // RFC 9110, 15.6.5 + + StatusHTTPVersionNotSupported StatusCode = 505 // RFC 9110, 15.6.6 + + StatusVariantAlsoNegotiates StatusCode = 506 // RFC 2295, 8.1 + + StatusInsufficientStorage StatusCode = 507 // RFC 4918, 11.5 + + StatusLoopDetected StatusCode = 508 // RFC 5842, 7.2 + + StatusNotExtended StatusCode = 510 // RFC 2774, 7 + + StatusNetworkAuthenticationRequired StatusCode = 511 // RFC 6585, 6 + +) + +// StatusText returns a text for the HTTP status code. It returns the empty + +// string if the code is unknown. + +func StatusText(code StatusCode) string { + + switch code { + + case StatusContinue: + + return "Continue" + + case StatusSwitchingProtocols: + + return "Switching Protocols" + + case StatusProcessing: + + return "Processing" + + case StatusEarlyHints: + + return "Early Hints" + + case StatusOK: + + return "OK" + + case StatusCreated: + + return "Created" + + case StatusAccepted: + + return "Accepted" + + case StatusNonAuthoritativeInfo: + + return "Non-Authoritative Information" + + case StatusNoContent: + + return "No Content" + + case StatusResetContent: + + return "Reset Content" + + case StatusPartialContent: + + return "Partial Content" + + case StatusMultiStatus: + + return "Multi-Status" + + case StatusAlreadyReported: + + return "Already Reported" + + case StatusIMUsed: + + return "IM Used" + + case StatusMultipleChoices: + + return "Multiple Choices" + + case StatusMovedPermanently: + + return "Moved Permanently" + + case StatusFound: + + return "Found" + + case StatusSeeOther: + + return "See Other" + + case StatusNotModified: + + return "Not Modified" + + case StatusUseProxy: + + return "Use Proxy" + + case StatusTemporaryRedirect: + + return "Temporary Redirect" + + case StatusPermanentRedirect: + + return "Permanent Redirect" + + case StatusBadRequest: + + return "Bad Request" + + case StatusUnauthorized: + + return "Unauthorized" + + case StatusPaymentRequired: + + return "Payment Required" + + case StatusForbidden: + + return "Forbidden" + + case StatusNotFound: + + return "Not Found" + + case StatusMethodNotAllowed: + + return "Method Not Allowed" + + case StatusNotAcceptable: + + return "Not Acceptable" + + case StatusProxyAuthRequired: + + return "Proxy Authentication Required" + + case StatusRequestTimeout: + + return "Request Timeout" + + case StatusConflict: + + return "Conflict" + + case StatusGone: + + return "Gone" + + case StatusLengthRequired: + + return "Length Required" + + case StatusPreconditionFailed: + + return "Precondition Failed" + + case StatusRequestEntityTooLarge: + + return "Request Entity Too Large" + + case StatusRequestURITooLong: + + return "Request URI Too Long" + + case StatusUnsupportedMediaType: + + return "Unsupported Media Type" + + case StatusRequestedRangeNotSatisfiable: + + return "Requested Range Not Satisfiable" + + case StatusExpectationFailed: + + return "Expectation Failed" + + case StatusTeapot: + + return "I'm a teapot" + + case StatusMisdirectedRequest: + + return "Misdirected Request" + + case StatusUnprocessableEntity: + + return "Unprocessable Entity" + + case StatusLocked: + + return "Locked" + + case StatusFailedDependency: + + return "Failed Dependency" + + case StatusTooEarly: + + return "Too Early" + + case StatusUpgradeRequired: + + return "Upgrade Required" + + case StatusPreconditionRequired: + + return "Precondition Required" + + case StatusTooManyRequests: + + return "Too Many Requests" + + case StatusRequestHeaderFieldsTooLarge: + + return "Request Header Fields Too Large" + + case StatusUnavailableForLegalReasons: + + return "Unavailable For Legal Reasons" + + case StatusInternalServerError: + + return "Internal Server Error" + + case StatusNotImplemented: + + return "Not Implemented" + + case StatusBadGateway: + + return "Bad Gateway" + + case StatusServiceUnavailable: + + return "Service Unavailable" + + case StatusGatewayTimeout: + + return "Gateway Timeout" + + case StatusHTTPVersionNotSupported: + + return "HTTP Version Not Supported" + + case StatusVariantAlsoNegotiates: + + return "Variant Also Negotiates" + + case StatusInsufficientStorage: + + return "Insufficient Storage" + + case StatusLoopDetected: + + return "Loop Detected" + + case StatusNotExtended: + + return "Not Extended" + + case StatusNetworkAuthenticationRequired: + + return "Network Authentication Required" + + default: + + return "" + + } + +} + +// ToStatusCode converts the integer value to a status code +func ToStatusCode(status uint16) StatusCode { + return StatusCode(status) +} + +// ToInt converts the status code to an integer value +func (s StatusCode) ToInt() int { + return int(s) +} diff --git a/go.mod b/go.mod index 7beea72..9bcd103 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,33 @@ module github.com/5GCoreNet/5GCoreNetSDK go 1.18 + +require ( + github.com/5GCoreNet/client-openapi v0.0.0-20230128134546-a505b74025b3 + github.com/5GCoreNet/server-openapi v0.0.0-20230126185629-9202d02e7eea + github.com/gin-gonic/gin v1.8.2 +) + +require ( + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.11.1 // indirect + github.com/goccy/go-json v0.9.11 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/ugorji/go/codec v1.2.7 // indirect + golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect + golang.org/x/net v0.5.0 // indirect + golang.org/x/oauth2 v0.4.0 // indirect + golang.org/x/sys v0.4.0 // indirect + golang.org/x/text v0.6.0 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +) diff --git a/internal/header/header.go b/internal/header/header.go new file mode 100644 index 0000000..994c9b0 --- /dev/null +++ b/internal/header/header.go @@ -0,0 +1,12 @@ +package header + +import ( + "github.com/5GCoreNet/5GCoreNetSDK/fivegc" + "github.com/gin-gonic/gin" +) + +// BindRedirectHeader binds the redirect header to the gin context +func BindRedirectHeader(c *gin.Context, header fivegc.RedirectHeader) { + c.Header("Location", header.Location) + c.Header("3gpp-Sbi-Target-Nf-Id", header.SbiTarget) +} diff --git a/models/README.md b/models/README.md deleted file mode 100644 index 0ba9897..0000000 --- a/models/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Models -This directory contains all the Common Data Types for Service Based Interfaces in 5G described in this document from ETSI : https://www.etsi.org/deliver/etsi_ts/129500_129599/129571/15.03.00_60/ts_129571v150300p.pdf. - -The current version of the models follows the 3GPP TS 29.571 - Version 15.3.0 - Release 15. \ No newline at end of file diff --git a/models/barring/determined_barring_enums.go b/models/barring/determined_barring_enums.go deleted file mode 100644 index 9c0ba5b..0000000 --- a/models/barring/determined_barring_enums.go +++ /dev/null @@ -1,50 +0,0 @@ -package barring - -import "fmt" - -// RoamingOdb defines the Barring of Roaming as. See 3GPP TS 23.015 for further description. -type RoamingOdb string - -// Validate validates the RoamingOdb string. -func (r *RoamingOdb) Validate() error { - if r == nil { - return fmt.Errorf("roamingOdb must not be nil") - } - switch *r { - case RoamingOdbOutsideHomePlmn: - case RoamingOdbOutsideHomePlmnCountry: - default: - return fmt.Errorf("invalid roaming odb: %s", r) - } - return nil -} - -const ( - RoamingOdbOutsideHomePlmn RoamingOdb = "OUTSIDE_HOME_PLMN" // Barring of roaming outside the home PLMN. - RoamingOdbOutsideHomePlmnCountry RoamingOdb = "OUTSIDE_HOME_PLMN_COUNTRY" // Barring of roaming outside the home PLMN country. -) - -// OdbPacketServices The enumeration OdbPacketServices defines the Barring of Packet Oriented Services. See 3GPP TS 23.015 for further description. -type OdbPacketServices string - -// Validate validates the OdbPacketServices string. -func (o *OdbPacketServices) Validate() error { - if o == nil { - return fmt.Errorf("odbPacketServices must not be nil") - } - switch *o { - case OdbPacketServicesAllPacketServices: - case OdbPacketServicesRoamerAccessHplmnAp: - case OdbPacketServicesRoamerAccessVplmnAp: - default: - return fmt.Errorf("invalid odb packet services: %s", o) - } - return nil - -} - -const ( - OdbPacketServicesAllPacketServices OdbPacketServices = "ALL_PACKET_SERVICES" // Barring of all Packet Oriented Services. - OdbPacketServicesRoamerAccessHplmnAp OdbPacketServices = "ROAMER_ACCESS_HPLMN_AP" // Barring of Packet Oriented Services from access points that are within the HPLMN whilst the subscriber is roaming in a VPLMN. - OdbPacketServicesRoamerAccessVplmnAp OdbPacketServices = "ROAMER_ACCESS_VPLMN_AP" // Barring of Packet Oriented Services from access points that are within the roamed to VPLMN. -) diff --git a/models/barring/determined_barring_structs.go b/models/barring/determined_barring_structs.go deleted file mode 100644 index 43bfb2c..0000000 --- a/models/barring/determined_barring_structs.go +++ /dev/null @@ -1,15 +0,0 @@ -package barring - -type OdbData struct { - RoamingOdb *RoamingOdb `json:"roamingOdb,omitempty"` // Barring of Roaming (see 3GPP TS 23.015). -} - -// Validate validates this odb data -func (m *OdbData) Validate() error { - if m.RoamingOdb != nil { - if err := m.RoamingOdb.Validate(); err != nil { - return err - } - } - return nil -} diff --git a/models/base/base_model.go b/models/base/base_model.go deleted file mode 100644 index c387398..0000000 --- a/models/base/base_model.go +++ /dev/null @@ -1,21 +0,0 @@ -package base - -// BaseModel is the base model for all data models. -type BaseModel interface { - Validate() error -} - -// ValidateAll validates all models. -func ValidateAll(models ...BaseModel) error { - for _, model := range models { - if err := model.Validate(); err != nil { - return err - } - } - return nil -} - -// BaseModelPtr returns a pointer to the base model. -func BaseModelPtr(base BaseModel) *BaseModel { - return &base -} diff --git a/models/charging/charging_structs.go b/models/charging/charging_structs.go deleted file mode 100644 index e067212..0000000 --- a/models/charging/charging_structs.go +++ /dev/null @@ -1,57 +0,0 @@ -package charging - -import ( - "fmt" - "github.com/5GCoreNet/5GCoreNetSDK/models/common" - "github.com/5GCoreNet/5GCoreNetSDK/models/network" - "github.com/5GCoreNet/5GCoreNetSDK/models/qos" -) - -type SecondaryRatUsageReport struct { - SecondaryRatType *network.RatType `json:"secondaryRatType"` // Secondary RAT type. - QosFlowsUsageData []*QosFlowUsageReport `json:"qosFlowsUsageData"` // QoS flows usage data. -} - -// Validate validates this secondary rat usage report. -func (m *SecondaryRatUsageReport) Validate() error { - if err := m.SecondaryRatType.Validate(); err != nil { - return fmt.Errorf("secondaryRatType: %s", err) - } - if len(m.QosFlowsUsageData) < 1 { - return fmt.Errorf("qosFlowsUsageData must contain at least one element") - } - for i, item := range m.QosFlowsUsageData { - if err := item.Validate(); err != nil { - return fmt.Errorf("qosFlowsUsageData[%d]: %s", i, err) - } - } - return nil -} - -type QosFlowUsageReport struct { - Qfi *qos.Qfi `json:"qfi"` // QoS Flow Indicator. - StartTimestamp *common.DateTime `json:"startTimeStamp"` // UTC time indicating the start time of the collection period of the included usage data for DL and UL. - EndTimestamp *common.DateTime `json:"endTimeStamp"` // UTC time indicating the end time of the collection period of the included usage data for DL and UL. - DownlinkVolume *common.Int64 `json:"downlinkVolume"` // Data usage for DL, encoding a number of octets. - UplinkVolume *common.Int64 `json:"uplinkVolume"` // Data usage for UL, encoding a number of octets. -} - -// Validate validates this qos flow usage report. -func (m *QosFlowUsageReport) Validate() error { - if err := m.Qfi.Validate(); err != nil { - return fmt.Errorf("qfi: %s", err) - } - if err := m.StartTimestamp.Validate(); err != nil { - return fmt.Errorf("startTimestamp: %s", err) - } - if err := m.EndTimestamp.Validate(); err != nil { - return fmt.Errorf("endTimestamp: %s", err) - } - if err := m.DownlinkVolume.Validate(); err != nil { - return fmt.Errorf("downlinkVolume: %s", err) - } - if err := m.UplinkVolume.Validate(); err != nil { - return fmt.Errorf("uplinkVolume: %s", err) - } - return nil -} diff --git a/models/charging/charging_types.go b/models/charging/charging_types.go deleted file mode 100644 index c5c7e24..0000000 --- a/models/charging/charging_types.go +++ /dev/null @@ -1,36 +0,0 @@ -package charging - -import "fmt" - -// ChargingId is the charging identifier allowing correlation of charging information -type ChargingId uint32 - -// Validate validates the ChargingId. -func (c *ChargingId) Validate() error { - if c == nil { - return fmt.Errorf("chargingId must not be nil") - } - return nil -} - -// RatingGroupId is the identifier of a Rating Group -type RatingGroupId uint32 - -// Validate validates the ServiceId. -func (r *RatingGroupId) Validate() error { - if r == nil { - return fmt.Errorf("ratingGroupId must not be nil") - } - return nil -} - -// ServiceId is the identifier of a Service -type ServiceId uint32 - -// Validate validates the ServiceId. -func (s *ServiceId) Validate() error { - if s == nil { - return fmt.Errorf("serviceId must not be nil") - } - return nil -} diff --git a/models/common/common_enums.go b/models/common/common_enums.go deleted file mode 100644 index 9a94510..0000000 --- a/models/common/common_enums.go +++ /dev/null @@ -1,78 +0,0 @@ -package common - -import "fmt" - -type PatchOperation string - -// Validate validates the PatchOperation string. -func (p *PatchOperation) Validate() error { - if p == nil { - return fmt.Errorf("patchOperation must not be nil") - } - switch *p { - case "add": - case "remove": - case "replace": - case "move": - case "copy": - case "test": - default: - return fmt.Errorf("invalid patch operation: %s", p) - } - return nil -} - -const ( - PatchOperationAdd PatchOperation = "add" // Add operation as defined in IETF RFC 6902. - PatchOperationCopy PatchOperation = "copy" // Copy operation as defined in IETF RFC 6902. - PatchOperationMove PatchOperation = "move" // Move operation as defined in IETF RFC 6902. - PatchOperationRemove PatchOperation = "remove" // Remove operation as defined in IETF RFC 6902. - PatchOperationReplace PatchOperation = "replace" // Replace operation as defined in IETF RFC 6902. - PatchOperationTest PatchOperation = "test" // Test operation as defined in IETF RFC 6902. -) - -type UriScheme string - -// Validate validates the UriScheme string. -func (u *UriScheme) Validate() error { - if u == nil { - return fmt.Errorf("uriScheme must not be nil") - } - switch *u { - case "http": - case "https": - default: - return fmt.Errorf("invalid uri scheme: %s", u) - } - return nil -} - -const ( - UriSchemeHttp UriScheme = "http" // HTTP URI scheme. - UriSchemeHttps UriScheme = "https" // HTTPS URI scheme. -) - -type ChangeType string - -// Validate validates the ChangeType string. -func (c *ChangeType) Validate() error { - if c == nil { - return fmt.Errorf("changeType must not be nil") - } - switch *c { - case "ADD": - case "MOVE": - case "REMOVE": - case "REPLACE": - default: - return fmt.Errorf("invalid change type: %s", c) - } - return nil -} - -const ( - ChangeTypeAdd ChangeType = "ADD" // This value indicates new attribute has been added to the resource. - ChangeTypeMove ChangeType = "MOVE" // This value indicates existing attribute has been moved to a different path in the resource. - ChangeTypeRemove ChangeType = "REMOVE" // This value indicates existing attribute has been deleted from the resource. - ChangeTypeReplace ChangeType = "REPLACE" // This value indicates existing attribute has been updated with new value. -) diff --git a/models/common/common_structs.go b/models/common/common_structs.go deleted file mode 100644 index aace384..0000000 --- a/models/common/common_structs.go +++ /dev/null @@ -1,322 +0,0 @@ -package common - -import "fmt" - -type ProblemDetails struct { - Type *Uri `json:"type,omitempty"` // A URI reference according to IETF RFC 3986 that identifies the problem type. - Title *string `json:"title,omitempty"` // A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem. - Status *int32 `json:"status,omitempty"` // The HTTP status code for this occurrence of the problem. - Detail *string `json:"detail,omitempty"` // A human-readable explanation specific to this occurrence of the problem. - Instance *Uri `json:"instance,omitempty"` // A URI reference that identifies the specific occurrence of the problem. - Cause *string `json:"cause,omitempty"` // A machine-readable application error cause specific to this occurrence of the problem This IE should be present and provide application- related error information, if available. - InvalidParams []*InvalidParam `json:"invalidParams,omitempty"` // Description of invalid parameters, for a request rejected due to invalid parameters. - // NOTE 1: See IETF RFC 7807 for detailed information and guidance for each attribute, and 3GPP TS 29.501 for guidelines on error handling support by 5GC SBI APIs. - //NOTE 2: Additional attributes may be defined per API. -} - -// Validate validates this problem details. -func (p *ProblemDetails) Validate() error { - if p.Type != nil { - if err := p.Type.Validate(); err != nil { - return err - } - } - if p.Instance != nil { - if err := p.Instance.Validate(); err != nil { - return err - } - } - for _, invalidParam := range p.InvalidParams { - if err := invalidParam.Validate(); err != nil { - return err - } - } - return nil -} - -type Link struct { - Href *Uri `json:"href"` // It contains the URI of the linked resource. -} - -// Validate validates this link. -func (l *Link) Validate() error { - if err := l.Href.Validate(); err != nil { - return err - } - return nil -} - -type PatchItem struct { - Op *PatchOperation `json:"op"` //This IE indicates the patch operation as defined in IETF RFC 6902 to be performed on resource. - Path *string `json:"path"` // This IE contains a JSON pointer value (as defined in IETF RFC 6901) that references a location of a resource on which the patch operation shall be performed. - From *string `json:"from,omitempty"` // This IE indicates the path of the source JSON element (according to JSON Pointer syntax) being moved or copied to the location indicated by the "path" attribute. It shall be present if the patch operation is "move" or "copy". - Value *interface{} `json:"value,omitempty"` // This IE indicates a new value for the resource specified in the path attribute. It shall be present if the patch operation is "add", "replace" or "test". The null value shall be allowed. -} - -// Validate validates this patch item. -func (p *PatchItem) Validate() error { - if err := p.Op.Validate(); err != nil { - return err - } - if p.Path == nil { - return fmt.Errorf("path is required") - } - if *p.Op == PatchOperationMove || *p.Op == PatchOperationCopy { - if p.From == nil { - return fmt.Errorf("from must be present if op is move or copy") - } - } else { - if p.From != nil { - return fmt.Errorf("from must not be present if op is not move or copy") - } - if p.Value == nil { - return fmt.Errorf("value must be present if op is not move or copy") - } - } - return nil -} - -// LinksValueSchema is a list of mutually exclusive alternatives Links or Link. -type LinksValueSchema struct { - Links []*Link `json:"links,omitempty"` // Array of links. - Link *Link `json:"link,omitempty"` // Link. -} - -// Validate validates this links value schema. -func (l *LinksValueSchema) Validate() error { - if l.Links != nil && l.Link != nil { - return fmt.Errorf("links and link must not be both present") - } - if l.Links == nil && l.Link == nil { - return fmt.Errorf("links or link must be present") - } - if l.Links != nil { - for _, link := range l.Links { - if err := link.Validate(); err != nil { - return err - } - } - } - if l.Link != nil { - if err := l.Link.Validate(); err != nil { - return err - } - } - return nil -} - -type SelfLink struct { - Self *Link `json:"self"` // It contains the URI of the linked resource. -} - -// Validate validates this self link. -func (s *SelfLink) Validate() error { - if err := s.Self.Validate(); err != nil { - return err - } - return nil -} - -type InvalidParam struct { - Param *string `json:"param"` // Attribute's name encoded as a JSON Pointer. - Reason *string `json:"reason,omitempty"` // A human-readable reason, e.g. "must be a positive integer". -} - -// Validate validates this invalid param. -func (i *InvalidParam) Validate() error { - if i.Param == nil { - return fmt.Errorf("param is required") - } - return nil -} - -// LinkRM is defined in the same way as the Link data type, but with the OpenAPI "nullable: true" property. -type LinkRM Link - -// Validate validates this link rm. -func (l *LinkRM) Validate() error { - if l == nil { - return nil - } - return (*Link)(l).Validate() -} - -type ChangeItem struct { - Op *ChangeType `json:"op"` // This IE indicates the change type which happens to the resource. - Path *string `json:"path"` // This IE contains a JSON pointer value (as defined in IETF RFC 6901) that references a location of an attribute on which the change has been applied. - From *string `json:"from,omitempty"` // This IE indicates the path of the source JSON element (according to JSON Pointer syntax) being moved or copied to the location indicated by the "path" attribute. It shall be present if the "op" attribute is of value "MOVE". - OrigValue *interface{} `json:"origValue,omitempty"` // This IE indicates the original value of the attribute specified in the path attribute. This attribute only applies when the "op" attribute is of value "REMOVE", "REPLACE" or "MOVE" Based on the use case, this attribute may be included. - NewValue *interface{} `json:"newValue,omitempty"` // This IE indicates a new value of the attribute specified in the path attribute. It shall be present if the "op" attribute is of value "ADD", "REPLACE". The null value shall be allowed. -} - -// Validate validates this change item. -func (c *ChangeItem) Validate() error { - if err := c.Op.Validate(); err != nil { - return err - } - if c.Path == nil { - return fmt.Errorf("path is required") - } - if *c.Op == ChangeTypeMove { - if c.From == nil { - return fmt.Errorf("from must be present if op is move") - } - } else { - if c.From != nil { - return fmt.Errorf("from must not be present if op is not move") - } - } - if *c.Op == ChangeTypeAdd || *c.Op == ChangeTypeReplace { - if c.NewValue == nil { - return fmt.Errorf("newValue must be present if op is add or replace") - } - } else { - if c.NewValue != nil { - return fmt.Errorf("newValue must not be present if op is not add or replace") - } - } - if *c.Op == ChangeTypeRemove || *c.Op == ChangeTypeReplace || *c.Op == ChangeTypeMove { - if c.OrigValue == nil { - return fmt.Errorf("origValue must be present if op is remove, replace or move") - } - } else { - if c.OrigValue != nil { - return fmt.Errorf("origValue must not be present if op is not remove, replace or move") - } - } - return nil -} - -type NotifyItem struct { - ResourceId *Uri `json:"resourceId"` // This IE contains the URI of the resource which has been changed. - Changes []*ChangeItem `json:"changes"` // This IE contains the changes which have been applied on the resource identified by the resourceId attribute. -} - -// Validate validates this notify item. -func (n *NotifyItem) Validate() error { - if err := n.ResourceId.Validate(); err != nil { - return err - } - if len(n.Changes) == 0 { - return fmt.Errorf("changes must not be empty") - } - for _, change := range n.Changes { - if err := change.Validate(); err != nil { - return err - } - } - return nil -} - -// ComplexQuery data type is either a conjunctive normal form or a disjunctive normal form. The attribute names -// "cnfUnits" and "dnfUnits" serve as discriminator. -type ComplexQuery struct { - Cnf *Cnf `json:"cnf,omitempty"` // A conjunctive normal form. - Dnf *Dnf `json:"dnf,omitempty"` // A disjunctive normal form. -} - -// Validate validates this complex query. -func (c *ComplexQuery) Validate() error { - if c.Cnf != nil && c.Dnf != nil { - return fmt.Errorf("cnf and dnf must not be both present") - } - if c.Cnf == nil && c.Dnf == nil { - return fmt.Errorf("cnf or dnf must be present") - } - if c.Cnf != nil { - if err := c.Cnf.Validate(); err != nil { - return err - } - } - if c.Dnf != nil { - if err := c.Dnf.Validate(); err != nil { - return err - } - } - return nil -} - -type Cnf struct { - CnfUnits []*CnfUnit `json:"cnfUnits"` // During the processing of cnfUnits attribute, all the members in the array shall be interpreted as logically concatenated with logical "AND". -} - -// Validate validates this cnf. -func (c *Cnf) Validate() error { - if len(c.CnfUnits) == 0 { - return fmt.Errorf("cnfUnits must not be empty") - } - for _, cnfUnit := range c.CnfUnits { - if err := cnfUnit.Validate(); err != nil { - return err - } - } - return nil -} - -type Dnf struct { - DnfUnits []*DnfUnit `json:"dnfUnits"` // During the processing of dnfUnits attribute, all the members in the array shall be interpreted as logically concatenated with logical "OR" -} - -// Validate validates this dnf. -func (d *Dnf) Validate() error { - if len(d.DnfUnits) == 0 { - return fmt.Errorf("dnfUnits must not be empty") - } - for _, dnfUnit := range d.DnfUnits { - if err := dnfUnit.Validate(); err != nil { - return err - } - } - return nil -} - -type CnfUnit struct { - CnfUnit []*Atom `json:"cnfUnit"` // During the processing of cnfUnit attribute, all the members in the array shall be interpreted as logically concatenated with logical "OR" -} - -// Validate validates this cnf unit. -func (c *CnfUnit) Validate() error { - if len(c.CnfUnit) == 0 { - return fmt.Errorf("cnfUnit must not be empty") - } - for _, atom := range c.CnfUnit { - if err := atom.Validate(); err != nil { - return err - } - } - return nil -} - -type DnfUnit struct { - DnfUnit []*Atom `json:"dnfUnit"` // During the processing of dnfUnit attribute, all the members in the array shall be interpreted as logically concatenated with logical "AND" -} - -// Validate validates this dnf unit. -func (d *DnfUnit) Validate() error { - if len(d.DnfUnit) == 0 { - return fmt.Errorf("dnfUnit must not be empty") - } - for _, atom := range d.DnfUnit { - if err := atom.Validate(); err != nil { - return err - } - } - return nil -} - -type Atom struct { - Attr *string `json:"attr"` // This attribute contains the name of a defined query parameter. - Value *interface{} `json:"value"` // This attribute contains the value of the query parameter as indicated by attr attribute. - Negative *bool `json:"negative,omitempty"` // This attribute indicates whether the negative condition applies for the query condition. -} - -// Validate validates this atom. -func (a *Atom) Validate() error { - if a.Attr == nil { - return fmt.Errorf("attr must be present") - } - if a.Value == nil { - return fmt.Errorf("value must be present") - } - return nil -} diff --git a/models/common/common_types.go b/models/common/common_types.go deleted file mode 100644 index 30c58e7..0000000 --- a/models/common/common_types.go +++ /dev/null @@ -1,543 +0,0 @@ -package common - -import ( - "fmt" - "math" - "net/url" - "regexp" -) - -// Binary is a string with format "binary" as defined in OpenAPI Specification. -type Binary string - -// Validate validates the Binary string. -func (b *Binary) Validate() error { - if b == nil { - return fmt.Errorf("binary mustn't be null") - } - return nil -} - -// BinaryRm is is defined in the same way as the "Binary" data type, but with the OpenAPI "nullable: true" property. -type BinaryRm Binary - -// Validate validates the BinaryRm string. -func (b *BinaryRm) Validate() error { - if b == nil { - return nil - } - return (*Binary)(b).Validate() -} - -// Bytes is a string with format "byte" as defined in OpenAPI Specification. -type Bytes string - -// Validate validates the Bytes string. -func (b *Bytes) Validate() error { - if b == nil { - return fmt.Errorf("bytes mustn't be null") - } - return nil -} - -// BytesRm is defined in the same way as the "Bytes" data type, but with the OpenAPI "nullable: true" property. -type BytesRm Bytes - -// Validate validates the BytesRm string. -func (b *BytesRm) Validate() error { - if b == nil { - return nil - } - return (*Bytes)(b).Validate() -} - -// Date is a string with format "date" as defined in OpenAPI Specification. -type Date string - -// Validate validates the Date string. -func (d *Date) Validate() error { - if d == nil { - return fmt.Errorf("date mustn't be null") - } - return nil -} - -// DateRm is defined in the same way as the "Date" data type, but with the OpenAPI "nullable: true" property. -type DateRm Date - -// Validate validates the DateRm string. -func (d *DateRm) Validate() error { - if d == nil { - return nil - } - return (*Date)(d).Validate() -} - -// DateTime is a string with format "date-time" as defined in OpenAPI Specification. -type DateTime string - -// Validate validates the DateTime string. -func (d *DateTime) Validate() error { - if d == nil { - return fmt.Errorf("date-time mustn't be null") - } - return nil -} - -// DateTimeRm is defined in the same way as the "DateTime" data type, but with the OpenAPI "nullable: true" property. -type DateTimeRm DateTime - -// Validate validates the DateTimeRm string. -func (d *DateTimeRm) Validate() error { - if d == nil { - return nil - } - return (*DateTime)(d).Validate() -} - -// DiameterIdentity is a string containing a Diameter Identity, according to clause 4.3 of IETF RFC 6733. -// DiameterIdentity must follow this pattern '^([A-Za-z0-9]+(-[A-Za-z0-9]+).)+[a-z]{2,}$'. -type DiameterIdentity string - -// Validate validates the DiameterIdentity string -func (d *DiameterIdentity) Validate() error { - if d == nil { - return fmt.Errorf("diameter identity mustn't be null") - } - if !regexp.MustCompile(`^([A-Za-z0-9]+(-[A-Za-z0-9]+).)+[a-z]{2,}$`).MatchString(string(*d)) { - return fmt.Errorf("diameter identity must follow this pattern '^([A-Za-z0-9]+(-[A-Za-z0-9]+).)+[a-z]{2,}$'") - } - return nil -} - -// DiameterIdentityRm is defined in the same way as the "DiameterIdentity" data type, but with the OpenAPI "nullable: true" property. -type DiameterIdentityRm DiameterIdentity - -// Validate validates the DiameterIdentityRm string -func (d *DiameterIdentityRm) Validate() error { - if d == nil { - return nil - } - return (*DiameterIdentity)(d).Validate() -} - -// Double is a number with format "double" as defined in OpenAPI Specification. -type Double float64 - -// Validate validates the Double number. -func (d *Double) Validate() error { - if d == nil { - return fmt.Errorf("double mustn't be null") - } - return nil -} - -// DoubleRm is defined in the same way as the "Double" data type, but with the OpenAPI "nullable: true" property. -type DoubleRm Double - -// Validate validates the DoubleRm number. -func (d *DoubleRm) Validate() error { - if d == nil { - return nil - } - return (*Double)(d).Validate() -} - -// DurationSec is an unsigned integer identifying a period of time in units of seconds -type DurationSec uint64 - -func (d *DurationSec) Validate() error { - if d == nil { - return fmt.Errorf("duration sec mustn't be null") - } - return nil -} - -// DurationSecRm is defined in the same way as the DurationSec data type, but with the OpenAPI "nullable: true" property. -type DurationSecRm DurationSec - -// Validate validates the DurationSecRm. -func (d *DurationSecRm) Validate() error { - if d == nil { - return nil - } - return (*DurationSec)(d).Validate() -} - -// Float is a number with format "float" as defined in OpenAPI Specification. -type Float float64 - -func (f *Float) Validate() error { - if f == nil { - return fmt.Errorf("float mustn't be null") - } - return nil -} - -// FloatRm is defined in the same way as the Float data type, but with the OpenAPI "nullable: true" property. -type FloatRm Float - -// Validate validates the FloatRm. -func (f *FloatRm) Validate() error { - if f == nil { - return nil - } - return (*Float)(f).Validate() -} - -// Uint16 is an unsigned 6-bit integers, i.e. only value between 0 and 65535 are permissible. -type Uint16 uint16 - -// Validate validates the Uint16. -func (u *Uint16) Validate() error { - if u == nil { - return fmt.Errorf("uint16 mustn't be null") - } - if *u < 0 || *u > 65535 { - return fmt.Errorf("uint16 must be between 0 and 65535") - } - return nil -} - -// Uint16Rm is defined in the same way as the Uint16 data type, but with the OpenAPI "nullable: true" property. -type Uint16Rm Uint16 - -// Validate validates the Uint16Rm. -func (u *Uint16Rm) Validate() error { - if u == nil { - return nil - } - return (*Uint16)(u).Validate() -} - -// Int32 is an integer with format "int32" as defined in OpenAPI Specification. -type Int32 int32 - -// Validate validates the Int32. -func (i *Int32) Validate() error { - if i == nil { - return fmt.Errorf("int32 mustn't be null") - } - return nil -} - -// Int32Rm is defined in the same way as the Int32 data type, but with the OpenAPI "nullable: true" property. -type Int32Rm Int32 - -// Validate validates the Int32Rm. -func (i *Int32Rm) Validate() error { - if i == nil { - return nil - } - return (*Int32)(i).Validate() -} - -// Int64 is an integer with format "int64" as defined in OpenAPI Specification. -type Int64 int64 - -// Validate validates the Int64 number. -func (i *Int64) Validate() error { - if i == nil { - return fmt.Errorf("int64 mustn't be null") - } - return nil -} - -// Int64Rm is defined in the same way as the Int64 data type, but with the OpenAPI "nullable: true" property. -type Int64Rm Int64 - -// Validate validates the Int64Rm number. -func (i *Int64Rm) Validate() error { - if i == nil { - return nil - } - return (*Int64)(i).Validate() -} - -// Ipv4Addr is a string dentifying a IPv4 address formatted in the "dotted decimal" notation as defined in in IETF RFC 1166. -// Must follow this pattern '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$'. -type Ipv4Addr string - -// Validate validates the Ipv4Addr string. -func (a *Ipv4Addr) Validate() error { - if a == nil { - return fmt.Errorf("ipv4 address mustn't be null") - } - if !regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$`).MatchString(string(*a)) { - return fmt.Errorf("ipv4 address must follow this pattern '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$'") - } - return nil -} - -// Ipv4AddrRm is defined in the same way as the Ipv4Addr data type, but with the OpenAPI "nullable: true" property. -type Ipv4AddrRm Ipv4Addr - -// Validate validates the Ipv4AddrRm string. -func (a *Ipv4AddrRm) Validate() error { - if a == nil { - return nil - } - return (*Ipv4Addr)(a).Validate() -} - -// Ipv6Addr is a string identifying an IPv6 address formatted according to clause 4 -//of IETF RFC 5952. The mixed IPv4 IPv6 notation according to clause 5 of -//IETF RFC 5952 shall not be used. -// Must follow this pattern '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' or '((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$'. -type Ipv6Addr string - -// Validate validates the Ipv6Addr string. -func (a *Ipv6Addr) Validate() error { - if a == nil { - return fmt.Errorf("ipv6 address mustn't be null") - } - if !regexp.MustCompile(`^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$`).MatchString(string(*a)) || !regexp.MustCompile(`((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$`).MatchString(string(*a)) { - return fmt.Errorf("ipv6 address must follow this pattern '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))$' or '((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))$'") - } - return nil -} - -// Ipv6AddrRm is defined in the same way as the Ipv6Addr data type, but with the OpenAPI "nullable: true" property. -type Ipv6AddrRm Ipv6Addr - -// Validate validates the Ipv6AddrRm string. -func (a *Ipv6AddrRm) Validate() error { - if a == nil { - return nil - } - return (*Ipv6Addr)(a).Validate() -} - -// Ipv6Prefix is a string identifying an IPv6 prefix formatted according to clause 4 of IETF RFC 5952. -// Must follow this pattern: ^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' or '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\/.+)$'. -type Ipv6Prefix string - -// Validate validates the Ipv6Prefix string. -func (a *Ipv6Prefix) Validate() error { - if a == nil { - return fmt.Errorf("ipv6 prefix mustn't be null") - } - if !regexp.MustCompile(`^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$`).MatchString(string(*a)) || !regexp.MustCompile(`^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\\/.)$`).MatchString(string(*a)) { - return fmt.Errorf("ipv6 prefix must follow this pattern: '^((:|(0?|([1-9a-f][0-9a-f]{0,3}))):)((0?|([1-9a-f][0-9a-f]{0,3})):){0,6}(:|(0?|([1-9a-f][0-9a-f]{0,3})))(\\/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))$' or '^((([^:]+:){7}([^:]+))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?))(\\/.)$'") - } - return nil -} - -// Ipv6PrefixRm is defined in the same way as the Ipv6Prefix data type, but with the OpenAPI "nullable: true" property. -type Ipv6PrefixRm Ipv6Prefix - -// Validate validates the Ipv6PrefixRm string. -func (a *Ipv6PrefixRm) Validate() error { - if a == nil { - return nil - } - return (*Ipv6Prefix)(a).Validate() -} - -// MacAddr48 is a string identifying a MAC address formatted in the hexadecimal notation according to subclause 1.1 and subclause 2.1 of IETF RFC 7042. -// Must follow this pattern: '^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$'. -type MacAddr48 string - -// Validate validates the MacAddr48 string. -func (a *MacAddr48) Validate() error { - if a == nil { - return fmt.Errorf("mac address mustn't be null") - } - if !regexp.MustCompile(`^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$`).MatchString(string(*a)) { - return fmt.Errorf("mac address must follow this pattern: '^([0-9a-fA-F]{2})((-[0-9a-fA-F]{2}){5})$'") - } - return nil -} - -// MacAddr48Rm is defined in the same way as the MacAddr48 data type, but with the OpenAPI "nullable: true" property. -type MacAddr48Rm MacAddr48 - -// Validate validates the MacAddr48Rm string. -func (a *MacAddr48Rm) Validate() error { - if a == nil { - return nil - } - return (*MacAddr48)(a).Validate() -} - -// SupportedFeatures is a string used to indicate the features supported by an -// API that is used as defined in subclause 6.6 in 3GPP TS 29.500. The string -// shall contain a bitmask indicating supported features in hexadecimal -// representation: -// Each character in the string shall take a value of "0" to "9" or "A" -// to "F" and shall represent the support of 4 features as described -// in table 5.2.2-3. The most significant character representing the -// highest-numbered features shall appear first in the string, and the -// character representing features 1 to 4 shall appear last in the -// string. The list of features and their numbering (starting with 1) -// are defined separately for each API. If the string contains a lower -// number of characters than there are defined features for an API, -// all features that would be represented by characters that are not -// present in the string are not supported. -type SupportedFeatures string - -// Validate validates the SupportedFeatures string. -func (a *SupportedFeatures) Validate() error { - if a == nil { - return fmt.Errorf("supported features mustn't be null") - } - if !regexp.MustCompile(`^([0-9a-fA-F]{1,8})$`).MatchString(string(*a)) { - return fmt.Errorf("supported features must follow this pattern: '^([0-9a-fA-F]{1,8})$'") - } - return nil -} - -// Uinteger is an unsigned Integer, i.e. only value 0 and integers above 0 are permissible. -type Uinteger uint64 - -// Validate validates the Uinteger number. -func (u *Uinteger) Validate() error { - if u == nil { - return fmt.Errorf("uinteger64 mustn't be null") - } - return nil -} - -// UintegerRm is defined in the same way as the Uinteger data type, but with the OpenAPI "nullable: true" property. -type UintegerRm Uinteger - -// Validate validates the UintegerRm number. -func (u *UintegerRm) Validate() error { - if u == nil { - return nil - } - return (*Uinteger)(u).Validate() -} - -// Uint32 is an unsigned 32-bit integers, i.e. only value 0 and 32-bit integers above 0 are permissible. -type Uint32 uint32 - -// Validate validates the Uint32 number. -func (u *Uint32) Validate() error { - if u == nil { - return fmt.Errorf("uint32 mustn't be null") - } - if *u < 0 || *u > math.MaxUint32 { - return fmt.Errorf("uint32 must be between 0 and %d", math.MaxUint32) - } - return nil -} - -// Uint32Rm is defined in the same way as the Uint32 data type, but with the OpenAPI "nullable: true" property. -type Uint32Rm Uint32 - -// Validate validates the Uint32Rm number. -func (u *Uint32Rm) Validate() error { - if u == nil { - return nil - } - return (*Uint32)(u).Validate() -} - -// Uint64 is an unsigned 64-bit integers, i.e. only value 0 and 64-bit integers above 0 are permissible. -type Uint64 uint64 - -// Validate validates the Uint64 number. -func (u *Uint64) Validate() error { - if u == nil { - return fmt.Errorf("uint64 mustn't be null") - } - if *u < 0 || *u > math.MaxUint64 { - return fmt.Errorf("uint64 must be between 0 and %d", math.MaxUint64) - } - return nil -} - -// Uint64Rm is defined in the same way as the Uint64 data type, but with the OpenAPI "nullable: true" property. -type Uint64Rm Uint64 - -// Validate validates the Uint64Rm number. -func (u *Uint64Rm) Validate() error { - if u == nil { - return nil - } - return (*Uint64)(u).Validate() -} - -// Uri is a string providing an URI formatted according to IETF RFC 3986. -type Uri string - -// Validate validates the Uri string -// Uri musn't be null and must follow the IETF RFC 3986 format. -func (u *Uri) Validate() error { - if u == nil { - return fmt.Errorf("uri mustn't be null") - } - if _, err := url.ParseRequestURI(string(*u)); err != nil { - return fmt.Errorf("uri must follow the IETF RFC 3986 format") - } - return nil -} - -// UriRm is defined in the same way as the Uri data type, but with the OpenAPI "nullable: true" property. -type UriRm Uri - -// Validate validates the UriRm string. -func (u *UriRm) Validate() error { - if u == nil { - return nil - } - return (*Uri)(u).Validate() -} - -// VarUeId is a string representing the SUPI or GPSI. -// Must follow the pattern: '^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$'. -type VarUeId string - -// Validate validates the VarUeId string. -func (v *VarUeId) Validate() error { - if v == nil { - return fmt.Errorf("var ue id mustn't be null") - } - if !regexp.MustCompile(`^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$`).MatchString(string(*v)) { - return fmt.Errorf("var ue id must follow the pattern: '^(imsi-[0-9]{5,15}|nai-.+|msisdn-[0-9]{5,15}|extid-[^@]+@[^@]+|.+)$'") - } - return nil -} - -// VarUeIdRm is defined in the same way as the VarUeId data type, but with the OpenAPI "nullable: true" property. -type VarUeIdRm VarUeId - -// Validate validates the VarUeIdRm string. -func (v *VarUeIdRm) Validate() error { - if v == nil { - return nil - } - return (*VarUeId)(v).Validate() -} - -// TimeZone is a string with format "" optionally appended by "", where: -// - shall represent the time zone adjusted for daylight saving time and be encoded as time-numoffset as -// defined in subclause 5.6 of IETF RFC 3339 [10]; -// - shall represent the adjustment that has been made and shall be encoded as "+1" or -// "+2" for a +1 or +2 hours adjustment. -// -//Example: "-08:00+1" (for 8 hours behind UTC, +1 hour adjustment for Daylight Saving Time). -type TimeZone string - -// Validate validates the TimeZone string. -func (t *TimeZone) Validate() error { - if t == nil { - return fmt.Errorf("timezone mustn't be null") - } - if !regexp.MustCompile(`^([+-][0-9]{2}:[0-9]{2})([+-][0-9])?$`).MatchString(string(*t)) { - return fmt.Errorf("timezone must follow the pattern: '^([+-][0-9]{2}:[0-9]{2})([+-][0-9])?$'") - } - return nil -} - -// TimeZoneRm is defined in the same way as the TimeZone data type, but with the OpenAPI "nullable: true" property. -type TimeZoneRm TimeZone - -// Validate validates the TimeZoneRm string. -func (t *TimeZoneRm) Validate() error { - if t == nil { - return nil - } - return (*TimeZone)(t).Validate() -} diff --git a/models/network/network_enums.go b/models/network/network_enums.go deleted file mode 100644 index 5c0e15c..0000000 --- a/models/network/network_enums.go +++ /dev/null @@ -1,341 +0,0 @@ -package network - -import "fmt" - -type AccessType string - -// Validate validates the AccessType string. -func (t *AccessType) Validate() error { - if t == nil { - return fmt.Errorf("accessType must not be nil") - } - switch *t { - case AccessType3GPPAccess: - case AccessTypeNon3GPPAccess: - default: - return fmt.Errorf("invalid access type: %s", *t) - } - return nil -} - -const ( - AccessType3GPPAccess AccessType = "3GPP_ACCESS" // 3GPP access - AccessTypeNon3GPPAccess AccessType = "NON_3_GPP_ACCESS" // Non-3GPP access -) - -type RatType string - -// Validate validates the RatType string. -func (t *RatType) Validate() error { - if t == nil { - return fmt.Errorf("ratType must not be nil") - } - switch *t { - case RatTypeNR: - case RatTypeEUTRA: - case RatTypeWLAN: - case RatTypeVIRTUAL: - default: - return fmt.Errorf("invalid rat type: %s", t) - } - return nil -} - -const ( - RatTypeNR RatType = "NR" // New Radio - RatTypeEUTRA RatType = "EUTRA" // (WB) Evolved Universal Terrestrial Radio Access - RatTypeWLAN RatType = "WLAN" // Wireless LAN - RatTypeVIRTUAL RatType = "VIRTUAL" // Virtual. Virtual shall be used if the N3IWF does not know the access technology used for an untrusted non-3GPP access. -) - -// PduSessionType indicates the type of PDU session. -type PduSessionType string - -// Validate validates the PduSessionType string. -func (t *PduSessionType) Validate() error { - if t == nil { - return fmt.Errorf("pduSessionType must not be nil") - } - switch *t { - case PduSessionTypeIpv4: - case PduSessionTypeIpv6: - case PduSessionTypeIpv4v6: - case PduSessionTypeUnstructured: - case PduSessionTypeEthernet: - default: - return fmt.Errorf("invalid pdu session type: %s", *t) - } - return nil -} - -const ( - PduSessionTypeIpv4 PduSessionType = "IPV4" // IPv4 - PduSessionTypeIpv6 PduSessionType = "IPV6" // IPv6 - PduSessionTypeIpv4v6 PduSessionType = "IPV4V6" // IPv4v6 - PduSessionTypeUnstructured PduSessionType = "UNSTRUCTURED" // Unstructured - PduSessionTypeEthernet PduSessionType = "ETHERNET" // Ethernet -) - -// UpIntegrity indicates whether UP integrity protection is required, preferred or not needed for all the traffic on the PDU Session. -type UpIntegrity string - -// Validate validates the UpIntegrity string. -func (t *UpIntegrity) Validate() error { - if t == nil { - return fmt.Errorf("upIntegrity must not be nil") - } - switch *t { - case UpIntegrityRequired: - case UpIntegrityPreferred: - case UpIntegrityNotNeeded: - default: - return fmt.Errorf("invalid up integrity: %s", *t) - } - return nil -} - -const ( - UpIntegrityRequired UpIntegrity = "REQUIRED" // UP integrity protection shall apply for all the traffic on the PDU Session. - UpIntegrityPreferred UpIntegrity = "PREFERRED" // UP integrity protection should apply for all the traffic on the PDU Session. - UpIntegrityNotNeeded UpIntegrity = "NOT_NEEDED" // UP integrity protection shall not apply on the PDU Session. -) - -// UpConfidentiality indicates whether UP confidentiality protection is required, preferred or not needed for all the traffic on the PDU Session. -type UpConfidentiality string - -// Validate validates the UpConfidentiality string. -func (t *UpConfidentiality) Validate() error { - if t == nil { - return fmt.Errorf("upConfidentiality must not be nil") - } - switch *t { - case UpConfidentialityRequired: - case UpConfidentialityPreferred: - case UpConfidentialityNotNeeded: - default: - return fmt.Errorf("invalid up confidentiality: %s", *t) - } - return nil -} - -const ( - UpConfidentialityRequired UpConfidentiality = "REQUIRED" // UP confidentiality protection shall apply for all the traffic on the PDU Session. - UpConfidentialityPreferred UpConfidentiality = "PREFERRED" // UP confidentiality protection should apply for all the traffic on the PDU Session. - UpConfidentialityNotNeeded UpConfidentiality = "NOT_NEEDED" // UP confidentiality protection shall not apply on the PDU Session. -) - -// SscMode represents the service and session continuity mode. -type SscMode string - -// Validate validates the SscMode string. -func (t *SscMode) Validate() error { - if t == nil { - return fmt.Errorf("sscMode must not be nil") - } - switch *t { - case SscMode1: - case SscMode2: - case SscMode3: - default: - return fmt.Errorf("invalid ssc mode: %s", *t) - } - return nil -} - -const ( - SscMode1 SscMode = "SSC_MODE_1" // see 3GPP TS 23.501. - SscMode2 SscMode = "SSC_MODE_2" // see 3GPP TS 23.501. - SscMode3 SscMode = "SSC_MODE_3" // see 3GPP TS 23.501. -) - -// DnaiChangeType represents the type of a DNAI change. A NF service consumer may subscribe to -// "EARLY", "LATE" or "EARLY_LATE" types of DNAI change. The types of observed DNAI change the SMF may -// notify are "EARLY" or "LATE". -type DnaiChangeType string - -// Validate validates the DnaiChangeType string. -func (t *DnaiChangeType) Validate() error { - if t == nil { - return fmt.Errorf("dnaiChangeType must not be nil") - } - switch *t { - case DnaiChangeTypeEarly: - case DnaiChangeTypeLate: - case DnaiChangeTypeEarlyLate: - default: - return fmt.Errorf("invalid dnai change type: %s", *t) - } - return nil -} - -const ( - DnaiChangeTypeEarly DnaiChangeType = "EARLY" // Early notification of UP path reconfiguration. - DnaiChangeTypeEarlyLate DnaiChangeType = "EARLY_LATE" // Early and late notification of UP path reconfiguration. This value shall only be present in the subscription to the DNAI change event. - DnaiChangeTypeLate DnaiChangeType = "LATE" // Late notification of UP path reconfiguration. -) - -type RestrictionType string - -// Validate validates the RestrictionType string. -func (t *RestrictionType) Validate() error { - if t == nil { - return fmt.Errorf("restrictionType must not be nil") - } - switch *t { - case RestrictionTypeAllowed: - case RestrictionTypeNotAllowed: - default: - return fmt.Errorf("invalid restriction type: %s", *t) - } - return nil -} - -const ( - RestrictionTypeAllowed RestrictionType = "ALLOWED_AREAS" // This value indicates that areas are allowed. - RestrictionTypeNotAllowed RestrictionType = "NOT_ALLOWED_AREAS" // This value indicates that areas are not allowed. -) - -type CoreNetworkType string - -// Validate validates the CoreNetworkType string. -func (t *CoreNetworkType) Validate() error { - if t == nil { - return fmt.Errorf("coreNetworkType must not be nil") - } - switch *t { - case CoreNetworkType5GC: - case CoreNetworkTypeEPC: - default: - return fmt.Errorf("invalid core network type: %s", *t) - } - return nil -} - -const ( - CoreNetworkType5GC CoreNetworkType = "5GC" // 5G Core. - CoreNetworkTypeEPC CoreNetworkType = "EPC" // Evolved Packet Core. -) - -// AccessTypeRm is defined in the same way as the AccessType enumeration, but with the OpenAPI "nullable: true" property. -type AccessTypeRm AccessType - -// Validate validates the AccessTypeRm string. -func (t *AccessTypeRm) Validate() error { - if t == nil { - return nil - } - return (*AccessType)(t).Validate() -} - -// RatTypeRm is defined in the same way as the RatType enumeration, but with the OpenAPI "nullable: true" property. -type RatTypeRm RatType - -// Validate validates the RatTypeRm string. -func (t *RatTypeRm) Validate() error { - if t == nil { - return nil - } - return (*RatType)(t).Validate() -} - -// PduSessionTypeRm is defined in the same way as the PduSessionType enumeration, but with the OpenAPI "nullable: true" property. -type PduSessionTypeRm PduSessionType - -// Validate validates the PduSessionTypeRm string. -func (t *PduSessionTypeRm) Validate() error { - if t == nil { - return nil - } - return (*PduSessionType)(t).Validate() -} - -// UpIntegrityRm is defined in the same way as the UpIntegrity enumeration, but with the OpenAPI "nullable: true" property. -type UpIntegrityRm UpIntegrity - -// Validate validates the UpIntegrityRm string. -func (t *UpIntegrityRm) Validate() error { - if t == nil { - return nil - } - return (*UpIntegrity)(t).Validate() -} - -// UpConfidentialityRm is defined in the same way as the UpConfidentiality enumeration, but with the OpenAPI "nullable: true" property. -type UpConfidentialityRm UpConfidentiality - -// Validate validates the UpConfidentialityRm string. -func (t *UpConfidentialityRm) Validate() error { - if t == nil { - return nil - } - return (*UpConfidentiality)(t).Validate() -} - -// SscModeRm is defined in the same way as the SscMode enumeration, but with the OpenAPI "nullable: true" property. -type SscModeRm SscMode - -// Validate validates the SscModeRm string. -func (t *SscModeRm) Validate() error { - if t == nil { - return nil - } - return (*SscMode)(t).Validate() -} - -// DnaiChangeTypeRm is defined in the same way as the DnaiChangeType enumeration, but with the OpenAPI "nullable: true" property. -type DnaiChangeTypeRm DnaiChangeType - -// Validate validates the DnaiChangeTypeRm string. -func (t *DnaiChangeTypeRm) Validate() error { - if t == nil { - return nil - } - return (*DnaiChangeType)(t).Validate() -} - -// RestrictionTypeRm is defined in the same way as the RestrictionType enumeration, but with the OpenAPI "nullable: true" property. -type RestrictionTypeRm RestrictionType - -// Validate validates the RestrictionTypeRm string. -func (t *RestrictionTypeRm) Validate() error { - if t == nil { - return nil - } - return (*RestrictionType)(t).Validate() -} - -// CoreNetworkTypeRm is defined in the same way as the CoreNetworkType enumeration, but with the OpenAPI "nullable: true" property. -type CoreNetworkTypeRm CoreNetworkType - -// Validate validates the CoreNetworkTypeRm string. -func (t *CoreNetworkTypeRm) Validate() error { - if t == nil { - return nil - } - return (*CoreNetworkType)(t).Validate() -} - -type PresenceState string - -// Validate validates the PresenceState string. -func (t *PresenceState) Validate() error { - if t == nil { - return fmt.Errorf("presenceState must not be nil") - } - switch *t { - case PresenceStateInArea: - case PresenceStateOutOfArea: - case PresenceStateUnknown: - case PresenceStateInactive: - default: - return fmt.Errorf("invalid presence state: %s", *t) - } - return nil -} - -const ( - PresenceStateInArea PresenceState = "IN_AREA" // Indicates that the UE is inside or enters the presence reporting area. - PresenceStateOutOfArea PresenceState = "OUT_OF_AREA" // Indicates that the UE is outside or leaves the presence reporting area. - PresenceStateUnknown PresenceState = "UNKNOWN" // Indicates it is unknown whether the UE is in the presence reporting area or not. - PresenceStateInactive PresenceState = "INACTIVE" // Indicates that the presence reporting area is inactive in the serving node. -) diff --git a/models/network/network_structs.go b/models/network/network_structs.go deleted file mode 100644 index 5e11954..0000000 --- a/models/network/network_structs.go +++ /dev/null @@ -1,850 +0,0 @@ -package network - -import ( - "fmt" - "github.com/5GCoreNet/5GCoreNetSDK/models/common" - "github.com/5GCoreNet/5GCoreNetSDK/models/qos" - "github.com/5GCoreNet/5GCoreNetSDK/models/subscription" - "regexp" -) - -type SubscribedDefaultQos struct { - FiveQi *qos.FiveQi `json:"5qi"` // Default 5G QoS identifier. - Arp *qos.Arp `json:"arp"` // Default Allocation and Retention Priority see 3GPP TS 23.501 subclause 5.7.2.7. - PriorityLevel *qos.FiveQiPriorityLevel `json:"priorityLevel,omitempty"` // Defines the 5QI Priority Level. When present, it contains the 5QI Priority Level value that overrides the standardized or pre-configured value as described in 3GPP TS 23.501. -} - -// Validate validates this subscribed default qos. -func (m *SubscribedDefaultQos) Validate() error { - if err := m.FiveQi.Validate(); err != nil { - return fmt.Errorf("5qi %s", err.Error()) - } - if err := m.Arp.Validate(); err != nil { - return fmt.Errorf("arp %s", err.Error()) - } - if m.PriorityLevel != nil { - if err := m.PriorityLevel.Validate(); err != nil { - return fmt.Errorf("priorityLevel %s", err.Error()) - } - } - return nil -} - -// Snssai , When Snssai needs to be converted to string (e.g. when used in maps -// as key), the string shall be composed of one to three digits "sst" optionally -// followed by "-" and 6 hexadecimal digits "sd", and shall match the following -// pattern: -// ^([0-9]|[1-9][0-9]|1[0-9][0-9]|2([0-4][0-9]|5[0-5]))(-[A-Fa-f0-9]{6})?$ -type Snssai struct { - // Sst is an unsigned integer, within the range 0 to 255, - // representing the Slice/Service Type. It indicates the - // expected Network Slice behaviour in terms of - // features and services. - // Values 0 to 127 correspond to the standardized SST - // range. Values 128 to 255 correspond to the - // Operator-specific range. See subclause 28.4.2 of - // 3GPP TS 23.003. - // Standardized values are defined in - // subclause 5.15.2.2 of 3GPP TS 23.501 - Sst *common.Uinteger `json:"sst"` - // Sd is a 3-octet string, representing the Slice Differentiator, in - // hexadecimal representation. Each character in the - // string shall take a value of "0" to "9" or "A" to "F" and - // shall represent 4 bits. The most significant character - // representing the 4 most significant bits of the SD - // shall appear first in the string, and the character - // representing the 4 least significant bit of the SD shall - // appear last in the string. - // This is an optional parameter that complements the - // Slice/Service type(s) to allow to differentiate - // amongst multiple Network Slices of the same - // Slice/Service type. - Sd *string `json:"sd,omitempty"` -} - -// Validate validates this snssai. -func (m *Snssai) Validate() error { - if err := m.Sst.Validate(); err != nil { - return fmt.Errorf("sst %s", err.Error()) - } - if *m.Sst < 0 || *m.Sst > 255 { - return fmt.Errorf("sst must be in the range 0 to 255") - } - if m.Sd != nil { - if !regexp.MustCompile(`^[A-F\d]{6}$`).MatchString(*m.Sd) { - return fmt.Errorf("sd must match the pattern [0-9A-F]{6}$") - } - } - return nil -} - -type PlmnId struct { - Mcc *Mcc `json:"mcc"` // Mobile Country Code. - Mnc *Mnc `json:"mnc"` // Mobile Network Code. -} - -// Validate validates this plmn id. -func (m *PlmnId) Validate() error { - if err := m.Mcc.Validate(); err != nil { - return fmt.Errorf("mcc %s", err.Error()) - } - if err := m.Mnc.Validate(); err != nil { - return fmt.Errorf("mnc %s", err.Error()) - } - return nil -} - -type Tai struct { - PlmnId *PlmnId `json:"plmnId"` // PLMN identity. - Tac *Tac `json:"tac"` // Tracking Area Code. -} - -// Validate validates this tai. -func (m *Tai) Validate() error { - if err := m.PlmnId.Validate(); err != nil { - return fmt.Errorf("plmnId %s", err.Error()) - } - if err := m.Tac.Validate(); err != nil { - return fmt.Errorf("tac %s", err.Error()) - } - return nil -} - -type Ecgi struct { - PlmnId *PlmnId `json:"plmnId"` // PLMN identity. - EutraCellId *EutraCellId `json:"eutraCellId"` // E-UTRA cell identity. -} - -// Validate validates this ecgi. -func (m *Ecgi) Validate() error { - if err := m.PlmnId.Validate(); err != nil { - return fmt.Errorf("plmnId %s", err.Error()) - } - if err := m.EutraCellId.Validate(); err != nil { - return fmt.Errorf("eutraCellId %s", err.Error()) - } - return nil -} - -type Ncgi struct { - PlmnId *PlmnId `json:"plmnId"` // PLMN identity. - NrCellId *NrCellId `json:"nrCellId"` // NR cell identity. -} - -// Validate validates this ncgi. -func (m *Ncgi) Validate() error { - if err := m.PlmnId.Validate(); err != nil { - return fmt.Errorf("plmnId %s", err.Error()) - } - if err := m.NrCellId.Validate(); err != nil { - return fmt.Errorf("nrCellId %s", err.Error()) - } - return nil -} - -type UserLocation struct { - EutraLocation *EutraLocation `json:"eutraLocation,omitempty"` // E-UTRA user location (see NOTE). - NrLocation *NrLocation `json:"nrLocation,omitempty"` // NR user location (see NOTE). - N3gaLocation *N3gaLocation `json:"n3gaLocation,omitempty"` // Non-3GPP access user location (see NOTE). - // NOTE: At least one of eutraLocation, nrLocation and n3gaLocation shall be present. Several of them may be - // present. -} - -// Validate validates this user location. -func (m *UserLocation) Validate() error { - if m.EutraLocation == nil && m.NrLocation == nil && m.N3gaLocation == nil { - return fmt.Errorf("at least one of eutraLocation, nrLocation and n3gaLocation shall be present") - } - if err := m.EutraLocation.Validate(); err != nil { - return fmt.Errorf("eutraLocation %s", err.Error()) - } - if err := m.NrLocation.Validate(); err != nil { - return fmt.Errorf("nrLocation %s", err.Error()) - } - if err := m.N3gaLocation.Validate(); err != nil { - return fmt.Errorf("n3gaLocation %s", err.Error()) - } - return nil -} - -type EutraLocation struct { - Tai *Tai `json:"tai"` // Tracking Area Identity. - Ecgi *Ecgi `json:"ecgi"` // E-UTRA Cell Identity. - // AgeOfLocationInformation represents the elapsed time in minutes since the last network contact of the mobile station. - // Value "0" indicates that the location information was obtained after a successful paging procedure for - // Active Location Retrieval when the UE is in idle mode or after a successful NG-RAN location - // reporting procedure with the eNB when the UE is in connected mode. - // Any other value than "0" indicates that the location - // information is the last known one. - // See 3GPP TS 29.002 [21] subclause 17.7.8. - AgeOfLocationInformation *common.Int64 `json:"ageOfLocationInformation,omitempty"` - UeLocationTimestamp *common.DateTime `json:"ueLocationTimestamp,omitempty"` // The value represents the UTC time when the UeLocation information was acquired. - // GeographicalInformation refers to geographical Information. - // See 3GPP TS 23.032 subclause 7.3.2. Only the - // description of an ellipsoid point with uncertainty circle - // is allowed to be used. - // Allowed characters are 0-9 and A-F. - GeographicalInformation *string `json:"geographicalInformation,omitempty"` - // GeodeticInformation refers to Calling Geodetic Location. - // See ITU-T Recommendation Q.763 (1999) - // subclause 3.88.2. Only the description of an ellipsoid - // point with uncertainty circle is allowed to be used. - // Allowed characters are 0-9 and A-F. - GeodeticInformation *string `json:"geodeticInformation,omitempty"` - // GlobalNgenbId indicates the global identity of the ng-eNodeB in - // which the UE is currently located. - // See 3GPP TS 38.413 subclause 9.3.1.8. - GlobalNgenbId *GlobalRanNodeId `json:"globalNgenbId,omitempty"` -} - -// Validate validates this eutra location. -func (m *EutraLocation) Validate() error { - if err := m.Tai.Validate(); err != nil { - return fmt.Errorf("tai %s", err.Error()) - } - if err := m.Ecgi.Validate(); err != nil { - return fmt.Errorf("ecgi %s", err.Error()) - } - if m.AgeOfLocationInformation != nil { - if err := m.AgeOfLocationInformation.Validate(); err != nil { - return fmt.Errorf("ageOfLocationInformation %s", err.Error()) - } - } - if m.UeLocationTimestamp != nil { - if err := m.UeLocationTimestamp.Validate(); err != nil { - return fmt.Errorf("ueLocationTimestamp %s", err.Error()) - } - } - if m.GeographicalInformation != nil { - if !regexp.MustCompile(`^[\dA-F]+$`).MatchString(*m.GeographicalInformation) { - return fmt.Errorf("geographicalInformation must match the pattern `^[0-9A-F]+$`") - } - } - if m.GeodeticInformation != nil { - if !regexp.MustCompile(`^[\dA-F]+$`).MatchString(*m.GeodeticInformation) { - return fmt.Errorf("geodeticInformation must match the pattern `^[0-9A-F]+$`") - } - } - if m.GlobalNgenbId != nil { - if err := m.GlobalNgenbId.Validate(); err != nil { - return fmt.Errorf("globalNgenbId %s", err.Error()) - } - } - return nil -} - -type NrLocation struct { - Tai *Tai `json:"tai"` // Tracking Area Identity. - Ncgi *Ncgi `json:"ncgi"` // NR Cell Identity. - // AgeOfLocationInformation represents the elapsed time in minutes since the last network contact of the mobile station. - // Value "0" indicates that the location information was obtained after a successful paging procedure for - // Active Location Retrieval when the UE is in idle mode or after a successful NG-RAN location - // reporting procedure with the gNB when the UE is in connected mode. - // Any other value than "0" indicates that the location - // information is the last known one. - // See 3GPP TS 29.002 [21] subclause 17.7.8. - AgeOfLocationInformation *common.Int64 `json:"ageOfLocationInformation,omitempty"` - UeLocationTimestamp *common.DateTime `json:"ueLocationTimestamp,omitempty"` // The value represents the UTC time when the UeLocation information was acquired. - // GeographicalInformation refers to geographical Information. - // See 3GPP TS 23.032 subclause 7.3.2. Only the - // description of an ellipsoid point with uncertainty circle - // is allowed to be used. - // Allowed characters are 0-9 and A-F. - GeographicalInformation *string `json:"geographicalInformation,omitempty"` - // GeodeticInformation refers to Calling Geodetic Location. - // See ITU-T Recommendation Q.763 (1999) - // subclause 3.88.2. Only the description of an ellipsoid - // point with uncertainty circle is allowed to be used. - // Allowed characters are 0-9 and A-F. - GeodeticInformation *string `json:"geodeticInformation,omitempty"` - // GlobalGnbId indicates the global identity of the gNodeB in - // which the UE is currently located. - // See 3GPP TS 38.413 subclause 9.3.1.8. - GlobalGnbId *GlobalRanNodeId `json:"globalGnbId,omitempty"` -} - -// Validate validates this nr location. -func (m *NrLocation) Validate() error { - if err := m.Tai.Validate(); err != nil { - return fmt.Errorf("tai %s", err.Error()) - } - if err := m.Ncgi.Validate(); err != nil { - return fmt.Errorf("ncgi %s", err.Error()) - } - if m.AgeOfLocationInformation != nil { - if err := m.AgeOfLocationInformation.Validate(); err != nil { - return fmt.Errorf("ageOfLocationInformation %s", err.Error()) - } - } - if m.UeLocationTimestamp != nil { - if err := m.UeLocationTimestamp.Validate(); err != nil { - return fmt.Errorf("ueLocationTimestamp %s", err.Error()) - } - } - if m.GeographicalInformation != nil { - if !regexp.MustCompile(`^[\dA-F]+$`).MatchString(*m.GeographicalInformation) { - return fmt.Errorf("geographicalInformation must match the pattern `^[0-9A-F]+$`") - } - } - if m.GeodeticInformation != nil { - if !regexp.MustCompile(`^[\dA-F]+$`).MatchString(*m.GeodeticInformation) { - return fmt.Errorf("geodeticInformation must match the pattern `^[0-9A-F]+$`") - } - } - if m.GlobalGnbId != nil { - if err := m.GlobalGnbId.Validate(); err != nil { - return fmt.Errorf("globalGnbId %s", err.Error()) - } - } - return nil -} - -type N3gaLocation struct { - // N3gppTai is the unique non 3GPP TAI used in the PLMN. It shall be present over - // the 3GPP PLMN internal interfaces, but shall not be present over the N5 - // interface. - N3gppTai *Tai `json:"n3gppTai,omitempty"` - // N3IwfId shall contain the N3IWF identifier received over NGAP and shall be - // encoded as a string of hexadecimal characters. Pattern: '^[A-Fa-f0-9]+$' It - // shall be present over the 3GPP PLMN internal interfaces, but shall not be - // present over the N5 interface - N3IwfId *N3IwfId `json:"n3IwfId,omitempty"` - // UeIpv4Addr is the UE local IPv4 address (used to reach the N3IWF). The - // ueIPv4Addr or the ueIPv6Addr shall be present. - UeIpv4Addr *common.Ipv4Addr `json:"ueIpv4Addr,omitempty"` - // UeIpv6Addr is the UE local IPv6 address (used to reach the N3IWF). The - // ueIPv4Addr or the ueIPv6Addr shall be present. - UeIpv6Addr *common.Ipv6Addr `json:"ueIpv6Addr,omitempty"` - // PortNumber is the UDP or TCP source port number. It shall be present if NAT is - // detected. - PortNumber *common.Uinteger `json:"portNumber,omitempty"` -} - -// Validate validates this n3ga location. -func (m *N3gaLocation) Validate() error { - if m.N3gppTai != nil { - if err := m.N3gppTai.Validate(); err != nil { - return fmt.Errorf("n3gppTai %s", err.Error()) - } - } - if m.N3IwfId != nil { - if err := m.N3IwfId.Validate(); err != nil { - return fmt.Errorf("n3IwfId %s", err.Error()) - } - } - if m.UeIpv4Addr == nil && m.UeIpv6Addr == nil { - return fmt.Errorf("ueIpv4Addr or ueIpv6Addr must be present") - } - if m.UeIpv4Addr != nil { - if err := m.UeIpv4Addr.Validate(); err != nil { - return fmt.Errorf("ueIpv4Addr %s", err.Error()) - } - } - if m.UeIpv6Addr != nil { - if err := m.UeIpv6Addr.Validate(); err != nil { - return fmt.Errorf("ueIpv6Addr %s", err.Error()) - } - } - if m.PortNumber != nil { - if err := m.PortNumber.Validate(); err != nil { - return fmt.Errorf("portNumber %s", err.Error()) - } - } - return nil -} - -type UpSecurity struct { - // UpIntegr shall indicate whether UP integrity protection is required, preferred - // or not needed for all the traffic on the PDU Session. - UpIntegr *UpIntegrity `json:"upIntegr"` - // UpConfid This IE shall indicate whether UP confidentiality protection is - // required, preferred or not needed for all the traffic on the PDU Session. - UpConfid *UpConfidentiality `json:"upConfid"` -} - -// Validate validates this up security. -func (m *UpSecurity) Validate() error { - if err := m.UpIntegr.Validate(); err != nil { - return fmt.Errorf("upIntegr %s", err.Error()) - } - if err := m.UpConfid.Validate(); err != nil { - return fmt.Errorf("upConfid %s", err.Error()) - } - return nil -} - -type NgApCause struct { - // Group shall indicate the group of the NGAP cause. The value of this IE shall - // equal to the ASN.1 value of the specified NGAP cause group. NGAP supports - // following cause groups defined as separate enumerations, as specified in - // subclause 9.4.5 of 3GPP TS 38.413 [11], with following values: - // 0 – radioNetwork - // 1 – transport - // 2 – nas - // 3 – protocol - // 4 – misc - Group *common.Uinteger `json:"group"` - // Value shall carry the NG AP cause value in specific - // cause group identified by the "group" attribute, as specified in subclause - // 9.4.5 of 3GPP TS 38.413. - Value *common.Uinteger `json:"value"` -} - -// Validate validates this ng ap cause. -func (m *NgApCause) Validate() error { - if *m.Group < 0 || *m.Group > 4 { - return fmt.Errorf("group must be in the range [0, 4]") - } - if err := m.Group.Validate(); err != nil { - return fmt.Errorf("group %s", err.Error()) - } - if err := m.Value.Validate(); err != nil { - return fmt.Errorf("value %s", err.Error()) - } - return nil -} - -type BackupAmfInfo struct { - // BackupAmf shall contain the AMF name of the backup - // AMF related to the specific GUAMI(s) (see - // subclause 5.21.2.3 of 3GPP TS 23.501). If no - // GUAMI is included in BackupAmfinfo, the AMF name - // of the backup AMF is related to all the GUAMI(s) - // supported by the AMF. - BackupAmf *AmfName `json:"backupAmf"` - // If present, this IE shall contain the GUAMI(s). - GuamiList []*subscription.Guami `json:"guamiList,omitempty"` -} - -// Validate validates this backup amf info. -func (m *BackupAmfInfo) Validate() error { - if err := m.BackupAmf.Validate(); err != nil { - return fmt.Errorf("backupAmf %s", err.Error()) - } - for i, v := range m.GuamiList { - if err := v.Validate(); err != nil { - return fmt.Errorf("guamiList[%d] %s", i, err.Error()) - } - } - return nil -} - -type RefToBinaryData struct { - ContentId *string `json:"contentId"` // This IE shall contain the value of the Content-ID header of the referenced binary body part. -} - -// Validate validates this ref to binary data. -func (m *RefToBinaryData) Validate() error { - if m.ContentId != nil { - return nil - } - return fmt.Errorf("contentId must be present") -} - -type RouteToLocation struct { - Dnai *Dnai `json:"dnai"` // Identifies the location of the application. - RouteInfo *RouteInformation `json:"routeInfo,omitempty"` // Includes the traffic routing information. - RouteProfId *string `json:"routeProfId,omitempty"` // Identifies the routing profile Id. - // NOTE: Either the "routeInfo" attribute or the "routeProfId" attribute shall be included in the - // "RouteToLocation" data type. -} - -// Validate validates this route to location. -func (m *RouteToLocation) Validate() error { - if err := m.Dnai.Validate(); err != nil { - return fmt.Errorf("dnai %s", err.Error()) - } - if m.RouteInfo == nil && m.RouteProfId == nil { - return fmt.Errorf("routeInfo or routeProfId must be present") - } - if m.RouteInfo != nil && m.RouteProfId != nil { - return fmt.Errorf("routeInfo and routeProfId must not be present at the same time") - } - if m.RouteInfo != nil { - if err := m.RouteInfo.Validate(); err != nil { - return fmt.Errorf("routeInfo %s", err.Error()) - } - } - if m.RouteProfId != nil { - return nil - } - return fmt.Errorf("routeProfId must be present") -} - -type RouteInformation struct { - Ipv4Addr *common.Ipv4Addr `json:"ipv4Addr,omitempty"` // Ipv4address of the tunnel end point in the data network. - Ipv6Addr *common.Ipv6Addr `json:"ipv6Addr,omitempty"` // Ipv6 address of the tunnel end point in the data network. - PortNumber *common.Uinteger `json:"portNumber"` // UDP port number of the tunnel end point in the data network. - // NOTE: At least one of the "ipv4Addr" attribute and the "ipv6Addr" attribute shall be included in the - // "RouteInformation" data type -} - -// Validate validates this route information. -func (m *RouteInformation) Validate() error { - if m.Ipv4Addr == nil && m.Ipv6Addr == nil { - return fmt.Errorf("ipv4Addr or ipv6Addr must be present") - } - if m.Ipv4Addr != nil { - if err := m.Ipv4Addr.Validate(); err != nil { - return fmt.Errorf("ipv4Addr %s", err.Error()) - } - } - if m.Ipv6Addr != nil { - if err := m.Ipv6Addr.Validate(); err != nil { - return fmt.Errorf("ipv6Addr %s", err.Error()) - } - } - if err := m.PortNumber.Validate(); err != nil { - return fmt.Errorf("portNumber %s", err.Error()) - } - return nil -} - -type Area struct { - Tacs []*Tac `json:"tacs,omitempty"` // List of TACs; shall be present if and only if areaCode is absent. - AreaCodes *AreaCode `json:"areaCodes,omitempty"` // Area Code; shall be present if and only if tacs is absent. -} - -// Validate validates this area. -func (m *Area) Validate() error { - if m.Tacs == nil && m.AreaCodes == nil { - return fmt.Errorf("tacs or areaCodes must be present") - } - if m.Tacs != nil && m.AreaCodes != nil { - return fmt.Errorf("tacs and areaCodes must not be present at the same time") - } - for i, v := range m.Tacs { - if err := v.Validate(); err != nil { - return fmt.Errorf("tacs[%d] %s", i, err.Error()) - } - } - if m.AreaCodes != nil { - if err := m.AreaCodes.Validate(); err != nil { - return fmt.Errorf("areaCodes %s", err.Error()) - } - } - return nil -} - -type ServiceAreaRestriction struct { - // RestrictionType is a string. "ALLOWED_AREAS" or "NOT_ALLOWED_AREAS" shall be - // present if and only if the areas attribute is present - RestrictionType *RestrictionType `json:"restrictionType,omitempty"` - // Areas is a list of Area. - // These areas are: - // - allowed areas if RestrictionType is - // "ALLOWED_AREAS" - // - not allowed areas if RestrictionType is - // "NOT_ALLOWED_AREAS" - Areas []*Area `json:"areas,omitempty"` - // MaxNumOfTAs is the Maximum number of allowed tracking areas. - // This attribute shall be absent when attribute "restrictionType" takes the - // value "NOT_ALLOWED_AREAS". - MaxNumOfTAs *common.Uinteger `json:"maxNumOfTAs,omitempty"` - // NOTE: The empty Area array is used when service is allowed/restricted nowhere. -} - -// Validate validates this service area restriction. -func (m *ServiceAreaRestriction) Validate() error { - if m.RestrictionType == nil && m.Areas == nil && m.MaxNumOfTAs == nil { - return nil - } - if m.Areas == nil { - return nil - } - if m.Areas != nil { - if m.RestrictionType == nil { - return fmt.Errorf("restrictionType must be present") - } - if *m.RestrictionType == RestrictionTypeNotAllowed && m.MaxNumOfTAs != nil { - return fmt.Errorf("maxNumOfTAs must be absent") - } - } - if m.RestrictionType != nil { - if err := m.RestrictionType.Validate(); err != nil { - return fmt.Errorf("restrictionType %s", err.Error()) - } - } - if m.MaxNumOfTAs != nil { - if err := m.MaxNumOfTAs.Validate(); err != nil { - return fmt.Errorf("maxNumOfTAs %s", err.Error()) - } - } - for i, v := range m.Areas { - if err := v.Validate(); err != nil { - return fmt.Errorf("areas[%d] %s", i, err.Error()) - } - } - return nil -} - -// PlmnIdRm is defined in the same way as the "PlmnId" data type, but with the OpenAPI "nullable: true" property. -type PlmnIdRm PlmnId - -// Validate validates this plmn id rm. -func (m *PlmnIdRm) Validate() error { - if m == nil { - return nil - } - if err := (*PlmnId)(m).Validate(); err != nil { - return fmt.Errorf("plmnId %s", err.Error()) - } - return nil -} - -// TaiRm is defined in the same way as the "Tai" data type, but with the OpenAPI "nullable: true" property. -type TaiRm Tai - -// Validate validates this tai rm. -func (m *TaiRm) Validate() error { - if m == nil { - return nil - } - if err := (*Tai)(m).Validate(); err != nil { - return fmt.Errorf("tai %s", err.Error()) - } - return nil -} - -// EcgiRm is defined in the same way as the "Ecgi" data type, but with the OpenAPI "nullable: true" property. -type EcgiRm Ecgi - -// Validate validates this ecgi rm. -func (m *EcgiRm) Validate() error { - if m == nil { - return nil - } - if err := (*Ecgi)(m).Validate(); err != nil { - return fmt.Errorf("ecgi %s", err.Error()) - } - return nil -} - -// NcgiRm is defined in the same way as the "Ncgi" data type, but with the OpenAPI "nullable: true" property. -type NcgiRm Ncgi - -// Validate validates this ncgi rm. -func (m *NcgiRm) Validate() error { - if m == nil { - return nil - } - if err := (*Ncgi)(m).Validate(); err != nil { - return fmt.Errorf("ncgi %s", err.Error()) - } - return nil -} - -// EutraLocationRm is defined in the same way as the "EutraLocation" data type, but with the OpenAPI "nullable: true" property. -type EutraLocationRm EutraLocation - -// Validate validates this eutra location rm. -func (m *EutraLocationRm) Validate() error { - if m == nil { - return nil - } - if err := (*EutraLocation)(m).Validate(); err != nil { - return fmt.Errorf("eutraLocation %s", err.Error()) - } - return nil -} - -// NrLocationRm is defined in the same way as the "NrLocation" data type, but with the OpenAPI "nullable: true" property. -type NrLocationRm NrLocation - -// Validate validates this nr location rm. -func (m *NrLocationRm) Validate() error { - if m == nil { - return nil - } - if err := (*NrLocation)(m).Validate(); err != nil { - return fmt.Errorf("nrLocation %s", err.Error()) - } - return nil -} - -// UpSecurityRm is defined in the same way as the "UpSecurity" data type, but with the OpenAPI "nullable: true" property. -type UpSecurityRm UpSecurity - -// Validate validates this up security rm. -func (m *UpSecurityRm) Validate() error { - if m == nil { - return nil - } - if err := (*UpSecurity)(m).Validate(); err != nil { - return fmt.Errorf("upSecurity %s", err.Error()) - } - return nil -} - -// RefToBinaryDataRm is defined in the same way as the "RefToBinaryData" data type, but with the OpenAPI "nullable: true" property. -type RefToBinaryDataRm RefToBinaryData - -// Validate validates this ref to binary data rm. -func (m *RefToBinaryDataRm) Validate() error { - if m == nil { - return nil - } - if err := (*RefToBinaryData)(m).Validate(); err != nil { - return fmt.Errorf("refToBinaryData %s", err.Error()) - } - return nil -} - -type PresenceInfo struct { - // PraId represents an identifier to the specified area. This - // IE shall be present if the Area of Interest subscribed - // or reported is a Presence Reporting Area. - PraId *string `json:"praId,omitempty"` - // PresenceState indicates whether the UE is inside or outside of the - // area of interest (e.g. presence reporting area or the - // LADN area), or if the presence reporting area is - // inactive in the serving node. - PresenceState *PresenceState `json:"presenceState,omitempty"` - // TrackingAreaList represents the list of tracking areas that constitutes - // the area. This IE shall be present if the subscription - // or the event report is for tracking UE presence in the - // tracking areas. For non 3GPP access the TAI shall - // be the N3GPP TAI. - TrackingAreaList []*Tai `json:"trackingAreaList,omitempty"` - // EcgiList represents the list of EUTRAN cell Ids that - // constitutes the area. This IE shall be present if the - // Area of Interest subscribed is a list of EUTRAN cell - // Ids. - EcgiList []*Ecgi `json:"ecgiList,omitempty"` - // NcgiList the list of NR cell Ids that constitutes the - // area. This IE shall be present if the Area of Interest - // subscribed is a list of NR cell Ids. - NcgiList []*Ncgi `json:"ncgiList,omitempty"` - // GlobalRanNodeIdList represents the list of NG RAN node identifiers that - //constitutes the area. This IE shall be present if the - //Area of Interest subscribed is a list of NG RAN node identifiers. - GlobalRanNodeIdList []*GlobalRanNodeId `json:"globalRanNodeIdList,omitempty"` -} - -// Validate validates this presence info. -func (m *PresenceInfo) Validate() error { - if m == nil { - return nil - } - if m.PresenceState != nil { - if err := m.PresenceState.Validate(); err != nil { - return fmt.Errorf("presenceState %s", err.Error()) - } - } - if m.TrackingAreaList != nil { - for i, v := range m.TrackingAreaList { - if err := v.Validate(); err != nil { - return fmt.Errorf("trackingAreaList[%d] %s", i, err.Error()) - } - } - } - if m.EcgiList != nil { - for i, v := range m.EcgiList { - if err := v.Validate(); err != nil { - return fmt.Errorf("ecgiList[%d] %s", i, err.Error()) - } - } - } - if m.NcgiList != nil { - for i, v := range m.NcgiList { - if err := v.Validate(); err != nil { - return fmt.Errorf("ncgiList[%d] %s", i, err.Error()) - } - } - } - if m.GlobalRanNodeIdList != nil { - for i, v := range m.GlobalRanNodeIdList { - if err := v.Validate(); err != nil { - return fmt.Errorf("globalRanNodeIdList[%d] %s", i, err.Error()) - } - } - } - return nil -} - -type GlobalRanNodeId struct { - // PlmnId indicates the identity of the PLMN that the RAN node - // belongs to. - PlmnId *PlmnId `json:"plmnId"` - // This IE shall be included if the RAN node belongs to - // non 3GPP access (i.e a N3IWF). - // (NOTE). - N3IwfId *N3IwfId `json:"n3IwfId,omitempty"` - // This IE shall be included if the RAN Node Id - // represents a gNB. When present, this IE shall - // contain the identifier of the gNB. (NOTE). - GNbId *GnbId `json:"gNbId,omitempty"` - // This IE shall be included if the RAN Node Id - // represents a NG-eNB. When present, this IE shall - // contain the identifier of an NG-eNB. (NOTE). - NgeNbId *NgeNbId `json:"ngeNbId,omitempty"` - // NOTE : At most one of the three attributes n3IwfId, gNbIdm, ngeNbId shall be present. -} - -// Validate validates this global ran node id. -func (m *GlobalRanNodeId) Validate() error { - if err := m.PlmnId.Validate(); err != nil { - return fmt.Errorf("plmnId %s", err.Error()) - } - if m.GNbId != nil && m.NgeNbId != nil || m.GNbId != nil && m.N3IwfId != nil || m.NgeNbId != nil && m.N3IwfId != nil { - return fmt.Errorf("at most one of the three attributes n3IwfId, gNbIdm, ngeNbId shall be present") - } - if m.N3IwfId != nil { - if err := m.N3IwfId.Validate(); err != nil { - return fmt.Errorf("n3IwfId %s", err.Error()) - } - } - if m.GNbId != nil { - if err := m.GNbId.Validate(); err != nil { - return fmt.Errorf("gNbId %s", err.Error()) - } - } - if m.NgeNbId != nil { - if err := m.NgeNbId.Validate(); err != nil { - return fmt.Errorf("ngeNbId %s", err.Error()) - } - } - return nil -} - -type GnbId struct { - // BitLength is an unsigned integer representing the bit length of the gNB ID as - // defined in subclause 9.3.1.6 of 3GPP TS 38.413, within the range 22 to 32 - BitLength *common.Int64 `json:"bitLength"` - // GNbValue represents the identifier of the gNB. - // The value of the gNB ID shall be encoded in hexadecimal - // representation. Each character in the string shall take a value of "0" to "9" - // or "A" to "F" and shall represent 4 bits. The padding 0 shall be added to make - // multiple nibbles, the most significant character representing the padding 0 if - // required together with the 4 most significant bits of the gNB ID shall appear - // first in the string, and the character representing the 4 least significant - // bit of the gNB ID shall appear last in the string. - // Examples: A 30 bit value "382A3F47" indicates a gNB ID with value 0x382A3F47 A 22 bit value "2A3F47" - // indicates a gNB ID with value 0x2A3F47 - GNbValue *string `json:"gNbValue"` -} - -// Validate validates this gnb id. -func (m *GnbId) Validate() error { - if err := m.BitLength.Validate(); err != nil { - return fmt.Errorf("bitLength %s", err.Error()) - } - if !regexp.MustCompile(`^[A-Fa-f\d]{6,8}$`).MatchString(*m.GNbValue) { - return fmt.Errorf("gNbValue must match the pattern ^[A-Fa-f0-9]{6,8}$") - } - return nil -} - -// PresenceInfoRm is defined in the same way as the "PresenceInfo" data type, but with the OpenAPI "nullable: true" property. -type PresenceInfoRm PresenceInfo - -// Validate validates this presence info rm. -func (m *PresenceInfoRm) Validate() error { - if m == nil { - return nil - } - if err := (*PresenceInfo)(m).Validate(); err != nil { - return fmt.Errorf("presenceInfo %s", err.Error()) - } - return nil -} diff --git a/models/network/network_types.go b/models/network/network_types.go deleted file mode 100644 index 807fc2b..0000000 --- a/models/network/network_types.go +++ /dev/null @@ -1,282 +0,0 @@ -package network - -import ( - "fmt" - "regexp" -) - -// ApplicationId is a string providing an application identifier. -type ApplicationId string - -// Validate validates the ApplicationId string. -func (a *ApplicationId) Validate() error { - if a != nil { - return nil - } - return fmt.Errorf("applicationId mustn't be null") -} - -// ApplicationIdRm is defined in the same way as the ApplicationId data type, but with the OpenAPI "nullable: true" property. -type ApplicationIdRm ApplicationId - -func (a *ApplicationIdRm) Validate() error { - if a != nil { - return (*ApplicationId)(a).Validate() - } - return nil -} - -// PduSessionId is an unsigned integer identifying a PDU session, within the range 0 to 255, as specified in subclause 11.2.3.1b, bits 1 to 8, of 3GPP TS 24.007 -type PduSessionId uint8 - -// Validate validates the PduSessionId. -func (p *PduSessionId) Validate() error { - if p != nil { - return nil - } - return fmt.Errorf("pduSessionId mustn't be null") -} - -// Mcc is the Mobile Country Code part of the PLMN, comprising 3 digits, as defined in subclause 9.3.3.5 of 3GPP TS 38.413 -type Mcc string - -// Validate validates the Mcc string. -func (m *Mcc) Validate() error { - if m != nil { - if !regexp.MustCompile("[0-9]{3}$").MatchString(string(*m)) { - return fmt.Errorf("mcc must follow this pattern '[0-9]{3}$'") - } - return nil - } - return fmt.Errorf("mcc mustn't be null") -} - -// MccRm is defined in the same way as the Mcc data type, but with the OpenAPI "nullable: true" property. -type MccRm Mcc - -// Validate validates the MccRm string. -func (m *MccRm) Validate() error { - if m != nil { - return (*Mcc)(m).Validate() - } - return nil -} - -// Mnc is the Mobile Network Code part of the PLMN, comprising 2 or 3 digits, as defined in subclause 9.3.3.5 of 3GPP TS 38.413. -type Mnc string - -// Validate validates the Mnc string. -func (m *Mnc) Validate() error { - if m != nil { - if !regexp.MustCompile("[0-9]{2,3}$").MatchString(string(*m)) { - return fmt.Errorf("mnc must follow this pattern '[0-9]{2,3}$'") - } - return nil - } - return fmt.Errorf("mnc mustn't be null") -} - -// MncRm is defined in the same way as the Mnc data type, but with the OpenAPI "nullable: true" property. -type MncRm Mnc - -// Validate validates the MncRm string. -func (m *MncRm) Validate() error { - if m != nil { - return (*Mnc)(m).Validate() - } - return nil -} - -// Tac is 2 or 3-octet string identifying a tracking area code as specified in subclause 9.3.3.10 of 3GPP TS 38.413 [11], in hexadecimal representation. -// Each character in the string shall take a value of -// "0" to "9" or "A" to "F" and shall represent 4 bits. The most -// significant character representing the 4 most significant bits of the -// TAC shall appear first in the string, and the character -// representing the 4 least significant bit of the TAC shall appear last -// in the string. -type Tac string - -// Validate validates the Tac string. -func (t *Tac) Validate() error { - if t != nil { - return nil - } - return fmt.Errorf("tac mustn't be null") -} - -// TacRm is defined in the same way as the Tac data type, but with the OpenAPI "nullable: true" property. -type TacRm Tac - -func (t *TacRm) Validate() error { - if t != nil { - return (*Tac)(t).Validate() - } - return nil -} - -// EutraCellId is a 28-bit string identifying an E-UTRA Cell Id as specified in subclause 9.3.1.9 of 3GPP TS 38.413 [11], in hexadecimal representation. -// Each character in the string shall take a value of -// "0" to "9" or "A" to "F" and shall represent 4 bits. The most -// significant character representing the 4 most significant bits of the -// Cell Id shall appear first in the string, and the character -// representing the 4 least significant bit of the Cell Id shall appear -// last in the string. -type EutraCellId string - -// Validate validates the EutraCellId string. -func (e *EutraCellId) Validate() error { - if e != nil { - if !regexp.MustCompile("^[A-Fa-f0-9]{7}$").MatchString(string(*e)) { - return fmt.Errorf("eutraCellId must follow this pattern '[0-9A-F]{7}$'") - } - return nil - } - return fmt.Errorf("eutraCellId mustn't be null") -} - -// EutraCellIdRm is defined in the same way as the EutraCellId data type, but with the OpenAPI "nullable: true" property. -type EutraCellIdRm EutraCellId - -// Validate validates the EutraCellIdRm string. -func (e *EutraCellIdRm) Validate() error { - if e != nil { - return (*EutraCellId)(e).Validate() - } - return nil -} - -// NrCellId is a 36-bit string identifying an NR Cell Id as specified in subclause 9.3.1.7 of 3GPP TS 38.413 [11], in hexadecimal representation. -// Each character in the string shall take a value of "0" to "9" or "A" -// to "F" and shall represent 4 bits. The most significant character -// representing the 4 most significant bits of the Cell Id shall appear -// first in the string, and the character representing the 4 least -// significant bit of the Cell Id shall appear last in the string. -type NrCellId string - -// Validate validates the NrCellId string. -func (n *NrCellId) Validate() error { - if n != nil { - if !regexp.MustCompile("^[A-Fa-f0-9]{9}$").MatchString(string(*n)) { - return fmt.Errorf("nrCellId must follow this pattern '[0-9A-F]{9}$'") - } - return nil - } - return fmt.Errorf("nrCellId mustn't be null") -} - -// NrCellIdRm is defined in the same way as the NrCellId data type, but with the OpenAPI "nullable: true" property. -type NrCellIdRm NrCellId - -// Validate validates the NrCellIdRm string. -func (n *NrCellIdRm) Validate() error { - if n != nil { - return (*NrCellId)(n).Validate() - } - return nil -} - -// Dnai is DNAI (Data network access identifier), see subclause 5.6.7 of 3GPP TS 23.501. -type Dnai string - -// Validate validates the Dnai string. -func (d *Dnai) Validate() error { - if d != nil { - return nil - } - return fmt.Errorf("dnai mustn't be null") -} - -// DnaiRm is defined in the same way as the Dnai data type, but with the OpenAPI "nullable: true" property. -type DnaiRm Dnai - -// Validate validates the DnaiRm string. -func (d *DnaiRm) Validate() error { - if d != nil { - return (*Dnai)(d).Validate() - } - return nil -} - -// FiveGMmCause represents the 5GMM cause code values as specified in 3GPP TS 24.501. -type FiveGMmCause uint64 - -// Validate validates the FiveGMmCause value. -func (f *FiveGMmCause) Validate() error { - if f != nil { - return nil - } - return fmt.Errorf("fiveGMmCause mustn't be null") -} - -// AreaCode is operator specific. -type AreaCode string - -// Validate validates the AreaCode string. -func (a *AreaCode) Validate() error { - if a != nil { - return nil - } - return fmt.Errorf("areaCode mustn't be null") -} - -// AreaCodeRm is defined in the same way as the AreaCode data type, but with the OpenAPI "nullable: true" property. -type AreaCodeRm AreaCode - -// Validate validates the AreaCodeRm string. -func (a *AreaCodeRm) Validate() error { - if a != nil { - return (*AreaCode)(a).Validate() - } - return nil -} - -// AmfName is the FQDN (Fully Qualified Domain Name) of the AMF as defined in subclause 28.3.2.5 of 3GPP TS 23.003. -type AmfName string - -// Validate validates the AmfName string. -func (a *AmfName) Validate() error { - if a != nil { - return nil - } - return fmt.Errorf("amfName mustn't be null") -} - -// N3IwfId represents the identifier of the N3IWF ID as specified in subclause 9.3.1.57 of 3GPP TS 38.413 [11] -type N3IwfId string - -// Validate validates the NThreeIwfId string. -func (n *N3IwfId) Validate() error { - if n != nil { - if !regexp.MustCompile("^[A-Fa-f0-9]+$").MatchString(string(*n)) { - return fmt.Errorf("nThreeIwfId must follow this pattern '[0-9A-F]{8}$'") - } - return nil - } - return fmt.Errorf("nThreeIwfId mustn't be null") -} - -// NgeNbId represents the identifier of the ng-eNB ID as specified in subclause 9.3.1.8 of 3GPP TS 38.413. -// The string shall be formatted with following pattern: -// Pattern: '^('MacroNGeNB-[A-Fa-f0-9]{5}| -// LMacroNGeNB-[A-Fa-f0-9]{6}| -// SMacroNGeNB-[A-Fa-f0-9]{5})$' -// The value of the ng-eNB ID shall be encoded in hexadecimal -// representation. Each character in the string shall take a value of -// "0" to "9" or "A" to "F" and shall represent 4 bits. The padding 0 -// shall be added to make multiple nibbles, so the most significant -// character representing the padding 0 if required together with the -// 4 most significant bits of the ng-eNB ID shall appear first in the -// string, and the character representing the 4 least significant bit of -// the ng-eNB ID (to form a nibble) shall appear last in the string. -type NgeNbId string - -// Validate validates the NgeNbId string. -func (n *NgeNbId) Validate() error { - if n != nil { - if !regexp.MustCompile("^(MacroNGeNB-[A-Fa-f0-9]{5}|LMacroNGeNB-[A-Fa-f0-9]{6}|SMacroNGeNB-[A-Fa-f0-9]{5})$").MatchString(string(*n)) { - return fmt.Errorf("ngeNbId must follow this pattern '^(MacroNGeNB-[0-9A-F]{5}|LMacroNGeNB-[0-9A-F]{6}|SMacroNGeNB-[0-9A-F]{5})$'") - } - return nil - } - return fmt.Errorf("ngeNbId mustn't be null") -} diff --git a/models/qos/qos_enums.go b/models/qos/qos_enums.go deleted file mode 100644 index 675033e..0000000 --- a/models/qos/qos_enums.go +++ /dev/null @@ -1,190 +0,0 @@ -package qos - -import "fmt" - -// PreemptionCapability indicates the pre-emption capability of a request on other QoS flows. See subclause 5.7.2.2 of 3GPP TS 23.501. -type PreemptionCapability string - -// Validate validates the PreemptionCapability string. -func (p *PreemptionCapability) Validate() error { - if p == nil { - return fmt.Errorf("preemptionCapability must not be nil") - } - switch *p { - case PreemptionCapabilityNotPreempt: - case PreemptionCapabilityMayPreempt: - default: - return fmt.Errorf("invalid preemption capability: %s", p) - } - return nil -} - -const ( - PreemptionCapabilityNotPreempt PreemptionCapability = "NOT_PREEMPT" // Shall not trigger pre-emption. - PreemptionCapabilityMayPreempt PreemptionCapability = "MAY_PREEMPT" // May trigger pre-emption. -) - -// PreemptionVulnerability indicates the pre-emption vulnerability of the QoS flow to pre-emption from other QoS flows. See subclause 5.7.2.2 of 3GPP TS 23.501. -type PreemptionVulnerability string - -// Validate validates the PreemptionVulnerability string. -func (p *PreemptionVulnerability) Validate() error { - if p == nil { - return fmt.Errorf("preemptionVulnerability must not be nil") - } - switch *p { - case PreemptionVulnerabilityNotPreemptable: - case PreemptionVulnerabilityPreemptable: - default: - return fmt.Errorf("invalid preemption vulnerability: %s", p) - } - return nil -} - -const ( - PreemptionVulnerabilityNotPreemptable PreemptionVulnerability = "NOT_PREEMPTABLE" // Shall not be pre-empted. - PreemptionVulnerabilityPreemptable PreemptionVulnerability = "PREEMPTABLE" // May be pre-empted. -) - -// ReflectiveQosAttribute indicates whether certain traffic of the QoS flow may be subject to Reflective QoS (see subclause 5.7.2.3 of 3GPP TS 23.501). -type ReflectiveQosAttribute string - -// Validate validates the ReflectiveQosAttribute string. -func (r *ReflectiveQosAttribute) Validate() error { - if r == nil { - return fmt.Errorf("reflectiveQosAttribute must not be nil") - } - switch *r { - case ReflectiveQosAttributeRQoS: - case ReflectiveQosAttributeNoRQoS: - default: - return fmt.Errorf("invalid reflective qos attribute: %s", r) - } - return nil -} - -const ( - ReflectiveQosAttributeRQoS ReflectiveQosAttribute = "RQOS" // Certain traffic of the Qos flow may be subject to Reflective QoS. - ReflectiveQosAttributeNoRQoS ReflectiveQosAttribute = "NO_RQOS" // Traffic of the Qos flow is not subject to Reflective QoS. -) - -// NotificationControl indicates whether notifications are requested from the RAN when the GFBR can no longer (or again) be fulfilled for a QoS Flow during the lifetime of the QoS Flow (see subclause 5.7.2.4 of 3GPP TS 23.501). -type NotificationControl string - -// Validate validates the NotificationControl string. -func (n *NotificationControl) Validate() error { - if n == nil { - return fmt.Errorf("notificationControl must not be nil") - } - switch *n { - case NotificationControlRequested: - case NotificationControlNotRequested: - default: - return fmt.Errorf("invalid notification control: %s", n) - } - return nil -} - -const ( - NotificationControlRequested NotificationControl = "REQUESTED" // Notifications are requested from the RAN. - NotificationControlNotRequested NotificationControl = "NOT_REQUESTED" // Notifications are not requested from the RAN. -) - -// QosResourceType indicates whether a QoS Flow is non-GBR, delay critical GBR, or non-delay critical GBR (see subclauses 5.7.3.4 and 5.7.3.5 of 3GPP TS 23.501). -type QosResourceType string - -// Validate validates the QosResourceType string. -func (q *QosResourceType) Validate() error { - if q == nil { - return fmt.Errorf("qosResourceType must not be nil") - } - switch *q { - case QosResourceTypeNonGBR: - case QosResourceTypeNonCriticalGBR: - case QosResourceTypeCriticalGBR: - default: - return fmt.Errorf("invalid qos resource type: %s", q) - } - return nil -} - -const ( - QosResourceTypeNonGBR QosResourceType = "NON_GBR" // Non-GBR QoS Flow. - QosResourceTypeNonCriticalGBR QosResourceType = "NON_CRITICAL_GBR" // Non-delay critical GBR QoS Flow. - QosResourceTypeCriticalGBR QosResourceType = "CRITICAL_GBR" // Delay critical GBR QoS Flow. -) - -// PreemptionCapabilityRm is defined in the same way as the "PreemptionCapability" enumeration, but with the OpenAPI "nullable: true" property. -type PreemptionCapabilityRm PreemptionCapability - -// Validate validates the PreemptionCapabilityRm string. -func (p *PreemptionCapabilityRm) Validate() error { - if p != nil { - return (*PreemptionCapability)(p).Validate() - } - return nil -} - -// PreemptionVulnerabilityRm is defined in the same way as the "PreemptionVulnerability" enumeration, but with the OpenAPI "nullable: true" property. -type PreemptionVulnerabilityRm PreemptionVulnerability - -// Validate validates the PreemptionVulnerabilityRm string. -func (p *PreemptionVulnerabilityRm) Validate() error { - if p != nil { - return (*PreemptionVulnerability)(p).Validate() - } - return nil -} - -// ReflectiveQosAttributeRm is defined in the same way as the "ReflectiveQosAttribute" enumeration, but with the OpenAPI "nullable: true" property. -type ReflectiveQosAttributeRm ReflectiveQosAttribute - -// Validate validates the ReflectiveQosAttributeRm string. -func (r *ReflectiveQosAttributeRm) Validate() error { - if r != nil { - return (*ReflectiveQosAttribute)(r).Validate() - } - return nil -} - -// NotificationControlRm is defined in the same way as the "NotificationControl" enumeration, but with the OpenAPI "nullable: true" property. -type NotificationControlRm NotificationControl - -// Validate validates the NotificationControlRm string. -func (n *NotificationControlRm) Validate() error { - if n != nil { - return (*NotificationControl)(n).Validate() - } - return nil -} - -// QosResourceTypeRm is defined in the same way as the "QosResourceType" enumeration, but with the OpenAPI "nullable: true" property. -type QosResourceTypeRm QosResourceType - -// Validate validates the QosResourceTypeRm string. -func (q *QosResourceTypeRm) Validate() error { - if q != nil { - return (*QosResourceType)(q).Validate() - } - return nil -} - -// AdditionalQosFlowInfo provides additional QoS flow information (see subclause 9.3.1.12 3GPP TS 38.413). -type AdditionalQosFlowInfo string - -// Validate validates the AdditionalQosFlowInfo string. -func (a *AdditionalQosFlowInfo) Validate() error { - if a == nil { - return fmt.Errorf("additionalQosFlowInfo must not be nil") - } - switch *a { - case AdditionalQosFlowInfoMoreLikely: - default: - return fmt.Errorf("invalid additional qos flow info: %s", a) - } - return nil -} - -const ( - AdditionalQosFlowInfoMoreLikely AdditionalQosFlowInfo = "MORE_LIKELY" // Traffic for the QoS flow is likely to appear more often than traffic for other flows established for the PDU session. -) diff --git a/models/qos/qos_structs.go b/models/qos/qos_structs.go deleted file mode 100644 index 55b0b27..0000000 --- a/models/qos/qos_structs.go +++ /dev/null @@ -1,156 +0,0 @@ -package qos - -import "fmt" - -type Arp struct { - PriorityLevel *ArpPriorityLevel `json:"priorityLevel"` // Defines the relative importance of a resource request. - PreemptCap *PreemptionCapability `json:"preemptCap"` // Defines whether a service data flow may get resources that were already assigned to another service data flow with a lower priority level. - PreemptVuln *PreemptionVulnerability `json:"preemptVuln"` // Defines whether a service data flow may lose the resources assigned to it in order to admit a service data flow with higher priority level. -} - -// Validate validates this arp. -func (a *Arp) Validate() error { - if a.PreemptVuln == nil { - return fmt.Errorf("preemptionVulnerability must not be nil") - } - if err := a.PreemptVuln.Validate(); err != nil { - return fmt.Errorf("preemptionVulnerability %s", err.Error()) - } - if a.PreemptCap == nil { - return fmt.Errorf("preemptionCapability must not be nil") - } - if err := a.PreemptCap.Validate(); err != nil { - return fmt.Errorf("preemptionCapability %s", err.Error()) - } - if a.PriorityLevel == nil { - return fmt.Errorf("priorityLevel must not be nil") - } - if err := a.PriorityLevel.Validate(); err != nil { - return fmt.Errorf("priorityLevel %s", err.Error()) - } - return nil -} - -type Ambr struct { - Uplink *BitRate `json:"uplink"` // AMBR for uplink - Downlink *BitRate `json:"downlink"` // AMBR for downlink -} - -// Validate validates this ambr. -func (a *Ambr) Validate() error { - if a.Downlink == nil { - return fmt.Errorf("downlink must not be nil") - } - if err := a.Downlink.Validate(); err != nil { - return fmt.Errorf("downlink %s", err.Error()) - } - if a.Uplink == nil { - return fmt.Errorf("uplink must not be nil") - } - if err := a.Uplink.Validate(); err != nil { - return fmt.Errorf("uplink %s", err.Error()) - } - return nil -} - -type Dynamic5Qi struct { - ResourceType *QosResourceType `json:"resourceType"` // Defines the 5QI resource type. - PriorityLevel *FiveQiPriorityLevel `json:"priorityLevel"` // Defines the 5QI Priority Level. - PacketDelayBudget *PacketDelBudget `json:"packetDelayBudget"` // Defines the packet delay budget. - PacketErrRate *PacketErrRate `json:"packetErrRate"` // Defines the packet error rate. - AverWindow *AverWindow `json:"averWindow,omitempty"` // Defines the averaging window. This IE shall be present only for a GBR QoS flow or a Delay Critical GBR QoS flow. - MaxDataBurstVol *MaxDataBurstVol `json:"maxDataBurstVol,omitempty"` // Defines the maximum data burst volume. This IE shall be present for a Delay Critical GBR QoS flow. -} - -// Validate validates this dynamic5Qi. -func (d *Dynamic5Qi) Validate() error { - if d.ResourceType == nil { - return fmt.Errorf("resourceType must not be nil") - } - if err := d.ResourceType.Validate(); err != nil { - return fmt.Errorf("resourceType %s", err.Error()) - } - if d.PriorityLevel == nil { - return fmt.Errorf("priorityLevel must not be nil") - } - if err := d.PriorityLevel.Validate(); err != nil { - return fmt.Errorf("priorityLevel %s", err.Error()) - } - if d.PacketDelayBudget == nil { - return fmt.Errorf("packetDelayBudget must not be nil") - } - if err := d.PacketDelayBudget.Validate(); err != nil { - return fmt.Errorf("packetDelayBudget %s", err.Error()) - } - if d.PacketErrRate == nil { - return fmt.Errorf("packetErrRate must not be nil") - } - if err := d.PacketErrRate.Validate(); err != nil { - return fmt.Errorf("packetErrRate %s", err.Error()) - } - if d.AverWindow != nil { - if err := d.AverWindow.Validate(); err != nil { - return fmt.Errorf("averWindow %s", err.Error()) - } - } - if d.MaxDataBurstVol != nil { - if err := d.MaxDataBurstVol.Validate(); err != nil { - return fmt.Errorf("maxDataBurstVol %s", err.Error()) - } - } - return nil -} - -type NonDynamic5Qi struct { - PriorityLevel *FiveQiPriorityLevel `json:"priorityLevel,omitempty"` // Defines the 5QI Priority Level. When present, it contains the 5QI Priority Level value that overrides the standardized or pre-configured value. - AverWindow *AverWindow `json:"averWindow,omitempty"` // Defines the averaging window. This IE may be present for a GBR QoS flow or a Delay Critical GBR QoS flow. When present, it contains the Averaging Window that overrides the standardized or pre-configured value - MaxDataBurstVol *MaxDataBurstVol `json:"maxDataBurstVol,omitempty"` // Defines the maximum data burst volume. This IE may be present for a Delay Critical GBR QoS flow. When present, it contains the Maximum Data Burst Volume value that overrides the standardized or pre-configured value. -} - -// Validate validates this nonDynamic5Qi. -func (n *NonDynamic5Qi) Validate() error { - if n.PriorityLevel != nil { - if err := n.PriorityLevel.Validate(); err != nil { - return fmt.Errorf("priorityLevel %s", err.Error()) - } - } - if n.AverWindow != nil { - if err := n.AverWindow.Validate(); err != nil { - return fmt.Errorf("averWindow %s", err.Error()) - } - } - if n.MaxDataBurstVol != nil { - if err := n.MaxDataBurstVol.Validate(); err != nil { - return fmt.Errorf("maxDataBurstVol %s", err.Error()) - } - } - return nil -} - -// ArpRm is defined in the same way as the Arp data type, but with the OpenAPI "nullable: true" property. -type ArpRm Arp - -// Validate validates this arpRm. -func (a *ArpRm) Validate() error { - if a == nil { - return nil - } - if err := (*Arp)(a).Validate(); err != nil { - return err - } - return nil -} - -// AmbrRm is defined in the same way as the Ambr data type, but with the OpenAPI "nullable: true" property. -type AmbrRm Ambr - -// Validate validates this ambrRm. -func (a *AmbrRm) Validate() error { - if a == nil { - return nil - } - if err := (*Ambr)(a).Validate(); err != nil { - return err - } - return nil -} diff --git a/models/qos/qos_types.go b/models/qos/qos_types.go deleted file mode 100644 index ed7b0bd..0000000 --- a/models/qos/qos_types.go +++ /dev/null @@ -1,262 +0,0 @@ -package qos - -import ( - "fmt" - "regexp" -) - -// Qfi is an unsigned integer identifying a QoS flow, within the range 0 to 63. -type Qfi uint8 - -// Validate validates this qfi. -func (q *Qfi) Validate() error { - if q == nil { - return fmt.Errorf("qfi must not be nil") - } - if *q < 0 || *q > 63 { - return fmt.Errorf("qfi %d is out of range [0, 63]", *q) - } - return nil -} - -// QfiRm data type is defined in the same way as the Qfi data type, but with the OpenAPI "nullable: true" property. -type QfiRm Qfi - -// Validate validates this qfi rm. -func (q *QfiRm) Validate() error { - if q != nil { - return (*Qfi)(q).Validate() - } - return nil -} - -// FiveQi (5qi) is an unsigned integer representing a 5G QoS Identifier (see subclause 5.7.2.1 of 3GPP TS 23.501), within the range 0 to 255. -type FiveQi uint8 - -// Validate validates this 5qi. -func (f *FiveQi) Validate() error { - if f == nil { - return fmt.Errorf("5qi must not be nil") - } - if *f < 0 || *f > 255 { - return fmt.Errorf("5qi %d is out of range [0, 255]", *f) - } - return nil -} - -// FiveQiRm data type is defined in the same way as the FiveQi data type, but with the OpenAPI "nullable: true" property. -type FiveQiRm FiveQi - -// Validate validates this 5qi rm. -func (f *FiveQiRm) Validate() error { - if f != nil { - return (*FiveQi)(f).Validate() - } - return nil -} - -// BitRate is a string representing a bit rate. -type BitRate string - -// Validate validates this bit rate. -func (b *BitRate) Validate() error { - if b == nil { - return fmt.Errorf("bit rate must not be nil") - } - if !regexp.MustCompile("^\\d+(\\.\\d+)? (bps|Kbps|Mbps|Gbps|Tbps)$").MatchString(string(*b)) { - return fmt.Errorf("bit rate %s is not valid", *b) - } - return nil -} - -// BitRateRm data type is defined in the same way as the BitRate data type, but with the OpenAPI "nullable: true" property. -type BitRateRm BitRate - -// Validate validates this bit rate rm. -func (b *BitRateRm) Validate() error { - if b != nil { - return (*BitRate)(b).Validate() - } - return nil -} - -// ArpPriorityLevel is an unsignedinteger indicating the ARP Priority Level (see subclause 5.7.2.2 of 3GPP TS 23.501), within the range 1 to 15. -//Values are ordered in decreasing order of priority, i.e. with 1 as the highest priority and 15 as the lowest priority. -type ArpPriorityLevel uint8 - -// Validate validates this arp priority level. -func (a *ArpPriorityLevel) Validate() error { - if a == nil { - return fmt.Errorf("arp priority level must not be nil") - } - if *a < 1 || *a > 15 { - return fmt.Errorf("arp priority level %d is out of range [1, 15]", *a) - } - return nil -} - -// ArpPriorityLevelRm data type is defined in the same way as the ArpPriorityLevel data type, but with the OpenAPI "nullable: true" property. -type ArpPriorityLevelRm ArpPriorityLevel - -// Validate validates this arp priority level rm. -func (a *ArpPriorityLevelRm) Validate() error { - if a != nil { - return (*ArpPriorityLevel)(a).Validate() - } - return nil -} - -// FiveQiPriorityLevel is an unsigned integer indicating the 5QI Priority Level (see subclauses 5.7.3.3 and 5.7.4 of 3GPP TS 23.501), within the range 1 to 127. -//Values are ordered in decreasing order of priority, i.e. with 1 as the highest priority and 127 as the lowest priority. -type FiveQiPriorityLevel uint8 - -// Validate validates this 5qi priority level. -func (f *FiveQiPriorityLevel) Validate() error { - if f == nil { - return fmt.Errorf("5qi priority level must not be nil") - } - if *f < 1 || *f > 127 { - return fmt.Errorf("5qi priority level %d is out of range [1, 127]", *f) - } - return nil -} - -// FiveQiPriorityLevelRm data type is defined in the same way as the FiveQiPriorityLevel data type, but with the OpenAPI "nullable: true" property. -type FiveQiPriorityLevelRm FiveQiPriorityLevel - -// Validate validates this 5qi priority level rm. -func (f *FiveQiPriorityLevelRm) Validate() error { - if f != nil { - return (*FiveQiPriorityLevel)(f).Validate() - } - return nil -} - -// PacketDelBudget is an unsigned integer indicating Packet Delay Budget (see subclauses 5.7.3.4 and 5.7.4 of 3GPP TS 23.501), expressed in milliseconds. -// Minimum = 1. -type PacketDelBudget uint64 - -// Validate validates this packet del budget. -func (p *PacketDelBudget) Validate() error { - if p == nil { - return fmt.Errorf("packet del budget must not be nil") - } - if *p < 1 { - return fmt.Errorf("packet del budget %d is out of range [1, infinity]", *p) - } - return nil -} - -// PacketDelBudgetRm data type is defined in the same way as the PacketDelBudget data type, but with the OpenAPI "nullable: true" property. -type PacketDelBudgetRm PacketDelBudget - -// Validate validates this packet del budget rm. -func (p *PacketDelBudgetRm) Validate() error { - if p != nil { - return (*PacketDelBudget)(p).Validate() - } - return nil -} - -// PacketErrRate is a string representing Packet Error Rate (see subclause 5.7.3.5 and 5.7.4 of 3GPP TS 23.501), expressed as a "scalar x 10-k" where the scalar and the exponent k are each encoded as one decimal digit. -type PacketErrRate string - -// Validate validates this packet err rate. -func (p *PacketErrRate) Validate() error { - if p == nil { - return fmt.Errorf("packet err rate must not be nil") - } - if !regexp.MustCompile("^([0-9]E-[0-9])$").MatchString(string(*p)) { - return fmt.Errorf("packet err rate %s is not valid", *p) - } - return nil -} - -// PacketErrRateRm data type is defined in the same way as the PacketErrRate data type, but with the OpenAPI "nullable: true" property. -type PacketErrRateRm PacketErrRate - -// Validate validates this packet err rate rm. -func (p *PacketErrRateRm) Validate() error { - if p != nil { - return (*PacketErrRate)(p).Validate() - } - return nil -} - -// PacketLossRate is an unsigned integer indicating Packet Loss Rate (see subclauses 5.7.2.8 and 5.7.4 of 3GPP TS 23.501), expressed in tenth of percent. -//Minimum = 0. Maximum = 1000. -type PacketLossRate uint16 - -// Validate validates this packet loss rate. -func (p *PacketLossRate) Validate() error { - if p == nil { - return fmt.Errorf("packet loss rate must not be nil") - } - if *p < 0 || *p > 1000 { - return fmt.Errorf("packet loss rate %d is out of range [0, 1000]", *p) - } - return nil -} - -// PacketLossRateRm data type is defined in the same way as the PacketLossRate data type, but with the OpenAPI "nullable: true" property. -type PacketLossRateRm PacketLossRate - -// Validate validates this packet loss rate rm. -func (p *PacketLossRateRm) Validate() error { - if p != nil { - return (*PacketLossRate)(p).Validate() - } - return nil -} - -// AverWindow is an unsigned integer indicating Averaging Window (see subclause 5.7.3.6 and 5.7.4 of 3GPP TS 23.501), expressed in milliseconds. -//Minimum = 1. Maximum = 4095. -type AverWindow uint16 - -// Validate validates this aver window. -func (a *AverWindow) Validate() error { - if a == nil { - return fmt.Errorf("aver window must not be nil") - } - if *a < 1 || *a > 4095 { - return fmt.Errorf("aver window %d is out of range [1, 4095]", *a) - } - return nil -} - -// AverWindowRm data type is defined in the same way as the AverWindow data type, but with the OpenAPI "nullable: true" property. -type AverWindowRm AverWindow - -// Validate validates this aver window rm. -func (a *AverWindowRm) Validate() error { - if a != nil { - return (*AverWindow)(a).Validate() - } - return nil -} - -// MaxDataBurstVol is an unsigned integer indicating Maximum Data Burst Volume (see subclauses 5.7.3.7 and 5.7.4 of 3GPP TS 23.501), expressed in Bytes. -//Minimum = 1. Maximum = 4095. -type MaxDataBurstVol uint16 - -// Validate validates this max data burst vol. -func (m *MaxDataBurstVol) Validate() error { - if m == nil { - return fmt.Errorf("max data burst vol must not be nil") - } - if *m < 1 || *m > 4095 { - return fmt.Errorf("max data burst vol %d is out of range [1, 4095]", *m) - } - return nil -} - -// MaxDataBurstVolRm data type is defined in the same way as the MaxDataBurstVol data type, but with the OpenAPI "nullable: true" property. -type MaxDataBurstVolRm MaxDataBurstVol - -// Validate validates this max data burst vol rm. -func (m *MaxDataBurstVolRm) Validate() error { - if m != nil { - return (*MaxDataBurstVol)(m).Validate() - } - return nil -} diff --git a/models/subscription/subscription_identification_numbering_structs.go b/models/subscription/subscription_identification_numbering_structs.go deleted file mode 100644 index 1a6252c..0000000 --- a/models/subscription/subscription_identification_numbering_structs.go +++ /dev/null @@ -1,60 +0,0 @@ -package subscription - -import ( - "fmt" - "github.com/5GCoreNet/5GCoreNetSDK/models/network" -) - -type Guami struct { - PlmnId *network.PlmnId `json:"plmnId"` // PLMN Identity. - AmfId *AmfId `json:"amfId"` // AMF Identity. -} - -// Validate validates the Guami. -func (g *Guami) Validate() error { - if g.PlmnId == nil || g.AmfId == nil { - return fmt.Errorf("plmnId and amfId mustn't be null") - } - if err := g.PlmnId.Validate(); err != nil { - return err - } - if err := g.AmfId.Validate(); err != nil { - return err - } - return nil -} - -type NetworkId struct { - Mcc *network.Mcc `json:"mcc,omitempty"` // Mobile Country Code. - Mnc *network.Mnc `json:"mnc,omitempty"` // Mobile Network Code. - // NOTE: At least one MNC or MCC shall be included. -} - -// Validate validates the NetworkId. -func (n *NetworkId) Validate() error { - if n.Mcc == nil && n.Mnc == nil { - return fmt.Errorf("mcc and mnc mustn't be null") - } - if n.Mcc != nil { - if err := n.Mcc.Validate(); err != nil { - return err - } - } - if n.Mnc != nil { - if err := n.Mnc.Validate(); err != nil { - return err - } - } - return nil -} - -// GuamiRm is defined in the same way as the Guami data type, but with the OpenAPI "nullable: true" property. -type GuamiRm Guami - -// Validate validates the GuamiRm. -func (g *GuamiRm) Validate() error { - if g == nil { - return nil - } - return (*Guami)(g).Validate() -} diff --git a/models/subscription/subscription_identification_numbering_types.go b/models/subscription/subscription_identification_numbering_types.go deleted file mode 100644 index aa1d958..0000000 --- a/models/subscription/subscription_identification_numbering_types.go +++ /dev/null @@ -1,250 +0,0 @@ -package subscription - -import ( - "fmt" - "regexp" -) - -// Dnn reprsents a Data Network as defined in subclause 9A of -// 3GPP TS 23.003. It shall be formatted as string in which the -// labels are separated by dots (e.g. "Label1.Label2.Label3"). -type Dnn string - -// Validate validates the Dnn string. -func (d *Dnn) Validate() error { - if d == nil { - return fmt.Errorf("dnn mustn't be null") - } - return nil -} - -// DnnRm is defined in the same way as the Dnn data type, but with the OpenAPI "nullable: true" property. -type DnnRm Dnn - -// Validate validates the DnnRm string. -func (d *DnnRm) Validate() error { - if d == nil { - return nil - } - return (*Dnn)(d).Validate() -} - -// Gpsi dentifying a Gpsi shall contain either an External Id or an MSISDN. It -// shall be formatted as follows: -// -External Identifier: "extid-, where shall be formatted -// according to subclause 19.7.2 of 3GPP TS 23.003 that describes an External -// Identifier. -MSISDN: "msisdn-, where shall be formatted -// according to subclause 3.3 of 3GPP TS 23.003 that describes an MSISDN. -type Gpsi string - -// Validate validates the Gpsi string. -func (g *Gpsi) Validate() error { - if g == nil { - return fmt.Errorf("gpsi mustn't be null") - } - if !regexp.MustCompile(`^(msisdn-\d{5,15}|extid-.+@.+|.+)$`).MatchString(string(*g)) { - return fmt.Errorf("gpsi must follow this pattern '^(msisdn-[0-9]{5,15}|extid-.+@.+|.+)$'") - } - return nil -} - -// GpsiRm is defined in the same way as the Gpsi data type, but with the OpenAPI "nullable: true" property. -type GpsiRm Gpsi - -// Validate validates the GpsiRm string. -func (g *GpsiRm) Validate() error { - if g == nil { - return nil - } - return (*Gpsi)(g).Validate() -} - -// GroupId identifying a group of devices network internal globally -// unique ID which identifies a set of IMSIs, as specified in -// subclause 19.9 of 3GPP TS 23.003. -type GroupId string - -// Validate validates the GroupId string. -func (g *GroupId) Validate() error { - if g == nil { - return fmt.Errorf("group id mustn't be null") - } - if !regexp.MustCompile(`^[A-Fa-f\d]{8}-\d{3}-\d{2,3}-([A-Fa-f\d][A-Fa-f\d]){1,10}$`).MatchString(string(*g)) { - return fmt.Errorf("group id must follow this pattern '^imsi-[0-9]{5,15}$'") - } - return nil -} - -// GroupIdRm is defined in the same way as the GroupId data type, but with the OpenAPI "nullable: true" property. -type GroupIdRm GroupId - -// Validate validates the GroupIdRm string. -func (g *GroupIdRm) Validate() error { - if g == nil { - return nil - } - return (*GroupId)(g).Validate() -} - -// Pei representing a Permanent Equipment Identifier, if it contains an IMEI or -// IMEISV it is defined as specified in subclause 6.2 of 3GPP TS 23.003. -type Pei string - -// Validate validates the Pei string. -func (p *Pei) Validate() error { - if p == nil { - return fmt.Errorf("pei mustn't be null") - } - if !regexp.MustCompile(`^(imei-\d{15}|imeisv-\d{16}|.+)$`).MatchString(string(*p)) { - return fmt.Errorf("pei must follow this pattern '^imei-[0-9]{5,15}$'") - } - return nil -} - -// PeiRm is defined in the same way as the Pei data type, but with the OpenAPI "nullable: true" property. -type PeiRm Pei - -// Validate validates the PeiRm string. -func (p *PeiRm) Validate() error { - if p == nil { - return nil - } - return (*Pei)(p).Validate() -} - -// Supi identifying a Supi shall contain either an IMSI or an NAI. It -// shall be formatted as follows for: -// - IMSI "imsi-, shall be formatted according to subclause 2.2 of -// 3GPP TS 23.003 that describes an IMSI. - NAI "nai-, shall be -// formatted according to subclause 28.6.2 of 3GPP TS 23.003 that describes -// an NAI. -// To enable that the value is used as part of an URI, the string shall -// only contain characters allowed according to the "lower-with- -// hyphen" naming convention defined in 3GPP TS 29.501. -type Supi string - -// Validate validates the Supi string. -func (s *Supi) Validate() error { - if s == nil { - return fmt.Errorf("supi mustn't be null") - } - if !regexp.MustCompile(`^(imsi-\d{5,15}|nai-.+|.+)$`).MatchString(string(*s)) { - return fmt.Errorf("supi must follow this pattern '^(imsi-[0-9]{5,15}|nai-.+@.+|.+)$'") - } - return nil -} - -// SupiRm is defined in the same way as the Supi data type, but with the OpenAPI "nullable: true" property. -type SupiRm Supi - -// Validate validates the SupiRm string. -func (s *SupiRm) Validate() error { - if s == nil { - return nil - } - return (*Supi)(s).Validate() -} - -// NfInstanceId uniquely identifying a NF instance. The format of the NF Instance -// ID shall be a Universally Unique Identifier (UUID) version 4, as described in -// IETF RFC 4122 -type NfInstanceId string - -// Validate validates the NfInstanceId string. -func (n *NfInstanceId) Validate() error { - if n == nil { - return fmt.Errorf("nf instance id mustn't be null") - } - if !regexp.MustCompile(`^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$`).MatchString(string(*n)) { - return fmt.Errorf("nf instance id must follow this pattern (UUID v4) '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'") - } - return nil -} - -// AmfId identifying the AMF ID composed of AMF Region ID (8 -// bits), AMF Set ID (10 bits) and AMF Pointer (6 bits) as specified in subclause -// 2.10.1 of 3GPP TS 23.003. It is encoded as a string of 6 hexadecimal -// characters (i.e., 24 bits). -type AmfId string - -// Validate validates the AmfId string. -func (i *AmfId) Validate() error { - if i == nil { - return fmt.Errorf("amf id mustn't be null") - } - if !regexp.MustCompile(`^[\dA-Faa-f]{6}$`).MatchString(string(*i)) { - return fmt.Errorf("amf id must follow this pattern '^[0-9A-Faa-f]{6}$'") - } - return nil -} - -// AmfRegionId identifying the AMF Region ID (8 bits), as specified in subclause -// 2.10.1 of 3GPP TS 23.003. It is encoded as a string of 2 hexadecimal -// characters (i.e. 8 bits). -type AmfRegionId string - -// Validate validates the AmfRegionId string. -func (i *AmfRegionId) Validate() error { - if i == nil { - return fmt.Errorf("amf region id mustn't be null") - } - if !regexp.MustCompile(`^[\dA-Faa-f]{2}$`).MatchString(string(*i)) { - return fmt.Errorf("amf region id must follow this pattern '^[0-9A-Faa-f]{2}$'") - } - return nil -} - -// AmfSetId identifying the AMF Set ID (10 bits) as specified in -// subclause 2.10.1 of 3GPP TS 23.003. It is encoded as a string of 3 -// hexadecimal characters where the first character is limited to values 0 to 3 -// (i.e. 10 bits). -type AmfSetId string - -// Validate validates the AmfSetId string. -func (i *AmfSetId) Validate() error { - if i == nil { - return fmt.Errorf("amf set id mustn't be null") - } - if !regexp.MustCompile(`^[0-3][\dA-Faa-f]{2}$`).MatchString(string(*i)) { - return fmt.Errorf("amf set id must follow this pattern '^[0-3][0-9A-Faa-f]{2}$'") - } - return nil -} - -// RfspIndex representing the "Subscriber Profile ID for -// RAT/Frequency Priority" as specified in 3GPP TS 36.413. -// Minimum = 1. Maximum = 256. -type RfspIndex uint16 - -// Validate validates the RfspIndex. -func (i *RfspIndex) Validate() error { - if i == nil { - return fmt.Errorf("rfsp index mustn't be null") - } - if *i < 1 || *i > 256 { - return fmt.Errorf("rfsp index must be between 1 and 256") - } - return nil -} - -// RfspIndexRm is defined in the same way as the RfspIndex data type, but with the OpenAPI "nullable: true" property. -type RfspIndexRm RfspIndex - -// Validate validates the RfspIndexRm. -func (i *RfspIndexRm) Validate() error { - if i == nil { - return nil - } - return (*RfspIndex)(i).Validate() -} - -// NfGroupId is the identifier of a group of NFs. -type NfGroupId string - -// Validate validates the NfGroupId string. -func (n *NfGroupId) Validate() error { - if n == nil { - return fmt.Errorf("nf group id mustn't be null") - } - return nil -} diff --git a/models/trace/trace_enums.go b/models/trace/trace_enums.go deleted file mode 100644 index 2fb21c7..0000000 --- a/models/trace/trace_enums.go +++ /dev/null @@ -1,44 +0,0 @@ -package trace - -import "fmt" - -// TraceDepth defines how detailed information should be recorded in the trace. See 3GPP TS 32.422 for further description of the values. -type TraceDepth string - -// Validate validates the TraceDepth string. -func (t *TraceDepth) Validate() error { - if t == nil { - return fmt.Errorf("traceDepth must not be nil") - } - switch *t { - case TraceDepthMinimum: - case TraceDepthMedium: - case TraceDepthMaximum: - case TraceDepthMinimumWoVendorExtension: - case TraceDepthMediumWoVendorExtension: - case TraceDepthMaximumWoVendorExtension: - default: - return fmt.Errorf("invalid trace depth: %s", t) - } - return nil -} - -const ( - TraceDepthMinimum TraceDepth = "MINIMUM" // Minimum trace depth. - TraceDepthMedium TraceDepth = "MEDIUM" // Medium trace depth. - TraceDepthMaximum TraceDepth = "MAXIMUM" // Maximum trace depth. - TraceDepthMinimumWoVendorExtension TraceDepth = "MINIMUM_WO_VENDOR_EXTENSION" // Minimum without vendor specific extension. - TraceDepthMediumWoVendorExtension TraceDepth = "MEDIUM_WO_VENDOR_EXTENSION" // Medium without vendor specific extension. - TraceDepthMaximumWoVendorExtension TraceDepth = "MAXIMUM_WO_VENDOR_EXTENSION" // Maximum without vendor specific extension. -) - -// TraceDepthRm the same way as the TraceDepth enumeration, but with the OpenAPI "nullable: true" property. -type TraceDepthRm TraceDepth - -// Validate validates the TraceDepthRm string. -func (t *TraceDepthRm) Validate() error { - if t == nil { - return nil - } - return (*TraceDepth)(t).Validate() -} diff --git a/models/trace/trace_structs.go b/models/trace/trace_structs.go deleted file mode 100644 index 2c08ba2..0000000 --- a/models/trace/trace_structs.go +++ /dev/null @@ -1,74 +0,0 @@ -package trace - -import ( - "fmt" - "github.com/5GCoreNet/5GCoreNetSDK/models/common" - "regexp" -) - -type TraceData struct { - // TraceRef is the trace reference (see 3GPP TS 32.422). - // TraceRef shall be encoded as the concatenation of MCC, MNC and Trace ID as follows: - - // The Trace ID shall be encoded as a 3 octet string in hexadecimal representation. Each character in the Trace ID string shall take a value of "0" to "9" or "A" - // to "F" and shall represent 4 bits. The most significant character representing the 4 most significant bits of the Trace ID shall appear first in the string, and the - // character representing the 4 least significant bit of the Trace ID shall appear last in the string. - TraceRef string `json:"traceRef"` - // TraceDepth (see 3GPP TS 32.422 [19]). - TraceDepth *TraceDepth `json:"traceDepth"` - // NeTypeList is the list of NE Types (see 3GPP TS 32.422). - //It shall be encoded as an octet string in hexadecimal representation. Each character in the string shall take a value of "0" to "9" or "A" to "F" and shall represent 4 bits. - //The most significant character representing the 4 most significant bits shall appear first in the string, and the character representing the - //4 least significant bit shall appear last in the string. Octets shall be coded according to 3GPP TS 32.422. - NeTypeList string `json:"neTypeList"` - // EventList is the list of Triggering events (see 3GPP TS 32.422). It shall be encoded as an octet string in hexadecimal representation. Each character in the string shall - //take a value of "0" to "9" or "A" to "F" and shall represent 4 bits. The most significant character representing the 4 most significant bits shall appear - //first in the string, and the character representing the 4 least significant bit shall appear last in the string. Octets shall be coded according to 3GPP TS 32.422. - EventList string `json:"eventList"` - // CollectionEntityIpv4Addr is the IPv4 Address of the Trace Collection Entity (see 3GPP TS 32.422). - //At least one of the collectionEntityIpv4Addr or collectionEntityIpv6Addr attributes shall be present. - CollectionEntityIpv4Addr *common.Ipv4Addr `json:"collectionEntityIpv4Addr,omitempty"` - // CollectionEntityIpv6Addr is the IPv6 Address of the Trace Collection Entity (see 3GPP TS 32.422). - //At least one of the collectionEntityIpv4Addr or collectionEntityIpv6Addr attributes shall be present. - CollectionEntityIpv6Addr *common.Ipv6Addr `json:"collectionEntityIpv6Addr,omitempty"` - // InterfaceList is the list of interfaces (see 3GPP TS 32.422). It shall be encoded as an octet string in hexadecimal representation. Each character in the string shall - //take a value of "0" to "9" or "A" to "F" and shall represent 4 bits. The most significant character representing the 4 most significant bits shall appear first in the string, and the character representing the - //4 least significant bit shall appear last in the string. Octets shall be coded according to 3GPP TS 32.422. - //If this attribute is not present, all the interfaces applicable to the list of NE types indicated in the neTypeList attribute should be traced. - InterfaceList string `json:"interfaceList,omitempty"` -} - -// Validate validates this trace data -func (m *TraceData) Validate() error { - if !regexp.MustCompile("[0-9]{3}[0-9]{2,3}-[A-Fa-f0-9]{6}$'").MatchString(m.TraceRef) { - return fmt.Errorf("invalid trace reference: %s", m.TraceRef) - } - if err := m.TraceDepth.Validate(); err != nil { - return err - } - if !regexp.MustCompile("^[A-Fa-f0-9]+$").MatchString(m.NeTypeList) { - return fmt.Errorf("invalid NE type list: %s", m.NeTypeList) - } - if !regexp.MustCompile("^[A-Fa-f0-9]+$").MatchString(m.EventList) { - return fmt.Errorf("invalid event list: %s", m.EventList) - } - if m.CollectionEntityIpv4Addr != nil && m.CollectionEntityIpv6Addr != nil { - return fmt.Errorf("collectionEntityIpv4Addr and collectionEntityIpv6Addr must not be set at the same time") - } - if m.CollectionEntityIpv4Addr == nil && m.CollectionEntityIpv6Addr == nil { - return fmt.Errorf("collectionEntityIpv4Addr or collectionEntityIpv6Addr must be set") - } - if m.CollectionEntityIpv4Addr != nil { - if err := m.CollectionEntityIpv4Addr.Validate(); err != nil { - return err - } - } - if m.CollectionEntityIpv6Addr != nil { - if err := m.CollectionEntityIpv6Addr.Validate(); err != nil { - return err - } - } - if !regexp.MustCompile("^[A-Fa-f0-9]+$").MatchString(m.InterfaceList) { - return fmt.Errorf("invalid interface list: %s", m.InterfaceList) - } - return nil -} diff --git a/pkg/naf/.KEEP b/pkg/naf/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/namf/.KEEP b/pkg/namf/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/nausf/auth.go b/pkg/nausf/auth.go deleted file mode 100644 index 3c2282d..0000000 --- a/pkg/nausf/auth.go +++ /dev/null @@ -1,9 +0,0 @@ -package nausf - -import "context" - -type AuthHandler interface { - Authentication(ctx context.Context) error - AkaConfirmation(ctx context.Context) error - EapSession(ctx context.Context) error -} diff --git a/pkg/nausf/nausf.go b/pkg/nausf/nausf.go deleted file mode 100644 index d9c49c1..0000000 --- a/pkg/nausf/nausf.go +++ /dev/null @@ -1,28 +0,0 @@ -package nausf - -const ( - ApiVersion = "v1" - ApiNameAuth = "nausf-auth" - ApiNameSor = "nausf-sorprotection" - ApiNameUpu = "nausf-upuprotection" -) - -type NausfConfig struct { - UriScheme string -} - -type Nausf struct { - cfg *NausfConfig - auth AuthHandler - sorProtection SorProtectionHandler - upuProtection UpuProtectionHandler -} - -func NewNausf(cfg *NausfConfig) *Nausf { - return &Nausf{ - cfg: cfg, - auth: nil, - sorProtection: nil, - upuProtection: nil, - } -} diff --git a/pkg/nausf/sorprotection.go b/pkg/nausf/sorprotection.go deleted file mode 100644 index 10b39a3..0000000 --- a/pkg/nausf/sorprotection.go +++ /dev/null @@ -1,10 +0,0 @@ -package nausf - -import ( - "context" - "github.com/5GCoreNet/5GCoreNetSDK/models/subscription" -) - -type SorProtectionHandler interface { - Sor(ctx context.Context, supi subscription.Supi) error -} diff --git a/pkg/nausf/upuprotection.go b/pkg/nausf/upuprotection.go deleted file mode 100644 index 5ff2351..0000000 --- a/pkg/nausf/upuprotection.go +++ /dev/null @@ -1,25 +0,0 @@ -package nausf - -import ( - "context" - "github.com/5GCoreNet/5GCoreNetSDK/models/common" - "github.com/5GCoreNet/5GCoreNetSDK/models/subscription" -) - -type UpuSecurityInfo struct { - UpuMacIausf string - counterUpu string -} - -type UpuData struct { - secPacket string - defaultConfNssai []string -} - -type UpuInfo struct { - UpuDataList []UpuData -} - -type UpuProtectionHandler interface { - GenerateUPUData(ctx context.Context, supi subscription.Supi, info UpuInfo) (UpuSecurityInfo, common.ProblemDetails) -} diff --git a/pkg/nnef/.KEEP b/pkg/nnef/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/nnrf/.KEEP b/pkg/nnrf/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/nnssf/.KEEP b/pkg/nnssf/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/npcf/.KEEP b/pkg/npcf/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/nsmf/.KEEP b/pkg/nsmf/.KEEP deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/nudm/.KEEP b/pkg/nudm/.KEEP deleted file mode 100644 index e69de29..0000000