From: Mohamed Abukar Date: Wed, 26 Feb 2020 14:46:34 +0000 (+0200) Subject: New API version with additional structures and params X-Git-Tag: v0.4.3^0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=429da19d53224135082f8b6f65470ae3ee8df176;p=ric-plt%2Fxapp-frame.git New API version with additional structures and params Change-Id: I02855719e75a9f8d9a0f56e762e56bdc143803ce Signed-off-by: Mohamed Abukar --- diff --git a/api/xapp_rest_api.yaml b/api/xapp_rest_api.yaml index f5a6f57..373fc7a 100755 --- a/api/xapp_rest_api.yaml +++ b/api/xapp_rest_api.yaml @@ -1,4 +1,4 @@ -swagger: '2.0' +swagger: "2.0" info: description: This is the initial REST API for RIC subscription version: 0.0.1 @@ -30,7 +30,7 @@ paths: post: tags: - "report" - summary: Subscribe a list of X2AP event triggers to receive "REPORT" messages sent by RAN + summary: Subscribe a list of X2AP event triggers to receive "REPORT" messages sent by RAN or Subscribe to receive the content of gNB NRT table in REPORT message sent by RAN operationId: subscribeReport consumes: - application/json @@ -46,32 +46,7 @@ paths: '201': description: Subscription successfully created schema: - $ref: '#/definitions/SubscriptionResult' - '400': - description: Invalid input - '500': - description: Internal error - /subscriptions/control: - post: - tags: - - "control" - summary: Subscribe and send "CONTROL" message to RAN to initiate or resume call processing in RAN - operationId: subscribeControl - consumes: - - application/json - produces: - - application/json - parameters: - - name: ControlParams - in: body - description: Subscription control parameters - schema: - $ref: '#/definitions/ControlParams' - responses: - '201': - description: Subscription successfully created - schema: - $ref: '#/definitions/SubscriptionResult' + $ref: '#/definitions/SubscriptionResponse' '400': description: Invalid input '500': @@ -96,7 +71,7 @@ paths: '201': description: Subscription successfully created schema: - $ref: '#/definitions/SubscriptionResult' + $ref: '#/definitions/SubscriptionResponse' '400': description: Invalid input '500': @@ -110,40 +85,42 @@ paths: parameters: - name: subscriptionId in: path - description: The subscriptionId to be unsubscribed + description: The subscriptionId received in the Subscription Response required: true - type: integer + type: string responses: '204': description: Operation done successfully '400': - description: Invalid requestorId supplied + description: Invalid subscriptionId supplied '500': description: Internal error definitions: SubscriptionType: type: string enum: - - control - insert - policy - report ReportParams: type: object required: - - RequestorId + - RANFunctionID + - ClientEndpoint - EventTriggers properties: - RequestorId: + Meid: + type: string + RANFunctionID: type: integer + ClientEndpoint: + type: string EventTriggers: $ref: '#/definitions/EventTriggerList' + ReportActionDefinitions: + $ref: '#/definitions/ReportActionDefinition' EventTrigger: type: object - required: - - InterfaceDirection - - ProcedureCode - - TypeOfMessage properties: InterfaceDirection: type: integer @@ -151,33 +128,137 @@ definitions: type: integer TypeOfMessage: type: integer + TriggerNature: + type: string + enum: + - now + - on change PlmnId: type: string ENBId: - type: integer + type: string EventTriggerList: type: array items: $ref: '#/definitions/EventTrigger' - SubscriptionResult: - type: array - description: A list of unique IDs - items: - type: integer - ControlParams: + ActionParameters: + type: object + required: + - ActionParameterID + - ActionParameterValue + properties: + ActionParameterID: + type: integer + ActionParameterValue: + type: boolean + Format1ActionDefinition: type: object + required: + - StyleID + - ActionParameters properties: - RequestorId: + StyleID: type: integer - TBD: - type: string + ActionParameters: + type: array + items: + $ref: '#/definitions/ActionParameters' + ReportActionDefinition: + type: object + properties: + ActionDefinitionFormat1: + $ref: '#/definitions/Format1ActionDefinition' PolicyParams: type: object + required: + - Meid + - RANFunctionID + - ClientEndpoint + - EventTriggers + - PolicyActionDefinitions properties: - RequestorId: + Meid: + type: string + RANFunctionID: + type: integer + ClientEndpoint: + type: string + EventTriggers: + $ref: '#/definitions/EventTriggerList' + PolicyActionDefinitions: + $ref: '#/definitions/PolicyActionDefinition' + PolicyActionDefinition: + type: object + properties: + ActionDefinitionFormat2: + $ref: '#/definitions/Format2ActionDefinition' + Format2ActionDefinition: + type: object + required: + - RANUeGroupParameters + properties: + RANUeGroupParameters: + type: array + items: + $ref: '#/definitions/RANUeGroupList' + RANUeGroupList: + type: object + required: + - RANUeGroupID + - RANUeGroupDefinition + - RANImperativePolicy + properties: + RANUeGroupID: + type: integer + RANUeGroupDefinition: + $ref: '#/definitions/RANUeGroupParams' + RANImperativePolicy: + $ref: '#/definitions/ImperativePolicyDefinition' + RANUeGroupParams: + type: object + required: + - RANParameterID + - RANParameterValue + properties: + RANParameterID: + type: integer + RANParameterTestCondition: + type: string + enum: + - equal + - greaterthan + - lessthan + - contains + - present + RANParameterValue: + type: integer + ImperativePolicyDefinition: + type: object + required: + - PolicyParameterID + - PolicyParameterValue + properties: + PolicyParameterID: + type: integer + PolicyParameterValue: type: integer - TBD: + SubscriptionResponseItem: + type: object + required: + - SubscriptionId + - RequestorId + - InstanceId + properties: + SubscriptionId: type: string + RequestorId: + type: integer + InstanceId: + type: integer + SubscriptionResponse: + type: array + items: + $ref: '#/definitions/SubscriptionResponseItem' SubscriptionData: type: object properties: diff --git a/pkg/clientapi/common/unsubscribe_parameters.go b/pkg/clientapi/common/unsubscribe_parameters.go index 5563ca5..6d32e7e 100644 --- a/pkg/clientapi/common/unsubscribe_parameters.go +++ b/pkg/clientapi/common/unsubscribe_parameters.go @@ -13,7 +13,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/swag" strfmt "github.com/go-openapi/strfmt" ) @@ -63,10 +62,10 @@ for the unsubscribe operation typically these are written to a http.Request type UnsubscribeParams struct { /*SubscriptionID - The subscriptionId to be unsubscribed + The subscriptionId received in the Subscription Response */ - SubscriptionID int64 + SubscriptionID string timeout time.Duration Context context.Context @@ -107,13 +106,13 @@ func (o *UnsubscribeParams) SetHTTPClient(client *http.Client) { } // WithSubscriptionID adds the subscriptionID to the unsubscribe params -func (o *UnsubscribeParams) WithSubscriptionID(subscriptionID int64) *UnsubscribeParams { +func (o *UnsubscribeParams) WithSubscriptionID(subscriptionID string) *UnsubscribeParams { o.SetSubscriptionID(subscriptionID) return o } // SetSubscriptionID adds the subscriptionId to the unsubscribe params -func (o *UnsubscribeParams) SetSubscriptionID(subscriptionID int64) { +func (o *UnsubscribeParams) SetSubscriptionID(subscriptionID string) { o.SubscriptionID = subscriptionID } @@ -126,7 +125,7 @@ func (o *UnsubscribeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R var res []error // path param subscriptionId - if err := r.SetPathParam("subscriptionId", swag.FormatInt64(o.SubscriptionID)); err != nil { + if err := r.SetPathParam("subscriptionId", o.SubscriptionID); err != nil { return err } diff --git a/pkg/clientapi/common/unsubscribe_responses.go b/pkg/clientapi/common/unsubscribe_responses.go index ed78aef..8d6b470 100644 --- a/pkg/clientapi/common/unsubscribe_responses.go +++ b/pkg/clientapi/common/unsubscribe_responses.go @@ -76,7 +76,7 @@ func NewUnsubscribeBadRequest() *UnsubscribeBadRequest { /*UnsubscribeBadRequest handles this case with default header values. -Invalid requestorId supplied +Invalid subscriptionId supplied */ type UnsubscribeBadRequest struct { } diff --git a/pkg/clientapi/control/control_client.go b/pkg/clientapi/control/control_client.go deleted file mode 100644 index 4c99b8c..0000000 --- a/pkg/clientapi/control/control_client.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" -) - -// New creates a new control API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { - return &Client{transport: transport, formats: formats} -} - -/* -Client for control API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -/* -SubscribeControl subscribes and send c o n t r o l message to r a n to initiate or resume call processing in r a n -*/ -func (a *Client) SubscribeControl(params *SubscribeControlParams) (*SubscribeControlCreated, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewSubscribeControlParams() - } - - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "subscribeControl", - Method: "POST", - PathPattern: "/subscriptions/control", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &SubscribeControlReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - }) - if err != nil { - return nil, err - } - return result.(*SubscribeControlCreated), nil - -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/pkg/clientapi/control/subscribe_control_parameters.go b/pkg/clientapi/control/subscribe_control_parameters.go deleted file mode 100644 index 81a5355..0000000 --- a/pkg/clientapi/control/subscribe_control_parameters.go +++ /dev/null @@ -1,139 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" - - clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel" -) - -// NewSubscribeControlParams creates a new SubscribeControlParams object -// with the default values initialized. -func NewSubscribeControlParams() *SubscribeControlParams { - var () - return &SubscribeControlParams{ - - timeout: cr.DefaultTimeout, - } -} - -// NewSubscribeControlParamsWithTimeout creates a new SubscribeControlParams object -// with the default values initialized, and the ability to set a timeout on a request -func NewSubscribeControlParamsWithTimeout(timeout time.Duration) *SubscribeControlParams { - var () - return &SubscribeControlParams{ - - timeout: timeout, - } -} - -// NewSubscribeControlParamsWithContext creates a new SubscribeControlParams object -// with the default values initialized, and the ability to set a context for a request -func NewSubscribeControlParamsWithContext(ctx context.Context) *SubscribeControlParams { - var () - return &SubscribeControlParams{ - - Context: ctx, - } -} - -// NewSubscribeControlParamsWithHTTPClient creates a new SubscribeControlParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewSubscribeControlParamsWithHTTPClient(client *http.Client) *SubscribeControlParams { - var () - return &SubscribeControlParams{ - HTTPClient: client, - } -} - -/*SubscribeControlParams contains all the parameters to send to the API endpoint -for the subscribe control operation typically these are written to a http.Request -*/ -type SubscribeControlParams struct { - - /*ControlParams - Subscription control parameters - - */ - ControlParams *clientmodel.ControlParams - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithTimeout adds the timeout to the subscribe control params -func (o *SubscribeControlParams) WithTimeout(timeout time.Duration) *SubscribeControlParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the subscribe control params -func (o *SubscribeControlParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the subscribe control params -func (o *SubscribeControlParams) WithContext(ctx context.Context) *SubscribeControlParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the subscribe control params -func (o *SubscribeControlParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the subscribe control params -func (o *SubscribeControlParams) WithHTTPClient(client *http.Client) *SubscribeControlParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the subscribe control params -func (o *SubscribeControlParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithControlParams adds the controlParams to the subscribe control params -func (o *SubscribeControlParams) WithControlParams(controlParams *clientmodel.ControlParams) *SubscribeControlParams { - o.SetControlParams(controlParams) - return o -} - -// SetControlParams adds the controlParams to the subscribe control params -func (o *SubscribeControlParams) SetControlParams(controlParams *clientmodel.ControlParams) { - o.ControlParams = controlParams -} - -// WriteToRequest writes these params to a swagger request -func (o *SubscribeControlParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.ControlParams != nil { - if err := r.SetBodyParam(o.ControlParams); err != nil { - return err - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/clientapi/control/subscribe_control_responses.go b/pkg/clientapi/control/subscribe_control_responses.go deleted file mode 100644 index 15d72e5..0000000 --- a/pkg/clientapi/control/subscribe_control_responses.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" - - clientmodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel" -) - -// SubscribeControlReader is a Reader for the SubscribeControl structure. -type SubscribeControlReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *SubscribeControlReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - - case 201: - result := NewSubscribeControlCreated() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - - case 400: - result := NewSubscribeControlBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - - case 500: - result := NewSubscribeControlInternalServerError() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) - } -} - -// NewSubscribeControlCreated creates a SubscribeControlCreated with default headers values -func NewSubscribeControlCreated() *SubscribeControlCreated { - return &SubscribeControlCreated{} -} - -/*SubscribeControlCreated handles this case with default header values. - -Subscription successfully created -*/ -type SubscribeControlCreated struct { - Payload clientmodel.SubscriptionResult -} - -func (o *SubscribeControlCreated) Error() string { - return fmt.Sprintf("[POST /subscriptions/control][%d] subscribeControlCreated %+v", 201, o.Payload) -} - -func (o *SubscribeControlCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewSubscribeControlBadRequest creates a SubscribeControlBadRequest with default headers values -func NewSubscribeControlBadRequest() *SubscribeControlBadRequest { - return &SubscribeControlBadRequest{} -} - -/*SubscribeControlBadRequest handles this case with default header values. - -Invalid input -*/ -type SubscribeControlBadRequest struct { -} - -func (o *SubscribeControlBadRequest) Error() string { - return fmt.Sprintf("[POST /subscriptions/control][%d] subscribeControlBadRequest ", 400) -} - -func (o *SubscribeControlBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} - -// NewSubscribeControlInternalServerError creates a SubscribeControlInternalServerError with default headers values -func NewSubscribeControlInternalServerError() *SubscribeControlInternalServerError { - return &SubscribeControlInternalServerError{} -} - -/*SubscribeControlInternalServerError handles this case with default header values. - -Internal error -*/ -type SubscribeControlInternalServerError struct { -} - -func (o *SubscribeControlInternalServerError) Error() string { - return fmt.Sprintf("[POST /subscriptions/control][%d] subscribeControlInternalServerError ", 500) -} - -func (o *SubscribeControlInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/pkg/clientapi/policy/subscribe_policy_responses.go b/pkg/clientapi/policy/subscribe_policy_responses.go index e817e10..e9f52da 100644 --- a/pkg/clientapi/policy/subscribe_policy_responses.go +++ b/pkg/clientapi/policy/subscribe_policy_responses.go @@ -61,7 +61,7 @@ func NewSubscribePolicyCreated() *SubscribePolicyCreated { Subscription successfully created */ type SubscribePolicyCreated struct { - Payload clientmodel.SubscriptionResult + Payload clientmodel.SubscriptionResponse } func (o *SubscribePolicyCreated) Error() string { diff --git a/pkg/clientapi/r_i_c_subscription_client.go b/pkg/clientapi/r_i_c_subscription_client.go index 7591e49..2acd8c0 100644 --- a/pkg/clientapi/r_i_c_subscription_client.go +++ b/pkg/clientapi/r_i_c_subscription_client.go @@ -12,7 +12,6 @@ import ( strfmt "github.com/go-openapi/strfmt" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/common" - "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/control" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/policy" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/query" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/report" @@ -63,8 +62,6 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *RICSubscri cli.Common = common.New(transport, formats) - cli.Control = control.New(transport, formats) - cli.Policy = policy.New(transport, formats) cli.Query = query.New(transport, formats) @@ -117,8 +114,6 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { type RICSubscription struct { Common *common.Client - Control *control.Client - Policy *policy.Client Query *query.Client @@ -134,8 +129,6 @@ func (c *RICSubscription) SetTransport(transport runtime.ClientTransport) { c.Common.SetTransport(transport) - c.Control.SetTransport(transport) - c.Policy.SetTransport(transport) c.Query.SetTransport(transport) diff --git a/pkg/clientapi/report/report_client.go b/pkg/clientapi/report/report_client.go index ac70452..2f30071 100644 --- a/pkg/clientapi/report/report_client.go +++ b/pkg/clientapi/report/report_client.go @@ -25,7 +25,7 @@ type Client struct { } /* -SubscribeReport subscribes a list of x2 a p event triggers to receive r e p o r t messages sent by r a n +SubscribeReport subscribes a list of x2 a p event triggers to receive r e p o r t messages sent by r a n or subscribe to receive the content of g n b n r t table in r e p o r t message sent by r a n */ func (a *Client) SubscribeReport(params *SubscribeReportParams) (*SubscribeReportCreated, error) { // TODO: Validate the params before sending diff --git a/pkg/clientapi/report/subscribe_report_responses.go b/pkg/clientapi/report/subscribe_report_responses.go index 2b842f3..f6dfefe 100644 --- a/pkg/clientapi/report/subscribe_report_responses.go +++ b/pkg/clientapi/report/subscribe_report_responses.go @@ -61,7 +61,7 @@ func NewSubscribeReportCreated() *SubscribeReportCreated { Subscription successfully created */ type SubscribeReportCreated struct { - Payload clientmodel.SubscriptionResult + Payload clientmodel.SubscriptionResponse } func (o *SubscribeReportCreated) Error() string { diff --git a/pkg/clientmodel/action_parameters.go b/pkg/clientmodel/action_parameters.go new file mode 100644 index 0000000..c73f60b --- /dev/null +++ b/pkg/clientmodel/action_parameters.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActionParameters action parameters +// swagger:model ActionParameters +type ActionParameters struct { + + // action parameter ID + // Required: true + ActionParameterID *int64 `json:"ActionParameterID"` + + // action parameter value + // Required: true + ActionParameterValue *bool `json:"ActionParameterValue"` +} + +// Validate validates this action parameters +func (m *ActionParameters) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionParameterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActionParameterValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActionParameters) validateActionParameterID(formats strfmt.Registry) error { + + if err := validate.Required("ActionParameterID", "body", m.ActionParameterID); err != nil { + return err + } + + return nil +} + +func (m *ActionParameters) validateActionParameterValue(formats strfmt.Registry) error { + + if err := validate.Required("ActionParameterValue", "body", m.ActionParameterValue); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActionParameters) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActionParameters) UnmarshalBinary(b []byte) error { + var res ActionParameters + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/control_params.go b/pkg/clientmodel/control_params.go deleted file mode 100644 index 73d9034..0000000 --- a/pkg/clientmodel/control_params.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package clientmodel - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/swag" -) - -// ControlParams control params -// swagger:model ControlParams -type ControlParams struct { - - // requestor Id - RequestorID int64 `json:"RequestorId,omitempty"` - - // t b d - TBD string `json:"TBD,omitempty"` -} - -// Validate validates this control params -func (m *ControlParams) Validate(formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ControlParams) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ControlParams) UnmarshalBinary(b []byte) error { - var res ControlParams - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/clientmodel/event_trigger.go b/pkg/clientmodel/event_trigger.go index e0a3206..02955ce 100644 --- a/pkg/clientmodel/event_trigger.go +++ b/pkg/clientmodel/event_trigger.go @@ -6,6 +6,8 @@ package clientmodel // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" + strfmt "github.com/go-openapi/strfmt" "github.com/go-openapi/errors" @@ -18,37 +20,30 @@ import ( type EventTrigger struct { // e n b Id - ENBID int64 `json:"ENBId,omitempty"` + ENBID string `json:"ENBId,omitempty"` // interface direction - // Required: true - InterfaceDirection *int64 `json:"InterfaceDirection"` + InterfaceDirection int64 `json:"InterfaceDirection,omitempty"` // plmn Id PlmnID string `json:"PlmnId,omitempty"` // procedure code - // Required: true - ProcedureCode *int64 `json:"ProcedureCode"` + ProcedureCode int64 `json:"ProcedureCode,omitempty"` + + // trigger nature + // Enum: [now on change] + TriggerNature string `json:"TriggerNature,omitempty"` // type of message - // Required: true - TypeOfMessage *int64 `json:"TypeOfMessage"` + TypeOfMessage int64 `json:"TypeOfMessage,omitempty"` } // Validate validates this event trigger func (m *EventTrigger) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateInterfaceDirection(formats); err != nil { - res = append(res, err) - } - - if err := m.validateProcedureCode(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTypeOfMessage(formats); err != nil { + if err := m.validateTriggerNature(formats); err != nil { res = append(res, err) } @@ -58,27 +53,43 @@ func (m *EventTrigger) Validate(formats strfmt.Registry) error { return nil } -func (m *EventTrigger) validateInterfaceDirection(formats strfmt.Registry) error { +var eventTriggerTypeTriggerNaturePropEnum []interface{} - if err := validate.Required("InterfaceDirection", "body", m.InterfaceDirection); err != nil { - return err +func init() { + var res []string + if err := json.Unmarshal([]byte(`["now","on change"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + eventTriggerTypeTriggerNaturePropEnum = append(eventTriggerTypeTriggerNaturePropEnum, v) } - - return nil } -func (m *EventTrigger) validateProcedureCode(formats strfmt.Registry) error { +const ( - if err := validate.Required("ProcedureCode", "body", m.ProcedureCode); err != nil { + // EventTriggerTriggerNatureNow captures enum value "now" + EventTriggerTriggerNatureNow string = "now" + + // EventTriggerTriggerNatureOnChange captures enum value "on change" + EventTriggerTriggerNatureOnChange string = "on change" +) + +// prop value enum +func (m *EventTrigger) validateTriggerNatureEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, eventTriggerTypeTriggerNaturePropEnum); err != nil { return err } - return nil } -func (m *EventTrigger) validateTypeOfMessage(formats strfmt.Registry) error { +func (m *EventTrigger) validateTriggerNature(formats strfmt.Registry) error { + + if swag.IsZero(m.TriggerNature) { // not required + return nil + } - if err := validate.Required("TypeOfMessage", "body", m.TypeOfMessage); err != nil { + // value enum + if err := m.validateTriggerNatureEnum("TriggerNature", "body", m.TriggerNature); err != nil { return err } diff --git a/pkg/clientmodel/format1_action_definition.go b/pkg/clientmodel/format1_action_definition.go new file mode 100644 index 0000000..f28039e --- /dev/null +++ b/pkg/clientmodel/format1_action_definition.go @@ -0,0 +1,99 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Format1ActionDefinition format1 action definition +// swagger:model Format1ActionDefinition +type Format1ActionDefinition struct { + + // action parameters + // Required: true + ActionParameters []*ActionParameters `json:"ActionParameters"` + + // style ID + // Required: true + StyleID *int64 `json:"StyleID"` +} + +// Validate validates this format1 action definition +func (m *Format1ActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionParameters(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStyleID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Format1ActionDefinition) validateActionParameters(formats strfmt.Registry) error { + + if err := validate.Required("ActionParameters", "body", m.ActionParameters); err != nil { + return err + } + + for i := 0; i < len(m.ActionParameters); i++ { + if swag.IsZero(m.ActionParameters[i]) { // not required + continue + } + + if m.ActionParameters[i] != nil { + if err := m.ActionParameters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ActionParameters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Format1ActionDefinition) validateStyleID(formats strfmt.Registry) error { + + if err := validate.Required("StyleID", "body", m.StyleID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Format1ActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Format1ActionDefinition) UnmarshalBinary(b []byte) error { + var res Format1ActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/format2_action_definition.go b/pkg/clientmodel/format2_action_definition.go new file mode 100644 index 0000000..075d07f --- /dev/null +++ b/pkg/clientmodel/format2_action_definition.go @@ -0,0 +1,82 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Format2ActionDefinition format2 action definition +// swagger:model Format2ActionDefinition +type Format2ActionDefinition struct { + + // r a n ue group parameters + // Required: true + RANUeGroupParameters []*RANUeGroupList `json:"RANUeGroupParameters"` +} + +// Validate validates this format2 action definition +func (m *Format2ActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRANUeGroupParameters(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Format2ActionDefinition) validateRANUeGroupParameters(formats strfmt.Registry) error { + + if err := validate.Required("RANUeGroupParameters", "body", m.RANUeGroupParameters); err != nil { + return err + } + + for i := 0; i < len(m.RANUeGroupParameters); i++ { + if swag.IsZero(m.RANUeGroupParameters[i]) { // not required + continue + } + + if m.RANUeGroupParameters[i] != nil { + if err := m.RANUeGroupParameters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("RANUeGroupParameters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Format2ActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Format2ActionDefinition) UnmarshalBinary(b []byte) error { + var res Format2ActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/imperative_policy_definition.go b/pkg/clientmodel/imperative_policy_definition.go new file mode 100644 index 0000000..3163bf9 --- /dev/null +++ b/pkg/clientmodel/imperative_policy_definition.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ImperativePolicyDefinition imperative policy definition +// swagger:model ImperativePolicyDefinition +type ImperativePolicyDefinition struct { + + // policy parameter ID + // Required: true + PolicyParameterID *int64 `json:"PolicyParameterID"` + + // policy parameter value + // Required: true + PolicyParameterValue *int64 `json:"PolicyParameterValue"` +} + +// Validate validates this imperative policy definition +func (m *ImperativePolicyDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePolicyParameterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolicyParameterValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ImperativePolicyDefinition) validatePolicyParameterID(formats strfmt.Registry) error { + + if err := validate.Required("PolicyParameterID", "body", m.PolicyParameterID); err != nil { + return err + } + + return nil +} + +func (m *ImperativePolicyDefinition) validatePolicyParameterValue(formats strfmt.Registry) error { + + if err := validate.Required("PolicyParameterValue", "body", m.PolicyParameterValue); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ImperativePolicyDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ImperativePolicyDefinition) UnmarshalBinary(b []byte) error { + var res ImperativePolicyDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/policy_action_definition.go b/pkg/clientmodel/policy_action_definition.go new file mode 100644 index 0000000..4190913 --- /dev/null +++ b/pkg/clientmodel/policy_action_definition.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// PolicyActionDefinition policy action definition +// swagger:model PolicyActionDefinition +type PolicyActionDefinition struct { + + // action definition format2 + ActionDefinitionFormat2 *Format2ActionDefinition `json:"ActionDefinitionFormat2,omitempty"` +} + +// Validate validates this policy action definition +func (m *PolicyActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionDefinitionFormat2(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyActionDefinition) validateActionDefinitionFormat2(formats strfmt.Registry) error { + + if swag.IsZero(m.ActionDefinitionFormat2) { // not required + return nil + } + + if m.ActionDefinitionFormat2 != nil { + if err := m.ActionDefinitionFormat2.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ActionDefinitionFormat2") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PolicyActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PolicyActionDefinition) UnmarshalBinary(b []byte) error { + var res PolicyActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/policy_params.go b/pkg/clientmodel/policy_params.go index 138681a..210fba7 100644 --- a/pkg/clientmodel/policy_params.go +++ b/pkg/clientmodel/policy_params.go @@ -8,22 +8,124 @@ package clientmodel import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/errors" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // PolicyParams policy params // swagger:model PolicyParams type PolicyParams struct { - // requestor Id - RequestorID int64 `json:"RequestorId,omitempty"` + // client endpoint + // Required: true + ClientEndpoint *string `json:"ClientEndpoint"` - // t b d - TBD string `json:"TBD,omitempty"` + // event triggers + // Required: true + EventTriggers EventTriggerList `json:"EventTriggers"` + + // meid + // Required: true + Meid *string `json:"Meid"` + + // policy action definitions + // Required: true + PolicyActionDefinitions *PolicyActionDefinition `json:"PolicyActionDefinitions"` + + // r a n function ID + // Required: true + RANFunctionID *int64 `json:"RANFunctionID"` } // Validate validates this policy params func (m *PolicyParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClientEndpoint(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEventTriggers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMeid(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolicyActionDefinitions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANFunctionID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyParams) validateClientEndpoint(formats strfmt.Registry) error { + + if err := validate.Required("ClientEndpoint", "body", m.ClientEndpoint); err != nil { + return err + } + + return nil +} + +func (m *PolicyParams) validateEventTriggers(formats strfmt.Registry) error { + + if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil { + return err + } + + if err := m.EventTriggers.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("EventTriggers") + } + return err + } + + return nil +} + +func (m *PolicyParams) validateMeid(formats strfmt.Registry) error { + + if err := validate.Required("Meid", "body", m.Meid); err != nil { + return err + } + + return nil +} + +func (m *PolicyParams) validatePolicyActionDefinitions(formats strfmt.Registry) error { + + if err := validate.Required("PolicyActionDefinitions", "body", m.PolicyActionDefinitions); err != nil { + return err + } + + if m.PolicyActionDefinitions != nil { + if err := m.PolicyActionDefinitions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("PolicyActionDefinitions") + } + return err + } + } + + return nil +} + +func (m *PolicyParams) validateRANFunctionID(formats strfmt.Registry) error { + + if err := validate.Required("RANFunctionID", "body", m.RANFunctionID); err != nil { + return err + } + return nil } diff --git a/pkg/clientmodel/r_a_n_ue_group_list.go b/pkg/clientmodel/r_a_n_ue_group_list.go new file mode 100644 index 0000000..d9d612f --- /dev/null +++ b/pkg/clientmodel/r_a_n_ue_group_list.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RANUeGroupList r a n ue group list +// swagger:model RANUeGroupList +type RANUeGroupList struct { + + // r a n imperative policy + // Required: true + RANImperativePolicy *ImperativePolicyDefinition `json:"RANImperativePolicy"` + + // r a n ue group definition + // Required: true + RANUeGroupDefinition *RANUeGroupParams `json:"RANUeGroupDefinition"` + + // r a n ue group ID + // Required: true + RANUeGroupID *int64 `json:"RANUeGroupID"` +} + +// Validate validates this r a n ue group list +func (m *RANUeGroupList) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRANImperativePolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANUeGroupDefinition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANUeGroupID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RANUeGroupList) validateRANImperativePolicy(formats strfmt.Registry) error { + + if err := validate.Required("RANImperativePolicy", "body", m.RANImperativePolicy); err != nil { + return err + } + + if m.RANImperativePolicy != nil { + if err := m.RANImperativePolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("RANImperativePolicy") + } + return err + } + } + + return nil +} + +func (m *RANUeGroupList) validateRANUeGroupDefinition(formats strfmt.Registry) error { + + if err := validate.Required("RANUeGroupDefinition", "body", m.RANUeGroupDefinition); err != nil { + return err + } + + if m.RANUeGroupDefinition != nil { + if err := m.RANUeGroupDefinition.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("RANUeGroupDefinition") + } + return err + } + } + + return nil +} + +func (m *RANUeGroupList) validateRANUeGroupID(formats strfmt.Registry) error { + + if err := validate.Required("RANUeGroupID", "body", m.RANUeGroupID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RANUeGroupList) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RANUeGroupList) UnmarshalBinary(b []byte) error { + var res RANUeGroupList + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/r_a_n_ue_group_params.go b/pkg/clientmodel/r_a_n_ue_group_params.go new file mode 100644 index 0000000..ba24f98 --- /dev/null +++ b/pkg/clientmodel/r_a_n_ue_group_params.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RANUeGroupParams r a n ue group params +// swagger:model RANUeGroupParams +type RANUeGroupParams struct { + + // r a n parameter ID + // Required: true + RANParameterID *int64 `json:"RANParameterID"` + + // r a n parameter test condition + // Enum: [equal greaterthan lessthan contains present] + RANParameterTestCondition string `json:"RANParameterTestCondition,omitempty"` + + // r a n parameter value + // Required: true + RANParameterValue *int64 `json:"RANParameterValue"` +} + +// Validate validates this r a n ue group params +func (m *RANUeGroupParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRANParameterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANParameterTestCondition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANParameterValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RANUeGroupParams) validateRANParameterID(formats strfmt.Registry) error { + + if err := validate.Required("RANParameterID", "body", m.RANParameterID); err != nil { + return err + } + + return nil +} + +var rANUeGroupParamsTypeRANParameterTestConditionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["equal","greaterthan","lessthan","contains","present"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + rANUeGroupParamsTypeRANParameterTestConditionPropEnum = append(rANUeGroupParamsTypeRANParameterTestConditionPropEnum, v) + } +} + +const ( + + // RANUeGroupParamsRANParameterTestConditionEqual captures enum value "equal" + RANUeGroupParamsRANParameterTestConditionEqual string = "equal" + + // RANUeGroupParamsRANParameterTestConditionGreaterthan captures enum value "greaterthan" + RANUeGroupParamsRANParameterTestConditionGreaterthan string = "greaterthan" + + // RANUeGroupParamsRANParameterTestConditionLessthan captures enum value "lessthan" + RANUeGroupParamsRANParameterTestConditionLessthan string = "lessthan" + + // RANUeGroupParamsRANParameterTestConditionContains captures enum value "contains" + RANUeGroupParamsRANParameterTestConditionContains string = "contains" + + // RANUeGroupParamsRANParameterTestConditionPresent captures enum value "present" + RANUeGroupParamsRANParameterTestConditionPresent string = "present" +) + +// prop value enum +func (m *RANUeGroupParams) validateRANParameterTestConditionEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, rANUeGroupParamsTypeRANParameterTestConditionPropEnum); err != nil { + return err + } + return nil +} + +func (m *RANUeGroupParams) validateRANParameterTestCondition(formats strfmt.Registry) error { + + if swag.IsZero(m.RANParameterTestCondition) { // not required + return nil + } + + // value enum + if err := m.validateRANParameterTestConditionEnum("RANParameterTestCondition", "body", m.RANParameterTestCondition); err != nil { + return err + } + + return nil +} + +func (m *RANUeGroupParams) validateRANParameterValue(formats strfmt.Registry) error { + + if err := validate.Required("RANParameterValue", "body", m.RANParameterValue); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RANUeGroupParams) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RANUeGroupParams) UnmarshalBinary(b []byte) error { + var res RANUeGroupParams + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/report_action_definition.go b/pkg/clientmodel/report_action_definition.go new file mode 100644 index 0000000..1657b44 --- /dev/null +++ b/pkg/clientmodel/report_action_definition.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// ReportActionDefinition report action definition +// swagger:model ReportActionDefinition +type ReportActionDefinition struct { + + // action definition format1 + ActionDefinitionFormat1 *Format1ActionDefinition `json:"ActionDefinitionFormat1,omitempty"` +} + +// Validate validates this report action definition +func (m *ReportActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionDefinitionFormat1(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReportActionDefinition) validateActionDefinitionFormat1(formats strfmt.Registry) error { + + if swag.IsZero(m.ActionDefinitionFormat1) { // not required + return nil + } + + if m.ActionDefinitionFormat1 != nil { + if err := m.ActionDefinitionFormat1.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ActionDefinitionFormat1") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReportActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReportActionDefinition) UnmarshalBinary(b []byte) error { + var res ReportActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/report_params.go b/pkg/clientmodel/report_params.go index 1be3bb1..151c2d0 100644 --- a/pkg/clientmodel/report_params.go +++ b/pkg/clientmodel/report_params.go @@ -17,24 +17,42 @@ import ( // swagger:model ReportParams type ReportParams struct { + // client endpoint + // Required: true + ClientEndpoint *string `json:"ClientEndpoint"` + // event triggers // Required: true EventTriggers EventTriggerList `json:"EventTriggers"` - // requestor Id + // meid + Meid string `json:"Meid,omitempty"` + + // r a n function ID // Required: true - RequestorID *int64 `json:"RequestorId"` + RANFunctionID *int64 `json:"RANFunctionID"` + + // report action definitions + ReportActionDefinitions *ReportActionDefinition `json:"ReportActionDefinitions,omitempty"` } // Validate validates this report params func (m *ReportParams) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateClientEndpoint(formats); err != nil { + res = append(res, err) + } + if err := m.validateEventTriggers(formats); err != nil { res = append(res, err) } - if err := m.validateRequestorID(formats); err != nil { + if err := m.validateRANFunctionID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReportActionDefinitions(formats); err != nil { res = append(res, err) } @@ -44,6 +62,15 @@ func (m *ReportParams) Validate(formats strfmt.Registry) error { return nil } +func (m *ReportParams) validateClientEndpoint(formats strfmt.Registry) error { + + if err := validate.Required("ClientEndpoint", "body", m.ClientEndpoint); err != nil { + return err + } + + return nil +} + func (m *ReportParams) validateEventTriggers(formats strfmt.Registry) error { if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil { @@ -60,15 +87,33 @@ func (m *ReportParams) validateEventTriggers(formats strfmt.Registry) error { return nil } -func (m *ReportParams) validateRequestorID(formats strfmt.Registry) error { +func (m *ReportParams) validateRANFunctionID(formats strfmt.Registry) error { - if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil { + if err := validate.Required("RANFunctionID", "body", m.RANFunctionID); err != nil { return err } return nil } +func (m *ReportParams) validateReportActionDefinitions(formats strfmt.Registry) error { + + if swag.IsZero(m.ReportActionDefinitions) { // not required + return nil + } + + if m.ReportActionDefinitions != nil { + if err := m.ReportActionDefinitions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ReportActionDefinitions") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ReportParams) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/pkg/clientmodel/subscription_response.go b/pkg/clientmodel/subscription_response.go new file mode 100644 index 0000000..58592c0 --- /dev/null +++ b/pkg/clientmodel/subscription_response.go @@ -0,0 +1,45 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// SubscriptionResponse subscription response +// swagger:model SubscriptionResponse +type SubscriptionResponse []*SubscriptionResponseItem + +// Validate validates this subscription response +func (m SubscriptionResponse) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/clientmodel/subscription_response_item.go b/pkg/clientmodel/subscription_response_item.go new file mode 100644 index 0000000..8237495 --- /dev/null +++ b/pkg/clientmodel/subscription_response_item.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package clientmodel + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SubscriptionResponseItem subscription response item +// swagger:model SubscriptionResponseItem +type SubscriptionResponseItem struct { + + // instance Id + // Required: true + InstanceID *int64 `json:"InstanceId"` + + // requestor Id + // Required: true + RequestorID *int64 `json:"RequestorId"` + + // subscription Id + // Required: true + SubscriptionID *string `json:"SubscriptionId"` +} + +// Validate validates this subscription response item +func (m *SubscriptionResponseItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRequestorID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubscriptionID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SubscriptionResponseItem) validateInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("InstanceId", "body", m.InstanceID); err != nil { + return err + } + + return nil +} + +func (m *SubscriptionResponseItem) validateRequestorID(formats strfmt.Registry) error { + + if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil { + return err + } + + return nil +} + +func (m *SubscriptionResponseItem) validateSubscriptionID(formats strfmt.Registry) error { + + if err := validate.Required("SubscriptionId", "body", m.SubscriptionID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SubscriptionResponseItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SubscriptionResponseItem) UnmarshalBinary(b []byte) error { + var res SubscriptionResponseItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/clientmodel/subscription_result.go b/pkg/clientmodel/subscription_result.go deleted file mode 100644 index dfeefa0..0000000 --- a/pkg/clientmodel/subscription_result.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package clientmodel - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" -) - -// SubscriptionResult A list of unique IDs -// swagger:model SubscriptionResult -type SubscriptionResult []int64 - -// Validate validates this subscription result -func (m SubscriptionResult) Validate(formats strfmt.Registry) error { - return nil -} diff --git a/pkg/clientmodel/subscription_type.go b/pkg/clientmodel/subscription_type.go index 6a2574c..eafbe57 100644 --- a/pkg/clientmodel/subscription_type.go +++ b/pkg/clientmodel/subscription_type.go @@ -20,9 +20,6 @@ type SubscriptionType string const ( - // SubscriptionTypeControl captures enum value "control" - SubscriptionTypeControl SubscriptionType = "control" - // SubscriptionTypeInsert captures enum value "insert" SubscriptionTypeInsert SubscriptionType = "insert" @@ -38,7 +35,7 @@ var subscriptionTypeEnum []interface{} func init() { var res []SubscriptionType - if err := json.Unmarshal([]byte(`["control","insert","policy","report"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["insert","policy","report"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/models/action_parameters.go b/pkg/models/action_parameters.go new file mode 100644 index 0000000..0173bd3 --- /dev/null +++ b/pkg/models/action_parameters.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ActionParameters action parameters +// swagger:model ActionParameters +type ActionParameters struct { + + // action parameter ID + // Required: true + ActionParameterID *int64 `json:"ActionParameterID"` + + // action parameter value + // Required: true + ActionParameterValue *bool `json:"ActionParameterValue"` +} + +// Validate validates this action parameters +func (m *ActionParameters) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionParameterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActionParameterValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ActionParameters) validateActionParameterID(formats strfmt.Registry) error { + + if err := validate.Required("ActionParameterID", "body", m.ActionParameterID); err != nil { + return err + } + + return nil +} + +func (m *ActionParameters) validateActionParameterValue(formats strfmt.Registry) error { + + if err := validate.Required("ActionParameterValue", "body", m.ActionParameterValue); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ActionParameters) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ActionParameters) UnmarshalBinary(b []byte) error { + var res ActionParameters + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/control_params.go b/pkg/models/control_params.go deleted file mode 100644 index 17ce7cf..0000000 --- a/pkg/models/control_params.go +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/swag" -) - -// ControlParams control params -// swagger:model ControlParams -type ControlParams struct { - - // requestor Id - RequestorID int64 `json:"RequestorId,omitempty"` - - // t b d - TBD string `json:"TBD,omitempty"` -} - -// Validate validates this control params -func (m *ControlParams) Validate(formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ControlParams) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ControlParams) UnmarshalBinary(b []byte) error { - var res ControlParams - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/models/event_trigger.go b/pkg/models/event_trigger.go index 2567fc4..43375c4 100644 --- a/pkg/models/event_trigger.go +++ b/pkg/models/event_trigger.go @@ -6,6 +6,8 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "encoding/json" + strfmt "github.com/go-openapi/strfmt" "github.com/go-openapi/errors" @@ -18,37 +20,30 @@ import ( type EventTrigger struct { // e n b Id - ENBID int64 `json:"ENBId,omitempty"` + ENBID string `json:"ENBId,omitempty"` // interface direction - // Required: true - InterfaceDirection *int64 `json:"InterfaceDirection"` + InterfaceDirection int64 `json:"InterfaceDirection,omitempty"` // plmn Id PlmnID string `json:"PlmnId,omitempty"` // procedure code - // Required: true - ProcedureCode *int64 `json:"ProcedureCode"` + ProcedureCode int64 `json:"ProcedureCode,omitempty"` + + // trigger nature + // Enum: [now on change] + TriggerNature string `json:"TriggerNature,omitempty"` // type of message - // Required: true - TypeOfMessage *int64 `json:"TypeOfMessage"` + TypeOfMessage int64 `json:"TypeOfMessage,omitempty"` } // Validate validates this event trigger func (m *EventTrigger) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateInterfaceDirection(formats); err != nil { - res = append(res, err) - } - - if err := m.validateProcedureCode(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTypeOfMessage(formats); err != nil { + if err := m.validateTriggerNature(formats); err != nil { res = append(res, err) } @@ -58,27 +53,43 @@ func (m *EventTrigger) Validate(formats strfmt.Registry) error { return nil } -func (m *EventTrigger) validateInterfaceDirection(formats strfmt.Registry) error { +var eventTriggerTypeTriggerNaturePropEnum []interface{} - if err := validate.Required("InterfaceDirection", "body", m.InterfaceDirection); err != nil { - return err +func init() { + var res []string + if err := json.Unmarshal([]byte(`["now","on change"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + eventTriggerTypeTriggerNaturePropEnum = append(eventTriggerTypeTriggerNaturePropEnum, v) } - - return nil } -func (m *EventTrigger) validateProcedureCode(formats strfmt.Registry) error { +const ( - if err := validate.Required("ProcedureCode", "body", m.ProcedureCode); err != nil { + // EventTriggerTriggerNatureNow captures enum value "now" + EventTriggerTriggerNatureNow string = "now" + + // EventTriggerTriggerNatureOnChange captures enum value "on change" + EventTriggerTriggerNatureOnChange string = "on change" +) + +// prop value enum +func (m *EventTrigger) validateTriggerNatureEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, eventTriggerTypeTriggerNaturePropEnum); err != nil { return err } - return nil } -func (m *EventTrigger) validateTypeOfMessage(formats strfmt.Registry) error { +func (m *EventTrigger) validateTriggerNature(formats strfmt.Registry) error { + + if swag.IsZero(m.TriggerNature) { // not required + return nil + } - if err := validate.Required("TypeOfMessage", "body", m.TypeOfMessage); err != nil { + // value enum + if err := m.validateTriggerNatureEnum("TriggerNature", "body", m.TriggerNature); err != nil { return err } diff --git a/pkg/models/format1_action_definition.go b/pkg/models/format1_action_definition.go new file mode 100644 index 0000000..9d568a1 --- /dev/null +++ b/pkg/models/format1_action_definition.go @@ -0,0 +1,99 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Format1ActionDefinition format1 action definition +// swagger:model Format1ActionDefinition +type Format1ActionDefinition struct { + + // action parameters + // Required: true + ActionParameters []*ActionParameters `json:"ActionParameters"` + + // style ID + // Required: true + StyleID *int64 `json:"StyleID"` +} + +// Validate validates this format1 action definition +func (m *Format1ActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionParameters(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStyleID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Format1ActionDefinition) validateActionParameters(formats strfmt.Registry) error { + + if err := validate.Required("ActionParameters", "body", m.ActionParameters); err != nil { + return err + } + + for i := 0; i < len(m.ActionParameters); i++ { + if swag.IsZero(m.ActionParameters[i]) { // not required + continue + } + + if m.ActionParameters[i] != nil { + if err := m.ActionParameters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ActionParameters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Format1ActionDefinition) validateStyleID(formats strfmt.Registry) error { + + if err := validate.Required("StyleID", "body", m.StyleID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Format1ActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Format1ActionDefinition) UnmarshalBinary(b []byte) error { + var res Format1ActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/format2_action_definition.go b/pkg/models/format2_action_definition.go new file mode 100644 index 0000000..351c7ae --- /dev/null +++ b/pkg/models/format2_action_definition.go @@ -0,0 +1,82 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Format2ActionDefinition format2 action definition +// swagger:model Format2ActionDefinition +type Format2ActionDefinition struct { + + // r a n ue group parameters + // Required: true + RANUeGroupParameters []*RANUeGroupList `json:"RANUeGroupParameters"` +} + +// Validate validates this format2 action definition +func (m *Format2ActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRANUeGroupParameters(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Format2ActionDefinition) validateRANUeGroupParameters(formats strfmt.Registry) error { + + if err := validate.Required("RANUeGroupParameters", "body", m.RANUeGroupParameters); err != nil { + return err + } + + for i := 0; i < len(m.RANUeGroupParameters); i++ { + if swag.IsZero(m.RANUeGroupParameters[i]) { // not required + continue + } + + if m.RANUeGroupParameters[i] != nil { + if err := m.RANUeGroupParameters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("RANUeGroupParameters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Format2ActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Format2ActionDefinition) UnmarshalBinary(b []byte) error { + var res Format2ActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/imperative_policy_definition.go b/pkg/models/imperative_policy_definition.go new file mode 100644 index 0000000..0b2a541 --- /dev/null +++ b/pkg/models/imperative_policy_definition.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ImperativePolicyDefinition imperative policy definition +// swagger:model ImperativePolicyDefinition +type ImperativePolicyDefinition struct { + + // policy parameter ID + // Required: true + PolicyParameterID *int64 `json:"PolicyParameterID"` + + // policy parameter value + // Required: true + PolicyParameterValue *int64 `json:"PolicyParameterValue"` +} + +// Validate validates this imperative policy definition +func (m *ImperativePolicyDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePolicyParameterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolicyParameterValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ImperativePolicyDefinition) validatePolicyParameterID(formats strfmt.Registry) error { + + if err := validate.Required("PolicyParameterID", "body", m.PolicyParameterID); err != nil { + return err + } + + return nil +} + +func (m *ImperativePolicyDefinition) validatePolicyParameterValue(formats strfmt.Registry) error { + + if err := validate.Required("PolicyParameterValue", "body", m.PolicyParameterValue); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ImperativePolicyDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ImperativePolicyDefinition) UnmarshalBinary(b []byte) error { + var res ImperativePolicyDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/policy_action_definition.go b/pkg/models/policy_action_definition.go new file mode 100644 index 0000000..841c868 --- /dev/null +++ b/pkg/models/policy_action_definition.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// PolicyActionDefinition policy action definition +// swagger:model PolicyActionDefinition +type PolicyActionDefinition struct { + + // action definition format2 + ActionDefinitionFormat2 *Format2ActionDefinition `json:"ActionDefinitionFormat2,omitempty"` +} + +// Validate validates this policy action definition +func (m *PolicyActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionDefinitionFormat2(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyActionDefinition) validateActionDefinitionFormat2(formats strfmt.Registry) error { + + if swag.IsZero(m.ActionDefinitionFormat2) { // not required + return nil + } + + if m.ActionDefinitionFormat2 != nil { + if err := m.ActionDefinitionFormat2.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ActionDefinitionFormat2") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PolicyActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PolicyActionDefinition) UnmarshalBinary(b []byte) error { + var res PolicyActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/policy_params.go b/pkg/models/policy_params.go index c8c7627..ab7b09d 100644 --- a/pkg/models/policy_params.go +++ b/pkg/models/policy_params.go @@ -8,22 +8,124 @@ package models import ( strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/errors" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // PolicyParams policy params // swagger:model PolicyParams type PolicyParams struct { - // requestor Id - RequestorID int64 `json:"RequestorId,omitempty"` + // client endpoint + // Required: true + ClientEndpoint *string `json:"ClientEndpoint"` - // t b d - TBD string `json:"TBD,omitempty"` + // event triggers + // Required: true + EventTriggers EventTriggerList `json:"EventTriggers"` + + // meid + // Required: true + Meid *string `json:"Meid"` + + // policy action definitions + // Required: true + PolicyActionDefinitions *PolicyActionDefinition `json:"PolicyActionDefinitions"` + + // r a n function ID + // Required: true + RANFunctionID *int64 `json:"RANFunctionID"` } // Validate validates this policy params func (m *PolicyParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClientEndpoint(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEventTriggers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMeid(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolicyActionDefinitions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANFunctionID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyParams) validateClientEndpoint(formats strfmt.Registry) error { + + if err := validate.Required("ClientEndpoint", "body", m.ClientEndpoint); err != nil { + return err + } + + return nil +} + +func (m *PolicyParams) validateEventTriggers(formats strfmt.Registry) error { + + if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil { + return err + } + + if err := m.EventTriggers.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("EventTriggers") + } + return err + } + + return nil +} + +func (m *PolicyParams) validateMeid(formats strfmt.Registry) error { + + if err := validate.Required("Meid", "body", m.Meid); err != nil { + return err + } + + return nil +} + +func (m *PolicyParams) validatePolicyActionDefinitions(formats strfmt.Registry) error { + + if err := validate.Required("PolicyActionDefinitions", "body", m.PolicyActionDefinitions); err != nil { + return err + } + + if m.PolicyActionDefinitions != nil { + if err := m.PolicyActionDefinitions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("PolicyActionDefinitions") + } + return err + } + } + + return nil +} + +func (m *PolicyParams) validateRANFunctionID(formats strfmt.Registry) error { + + if err := validate.Required("RANFunctionID", "body", m.RANFunctionID); err != nil { + return err + } + return nil } diff --git a/pkg/models/r_a_n_ue_group_list.go b/pkg/models/r_a_n_ue_group_list.go new file mode 100644 index 0000000..b0bbc14 --- /dev/null +++ b/pkg/models/r_a_n_ue_group_list.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RANUeGroupList r a n ue group list +// swagger:model RANUeGroupList +type RANUeGroupList struct { + + // r a n imperative policy + // Required: true + RANImperativePolicy *ImperativePolicyDefinition `json:"RANImperativePolicy"` + + // r a n ue group definition + // Required: true + RANUeGroupDefinition *RANUeGroupParams `json:"RANUeGroupDefinition"` + + // r a n ue group ID + // Required: true + RANUeGroupID *int64 `json:"RANUeGroupID"` +} + +// Validate validates this r a n ue group list +func (m *RANUeGroupList) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRANImperativePolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANUeGroupDefinition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANUeGroupID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RANUeGroupList) validateRANImperativePolicy(formats strfmt.Registry) error { + + if err := validate.Required("RANImperativePolicy", "body", m.RANImperativePolicy); err != nil { + return err + } + + if m.RANImperativePolicy != nil { + if err := m.RANImperativePolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("RANImperativePolicy") + } + return err + } + } + + return nil +} + +func (m *RANUeGroupList) validateRANUeGroupDefinition(formats strfmt.Registry) error { + + if err := validate.Required("RANUeGroupDefinition", "body", m.RANUeGroupDefinition); err != nil { + return err + } + + if m.RANUeGroupDefinition != nil { + if err := m.RANUeGroupDefinition.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("RANUeGroupDefinition") + } + return err + } + } + + return nil +} + +func (m *RANUeGroupList) validateRANUeGroupID(formats strfmt.Registry) error { + + if err := validate.Required("RANUeGroupID", "body", m.RANUeGroupID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RANUeGroupList) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RANUeGroupList) UnmarshalBinary(b []byte) error { + var res RANUeGroupList + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/r_a_n_ue_group_params.go b/pkg/models/r_a_n_ue_group_params.go new file mode 100644 index 0000000..411d6a3 --- /dev/null +++ b/pkg/models/r_a_n_ue_group_params.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RANUeGroupParams r a n ue group params +// swagger:model RANUeGroupParams +type RANUeGroupParams struct { + + // r a n parameter ID + // Required: true + RANParameterID *int64 `json:"RANParameterID"` + + // r a n parameter test condition + // Enum: [equal greaterthan lessthan contains present] + RANParameterTestCondition string `json:"RANParameterTestCondition,omitempty"` + + // r a n parameter value + // Required: true + RANParameterValue *int64 `json:"RANParameterValue"` +} + +// Validate validates this r a n ue group params +func (m *RANUeGroupParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRANParameterID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANParameterTestCondition(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRANParameterValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RANUeGroupParams) validateRANParameterID(formats strfmt.Registry) error { + + if err := validate.Required("RANParameterID", "body", m.RANParameterID); err != nil { + return err + } + + return nil +} + +var rANUeGroupParamsTypeRANParameterTestConditionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["equal","greaterthan","lessthan","contains","present"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + rANUeGroupParamsTypeRANParameterTestConditionPropEnum = append(rANUeGroupParamsTypeRANParameterTestConditionPropEnum, v) + } +} + +const ( + + // RANUeGroupParamsRANParameterTestConditionEqual captures enum value "equal" + RANUeGroupParamsRANParameterTestConditionEqual string = "equal" + + // RANUeGroupParamsRANParameterTestConditionGreaterthan captures enum value "greaterthan" + RANUeGroupParamsRANParameterTestConditionGreaterthan string = "greaterthan" + + // RANUeGroupParamsRANParameterTestConditionLessthan captures enum value "lessthan" + RANUeGroupParamsRANParameterTestConditionLessthan string = "lessthan" + + // RANUeGroupParamsRANParameterTestConditionContains captures enum value "contains" + RANUeGroupParamsRANParameterTestConditionContains string = "contains" + + // RANUeGroupParamsRANParameterTestConditionPresent captures enum value "present" + RANUeGroupParamsRANParameterTestConditionPresent string = "present" +) + +// prop value enum +func (m *RANUeGroupParams) validateRANParameterTestConditionEnum(path, location string, value string) error { + if err := validate.Enum(path, location, value, rANUeGroupParamsTypeRANParameterTestConditionPropEnum); err != nil { + return err + } + return nil +} + +func (m *RANUeGroupParams) validateRANParameterTestCondition(formats strfmt.Registry) error { + + if swag.IsZero(m.RANParameterTestCondition) { // not required + return nil + } + + // value enum + if err := m.validateRANParameterTestConditionEnum("RANParameterTestCondition", "body", m.RANParameterTestCondition); err != nil { + return err + } + + return nil +} + +func (m *RANUeGroupParams) validateRANParameterValue(formats strfmt.Registry) error { + + if err := validate.Required("RANParameterValue", "body", m.RANParameterValue); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RANUeGroupParams) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RANUeGroupParams) UnmarshalBinary(b []byte) error { + var res RANUeGroupParams + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/report_action_definition.go b/pkg/models/report_action_definition.go new file mode 100644 index 0000000..d578394 --- /dev/null +++ b/pkg/models/report_action_definition.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// ReportActionDefinition report action definition +// swagger:model ReportActionDefinition +type ReportActionDefinition struct { + + // action definition format1 + ActionDefinitionFormat1 *Format1ActionDefinition `json:"ActionDefinitionFormat1,omitempty"` +} + +// Validate validates this report action definition +func (m *ReportActionDefinition) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActionDefinitionFormat1(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ReportActionDefinition) validateActionDefinitionFormat1(formats strfmt.Registry) error { + + if swag.IsZero(m.ActionDefinitionFormat1) { // not required + return nil + } + + if m.ActionDefinitionFormat1 != nil { + if err := m.ActionDefinitionFormat1.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ActionDefinitionFormat1") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ReportActionDefinition) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ReportActionDefinition) UnmarshalBinary(b []byte) error { + var res ReportActionDefinition + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/report_params.go b/pkg/models/report_params.go index c4c12d3..b1d46b8 100644 --- a/pkg/models/report_params.go +++ b/pkg/models/report_params.go @@ -17,24 +17,42 @@ import ( // swagger:model ReportParams type ReportParams struct { + // client endpoint + // Required: true + ClientEndpoint *string `json:"ClientEndpoint"` + // event triggers // Required: true EventTriggers EventTriggerList `json:"EventTriggers"` - // requestor Id + // meid + Meid string `json:"Meid,omitempty"` + + // r a n function ID // Required: true - RequestorID *int64 `json:"RequestorId"` + RANFunctionID *int64 `json:"RANFunctionID"` + + // report action definitions + ReportActionDefinitions *ReportActionDefinition `json:"ReportActionDefinitions,omitempty"` } // Validate validates this report params func (m *ReportParams) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateClientEndpoint(formats); err != nil { + res = append(res, err) + } + if err := m.validateEventTriggers(formats); err != nil { res = append(res, err) } - if err := m.validateRequestorID(formats); err != nil { + if err := m.validateRANFunctionID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReportActionDefinitions(formats); err != nil { res = append(res, err) } @@ -44,6 +62,15 @@ func (m *ReportParams) Validate(formats strfmt.Registry) error { return nil } +func (m *ReportParams) validateClientEndpoint(formats strfmt.Registry) error { + + if err := validate.Required("ClientEndpoint", "body", m.ClientEndpoint); err != nil { + return err + } + + return nil +} + func (m *ReportParams) validateEventTriggers(formats strfmt.Registry) error { if err := validate.Required("EventTriggers", "body", m.EventTriggers); err != nil { @@ -60,15 +87,33 @@ func (m *ReportParams) validateEventTriggers(formats strfmt.Registry) error { return nil } -func (m *ReportParams) validateRequestorID(formats strfmt.Registry) error { +func (m *ReportParams) validateRANFunctionID(formats strfmt.Registry) error { - if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil { + if err := validate.Required("RANFunctionID", "body", m.RANFunctionID); err != nil { return err } return nil } +func (m *ReportParams) validateReportActionDefinitions(formats strfmt.Registry) error { + + if swag.IsZero(m.ReportActionDefinitions) { // not required + return nil + } + + if m.ReportActionDefinitions != nil { + if err := m.ReportActionDefinitions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ReportActionDefinitions") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ReportParams) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/pkg/models/subscription_response.go b/pkg/models/subscription_response.go new file mode 100644 index 0000000..8657177 --- /dev/null +++ b/pkg/models/subscription_response.go @@ -0,0 +1,45 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "strconv" + + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" +) + +// SubscriptionResponse subscription response +// swagger:model SubscriptionResponse +type SubscriptionResponse []*SubscriptionResponseItem + +// Validate validates this subscription response +func (m SubscriptionResponse) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/models/subscription_response_item.go b/pkg/models/subscription_response_item.go new file mode 100644 index 0000000..2bed019 --- /dev/null +++ b/pkg/models/subscription_response_item.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + strfmt "github.com/go-openapi/strfmt" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SubscriptionResponseItem subscription response item +// swagger:model SubscriptionResponseItem +type SubscriptionResponseItem struct { + + // instance Id + // Required: true + InstanceID *int64 `json:"InstanceId"` + + // requestor Id + // Required: true + RequestorID *int64 `json:"RequestorId"` + + // subscription Id + // Required: true + SubscriptionID *string `json:"SubscriptionId"` +} + +// Validate validates this subscription response item +func (m *SubscriptionResponseItem) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRequestorID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubscriptionID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SubscriptionResponseItem) validateInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("InstanceId", "body", m.InstanceID); err != nil { + return err + } + + return nil +} + +func (m *SubscriptionResponseItem) validateRequestorID(formats strfmt.Registry) error { + + if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil { + return err + } + + return nil +} + +func (m *SubscriptionResponseItem) validateSubscriptionID(formats strfmt.Registry) error { + + if err := validate.Required("SubscriptionId", "body", m.SubscriptionID); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SubscriptionResponseItem) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SubscriptionResponseItem) UnmarshalBinary(b []byte) error { + var res SubscriptionResponseItem + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/models/subscription_result.go b/pkg/models/subscription_result.go deleted file mode 100644 index d92eff6..0000000 --- a/pkg/models/subscription_result.go +++ /dev/null @@ -1,19 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" -) - -// SubscriptionResult A list of unique IDs -// swagger:model SubscriptionResult -type SubscriptionResult []int64 - -// Validate validates this subscription result -func (m SubscriptionResult) Validate(formats strfmt.Registry) error { - return nil -} diff --git a/pkg/models/subscription_type.go b/pkg/models/subscription_type.go index 8c6b7cf..c7dd86e 100644 --- a/pkg/models/subscription_type.go +++ b/pkg/models/subscription_type.go @@ -20,9 +20,6 @@ type SubscriptionType string const ( - // SubscriptionTypeControl captures enum value "control" - SubscriptionTypeControl SubscriptionType = "control" - // SubscriptionTypeInsert captures enum value "insert" SubscriptionTypeInsert SubscriptionType = "insert" @@ -38,7 +35,7 @@ var subscriptionTypeEnum []interface{} func init() { var res []SubscriptionType - if err := json.Unmarshal([]byte(`["control","insert","policy","report"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["insert","policy","report"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/restapi/configure_xapp_framework.go b/pkg/restapi/configure_xapp_framework.go index d497418..89e112d 100644 --- a/pkg/restapi/configure_xapp_framework.go +++ b/pkg/restapi/configure_xapp_framework.go @@ -12,8 +12,8 @@ import ( "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/common" - "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/control" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/policy" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/query" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report" ) @@ -42,9 +42,9 @@ func configureAPI(api *operations.XappFrameworkAPI) http.Handler { return middleware.NotImplemented("operation common.Unsubscribe has not yet been implemented") }) } - if api.ControlSubscribeControlHandler == nil { - api.ControlSubscribeControlHandler = control.SubscribeControlHandlerFunc(func(params control.SubscribeControlParams) middleware.Responder { - return middleware.NotImplemented("operation control.SubscribeControl has not yet been implemented") + if api.QueryGetAllSubscriptionsHandler == nil { + api.QueryGetAllSubscriptionsHandler = query.GetAllSubscriptionsHandlerFunc(func(params query.GetAllSubscriptionsParams) middleware.Responder { + return middleware.NotImplemented("operation query.GetAllSubscriptions has not yet been implemented") }) } if api.PolicySubscribePolicyHandler == nil { diff --git a/pkg/restapi/embedded_spec.go b/pkg/restapi/embedded_spec.go index a4b2585..79f7869 100644 --- a/pkg/restapi/embedded_spec.go +++ b/pkg/restapi/embedded_spec.go @@ -57,45 +57,6 @@ func init() { } } }, - "/subscriptions/control": { - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "control" - ], - "summary": "Subscribe and send \"CONTROL\" message to RAN to initiate or resume call processing in RAN", - "operationId": "subscribeControl", - "parameters": [ - { - "description": "Subscription control parameters", - "name": "ControlParams", - "in": "body", - "schema": { - "$ref": "#/definitions/ControlParams" - } - } - ], - "responses": { - "201": { - "description": "Subscription successfully created", - "schema": { - "$ref": "#/definitions/SubscriptionResult" - } - }, - "400": { - "description": "Invalid input" - }, - "500": { - "description": "Internal error" - } - } - } - }, "/subscriptions/policy": { "post": { "consumes": [ @@ -123,7 +84,7 @@ func init() { "201": { "description": "Subscription successfully created", "schema": { - "$ref": "#/definitions/SubscriptionResult" + "$ref": "#/definitions/SubscriptionResponse" } }, "400": { @@ -146,7 +107,7 @@ func init() { "tags": [ "report" ], - "summary": "Subscribe a list of X2AP event triggers to receive \"REPORT\" messages sent by RAN", + "summary": "Subscribe a list of X2AP event triggers to receive \"REPORT\" messages sent by RAN or Subscribe to receive the content of gNB NRT table in REPORT message sent by RAN", "operationId": "subscribeReport", "parameters": [ { @@ -162,7 +123,7 @@ func init() { "201": { "description": "Subscription successfully created", "schema": { - "$ref": "#/definitions/SubscriptionResult" + "$ref": "#/definitions/SubscriptionResponse" } }, "400": { @@ -183,8 +144,8 @@ func init() { "operationId": "Unsubscribe", "parameters": [ { - "type": "integer", - "description": "The subscriptionId to be unsubscribed", + "type": "string", + "description": "The subscriptionId received in the Subscription Response", "name": "subscriptionId", "in": "path", "required": true @@ -195,7 +156,7 @@ func init() { "description": "Operation done successfully" }, "400": { - "description": "Invalid requestorId supplied" + "description": "Invalid subscriptionId supplied" }, "500": { "description": "Internal error" @@ -205,27 +166,26 @@ func init() { } }, "definitions": { - "ControlParams": { + "ActionParameters": { "type": "object", + "required": [ + "ActionParameterID", + "ActionParameterValue" + ], "properties": { - "RequestorId": { + "ActionParameterID": { "type": "integer" }, - "TBD": { - "type": "string" + "ActionParameterValue": { + "type": "boolean" } } }, "EventTrigger": { "type": "object", - "required": [ - "InterfaceDirection", - "ProcedureCode", - "TypeOfMessage" - ], "properties": { "ENBId": { - "type": "integer" + "type": "string" }, "InterfaceDirection": { "type": "integer" @@ -236,6 +196,13 @@ func init() { "ProcedureCode": { "type": "integer" }, + "TriggerNature": { + "type": "string", + "enum": [ + "now", + "on change" + ] + }, "TypeOfMessage": { "type": "integer" } @@ -247,29 +214,162 @@ func init() { "$ref": "#/definitions/EventTrigger" } }, - "PolicyParams": { + "Format1ActionDefinition": { "type": "object", + "required": [ + "StyleID", + "ActionParameters" + ], "properties": { - "RequestorId": { + "ActionParameters": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionParameters" + } + }, + "StyleID": { + "type": "integer" + } + } + }, + "Format2ActionDefinition": { + "type": "object", + "required": [ + "RANUeGroupParameters" + ], + "properties": { + "RANUeGroupParameters": { + "type": "array", + "items": { + "$ref": "#/definitions/RANUeGroupList" + } + } + } + }, + "ImperativePolicyDefinition": { + "type": "object", + "required": [ + "PolicyParameterID", + "PolicyParameterValue" + ], + "properties": { + "PolicyParameterID": { + "type": "integer" + }, + "PolicyParameterValue": { "type": "integer" + } + } + }, + "PolicyActionDefinition": { + "type": "object", + "properties": { + "ActionDefinitionFormat2": { + "$ref": "#/definitions/Format2ActionDefinition" + } + } + }, + "PolicyParams": { + "type": "object", + "required": [ + "Meid", + "RANFunctionID", + "ClientEndpoint", + "EventTriggers", + "PolicyActionDefinitions" + ], + "properties": { + "ClientEndpoint": { + "type": "string" }, - "TBD": { + "EventTriggers": { + "$ref": "#/definitions/EventTriggerList" + }, + "Meid": { "type": "string" + }, + "PolicyActionDefinitions": { + "$ref": "#/definitions/PolicyActionDefinition" + }, + "RANFunctionID": { + "type": "integer" + } + } + }, + "RANUeGroupList": { + "type": "object", + "required": [ + "RANUeGroupID", + "RANUeGroupDefinition", + "RANImperativePolicy" + ], + "properties": { + "RANImperativePolicy": { + "$ref": "#/definitions/ImperativePolicyDefinition" + }, + "RANUeGroupDefinition": { + "$ref": "#/definitions/RANUeGroupParams" + }, + "RANUeGroupID": { + "type": "integer" + } + } + }, + "RANUeGroupParams": { + "type": "object", + "required": [ + "RANParameterID", + "RANParameterValue" + ], + "properties": { + "RANParameterID": { + "type": "integer" + }, + "RANParameterTestCondition": { + "type": "string", + "enum": [ + "equal", + "greaterthan", + "lessthan", + "contains", + "present" + ] + }, + "RANParameterValue": { + "type": "integer" + } + } + }, + "ReportActionDefinition": { + "type": "object", + "properties": { + "ActionDefinitionFormat1": { + "$ref": "#/definitions/Format1ActionDefinition" } } }, "ReportParams": { "type": "object", "required": [ - "RequestorId", + "RANFunctionID", + "ClientEndpoint", "EventTriggers" ], "properties": { + "ClientEndpoint": { + "type": "string" + }, "EventTriggers": { "$ref": "#/definitions/EventTriggerList" }, - "RequestorId": { + "Meid": { + "type": "string" + }, + "RANFunctionID": { "type": "integer" + }, + "ReportActionDefinitions": { + "$ref": "#/definitions/ReportActionDefinition" } } }, @@ -297,17 +397,34 @@ func init() { "$ref": "#/definitions/SubscriptionData" } }, - "SubscriptionResult": { - "description": "A list of unique IDs", + "SubscriptionResponse": { "type": "array", "items": { - "type": "integer" + "$ref": "#/definitions/SubscriptionResponseItem" + } + }, + "SubscriptionResponseItem": { + "type": "object", + "required": [ + "SubscriptionId", + "RequestorId", + "InstanceId" + ], + "properties": { + "InstanceId": { + "type": "integer" + }, + "RequestorId": { + "type": "integer" + }, + "SubscriptionId": { + "type": "string" + } } }, "SubscriptionType": { "type": "string", "enum": [ - "control", "insert", "policy", "report" @@ -355,45 +472,6 @@ func init() { } } }, - "/subscriptions/control": { - "post": { - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "control" - ], - "summary": "Subscribe and send \"CONTROL\" message to RAN to initiate or resume call processing in RAN", - "operationId": "subscribeControl", - "parameters": [ - { - "description": "Subscription control parameters", - "name": "ControlParams", - "in": "body", - "schema": { - "$ref": "#/definitions/ControlParams" - } - } - ], - "responses": { - "201": { - "description": "Subscription successfully created", - "schema": { - "$ref": "#/definitions/SubscriptionResult" - } - }, - "400": { - "description": "Invalid input" - }, - "500": { - "description": "Internal error" - } - } - } - }, "/subscriptions/policy": { "post": { "consumes": [ @@ -421,7 +499,7 @@ func init() { "201": { "description": "Subscription successfully created", "schema": { - "$ref": "#/definitions/SubscriptionResult" + "$ref": "#/definitions/SubscriptionResponse" } }, "400": { @@ -444,7 +522,7 @@ func init() { "tags": [ "report" ], - "summary": "Subscribe a list of X2AP event triggers to receive \"REPORT\" messages sent by RAN", + "summary": "Subscribe a list of X2AP event triggers to receive \"REPORT\" messages sent by RAN or Subscribe to receive the content of gNB NRT table in REPORT message sent by RAN", "operationId": "subscribeReport", "parameters": [ { @@ -460,7 +538,7 @@ func init() { "201": { "description": "Subscription successfully created", "schema": { - "$ref": "#/definitions/SubscriptionResult" + "$ref": "#/definitions/SubscriptionResponse" } }, "400": { @@ -481,8 +559,8 @@ func init() { "operationId": "Unsubscribe", "parameters": [ { - "type": "integer", - "description": "The subscriptionId to be unsubscribed", + "type": "string", + "description": "The subscriptionId received in the Subscription Response", "name": "subscriptionId", "in": "path", "required": true @@ -493,7 +571,7 @@ func init() { "description": "Operation done successfully" }, "400": { - "description": "Invalid requestorId supplied" + "description": "Invalid subscriptionId supplied" }, "500": { "description": "Internal error" @@ -503,27 +581,26 @@ func init() { } }, "definitions": { - "ControlParams": { + "ActionParameters": { "type": "object", + "required": [ + "ActionParameterID", + "ActionParameterValue" + ], "properties": { - "RequestorId": { + "ActionParameterID": { "type": "integer" }, - "TBD": { - "type": "string" + "ActionParameterValue": { + "type": "boolean" } } }, "EventTrigger": { "type": "object", - "required": [ - "InterfaceDirection", - "ProcedureCode", - "TypeOfMessage" - ], "properties": { "ENBId": { - "type": "integer" + "type": "string" }, "InterfaceDirection": { "type": "integer" @@ -534,6 +611,13 @@ func init() { "ProcedureCode": { "type": "integer" }, + "TriggerNature": { + "type": "string", + "enum": [ + "now", + "on change" + ] + }, "TypeOfMessage": { "type": "integer" } @@ -545,29 +629,162 @@ func init() { "$ref": "#/definitions/EventTrigger" } }, - "PolicyParams": { + "Format1ActionDefinition": { "type": "object", + "required": [ + "StyleID", + "ActionParameters" + ], "properties": { - "RequestorId": { + "ActionParameters": { + "type": "array", + "items": { + "$ref": "#/definitions/ActionParameters" + } + }, + "StyleID": { + "type": "integer" + } + } + }, + "Format2ActionDefinition": { + "type": "object", + "required": [ + "RANUeGroupParameters" + ], + "properties": { + "RANUeGroupParameters": { + "type": "array", + "items": { + "$ref": "#/definitions/RANUeGroupList" + } + } + } + }, + "ImperativePolicyDefinition": { + "type": "object", + "required": [ + "PolicyParameterID", + "PolicyParameterValue" + ], + "properties": { + "PolicyParameterID": { + "type": "integer" + }, + "PolicyParameterValue": { "type": "integer" + } + } + }, + "PolicyActionDefinition": { + "type": "object", + "properties": { + "ActionDefinitionFormat2": { + "$ref": "#/definitions/Format2ActionDefinition" + } + } + }, + "PolicyParams": { + "type": "object", + "required": [ + "Meid", + "RANFunctionID", + "ClientEndpoint", + "EventTriggers", + "PolicyActionDefinitions" + ], + "properties": { + "ClientEndpoint": { + "type": "string" }, - "TBD": { + "EventTriggers": { + "$ref": "#/definitions/EventTriggerList" + }, + "Meid": { "type": "string" + }, + "PolicyActionDefinitions": { + "$ref": "#/definitions/PolicyActionDefinition" + }, + "RANFunctionID": { + "type": "integer" + } + } + }, + "RANUeGroupList": { + "type": "object", + "required": [ + "RANUeGroupID", + "RANUeGroupDefinition", + "RANImperativePolicy" + ], + "properties": { + "RANImperativePolicy": { + "$ref": "#/definitions/ImperativePolicyDefinition" + }, + "RANUeGroupDefinition": { + "$ref": "#/definitions/RANUeGroupParams" + }, + "RANUeGroupID": { + "type": "integer" + } + } + }, + "RANUeGroupParams": { + "type": "object", + "required": [ + "RANParameterID", + "RANParameterValue" + ], + "properties": { + "RANParameterID": { + "type": "integer" + }, + "RANParameterTestCondition": { + "type": "string", + "enum": [ + "equal", + "greaterthan", + "lessthan", + "contains", + "present" + ] + }, + "RANParameterValue": { + "type": "integer" + } + } + }, + "ReportActionDefinition": { + "type": "object", + "properties": { + "ActionDefinitionFormat1": { + "$ref": "#/definitions/Format1ActionDefinition" } } }, "ReportParams": { "type": "object", "required": [ - "RequestorId", + "RANFunctionID", + "ClientEndpoint", "EventTriggers" ], "properties": { + "ClientEndpoint": { + "type": "string" + }, "EventTriggers": { "$ref": "#/definitions/EventTriggerList" }, - "RequestorId": { + "Meid": { + "type": "string" + }, + "RANFunctionID": { "type": "integer" + }, + "ReportActionDefinitions": { + "$ref": "#/definitions/ReportActionDefinition" } } }, @@ -595,17 +812,34 @@ func init() { "$ref": "#/definitions/SubscriptionData" } }, - "SubscriptionResult": { - "description": "A list of unique IDs", + "SubscriptionResponse": { "type": "array", "items": { - "type": "integer" + "$ref": "#/definitions/SubscriptionResponseItem" + } + }, + "SubscriptionResponseItem": { + "type": "object", + "required": [ + "SubscriptionId", + "RequestorId", + "InstanceId" + ], + "properties": { + "InstanceId": { + "type": "integer" + }, + "RequestorId": { + "type": "integer" + }, + "SubscriptionId": { + "type": "string" + } } }, "SubscriptionType": { "type": "string", "enum": [ - "control", "insert", "policy", "report" diff --git a/pkg/restapi/operations/common/unsubscribe_parameters.go b/pkg/restapi/operations/common/unsubscribe_parameters.go index 465b0ee..19f5111 100644 --- a/pkg/restapi/operations/common/unsubscribe_parameters.go +++ b/pkg/restapi/operations/common/unsubscribe_parameters.go @@ -10,7 +10,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" - "github.com/go-openapi/swag" strfmt "github.com/go-openapi/strfmt" ) @@ -31,11 +30,11 @@ type UnsubscribeParams struct { // HTTP Request Object HTTPRequest *http.Request `json:"-"` - /*The subscriptionId to be unsubscribed + /*The subscriptionId received in the Subscription Response Required: true In: path */ - SubscriptionID int64 + SubscriptionID string } // BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface @@ -68,11 +67,7 @@ func (o *UnsubscribeParams) bindSubscriptionID(rawData []string, hasKey bool, fo // Required: true // Parameter is provided by construction from the route - value, err := swag.ConvertInt64(raw) - if err != nil { - return errors.InvalidType("subscriptionId", "path", "int64", raw) - } - o.SubscriptionID = value + o.SubscriptionID = raw return nil } diff --git a/pkg/restapi/operations/common/unsubscribe_responses.go b/pkg/restapi/operations/common/unsubscribe_responses.go index ec8bd6b..1c7612c 100644 --- a/pkg/restapi/operations/common/unsubscribe_responses.go +++ b/pkg/restapi/operations/common/unsubscribe_responses.go @@ -38,7 +38,7 @@ func (o *UnsubscribeNoContent) WriteResponse(rw http.ResponseWriter, producer ru // UnsubscribeBadRequestCode is the HTTP code returned for type UnsubscribeBadRequest const UnsubscribeBadRequestCode int = 400 -/*UnsubscribeBadRequest Invalid requestorId supplied +/*UnsubscribeBadRequest Invalid subscriptionId supplied swagger:response unsubscribeBadRequest */ diff --git a/pkg/restapi/operations/common/unsubscribe_urlbuilder.go b/pkg/restapi/operations/common/unsubscribe_urlbuilder.go index 3f1710e..66c4ed8 100644 --- a/pkg/restapi/operations/common/unsubscribe_urlbuilder.go +++ b/pkg/restapi/operations/common/unsubscribe_urlbuilder.go @@ -10,13 +10,11 @@ import ( "net/url" golangswaggerpaths "path" "strings" - - "github.com/go-openapi/swag" ) // UnsubscribeURL generates an URL for the unsubscribe operation type UnsubscribeURL struct { - SubscriptionID int64 + SubscriptionID string _basePath string // avoid unkeyed usage @@ -44,7 +42,7 @@ func (o *UnsubscribeURL) Build() (*url.URL, error) { var _path = "/subscriptions/{subscriptionId}" - subscriptionID := swag.FormatInt64(o.SubscriptionID) + subscriptionID := o.SubscriptionID if subscriptionID != "" { _path = strings.Replace(_path, "{subscriptionId}", subscriptionID, -1) } else { diff --git a/pkg/restapi/operations/control/subscribe_control.go b/pkg/restapi/operations/control/subscribe_control.go deleted file mode 100644 index d35dbf2..0000000 --- a/pkg/restapi/operations/control/subscribe_control.go +++ /dev/null @@ -1,58 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "net/http" - - middleware "github.com/go-openapi/runtime/middleware" -) - -// SubscribeControlHandlerFunc turns a function with the right signature into a subscribe control handler -type SubscribeControlHandlerFunc func(SubscribeControlParams) middleware.Responder - -// Handle executing the request and returning a response -func (fn SubscribeControlHandlerFunc) Handle(params SubscribeControlParams) middleware.Responder { - return fn(params) -} - -// SubscribeControlHandler interface for that can handle valid subscribe control params -type SubscribeControlHandler interface { - Handle(SubscribeControlParams) middleware.Responder -} - -// NewSubscribeControl creates a new http.Handler for the subscribe control operation -func NewSubscribeControl(ctx *middleware.Context, handler SubscribeControlHandler) *SubscribeControl { - return &SubscribeControl{Context: ctx, Handler: handler} -} - -/*SubscribeControl swagger:route POST /subscriptions/control control subscribeControl - -Subscribe and send "CONTROL" message to RAN to initiate or resume call processing in RAN - -*/ -type SubscribeControl struct { - Context *middleware.Context - Handler SubscribeControlHandler -} - -func (o *SubscribeControl) ServeHTTP(rw http.ResponseWriter, r *http.Request) { - route, rCtx, _ := o.Context.RouteInfo(r) - if rCtx != nil { - r = rCtx - } - var Params = NewSubscribeControlParams() - - if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params - o.Context.Respond(rw, r, route.Produces, route, err) - return - } - - res := o.Handler.Handle(Params) // actually handle the request - - o.Context.Respond(rw, r, route.Produces, route, res) - -} diff --git a/pkg/restapi/operations/control/subscribe_control_parameters.go b/pkg/restapi/operations/control/subscribe_control_parameters.go deleted file mode 100644 index 79ebb27..0000000 --- a/pkg/restapi/operations/control/subscribe_control_parameters.go +++ /dev/null @@ -1,69 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/runtime/middleware" - - models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models" -) - -// NewSubscribeControlParams creates a new SubscribeControlParams object -// no default values defined in spec. -func NewSubscribeControlParams() SubscribeControlParams { - - return SubscribeControlParams{} -} - -// SubscribeControlParams contains all the bound params for the subscribe control operation -// typically these are obtained from a http.Request -// -// swagger:parameters subscribeControl -type SubscribeControlParams struct { - - // HTTP Request Object - HTTPRequest *http.Request `json:"-"` - - /*Subscription control parameters - In: body - */ - ControlParams *models.ControlParams -} - -// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface -// for simple values it will use straight method calls. -// -// To ensure default values, the struct must have been initialized with NewSubscribeControlParams() beforehand. -func (o *SubscribeControlParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error { - var res []error - - o.HTTPRequest = r - - if runtime.HasBody(r) { - defer r.Body.Close() - var body models.ControlParams - if err := route.Consumer.Consume(r.Body, &body); err != nil { - res = append(res, errors.NewParseError("controlParams", "body", "", err)) - } else { - // validate body object - if err := body.Validate(route.Formats); err != nil { - res = append(res, err) - } - - if len(res) == 0 { - o.ControlParams = &body - } - } - } - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/restapi/operations/control/subscribe_control_responses.go b/pkg/restapi/operations/control/subscribe_control_responses.go deleted file mode 100644 index 7a56f7f..0000000 --- a/pkg/restapi/operations/control/subscribe_control_responses.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "net/http" - - "github.com/go-openapi/runtime" - - models "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models" -) - -// SubscribeControlCreatedCode is the HTTP code returned for type SubscribeControlCreated -const SubscribeControlCreatedCode int = 201 - -/*SubscribeControlCreated Subscription successfully created - -swagger:response subscribeControlCreated -*/ -type SubscribeControlCreated struct { - - /* - In: Body - */ - Payload models.SubscriptionResult `json:"body,omitempty"` -} - -// NewSubscribeControlCreated creates SubscribeControlCreated with default headers values -func NewSubscribeControlCreated() *SubscribeControlCreated { - - return &SubscribeControlCreated{} -} - -// WithPayload adds the payload to the subscribe control created response -func (o *SubscribeControlCreated) WithPayload(payload models.SubscriptionResult) *SubscribeControlCreated { - o.Payload = payload - return o -} - -// SetPayload sets the payload to the subscribe control created response -func (o *SubscribeControlCreated) SetPayload(payload models.SubscriptionResult) { - o.Payload = payload -} - -// WriteResponse to the client -func (o *SubscribeControlCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.WriteHeader(201) - payload := o.Payload - if payload == nil { - // return empty array - payload = models.SubscriptionResult{} - } - - if err := producer.Produce(rw, payload); err != nil { - panic(err) // let the recovery middleware deal with this - } -} - -// SubscribeControlBadRequestCode is the HTTP code returned for type SubscribeControlBadRequest -const SubscribeControlBadRequestCode int = 400 - -/*SubscribeControlBadRequest Invalid input - -swagger:response subscribeControlBadRequest -*/ -type SubscribeControlBadRequest struct { -} - -// NewSubscribeControlBadRequest creates SubscribeControlBadRequest with default headers values -func NewSubscribeControlBadRequest() *SubscribeControlBadRequest { - - return &SubscribeControlBadRequest{} -} - -// WriteResponse to the client -func (o *SubscribeControlBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(400) -} - -// SubscribeControlInternalServerErrorCode is the HTTP code returned for type SubscribeControlInternalServerError -const SubscribeControlInternalServerErrorCode int = 500 - -/*SubscribeControlInternalServerError Internal error - -swagger:response subscribeControlInternalServerError -*/ -type SubscribeControlInternalServerError struct { -} - -// NewSubscribeControlInternalServerError creates SubscribeControlInternalServerError with default headers values -func NewSubscribeControlInternalServerError() *SubscribeControlInternalServerError { - - return &SubscribeControlInternalServerError{} -} - -// WriteResponse to the client -func (o *SubscribeControlInternalServerError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { - - rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses - - rw.WriteHeader(500) -} diff --git a/pkg/restapi/operations/control/subscribe_control_urlbuilder.go b/pkg/restapi/operations/control/subscribe_control_urlbuilder.go deleted file mode 100644 index 556a9f3..0000000 --- a/pkg/restapi/operations/control/subscribe_control_urlbuilder.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package control - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the generate command - -import ( - "errors" - "net/url" - golangswaggerpaths "path" -) - -// SubscribeControlURL generates an URL for the subscribe control operation -type SubscribeControlURL struct { - _basePath string -} - -// WithBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscribeControlURL) WithBasePath(bp string) *SubscribeControlURL { - o.SetBasePath(bp) - return o -} - -// SetBasePath sets the base path for this url builder, only required when it's different from the -// base path specified in the swagger spec. -// When the value of the base path is an empty string -func (o *SubscribeControlURL) SetBasePath(bp string) { - o._basePath = bp -} - -// Build a url path and query string -func (o *SubscribeControlURL) Build() (*url.URL, error) { - var _result url.URL - - var _path = "/subscriptions/control" - - _basePath := o._basePath - if _basePath == "" { - _basePath = "/ric/v1" - } - _result.Path = golangswaggerpaths.Join(_basePath, _path) - - return &_result, nil -} - -// Must is a helper function to panic when the url builder returns an error -func (o *SubscribeControlURL) Must(u *url.URL, err error) *url.URL { - if err != nil { - panic(err) - } - if u == nil { - panic("url can't be nil") - } - return u -} - -// String returns the string representation of the path with query string -func (o *SubscribeControlURL) String() string { - return o.Must(o.Build()).String() -} - -// BuildFull builds a full url with scheme, host, path and query string -func (o *SubscribeControlURL) BuildFull(scheme, host string) (*url.URL, error) { - if scheme == "" { - return nil, errors.New("scheme is required for a full url on SubscribeControlURL") - } - if host == "" { - return nil, errors.New("host is required for a full url on SubscribeControlURL") - } - - base, err := o.Build() - if err != nil { - return nil, err - } - - base.Scheme = scheme - base.Host = host - return base, nil -} - -// StringFull returns the string representation of a complete url -func (o *SubscribeControlURL) StringFull(scheme, host string) string { - return o.Must(o.BuildFull(scheme, host)).String() -} diff --git a/pkg/restapi/operations/policy/subscribe_policy_responses.go b/pkg/restapi/operations/policy/subscribe_policy_responses.go index 485674c..8092556 100644 --- a/pkg/restapi/operations/policy/subscribe_policy_responses.go +++ b/pkg/restapi/operations/policy/subscribe_policy_responses.go @@ -25,7 +25,7 @@ type SubscribePolicyCreated struct { /* In: Body */ - Payload models.SubscriptionResult `json:"body,omitempty"` + Payload models.SubscriptionResponse `json:"body,omitempty"` } // NewSubscribePolicyCreated creates SubscribePolicyCreated with default headers values @@ -35,13 +35,13 @@ func NewSubscribePolicyCreated() *SubscribePolicyCreated { } // WithPayload adds the payload to the subscribe policy created response -func (o *SubscribePolicyCreated) WithPayload(payload models.SubscriptionResult) *SubscribePolicyCreated { +func (o *SubscribePolicyCreated) WithPayload(payload models.SubscriptionResponse) *SubscribePolicyCreated { o.Payload = payload return o } // SetPayload sets the payload to the subscribe policy created response -func (o *SubscribePolicyCreated) SetPayload(payload models.SubscriptionResult) { +func (o *SubscribePolicyCreated) SetPayload(payload models.SubscriptionResponse) { o.Payload = payload } @@ -52,7 +52,7 @@ func (o *SubscribePolicyCreated) WriteResponse(rw http.ResponseWriter, producer payload := o.Payload if payload == nil { // return empty array - payload = models.SubscriptionResult{} + payload = models.SubscriptionResponse{} } if err := producer.Produce(rw, payload); err != nil { diff --git a/pkg/restapi/operations/report/subscribe_report.go b/pkg/restapi/operations/report/subscribe_report.go index 2ced7c7..d0ea85e 100644 --- a/pkg/restapi/operations/report/subscribe_report.go +++ b/pkg/restapi/operations/report/subscribe_report.go @@ -31,7 +31,7 @@ func NewSubscribeReport(ctx *middleware.Context, handler SubscribeReportHandler) /*SubscribeReport swagger:route POST /subscriptions/report report subscribeReport -Subscribe a list of X2AP event triggers to receive "REPORT" messages sent by RAN +Subscribe a list of X2AP event triggers to receive "REPORT" messages sent by RAN or Subscribe to receive the content of gNB NRT table in REPORT message sent by RAN */ type SubscribeReport struct { diff --git a/pkg/restapi/operations/report/subscribe_report_responses.go b/pkg/restapi/operations/report/subscribe_report_responses.go index d175d73..9402089 100644 --- a/pkg/restapi/operations/report/subscribe_report_responses.go +++ b/pkg/restapi/operations/report/subscribe_report_responses.go @@ -25,7 +25,7 @@ type SubscribeReportCreated struct { /* In: Body */ - Payload models.SubscriptionResult `json:"body,omitempty"` + Payload models.SubscriptionResponse `json:"body,omitempty"` } // NewSubscribeReportCreated creates SubscribeReportCreated with default headers values @@ -35,13 +35,13 @@ func NewSubscribeReportCreated() *SubscribeReportCreated { } // WithPayload adds the payload to the subscribe report created response -func (o *SubscribeReportCreated) WithPayload(payload models.SubscriptionResult) *SubscribeReportCreated { +func (o *SubscribeReportCreated) WithPayload(payload models.SubscriptionResponse) *SubscribeReportCreated { o.Payload = payload return o } // SetPayload sets the payload to the subscribe report created response -func (o *SubscribeReportCreated) SetPayload(payload models.SubscriptionResult) { +func (o *SubscribeReportCreated) SetPayload(payload models.SubscriptionResponse) { o.Payload = payload } @@ -52,7 +52,7 @@ func (o *SubscribeReportCreated) WriteResponse(rw http.ResponseWriter, producer payload := o.Payload if payload == nil { // return empty array - payload = models.SubscriptionResult{} + payload = models.SubscriptionResponse{} } if err := producer.Produce(rw, payload); err != nil { diff --git a/pkg/restapi/operations/xapp_framework_api.go b/pkg/restapi/operations/xapp_framework_api.go index 5c85580..10da039 100644 --- a/pkg/restapi/operations/xapp_framework_api.go +++ b/pkg/restapi/operations/xapp_framework_api.go @@ -20,7 +20,6 @@ import ( "github.com/go-openapi/swag" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/common" - "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/control" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/policy" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/query" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report" @@ -49,9 +48,6 @@ func NewXappFrameworkAPI(spec *loads.Document) *XappFrameworkAPI { QueryGetAllSubscriptionsHandler: query.GetAllSubscriptionsHandlerFunc(func(params query.GetAllSubscriptionsParams) middleware.Responder { return middleware.NotImplemented("operation QueryGetAllSubscriptions has not yet been implemented") }), - ControlSubscribeControlHandler: control.SubscribeControlHandlerFunc(func(params control.SubscribeControlParams) middleware.Responder { - return middleware.NotImplemented("operation ControlSubscribeControl has not yet been implemented") - }), PolicySubscribePolicyHandler: policy.SubscribePolicyHandlerFunc(func(params policy.SubscribePolicyParams) middleware.Responder { return middleware.NotImplemented("operation PolicySubscribePolicy has not yet been implemented") }), @@ -93,8 +89,6 @@ type XappFrameworkAPI struct { CommonUnsubscribeHandler common.UnsubscribeHandler // QueryGetAllSubscriptionsHandler sets the operation handler for the get all subscriptions operation QueryGetAllSubscriptionsHandler query.GetAllSubscriptionsHandler - // ControlSubscribeControlHandler sets the operation handler for the subscribe control operation - ControlSubscribeControlHandler control.SubscribeControlHandler // PolicySubscribePolicyHandler sets the operation handler for the subscribe policy operation PolicySubscribePolicyHandler policy.SubscribePolicyHandler // ReportSubscribeReportHandler sets the operation handler for the subscribe report operation @@ -170,10 +164,6 @@ func (o *XappFrameworkAPI) Validate() error { unregistered = append(unregistered, "query.GetAllSubscriptionsHandler") } - if o.ControlSubscribeControlHandler == nil { - unregistered = append(unregistered, "control.SubscribeControlHandler") - } - if o.PolicySubscribePolicyHandler == nil { unregistered = append(unregistered, "policy.SubscribePolicyHandler") } @@ -290,11 +280,6 @@ func (o *XappFrameworkAPI) initHandlerCache() { } o.handlers["GET"]["/subscriptions"] = query.NewGetAllSubscriptions(o.context, o.QueryGetAllSubscriptionsHandler) - if o.handlers["POST"] == nil { - o.handlers["POST"] = make(map[string]http.Handler) - } - o.handlers["POST"]["/subscriptions/control"] = control.NewSubscribeControl(o.context, o.ControlSubscribeControlHandler) - if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } diff --git a/pkg/restapi/server.go b/pkg/restapi/server.go index 23fda83..544be19 100644 --- a/pkg/restapi/server.go +++ b/pkg/restapi/server.go @@ -489,7 +489,7 @@ func (s *Server) TLSListener() (net.Listener, error) { func handleInterrupt(once *sync.Once, s *Server) { once.Do(func() { - for range s.interrupt { + for _ = range s.interrupt { if s.interrupted { s.Logf("Server already shutting down") continue diff --git a/pkg/xapp/subscription.go b/pkg/xapp/subscription.go index 2090123..ffc34fb 100755 --- a/pkg/xapp/subscription.go +++ b/pkg/xapp/subscription.go @@ -31,7 +31,7 @@ import ( "time" apiclient "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi" - apicontrol "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/control" + apicommon "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/common" apipolicy "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/policy" apireport "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientapi/report" apimodel "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/clientmodel" @@ -39,14 +39,15 @@ import ( "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/models" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations" - "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/control" + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/common" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/policy" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/query" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report" ) -type SubscriptionHandler func(models.SubscriptionType, interface{}) (models.SubscriptionResult, error) +type SubscriptionHandler func(models.SubscriptionType, interface{}) (models.SubscriptionResponse, error) type SubscriptionQueryHandler func() (models.SubscriptionList, error) +type SubscriptionDeleteHandler func(string) error type Subscriber struct { localAddr string @@ -77,7 +78,7 @@ func NewSubscriber(host string, timo int) *Subscriber { } // Server interface: listen and receive subscription requests -func (r *Subscriber) Listen(subHandler SubscriptionHandler, queryHandler SubscriptionQueryHandler) error { +func (r *Subscriber) Listen(add SubscriptionHandler, get SubscriptionQueryHandler, del SubscriptionDeleteHandler) error { swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON) if err != nil { return err @@ -88,7 +89,7 @@ func (r *Subscriber) Listen(subHandler SubscriptionHandler, queryHandler Subscri // Subscription: query api.QueryGetAllSubscriptionsHandler = query.GetAllSubscriptionsHandlerFunc( func(p query.GetAllSubscriptionsParams) middleware.Responder { - if resp, err := queryHandler(); err == nil { + if resp, err := get(); err == nil { return query.NewGetAllSubscriptionsOK().WithPayload(resp) } return query.NewGetAllSubscriptionsInternalServerError() @@ -97,30 +98,30 @@ func (r *Subscriber) Listen(subHandler SubscriptionHandler, queryHandler Subscri // SubscriptionType: Report api.ReportSubscribeReportHandler = report.SubscribeReportHandlerFunc( func(p report.SubscribeReportParams) middleware.Responder { - if resp, err := subHandler(models.SubscriptionTypeReport, p.ReportParams); err == nil { + if resp, err := add(models.SubscriptionTypeReport, p.ReportParams); err == nil { return report.NewSubscribeReportCreated().WithPayload(resp) } return report.NewSubscribeReportInternalServerError() }) - // SubscriptionType: Control - api.ControlSubscribeControlHandler = control.SubscribeControlHandlerFunc( - func(p control.SubscribeControlParams) middleware.Responder { - if resp, err := subHandler(models.SubscriptionTypeControl, p.ControlParams); err == nil { - return control.NewSubscribeControlCreated().WithPayload(resp) - } - return control.NewSubscribeControlInternalServerError() - }) - // SubscriptionType: policy api.PolicySubscribePolicyHandler = policy.SubscribePolicyHandlerFunc( func(p policy.SubscribePolicyParams) middleware.Responder { - if resp, err := subHandler(models.SubscriptionTypePolicy, p.PolicyParams); err == nil { + if resp, err := add(models.SubscriptionTypePolicy, p.PolicyParams); err == nil { return policy.NewSubscribePolicyCreated().WithPayload(resp) } return policy.NewSubscribePolicyInternalServerError() }) + // SubscriptionType: delete + api.CommonUnsubscribeHandler = common.UnsubscribeHandlerFunc( + func(p common.UnsubscribeParams) middleware.Responder { + if err := del(p.SubscriptionID); err == nil { + return common.NewUnsubscribeNoContent() + } + return common.NewUnsubscribeInternalServerError() + }) + server := restapi.NewServer(api) defer server.Shutdown() server.Host = r.localAddr @@ -134,38 +135,35 @@ func (r *Subscriber) Listen(subHandler SubscriptionHandler, queryHandler Subscri } // Subscription interface for xApp: REPORT -func (r *Subscriber) SubscribeReport(p *apimodel.ReportParams) (apimodel.SubscriptionResult, error) { +func (r *Subscriber) SubscribeReport(p *apimodel.ReportParams) (apimodel.SubscriptionResponse, error) { params := apireport.NewSubscribeReportParamsWithTimeout(r.timeout).WithReportParams(p) result, err := r.CreateTransport().Report.SubscribeReport(params) if err != nil { - return apimodel.SubscriptionResult{}, err - } - - return result.Payload, err -} - -// Subscription interface for xApp: CONTROL -func (r *Subscriber) SubscribeControl(p *apimodel.ControlParams) (apimodel.SubscriptionResult, error) { - params := apicontrol.NewSubscribeControlParamsWithTimeout(r.timeout).WithControlParams(p) - result, err := r.CreateTransport().Control.SubscribeControl(params) - if err != nil { - return apimodel.SubscriptionResult{}, err + return apimodel.SubscriptionResponse{}, err } return result.Payload, err } // Subscription interface for xApp: POLICY -func (r *Subscriber) SubscribePolicy(p *apimodel.PolicyParams) (apimodel.SubscriptionResult, error) { +func (r *Subscriber) SubscribePolicy(p *apimodel.PolicyParams) (apimodel.SubscriptionResponse, error) { params := apipolicy.NewSubscribePolicyParamsWithTimeout(r.timeout).WithPolicyParams(p) result, err := r.CreateTransport().Policy.SubscribePolicy(params) if err != nil { - return apimodel.SubscriptionResult{}, err + return apimodel.SubscriptionResponse{}, err } return result.Payload, err } +// Subscription interface for xApp: DELETE +func (r *Subscriber) UnSubscribe(subId string) error { + params := apicommon.NewUnsubscribeParamsWithTimeout(r.timeout).WithSubscriptionID(subId) + _, err := r.CreateTransport().Common.Unsubscribe(params) + + return err +} + // Subscription interface for xApp: QUERY func (r *Subscriber) QuerySubscriptions() (models.SubscriptionList, error) { resp, err := http.Get(fmt.Sprintf("http://%s/%s/subscriptions", r.remoteHost, r.remoteUrl)) diff --git a/pkg/xapp/subscription_test.go b/pkg/xapp/subscription_test.go index a685a81..2913246 100755 --- a/pkg/xapp/subscription_test.go +++ b/pkg/xapp/subscription_test.go @@ -16,47 +16,62 @@ import ( var suite *testing.T -var requestorId = int64(0x4EEC) +var meid = "gnb123456" +var funId = int64(1) +var clientEndpoint = "localhost:4561" var direction = int64(0) var procedureCode = int64(27) var typeOfMessage = int64(1) var reportParams = apimodel.ReportParams{ - RequestorID: &requestorId, + Meid: meid, + RANFunctionID: &funId, + ClientEndpoint: &clientEndpoint, EventTriggers: apimodel.EventTriggerList{ &apimodel.EventTrigger{ - InterfaceDirection: &direction, - ProcedureCode: &procedureCode, - TypeOfMessage: &typeOfMessage, + InterfaceDirection: direction, + ProcedureCode: procedureCode, + TypeOfMessage: typeOfMessage, }, }, } -var controlParams = apimodel.ControlParams{ - RequestorID: requestorId, -} - var policyParams = apimodel.PolicyParams{ - RequestorID: requestorId, + Meid: &meid, + RANFunctionID: &funId, + ClientEndpoint: &clientEndpoint, + EventTriggers: apimodel.EventTriggerList{ + &apimodel.EventTrigger{ + InterfaceDirection: direction, + ProcedureCode: procedureCode, + TypeOfMessage: typeOfMessage, + }, + }, + PolicyActionDefinitions: &apimodel.PolicyActionDefinition{}, } -func subscriptionHandler(stype models.SubscriptionType, params interface{}) (models.SubscriptionResult, error) { +func subscriptionHandler(stype models.SubscriptionType, params interface{}) (models.SubscriptionResponse, error) { switch stype { case models.SubscriptionTypeReport: p := params.(*models.ReportParams) - assert.Equal(suite, requestorId, *p.RequestorID) - assert.Equal(suite, direction, *p.EventTriggers[0].InterfaceDirection) - assert.Equal(suite, procedureCode, *p.EventTriggers[0].ProcedureCode) - assert.Equal(suite, typeOfMessage, *p.EventTriggers[0].TypeOfMessage) - case models.SubscriptionTypeControl: - p := params.(*models.ControlParams) - assert.Equal(suite, requestorId, p.RequestorID) + assert.Equal(suite, meid, p.Meid) + assert.Equal(suite, funId, *p.RANFunctionID) + assert.Equal(suite, clientEndpoint, *p.ClientEndpoint) + assert.Equal(suite, direction, p.EventTriggers[0].InterfaceDirection) + assert.Equal(suite, procedureCode, p.EventTriggers[0].ProcedureCode) + assert.Equal(suite, typeOfMessage, p.EventTriggers[0].TypeOfMessage) case models.SubscriptionTypePolicy: p := params.(*models.PolicyParams) - assert.Equal(suite, requestorId, p.RequestorID) + assert.Equal(suite, clientEndpoint, *p.ClientEndpoint) } - return models.SubscriptionResult{11, 22, 33}, nil + subId := "xapp-11" + reqId := int64(11) + instanceId := int64(22) + return models.SubscriptionResponse{ + &models.SubscriptionResponseItem{SubscriptionID: &subId, RequestorID: &reqId, InstanceID: &instanceId}, + &models.SubscriptionResponseItem{SubscriptionID: &subId, RequestorID: &reqId, InstanceID: &instanceId}, + }, nil } func queryHandler() (models.SubscriptionList, error) { @@ -71,11 +86,17 @@ func queryHandler() (models.SubscriptionList, error) { return resp, nil } +func deleteHandler(ep string) error { + assert.Equal(suite, clientEndpoint, ep) + + return nil +} + func TestSetup(t *testing.T) { suite = t // Start the server to simulate SubManager - go Subscription.Listen(subscriptionHandler, queryHandler) + go Subscription.Listen(subscriptionHandler, queryHandler, deleteHandler) time.Sleep(time.Duration(2) * time.Second) } @@ -92,24 +113,24 @@ func TestSubscriptionReportHandling(t *testing.T) { result, err := Subscription.SubscribeReport(&reportParams) assert.Equal(t, err, nil) - assert.Equal(t, len(result), 3) - assert.Equal(t, result[0], int64(11)) - assert.Equal(t, result[1], int64(22)) - assert.Equal(t, result[2], int64(33)) + assert.Equal(t, len(result), 2) + assert.Equal(t, *result[0].RequestorID, int64(11)) + assert.Equal(t, *result[0].InstanceID, int64(22)) + assert.Equal(t, *result[1].RequestorID, int64(11)) + assert.Equal(t, *result[1].InstanceID, int64(22)) } -func TestSubscriptionControltHandling(t *testing.T) { - result, err := Subscription.SubscribeControl(&controlParams) +func TestSubscriptionPolicytHandling(t *testing.T) { + result, err := Subscription.SubscribePolicy(&policyParams) assert.Equal(t, err, nil) - assert.Equal(t, len(result), 3) - assert.Equal(t, result[0], int64(11)) + assert.Equal(t, len(result), 2) + assert.Equal(t, *result[0].RequestorID, int64(11)) + assert.Equal(t, *result[0].InstanceID, int64(22)) } -func TestSubscriptionPolicytHandling(t *testing.T) { - result, err := Subscription.SubscribePolicy(&policyParams) +func TestSubscriptionDeleteHandling(t *testing.T) { + err := Subscription.UnSubscribe(clientEndpoint) assert.Equal(t, err, nil) - assert.Equal(t, len(result), 3) - assert.Equal(t, result[0], int64(11)) -} +} \ No newline at end of file