API update

Change-Id: I1ad0d7202227b01ff14d8433f27bead15d8c5a99
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
diff --git a/api/xapp_rest_api.yaml b/api/xapp_rest_api.yaml
index 373fc7a..efd5b8c 100755
--- a/api/xapp_rest_api.yaml
+++ b/api/xapp_rest_api.yaml
@@ -82,6 +82,10 @@
       - "common"
       summary: Unsubscribe X2AP events from Subscription Manager
       operationId: Unsubscribe
+      consumes:
+        - application/json
+      produces:
+        - application/json
       parameters:
         - name: subscriptionId
           in: path
@@ -242,23 +246,28 @@
         type: integer
       PolicyParameterValue:
         type: integer
-  SubscriptionResponseItem:
+  SubscriptionInstance:
     type: object
     required:
-      - SubscriptionId
       - RequestorId
       - InstanceId
     properties:
-      SubscriptionId:
-        type: string
       RequestorId:
         type: integer
       InstanceId:
         type: integer
   SubscriptionResponse:
-    type: array
-    items:
-      $ref: '#/definitions/SubscriptionResponseItem'
+    type: object
+    required:
+      - SubscriptionId
+      - SubscriptionInstances
+    properties:
+      SubscriptionId:
+        type: string
+      SubscriptionInstances:
+        type: array
+        items:
+          $ref: '#/definitions/SubscriptionInstance'
   SubscriptionData:
     type: object
     properties:
diff --git a/pkg/clientapi/common/common_client.go b/pkg/clientapi/common/common_client.go
index b88df18..8db6f11 100644
--- a/pkg/clientapi/common/common_client.go
+++ b/pkg/clientapi/common/common_client.go
@@ -37,8 +37,8 @@
 		ID:                 "Unsubscribe",
 		Method:             "DELETE",
 		PathPattern:        "/subscriptions/{subscriptionId}",
-		ProducesMediaTypes: []string{""},
-		ConsumesMediaTypes: []string{""},
+		ProducesMediaTypes: []string{"application/json"},
+		ConsumesMediaTypes: []string{"application/json"},
 		Schemes:            []string{"http"},
 		Params:             params,
 		Reader:             &UnsubscribeReader{formats: a.formats},
diff --git a/pkg/clientapi/policy/subscribe_policy_responses.go b/pkg/clientapi/policy/subscribe_policy_responses.go
index e9f52da..6241c82 100644
--- a/pkg/clientapi/policy/subscribe_policy_responses.go
+++ b/pkg/clientapi/policy/subscribe_policy_responses.go
@@ -61,7 +61,7 @@
 Subscription successfully created
 */
 type SubscribePolicyCreated struct {
-	Payload clientmodel.SubscriptionResponse
+	Payload *clientmodel.SubscriptionResponse
 }
 
 func (o *SubscribePolicyCreated) Error() string {
@@ -70,8 +70,10 @@
 
 func (o *SubscribePolicyCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
 
+	o.Payload = new(clientmodel.SubscriptionResponse)
+
 	// response payload
-	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
+	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
 		return err
 	}
 
diff --git a/pkg/clientapi/report/subscribe_report_responses.go b/pkg/clientapi/report/subscribe_report_responses.go
index f6dfefe..bace786 100644
--- a/pkg/clientapi/report/subscribe_report_responses.go
+++ b/pkg/clientapi/report/subscribe_report_responses.go
@@ -61,7 +61,7 @@
 Subscription successfully created
 */
 type SubscribeReportCreated struct {
-	Payload clientmodel.SubscriptionResponse
+	Payload *clientmodel.SubscriptionResponse
 }
 
 func (o *SubscribeReportCreated) Error() string {
@@ -70,8 +70,10 @@
 
 func (o *SubscribeReportCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
 
+	o.Payload = new(clientmodel.SubscriptionResponse)
+
 	// response payload
-	if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF {
+	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
 		return err
 	}
 
diff --git a/pkg/clientmodel/subscription_instance.go b/pkg/clientmodel/subscription_instance.go
new file mode 100644
index 0000000..4606479
--- /dev/null
+++ b/pkg/clientmodel/subscription_instance.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"
+)
+
+// SubscriptionInstance subscription instance
+// swagger:model SubscriptionInstance
+type SubscriptionInstance struct {
+
+	// instance Id
+	// Required: true
+	InstanceID *int64 `json:"InstanceId"`
+
+	// requestor Id
+	// Required: true
+	RequestorID *int64 `json:"RequestorId"`
+}
+
+// Validate validates this subscription instance
+func (m *SubscriptionInstance) 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 len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
+
+func (m *SubscriptionInstance) validateInstanceID(formats strfmt.Registry) error {
+
+	if err := validate.Required("InstanceId", "body", m.InstanceID); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *SubscriptionInstance) validateRequestorID(formats strfmt.Registry) error {
+
+	if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SubscriptionInstance) MarshalBinary() ([]byte, error) {
+	if m == nil {
+		return nil, nil
+	}
+	return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SubscriptionInstance) UnmarshalBinary(b []byte) error {
+	var res SubscriptionInstance
+	if err := swag.ReadJSON(b, &res); err != nil {
+		return err
+	}
+	*m = res
+	return nil
+}
diff --git a/pkg/clientmodel/subscription_response.go b/pkg/clientmodel/subscription_response.go
index 58592c0..2714b5b 100644
--- a/pkg/clientmodel/subscription_response.go
+++ b/pkg/clientmodel/subscription_response.go
@@ -12,25 +12,64 @@
 
 	"github.com/go-openapi/errors"
 	"github.com/go-openapi/swag"
+	"github.com/go-openapi/validate"
 )
 
 // SubscriptionResponse subscription response
 // swagger:model SubscriptionResponse
-type SubscriptionResponse []*SubscriptionResponseItem
+type SubscriptionResponse struct {
+
+	// subscription Id
+	// Required: true
+	SubscriptionID *string `json:"SubscriptionId"`
+
+	// subscription instances
+	// Required: true
+	SubscriptionInstances []*SubscriptionInstance `json:"SubscriptionInstances"`
+}
 
 // Validate validates this subscription response
-func (m SubscriptionResponse) Validate(formats strfmt.Registry) error {
+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
+	if err := m.validateSubscriptionID(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if err := m.validateSubscriptionInstances(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
+
+func (m *SubscriptionResponse) validateSubscriptionID(formats strfmt.Registry) error {
+
+	if err := validate.Required("SubscriptionId", "body", m.SubscriptionID); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *SubscriptionResponse) validateSubscriptionInstances(formats strfmt.Registry) error {
+
+	if err := validate.Required("SubscriptionInstances", "body", m.SubscriptionInstances); err != nil {
+		return err
+	}
+
+	for i := 0; i < len(m.SubscriptionInstances); i++ {
+		if swag.IsZero(m.SubscriptionInstances[i]) { // not required
 			continue
 		}
 
-		if m[i] != nil {
-			if err := m[i].Validate(formats); err != nil {
+		if m.SubscriptionInstances[i] != nil {
+			if err := m.SubscriptionInstances[i].Validate(formats); err != nil {
 				if ve, ok := err.(*errors.Validation); ok {
-					return ve.ValidateName(strconv.Itoa(i))
+					return ve.ValidateName("SubscriptionInstances" + "." + strconv.Itoa(i))
 				}
 				return err
 			}
@@ -38,8 +77,23 @@
 
 	}
 
-	if len(res) > 0 {
-		return errors.CompositeValidationError(res...)
+	return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SubscriptionResponse) MarshalBinary() ([]byte, error) {
+	if m == nil {
+		return nil, nil
 	}
+	return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SubscriptionResponse) UnmarshalBinary(b []byte) error {
+	var res SubscriptionResponse
+	if err := swag.ReadJSON(b, &res); err != nil {
+		return err
+	}
+	*m = res
 	return nil
 }
diff --git a/pkg/models/subscription_instance.go b/pkg/models/subscription_instance.go
new file mode 100644
index 0000000..d619166
--- /dev/null
+++ b/pkg/models/subscription_instance.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"
+)
+
+// SubscriptionInstance subscription instance
+// swagger:model SubscriptionInstance
+type SubscriptionInstance struct {
+
+	// instance Id
+	// Required: true
+	InstanceID *int64 `json:"InstanceId"`
+
+	// requestor Id
+	// Required: true
+	RequestorID *int64 `json:"RequestorId"`
+}
+
+// Validate validates this subscription instance
+func (m *SubscriptionInstance) 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 len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
+
+func (m *SubscriptionInstance) validateInstanceID(formats strfmt.Registry) error {
+
+	if err := validate.Required("InstanceId", "body", m.InstanceID); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *SubscriptionInstance) validateRequestorID(formats strfmt.Registry) error {
+
+	if err := validate.Required("RequestorId", "body", m.RequestorID); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SubscriptionInstance) MarshalBinary() ([]byte, error) {
+	if m == nil {
+		return nil, nil
+	}
+	return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SubscriptionInstance) UnmarshalBinary(b []byte) error {
+	var res SubscriptionInstance
+	if err := swag.ReadJSON(b, &res); err != nil {
+		return err
+	}
+	*m = res
+	return nil
+}
diff --git a/pkg/models/subscription_response.go b/pkg/models/subscription_response.go
index 8657177..c62b4f1 100644
--- a/pkg/models/subscription_response.go
+++ b/pkg/models/subscription_response.go
@@ -12,25 +12,64 @@
 
 	"github.com/go-openapi/errors"
 	"github.com/go-openapi/swag"
+	"github.com/go-openapi/validate"
 )
 
 // SubscriptionResponse subscription response
 // swagger:model SubscriptionResponse
-type SubscriptionResponse []*SubscriptionResponseItem
+type SubscriptionResponse struct {
+
+	// subscription Id
+	// Required: true
+	SubscriptionID *string `json:"SubscriptionId"`
+
+	// subscription instances
+	// Required: true
+	SubscriptionInstances []*SubscriptionInstance `json:"SubscriptionInstances"`
+}
 
 // Validate validates this subscription response
-func (m SubscriptionResponse) Validate(formats strfmt.Registry) error {
+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
+	if err := m.validateSubscriptionID(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if err := m.validateSubscriptionInstances(formats); err != nil {
+		res = append(res, err)
+	}
+
+	if len(res) > 0 {
+		return errors.CompositeValidationError(res...)
+	}
+	return nil
+}
+
+func (m *SubscriptionResponse) validateSubscriptionID(formats strfmt.Registry) error {
+
+	if err := validate.Required("SubscriptionId", "body", m.SubscriptionID); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (m *SubscriptionResponse) validateSubscriptionInstances(formats strfmt.Registry) error {
+
+	if err := validate.Required("SubscriptionInstances", "body", m.SubscriptionInstances); err != nil {
+		return err
+	}
+
+	for i := 0; i < len(m.SubscriptionInstances); i++ {
+		if swag.IsZero(m.SubscriptionInstances[i]) { // not required
 			continue
 		}
 
-		if m[i] != nil {
-			if err := m[i].Validate(formats); err != nil {
+		if m.SubscriptionInstances[i] != nil {
+			if err := m.SubscriptionInstances[i].Validate(formats); err != nil {
 				if ve, ok := err.(*errors.Validation); ok {
-					return ve.ValidateName(strconv.Itoa(i))
+					return ve.ValidateName("SubscriptionInstances" + "." + strconv.Itoa(i))
 				}
 				return err
 			}
@@ -38,8 +77,23 @@
 
 	}
 
-	if len(res) > 0 {
-		return errors.CompositeValidationError(res...)
+	return nil
+}
+
+// MarshalBinary interface implementation
+func (m *SubscriptionResponse) MarshalBinary() ([]byte, error) {
+	if m == nil {
+		return nil, nil
 	}
+	return swag.WriteJSON(m)
+}
+
+// UnmarshalBinary interface implementation
+func (m *SubscriptionResponse) UnmarshalBinary(b []byte) error {
+	var res SubscriptionResponse
+	if err := swag.ReadJSON(b, &res); err != nil {
+		return err
+	}
+	*m = res
 	return nil
 }
diff --git a/pkg/restapi/embedded_spec.go b/pkg/restapi/embedded_spec.go
index 79f7869..8cb57e1 100644
--- a/pkg/restapi/embedded_spec.go
+++ b/pkg/restapi/embedded_spec.go
@@ -137,6 +137,12 @@
     },
     "/subscriptions/{subscriptionId}": {
       "delete": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
         "tags": [
           "common"
         ],
@@ -390,23 +396,9 @@
         }
       }
     },
-    "SubscriptionList": {
-      "description": "A list of subscriptions",
-      "type": "array",
-      "items": {
-        "$ref": "#/definitions/SubscriptionData"
-      }
-    },
-    "SubscriptionResponse": {
-      "type": "array",
-      "items": {
-        "$ref": "#/definitions/SubscriptionResponseItem"
-      }
-    },
-    "SubscriptionResponseItem": {
+    "SubscriptionInstance": {
       "type": "object",
       "required": [
-        "SubscriptionId",
         "RequestorId",
         "InstanceId"
       ],
@@ -416,9 +408,31 @@
         },
         "RequestorId": {
           "type": "integer"
-        },
+        }
+      }
+    },
+    "SubscriptionList": {
+      "description": "A list of subscriptions",
+      "type": "array",
+      "items": {
+        "$ref": "#/definitions/SubscriptionData"
+      }
+    },
+    "SubscriptionResponse": {
+      "type": "object",
+      "required": [
+        "SubscriptionId",
+        "SubscriptionInstances"
+      ],
+      "properties": {
         "SubscriptionId": {
           "type": "string"
+        },
+        "SubscriptionInstances": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/SubscriptionInstance"
+          }
         }
       }
     },
@@ -552,6 +566,12 @@
     },
     "/subscriptions/{subscriptionId}": {
       "delete": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
         "tags": [
           "common"
         ],
@@ -805,23 +825,9 @@
         }
       }
     },
-    "SubscriptionList": {
-      "description": "A list of subscriptions",
-      "type": "array",
-      "items": {
-        "$ref": "#/definitions/SubscriptionData"
-      }
-    },
-    "SubscriptionResponse": {
-      "type": "array",
-      "items": {
-        "$ref": "#/definitions/SubscriptionResponseItem"
-      }
-    },
-    "SubscriptionResponseItem": {
+    "SubscriptionInstance": {
       "type": "object",
       "required": [
-        "SubscriptionId",
         "RequestorId",
         "InstanceId"
       ],
@@ -831,9 +837,31 @@
         },
         "RequestorId": {
           "type": "integer"
-        },
+        }
+      }
+    },
+    "SubscriptionList": {
+      "description": "A list of subscriptions",
+      "type": "array",
+      "items": {
+        "$ref": "#/definitions/SubscriptionData"
+      }
+    },
+    "SubscriptionResponse": {
+      "type": "object",
+      "required": [
+        "SubscriptionId",
+        "SubscriptionInstances"
+      ],
+      "properties": {
         "SubscriptionId": {
           "type": "string"
+        },
+        "SubscriptionInstances": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/SubscriptionInstance"
+          }
         }
       }
     },
diff --git a/pkg/restapi/operations/policy/subscribe_policy_responses.go b/pkg/restapi/operations/policy/subscribe_policy_responses.go
index 8092556..4a56d34 100644
--- a/pkg/restapi/operations/policy/subscribe_policy_responses.go
+++ b/pkg/restapi/operations/policy/subscribe_policy_responses.go
@@ -25,7 +25,7 @@
 	/*
 	  In: Body
 	*/
-	Payload models.SubscriptionResponse `json:"body,omitempty"`
+	Payload *models.SubscriptionResponse `json:"body,omitempty"`
 }
 
 // NewSubscribePolicyCreated creates SubscribePolicyCreated with default headers values
@@ -35,13 +35,13 @@
 }
 
 // WithPayload adds the payload to the subscribe policy created response
-func (o *SubscribePolicyCreated) WithPayload(payload models.SubscriptionResponse) *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.SubscriptionResponse) {
+func (o *SubscribePolicyCreated) SetPayload(payload *models.SubscriptionResponse) {
 	o.Payload = payload
 }
 
@@ -49,14 +49,11 @@
 func (o *SubscribePolicyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
 
 	rw.WriteHeader(201)
-	payload := o.Payload
-	if payload == nil {
-		// return empty array
-		payload = models.SubscriptionResponse{}
-	}
-
-	if err := producer.Produce(rw, payload); err != nil {
-		panic(err) // let the recovery middleware deal with this
+	if o.Payload != nil {
+		payload := o.Payload
+		if err := producer.Produce(rw, payload); err != nil {
+			panic(err) // let the recovery middleware deal with this
+		}
 	}
 }
 
diff --git a/pkg/restapi/operations/report/subscribe_report_responses.go b/pkg/restapi/operations/report/subscribe_report_responses.go
index 9402089..9e9d18d 100644
--- a/pkg/restapi/operations/report/subscribe_report_responses.go
+++ b/pkg/restapi/operations/report/subscribe_report_responses.go
@@ -25,7 +25,7 @@
 	/*
 	  In: Body
 	*/
-	Payload models.SubscriptionResponse `json:"body,omitempty"`
+	Payload *models.SubscriptionResponse `json:"body,omitempty"`
 }
 
 // NewSubscribeReportCreated creates SubscribeReportCreated with default headers values
@@ -35,13 +35,13 @@
 }
 
 // WithPayload adds the payload to the subscribe report created response
-func (o *SubscribeReportCreated) WithPayload(payload models.SubscriptionResponse) *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.SubscriptionResponse) {
+func (o *SubscribeReportCreated) SetPayload(payload *models.SubscriptionResponse) {
 	o.Payload = payload
 }
 
@@ -49,14 +49,11 @@
 func (o *SubscribeReportCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
 
 	rw.WriteHeader(201)
-	payload := o.Payload
-	if payload == nil {
-		// return empty array
-		payload = models.SubscriptionResponse{}
-	}
-
-	if err := producer.Produce(rw, payload); err != nil {
-		panic(err) // let the recovery middleware deal with this
+	if o.Payload != nil {
+		payload := o.Payload
+		if err := producer.Produce(rw, payload); err != nil {
+			panic(err) // let the recovery middleware deal with this
+		}
 	}
 }
 
diff --git a/pkg/xapp/subscription.go b/pkg/xapp/subscription.go
index ffc34fb..6ceabf9 100755
--- a/pkg/xapp/subscription.go
+++ b/pkg/xapp/subscription.go
@@ -45,7 +45,7 @@
 	"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/restapi/operations/report"
 )
 
-type SubscriptionHandler func(models.SubscriptionType, interface{}) (models.SubscriptionResponse, error)
+type SubscriptionHandler func(models.SubscriptionType, interface{}) (*models.SubscriptionResponse, error)
 type SubscriptionQueryHandler func() (models.SubscriptionList, error)
 type SubscriptionDeleteHandler func(string) error
 
@@ -135,22 +135,22 @@
 }
 
 // Subscription interface for xApp: REPORT
-func (r *Subscriber) SubscribeReport(p *apimodel.ReportParams) (apimodel.SubscriptionResponse, 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.SubscriptionResponse{}, err
+		return &apimodel.SubscriptionResponse{}, err
 	}
 
 	return result.Payload, err
 }
 
 // Subscription interface for xApp: POLICY
-func (r *Subscriber) SubscribePolicy(p *apimodel.PolicyParams) (apimodel.SubscriptionResponse, 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.SubscriptionResponse{}, err
+		return &apimodel.SubscriptionResponse{}, err
 	}
 
 	return result.Payload, err
diff --git a/pkg/xapp/subscription_test.go b/pkg/xapp/subscription_test.go
index 2913246..b9713af 100755
--- a/pkg/xapp/subscription_test.go
+++ b/pkg/xapp/subscription_test.go
@@ -50,7 +50,7 @@
 	PolicyActionDefinitions: &apimodel.PolicyActionDefinition{},
 }
 
-func subscriptionHandler(stype models.SubscriptionType, params interface{}) (models.SubscriptionResponse, error) {
+func subscriptionHandler(stype models.SubscriptionType, params interface{}) (*models.SubscriptionResponse, error) {
 	switch stype {
 	case models.SubscriptionTypeReport:
 		p := params.(*models.ReportParams)
@@ -68,9 +68,12 @@
 	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},
+	return &models.SubscriptionResponse{
+		SubscriptionID: &subId,
+		SubscriptionInstances: []*models.SubscriptionInstance{
+			&models.SubscriptionInstance{RequestorID: &reqId, InstanceID: &instanceId}, 
+			&models.SubscriptionInstance{RequestorID: &reqId, InstanceID: &instanceId},
+		},
 	}, nil
 }
 
@@ -110,23 +113,23 @@
 }
 
 func TestSubscriptionReportHandling(t *testing.T) {
-	result, err := Subscription.SubscribeReport(&reportParams)
+	resp, err := Subscription.SubscribeReport(&reportParams)
 
 	assert.Equal(t, err, nil)
-	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))
+	assert.Equal(t, len(resp.SubscriptionInstances), 2)
+	assert.Equal(t, *resp.SubscriptionInstances[0].RequestorID, int64(11))
+	assert.Equal(t, *resp.SubscriptionInstances[0].InstanceID, int64(22))
+	assert.Equal(t, *resp.SubscriptionInstances[1].RequestorID, int64(11))
+	assert.Equal(t, *resp.SubscriptionInstances[1].InstanceID, int64(22))
 }
 
 func TestSubscriptionPolicytHandling(t *testing.T) {
-	result, err := Subscription.SubscribePolicy(&policyParams)
+	resp, err := Subscription.SubscribePolicy(&policyParams)
 
 	assert.Equal(t, err, nil)
-	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, len(resp.SubscriptionInstances), 2)
+	assert.Equal(t, *resp.SubscriptionInstances[0].RequestorID, int64(11))
+	assert.Equal(t, *resp.SubscriptionInstances[0].InstanceID, int64(22))
 }
 
 func TestSubscriptionDeleteHandling(t *testing.T) {