Add interface to read metrics
[ric-plt/xapp-frame.git] / pkg / restapi / embedded_spec.go
index a4b2585..dd67843 100644 (file)
@@ -34,21 +34,22 @@ func init() {
   "host": "hostname",
   "basePath": "/ric/v1",
   "paths": {
-    "/subscriptions": {
+    "/config": {
       "get": {
         "produces": [
-          "application/json"
+          "application/json",
+          "application/xml"
         ],
         "tags": [
-          "query"
+          "xapp"
         ],
-        "summary": "Returns list of subscriptions",
-        "operationId": "getAllSubscriptions",
+        "summary": "Returns the configuration of all xapps",
+        "operationId": "getXappConfigList",
         "responses": {
           "200": {
-            "description": "successful query of subscriptions",
+            "description": "successful query of xApp config",
             "schema": {
-              "$ref": "#/definitions/SubscriptionList"
+              "$ref": "#/definitions/XappConfigList"
             }
           },
           "500": {
@@ -57,39 +58,23 @@ func init() {
         }
       }
     },
-    "/subscriptions/control": {
-      "post": {
-        "consumes": [
-          "application/json"
-        ],
+    "/subscriptions": {
+      "get": {
         "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"
-            }
-          }
+          "query"
         ],
+        "summary": "Returns list of subscriptions",
+        "operationId": "getAllSubscriptions",
         "responses": {
-          "201": {
-            "description": "Subscription successfully created",
+          "200": {
+            "description": "successful query of subscriptions",
             "schema": {
-              "$ref": "#/definitions/SubscriptionResult"
+              "$ref": "#/definitions/SubscriptionList"
             }
           },
-          "400": {
-            "description": "Invalid input"
-          },
           "500": {
             "description": "Internal error"
           }
@@ -123,7 +108,7 @@ func init() {
           "201": {
             "description": "Subscription successfully created",
             "schema": {
-              "$ref": "#/definitions/SubscriptionResult"
+              "$ref": "#/definitions/SubscriptionResponse"
             }
           },
           "400": {
@@ -146,7 +131,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 +147,7 @@ func init() {
           "201": {
             "description": "Subscription successfully created",
             "schema": {
-              "$ref": "#/definitions/SubscriptionResult"
+              "$ref": "#/definitions/SubscriptionResponse"
             }
           },
           "400": {
@@ -176,6 +161,12 @@ func init() {
     },
     "/subscriptions/{subscriptionId}": {
       "delete": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
         "tags": [
           "common"
         ],
@@ -183,8 +174,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 +186,7 @@ func init() {
             "description": "Operation done successfully"
           },
           "400": {
-            "description": "Invalid requestorId supplied"
+            "description": "Invalid subscriptionId supplied"
           },
           "500": {
             "description": "Internal error"
@@ -205,27 +196,48 @@ func init() {
     }
   },
   "definitions": {
-    "ControlParams": {
+    "ActionParameters": {
       "type": "object",
+      "required": [
+        "ActionParameterID",
+        "ActionParameterValue"
+      ],
       "properties": {
-        "RequestorId": {
+        "ActionParameterID": {
           "type": "integer"
         },
-        "TBD": {
-          "type": "string"
+        "ActionParameterValue": {
+          "type": "boolean"
         }
       }
     },
-    "EventTrigger": {
+    "ConfigMetadata": {
       "type": "object",
       "required": [
-        "InterfaceDirection",
-        "ProcedureCode",
-        "TypeOfMessage"
+        "xappName",
+        "configType"
       ],
+      "properties": {
+        "configType": {
+          "description": "The type of the content",
+          "type": "string",
+          "enum": [
+            "json",
+            "xml",
+            "other"
+          ]
+        },
+        "xappName": {
+          "description": "Name of the xApp",
+          "type": "string"
+        }
+      }
+    },
+    "EventTrigger": {
+      "type": "object",
       "properties": {
         "ENBId": {
-          "type": "integer"
+          "type": "string"
         },
         "InterfaceDirection": {
           "type": "integer"
@@ -236,6 +248,13 @@ func init() {
         "ProcedureCode": {
           "type": "integer"
         },
+        "TriggerNature": {
+          "type": "string",
+          "enum": [
+            "now",
+            "on change"
+          ]
+        },
         "TypeOfMessage": {
           "type": "integer"
         }
@@ -247,29 +266,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"
         },
-        "TBD": {
+        "PolicyParameterValue": {
+          "type": "integer"
+        }
+      }
+    },
+    "PolicyActionDefinition": {
+      "type": "object",
+      "properties": {
+        "ActionDefinitionFormat2": {
+          "$ref": "#/definitions/Format2ActionDefinition"
+        }
+      }
+    },
+    "PolicyParams": {
+      "type": "object",
+      "required": [
+        "Meid",
+        "RANFunctionID",
+        "ClientEndpoint",
+        "EventTriggers",
+        "PolicyActionDefinitions"
+      ],
+      "properties": {
+        "ClientEndpoint": {
+          "type": "string"
+        },
+        "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"
         }
       }
     },
@@ -290,6 +442,21 @@ func init() {
         }
       }
     },
+    "SubscriptionInstance": {
+      "type": "object",
+      "required": [
+        "RequestorId",
+        "InstanceId"
+      ],
+      "properties": {
+        "InstanceId": {
+          "type": "integer"
+        },
+        "RequestorId": {
+          "type": "integer"
+        }
+      }
+    },
     "SubscriptionList": {
       "description": "A list of subscriptions",
       "type": "array",
@@ -297,21 +464,53 @@ func init() {
         "$ref": "#/definitions/SubscriptionData"
       }
     },
-    "SubscriptionResult": {
-      "description": "A list of unique IDs",
-      "type": "array",
-      "items": {
-        "type": "integer"
+    "SubscriptionResponse": {
+      "type": "object",
+      "required": [
+        "SubscriptionId",
+        "SubscriptionInstances"
+      ],
+      "properties": {
+        "SubscriptionId": {
+          "type": "string"
+        },
+        "SubscriptionInstances": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/SubscriptionInstance"
+          }
+        }
       }
     },
     "SubscriptionType": {
       "type": "string",
       "enum": [
-        "control",
         "insert",
         "policy",
         "report"
       ]
+    },
+    "XAppConfig": {
+      "type": "object",
+      "required": [
+        "metadata",
+        "config"
+      ],
+      "properties": {
+        "config": {
+          "description": "Configuration in JSON format",
+          "type": "object"
+        },
+        "metadata": {
+          "$ref": "#/definitions/ConfigMetadata"
+        }
+      }
+    },
+    "XappConfigList": {
+      "type": "array",
+      "items": {
+        "$ref": "#/definitions/XAppConfig"
+      }
     }
   }
 }`))
@@ -332,21 +531,22 @@ func init() {
   "host": "hostname",
   "basePath": "/ric/v1",
   "paths": {
-    "/subscriptions": {
+    "/config": {
       "get": {
         "produces": [
-          "application/json"
+          "application/json",
+          "application/xml"
         ],
         "tags": [
-          "query"
+          "xapp"
         ],
-        "summary": "Returns list of subscriptions",
-        "operationId": "getAllSubscriptions",
+        "summary": "Returns the configuration of all xapps",
+        "operationId": "getXappConfigList",
         "responses": {
           "200": {
-            "description": "successful query of subscriptions",
+            "description": "successful query of xApp config",
             "schema": {
-              "$ref": "#/definitions/SubscriptionList"
+              "$ref": "#/definitions/XappConfigList"
             }
           },
           "500": {
@@ -355,39 +555,23 @@ func init() {
         }
       }
     },
-    "/subscriptions/control": {
-      "post": {
-        "consumes": [
-          "application/json"
-        ],
+    "/subscriptions": {
+      "get": {
         "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"
-            }
-          }
+          "query"
         ],
+        "summary": "Returns list of subscriptions",
+        "operationId": "getAllSubscriptions",
         "responses": {
-          "201": {
-            "description": "Subscription successfully created",
+          "200": {
+            "description": "successful query of subscriptions",
             "schema": {
-              "$ref": "#/definitions/SubscriptionResult"
+              "$ref": "#/definitions/SubscriptionList"
             }
           },
-          "400": {
-            "description": "Invalid input"
-          },
           "500": {
             "description": "Internal error"
           }
@@ -421,7 +605,7 @@ func init() {
           "201": {
             "description": "Subscription successfully created",
             "schema": {
-              "$ref": "#/definitions/SubscriptionResult"
+              "$ref": "#/definitions/SubscriptionResponse"
             }
           },
           "400": {
@@ -444,7 +628,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 +644,7 @@ func init() {
           "201": {
             "description": "Subscription successfully created",
             "schema": {
-              "$ref": "#/definitions/SubscriptionResult"
+              "$ref": "#/definitions/SubscriptionResponse"
             }
           },
           "400": {
@@ -474,6 +658,12 @@ func init() {
     },
     "/subscriptions/{subscriptionId}": {
       "delete": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
         "tags": [
           "common"
         ],
@@ -481,8 +671,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 +683,7 @@ func init() {
             "description": "Operation done successfully"
           },
           "400": {
-            "description": "Invalid requestorId supplied"
+            "description": "Invalid subscriptionId supplied"
           },
           "500": {
             "description": "Internal error"
@@ -503,27 +693,48 @@ func init() {
     }
   },
   "definitions": {
-    "ControlParams": {
+    "ActionParameters": {
       "type": "object",
+      "required": [
+        "ActionParameterID",
+        "ActionParameterValue"
+      ],
       "properties": {
-        "RequestorId": {
+        "ActionParameterID": {
           "type": "integer"
         },
-        "TBD": {
-          "type": "string"
+        "ActionParameterValue": {
+          "type": "boolean"
         }
       }
     },
-    "EventTrigger": {
+    "ConfigMetadata": {
       "type": "object",
       "required": [
-        "InterfaceDirection",
-        "ProcedureCode",
-        "TypeOfMessage"
+        "xappName",
+        "configType"
       ],
+      "properties": {
+        "configType": {
+          "description": "The type of the content",
+          "type": "string",
+          "enum": [
+            "json",
+            "xml",
+            "other"
+          ]
+        },
+        "xappName": {
+          "description": "Name of the xApp",
+          "type": "string"
+        }
+      }
+    },
+    "EventTrigger": {
+      "type": "object",
       "properties": {
         "ENBId": {
-          "type": "integer"
+          "type": "string"
         },
         "InterfaceDirection": {
           "type": "integer"
@@ -534,6 +745,13 @@ func init() {
         "ProcedureCode": {
           "type": "integer"
         },
+        "TriggerNature": {
+          "type": "string",
+          "enum": [
+            "now",
+            "on change"
+          ]
+        },
         "TypeOfMessage": {
           "type": "integer"
         }
@@ -545,29 +763,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"
         },
-        "TBD": {
+        "PolicyParameterValue": {
+          "type": "integer"
+        }
+      }
+    },
+    "PolicyActionDefinition": {
+      "type": "object",
+      "properties": {
+        "ActionDefinitionFormat2": {
+          "$ref": "#/definitions/Format2ActionDefinition"
+        }
+      }
+    },
+    "PolicyParams": {
+      "type": "object",
+      "required": [
+        "Meid",
+        "RANFunctionID",
+        "ClientEndpoint",
+        "EventTriggers",
+        "PolicyActionDefinitions"
+      ],
+      "properties": {
+        "ClientEndpoint": {
+          "type": "string"
+        },
+        "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"
         }
       }
     },
@@ -588,6 +939,21 @@ func init() {
         }
       }
     },
+    "SubscriptionInstance": {
+      "type": "object",
+      "required": [
+        "RequestorId",
+        "InstanceId"
+      ],
+      "properties": {
+        "InstanceId": {
+          "type": "integer"
+        },
+        "RequestorId": {
+          "type": "integer"
+        }
+      }
+    },
     "SubscriptionList": {
       "description": "A list of subscriptions",
       "type": "array",
@@ -595,21 +961,53 @@ func init() {
         "$ref": "#/definitions/SubscriptionData"
       }
     },
-    "SubscriptionResult": {
-      "description": "A list of unique IDs",
-      "type": "array",
-      "items": {
-        "type": "integer"
+    "SubscriptionResponse": {
+      "type": "object",
+      "required": [
+        "SubscriptionId",
+        "SubscriptionInstances"
+      ],
+      "properties": {
+        "SubscriptionId": {
+          "type": "string"
+        },
+        "SubscriptionInstances": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/SubscriptionInstance"
+          }
+        }
       }
     },
     "SubscriptionType": {
       "type": "string",
       "enum": [
-        "control",
         "insert",
         "policy",
         "report"
       ]
+    },
+    "XAppConfig": {
+      "type": "object",
+      "required": [
+        "metadata",
+        "config"
+      ],
+      "properties": {
+        "config": {
+          "description": "Configuration in JSON format",
+          "type": "object"
+        },
+        "metadata": {
+          "$ref": "#/definitions/ConfigMetadata"
+        }
+      }
+    },
+    "XappConfigList": {
+      "type": "array",
+      "items": {
+        "$ref": "#/definitions/XAppConfig"
+      }
     }
   }
 }`))