Merge "NONRTRIC-955: Fix unit test 404 issue"
[sim/a1-interface.git] / docs / simulator-api.rst
index bb23da3..f0a512a 100644 (file)
@@ -1,6 +1,6 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. SPDX-License-Identifier: CC-BY-4.0
-.. Copyright (C) 2020 Nordix
+.. Copyright (C) 2021 Nordix
 
 .. _simulator-api:
 
@@ -10,13 +10,9 @@ Simulator API
 
 This document describes the API used to manage policy types and manipulate the simulator.
 
-The simulator supports different versions of the A1 interface. Some functions are common for all version, and some are
+The simulator supports different versions of the A1 interface. Some functions are common for all versions, and some are
 specific for a certain version.
 
-.. contents:: Operations
-   :depth: 4
-   :local:
-
 Common Functions
 ================
 
@@ -31,29 +27,29 @@ The status of the simulator.
 GET
 +++
 
-  Returns the status of the simulator.
+Returns the status of the simulator.
 
-   **URL path:**
   /
+**URL path:**
+ /
 
-  **Parameters:**
+**Parameters:**
+  None.
 
-    None.
+**Responses:**
+  200:
+    OK
 
-  **Responses:**
+**Examples:**
 
-    200:
-      Simulator is living.
+**Call**: ::
 
-  **Examples:**
+  curl -X GET "http://localhost:8085/"
 
-    Call: ::
+**Result**:
 
-      curl -X GET "http://localhost:8085/"
+200: ::
 
-    Result:
-      200
-        Simulator is living (OSC_2.1.0 responds OK)
+  OK
 
 Supported Interfaces
 --------------------
@@ -66,34 +62,38 @@ The simulator can support different versions of the A1 interface. With this API
 GET
 +++
 
-  Returns the status of the simulator. (Not available for A1 Standard 1.1.3)
+Returns the status of the simulator. (Not available for A1 Standard 1.1.3)
+
+**URL path:**
+
+/container_interfaces
 
-   **URL path:**
-    /container_interfaces
+**Parameters:**
 
-  **Parameters:**
+None.
 
-    None.
+**Responses:**
 
-  **Responses:**
+200:
+    List of supported interfaces.
 
-    200:
-      List of supported interfaces.
+**Examples:**
 
-  **Examples:**
+**Call**: ::
 
-    Call: ::
+  curl -X GET "http://localhost:8085/container_interfaces"
 
-      curl -X GET "http://localhost:8085/container_interfaces"
 
-    Result:
-      200
-        1.1.x-alpha.2 OSC_2.1.0 STD_1.1.3
+**Result**:
+
+200: ::
+
+  Current interface: STD_2.0.0  All supported A1 interface yamls in this container: ['OSC_2.1.0', 'STD_1.1.3', 'STD_2.0.0']
 
 Counters
 --------
 
-The simulator keeps counts of different things that can be accessed.
+The simulator keeps count of different things that can be accessed.
 
 /counter
 ~~~~~~~~
@@ -101,39 +101,39 @@ The simulator keeps counts of different things that can be accessed.
 GET
 +++
 
-  Get a counter. Counter-name can be one of the following: 'num_instances', 'num_types' or 'interface'.
+Get a counter. Counter-name can be one of the following: 'num_instances', 'num_types', 'interface', 'remote_hosts' or 'datadelivery'.
 
-   **URL path:**
-    /counter/{counter-name}
+**URL path:**
 
-  **Parameters:**
+/counter/{counter-name}
 
-    None.
+**Parameters:**
 
-  **Responses:**
+None.
 
-    200:
-      The counter value for the given counter.
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+The counter value for the given counter.
 
-      curl -X GET "http://localhost:8085/counter/num_instances"
+**Examples:**
 
-    Result:
-      200
-        10
+**Call**: ::
 
-Version Specific Functions
-==========================
+  curl -X GET "http://localhost:8085/counter/num_instances"
 
-The methods available to control the simulator depends on the version of the A1 API the simulator is simulating.
+**Result**:
 
-OSC_2.1.0
----------
+200: ::
+
+  10
+
+
+Reset simulator
+---------------
 
-The available functions for the OSC_2.1.0 version of A1.
+There are two ways to reset the simulator, delete all instances or make a complete reset which resets the simulator to its original state.
 
 /deleteinstances
 ~~~~~~~~~~~~~~~~
@@ -141,29 +141,33 @@ The available functions for the OSC_2.1.0 version of A1.
 POST
 ++++
 
-  Delete all policy instances.
+Delete all policy instances.
 
-   **URL path:**
-    /deleteinstances
+**URL path:**
 
-  **Parameters:**
+/deleteinstances
+
+**Parameters:**
+
+None.
+
+**Responses:**
 
-    None.
+200:
 
-  **Responses:**
+All policy instances deleted.
 
-    200:
-      All policy instances deleted.
+**Examples:**
 
-  **Examples:**
+**Call**: ::
 
-    Call: ::
+  curl -X POST "http://localhost:8085/deleteinstances"
 
-      curl -X POST "http://localhost:8085/deleteinstances"
+**Result**:
 
-    Result:
-      200
-        All policy instances deleted.
+200: ::
+
+  All policy instances deleted.
 
 /deleteall
 ~~~~~~~~~~~~~~~~
@@ -171,693 +175,641 @@ POST
 POST
 ++++
 
-  Full reset.
+Full reset.
 
-   **URL path:**
-    /deleteall
+**URL path:**
 
-  **Parameters:**
+/deleteall
 
-    None.
+**Parameters:**
 
-  **Responses:**
+None.
 
-    200:
-      All policy instances and types deleted.
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+All policy instances and types deleted.
 
-      curl -X POST "http://localhost:8085/deleteall"
+**Examples:**
 
-    Result:
-      200
-        All policy instances and types deleted.
+**Call**: ::
 
-/policytype
-~~~~~~~~~~~
+  curl -X POST "http://localhost:8085/deleteall"
 
-PUT
-+++
+**Result**:
 
-  Create a policy type.
+200: ::
 
-   **URL path:**
-    /policytype?id=<policy-type-id>
+  All policy instances and types deleted.
 
-  **Parameters:**
+200  ::
+  All policy instances deleted  (Only for STD_1.1.3 since it has no types)
 
-    id: (*Required*)
-      The ID of the policy type.
+Response manipulation
+---------------------
+It is possible to manipulate the response of all operations on the A1 interface (admin interface is not affected)
 
-  **Body:** (*Required*)
-      A JSON object containing the schema for the type.
+/forceresponse
+~~~~~~~~~~~~~~
 
-  **Responses:**
+POST
+++++
 
-    200:
-      Policy type <policy-type-id> is OK.
+Force a specific response code for one (the next) A1 operation. After that response, the reponse code will go back to normal.
 
-    201:
-      Policy type <policy-type-id> is OK.
+**URL path:**
 
-  **Examples:**
+/forceresponse?code=<http-response-code>
 
-    Call: ::
+**Parameters:**
 
-      curl -X PUT "http://localhost:8085/policytype?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
-        -H  "Content-Type: application/json"
-        -d "
-          {
-            "$schema": "http://json-schema.org/draft-07/schema#",
-            "title": "STD_PolicyModelUnconstrained_0.2.0",
-            "description": "Standard model of a policy with unconstrained scope id combinations",
-            "type": "object",
-            "properties": {
-              "scope": {
-                "type": "object",
-                "properties": {
-                  "ueId": {"type": "string"},
-                  "groupId": {"type": "string"},
-                  "sliceId": {"type": "string"},
-                  "qosId": {"type": "string"},
-                  "cellId": {"type": "string"}
-                },
-                "minProperties": 1,
-                "additionalProperties": false
-              },
-              "qosObjectives": {
-                "type": "object",
-                "properties": {
-                  "gfbr": {"type": "number"},
-                  "mfbr": {"type": "number"},
-                  "priorityLevel": {"type": "number"},
-                  "pdb": {"type": "number"}
-                },
-                "additionalProperties": false
-              },
-              "qoeObjectives": {
-                "type": "object",
-                "properties": {
-                  "qoeScore": {"type": "number"},
-                  "initialBuffering": {"type": "number"},
-                  "reBuffFreq": {"type": "number"},
-                  "stallRatio": {"type": "number"}
-                },
-                "additionalProperties": false
-              },
-              "resources": {
-                "type": "array",
-                "items": {
-                  "type": "object",
-                  "properties": {
-                    "cellIdList": {
-                      "type": "array",
-                      "minItems": 1,
-                      "uniqueItems": true,
-                      "items": {
-                        "type": "string"
-                      }
-                    },
-                    "preference": {
-                      "type": "string",
-                      "enum": [
-                        "SHALL",
-                        "PREFER",
-                        "AVOID",
-                        "FORBID"
-                      ]
-                    },
-                    "primary": {"type": "boolean"}
-                  },
-                  "additionalProperties": false,
-                  "required": ["cellIdList", "preference"]
-                }
-              }
-            },
-            "minProperties": 2,
-            "additionalProperties": false,
-            "required": ["scope"]
-          }
-        "
+code: (*Required*)
 
-    Result:
-      201
-        Policy type STD_PolicyModelUnconstrained_0.2.0 is OK
+The HTTP response code to return.
 
-DELETE
-++++++
+**Responses:**
 
-  Delete a policy type.
+200:
 
-   **URL path:**
-    /policytype?id=<policy-type-id>
+Force response code:  <expected code> set for one single A1 response
 
-  **Parameters:**
+**Examples:**
 
-    id: (*Required*)
-      The ID of the policy type.
+**Call**: ::
 
-  **Responses:**
+  curl -X POST "http://localhost:8085/forceresponse?code=400"
 
-    204:
-      Policy type <policy-type-id> is OK.
+**Result**:
 
-  **Examples:**
+200: ::
 
-    Call: ::
+  Force response code:  400 set for one single A1 response
 
-     curl -X DELETE "http://localhost:8085/policytype?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
+/forcedelay
+~~~~~~~~~~~
 
-    Result:
-      204
-        Policy type STD_PolicyModelUnconstrained_0.2.0 is OK
+POST
+++++
 
-/policytypes
-~~~~~~~~~~~~
+Force delayed response of all A1 responses. The setting will remain until the delay is set to '0'
 
-GET
-+++
+**URL path:**
 
-  Get a list of policy types.
+/forcedelay?delay=<delay-time-seconds>
 
-   **URL path:**
-    /policytypes
+**Parameters:**
 
-  **Parameters:**
+delay: (*Required*)
 
-    None.
+The time in seconds to delay all responses.
 
-  **Responses:**
+**Responses:**
 
-    200:
-      A list of policy types.
+200:
 
-  **Examples:**
+Force delay: <expected delay> sec set for all A1 responses
 
-    Call: ::
+**Examples:**
 
-      curl -X GET "http://localhost:8085/policytypes"
+**Call**: ::
 
-    Result:
-      200
-        STD_PolicyModelUnconstrained_0.2.0
+  curl -X POST "http://localhost:8085/forcedelay?delay=2"
 
-/forceresponse
-~~~~~~~~~~~~~~
+**Result**:
+
+200: ::
+
+  Force delay: 2 sec set for all A1 responses
+
+
+Configure logging
+-----------------
+Detailed logging of the http headers and payload are activated by default. However, it is possible to turn this logging on or off.
+The 'off' state will only log ip, url and respose code.
+
+/payload_logging/
+~~~~~~~~~~~~~~~~~
 
 POST
 ++++
 
-  Force a specific response code for an A1 operation.
+Configure detailed logging on or off
+**URL path:**
 
-   **URL path:**
-    /forceresponse?responsecode=<http-response-code>
+/payload_logging/<state>
 
-  **Parameters:**
+**Parameters:**
 
-    responsecode: (*Required*)
-      The HTTP response code to return.
+state: (*Required*)
 
-  **Responses:**
+The state, 'on' or 'off'.
 
-    200:
-      Force response code:  <expected code> set for one single A1 response
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+Force delay: <expected delay> sec set for all A1 responses
 
-      curl -X POST "http://localhost:8085/forceresponse?responsecode=400"
+**Examples:**
 
-    Result:
-      200
-        Force response code:  400 set for one single A1 response
+**Call**: ::
 
-/forcedelay
-~~~~~~~~~~~
+  curl -X POST "http://localhost:8085/payload_logging/on"
 
-POST
-++++
+**Result**:
 
-  Force delayed response of all A1 operations.
+200: ::
 
-   **URL path:**
-    /forcedelay?delay=<delay-time-seconds>
+  Payload and header logging set to: on
 
-  **Parameters:**
 
-    delay: (*Required*)
-      The time in seconds to delay all responses.
+Version Specific Functions
+==========================
 
-  **Responses:**
+The methods available to control the simulator depends on the version of the A1 API the simulator is simulating.
 
-    200:
-      Force delay: <expected delay> sec set for all A1 responses
+OSC_2.1.0
+---------
 
-  **Examples:**
+This section describes the available administrative functions for the OSC_2.1.0 version of A1.
 
-    Call: ::
+To see the A1 functions for this version, see `OSC_2.1.0 API`_.
 
-      curl -X POST "http://localhost:8085/forcedelay?delay=2"
+.. _OSC_2.1.0 API: https://gerrit.o-ran-sc.org/r/gitweb?p=sim/a1-interface.git;a=blob;f=near-rt-ric-simulator/api/OSC_2.1.0/openapi.yaml
 
-    Result:
-      200
-        Force delay: 2 sec set for all A1 responses
 
-/status
-~~~~~~~
+
+/policytype
+~~~~~~~~~~~
 
 PUT
 +++
 
-  Set status and optional reason, delete and time stamp.
+Create a policy type.
 
-   **URL path:**
-    /status?policyid=<policyid>&status=<status>&deleted=<value>&created_at=<time-stamp>
+**URL path:**
 
-  **Parameters:**
+/policytype?id=<policy-type-id>
 
-    policyid: (*Required*)
-      The ID of a policy.
+**Parameters:**
 
-    status: (*Required*)
-      The status of a policy.
+id: (*Required*)
 
-    deleted: (*Optional*)
-      True or false for real values, but accepts anything for error testing.
+The ID of the policy type.
 
-    created_at: (*Optional*)
-      Time stamp for the status.
+**Body:** (*Required*)
 
-  **Responses:**
+A JSON object containing the schema for the type.
 
-    200:
-      Status set to <status> for policy <policy-id>
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+Policy type <policy-type-id> is OK.
 
-      curl -X PUT "http://localhost:8085/policyid=Policy1&status?status=Accepted
+201:
 
-    Result:
-      200
-        Status set to Accepted for policy Policy1.
+Policy type <policy-type-id> is OK.
 
-A1 Standard 1.1.3
------------------
+**Examples:**
 
-The available functions for the A1 Standard 1.1.3 version of A1.
+**Call**: ::
 
-/deleteinstances
-~~~~~~~~~~~~~~~~
+  curl -X PUT "http://localhost:8085/policytype?id=1"
+    -H  "Content-Type: application/json"
+    -d '{
+        "name": "pt1",
+        "description": "pt1 policy type",
+        "policy_type_id": 1,
+        "create_schema": {
+          "$schema": "http://json-schema.org/draft-07/schema#",
+          "title": "STD_QoSNudging_0.2.0",
+          "description": "QoS policy type",
+          "type": "object",
+          "properties": {
+            "scope": {
+              "type": "object",
+              "properties": {
+                "ueId": {
+                  "type": "string"
+                },
+                "qosId": {
+                  "type": "string"
+                }
+              },
+              "additionalProperties": false,
+              "required": [
+                "ueId",
+                "qosId"
+              ]
+            },
+            "statement": {
+              "type": "object",
+              "properties": {
+                "priorityLevel": {
+                  "type": "number"
+                }
+              },
+              "additionalProperties": false,
+              "required": [
+                "priorityLevel"
+              ]
+            }
+          }
+        }
+      }'
 
-POST
-++++
+**Result**:
 
-  Delete all policy instances.
+201: ::
 
-   **URL path:**
-    /deleteinstances
+  Policy type 1 is OK
 
-  **Parameters:**
+DELETE
+++++++
 
-    None.
+Delete a policy type.
 
-  **Responses:**
+**URL path:**
 
-    200:
-      All policy instances deleted.
+/policytype?id=<policy-type-id>
 
-  **Examples:**
+**Parameters:**
 
-    Call: ::
+id: (*Required*)
 
-      curl -X POST "http://localhost:8085/deleteinstances"
+The ID of the policy type.
 
-    Result:
-      200
-        All policy instances deleted.
+**Responses:**
 
-/deleteall
-~~~~~~~~~~
+204:
 
-POST
-++++
+Policy type <policy-type-id> is OK.
 
-  Full reset.
+**Examples:**
 
-   **URL path:**
-    /deleteinstances
+**Call**: ::
 
-  **Parameters:**
+  curl -X DELETE "http://localhost:8085/policytype?id=1"
 
-    None.
+**Result**:
 
-  **Responses:**
+204
 
-    200:
-      All policy instances deleted.
 
-  **Examples:**
 
-    Call: ::
+/policytypes
+~~~~~~~~~~~~
 
-      curl -X POST "http://localhost:8085/deleteall"
+GET
++++
 
-    Result:
-      200
-        All policy instances deleted.
+Get a list of policy types.
 
-/forceresponse
-~~~~~~~~~~~~~~
+**URL path:**
 
-POST
-++++
+/policytypes
 
-  Force a specific response code for an A1 operation.
+**Parameters:**
 
-   **URL path:**
-    /forceresponse?responsecode=<http-response-code>
+None.
 
-  **Parameters:**
+**Responses:**
 
-    responsecode: (*Required*)
-      The HTTP response code to return.
+200:
 
-  **Responses:**
+A list of policy types.
 
-    200:
-      Force response code: <expected code> set for one single A1 response
+**Examples:**
 
-  **Examples:**
+**Call**: ::
 
-    Call: ::
+  curl -X GET "http://localhost:8085/policytypes"
 
-      curl -X POST "http://localhost:8085/forceresponse?responsecode=400"
+**Result**:
 
-    Result:
-      200
-        Force response code: 400 set for one single A1 response
+200: ::
 
-/forcedelay
-~~~~~~~~~~~
+  ["1"]
 
-POST
-++++
 
-  Force delayed response of all A1 operations.
+/status
+~~~~~~~
 
-   **URL path:**
-    /forcedelay?delay=<delay-time-seconds>
+PUT
++++
 
-  **Parameters:**
+Set status and optional reason, delete and time stamp.
 
-    delay: (*Required*)
-      The time in seconds to delay all responses.
+**URL path:**
 
-  **Responses:**
+/status?policyid=<policyid>&status=<status>&deleted=<value>&created_at=<time-stamp>
 
-    200:
-      Force delay: <expected delay> sec set for all A1 responses
+**Parameters:**
 
-  **Examples:**
+policyid: (*Required*)
 
-    Call: ::
+The ID of a policy.
 
-      curl -X POST "http://localhost:8085/forcedelay?delay=2"
+status: (*Required*)
 
-    Result:
-      200
-        Force delay: 2 sec set for all A1 responses
+The status of a policy.
 
-/status
-~~~~~~~
+deleted: (*Optional*)
 
-PUT
-+++
+True or false for real values, but accepts anything for error testing.
 
-  Set status and optional reason, delete and time stamp.
+created_at: (*Optional*)
 
-   **URL path:**
-    /status?policyid=<policyid>&status=<status>&reason=<reason>
+Time stamp for the status.
 
-  **Parameters:**
+**Responses:**
 
-    policyid: (*Required*)
-      The ID of a policy.
+200:
 
-    status: (*Required*)
-      The status of a policy.
+Status set to <status> for policy <policy-id>
 
-    reason: (*Optional*)
-      The reason for the status.
+**Examples:**
 
-  **Responses:**
+**Call**: ::
 
-    200:
-      Status set to <status> for policy <policy-id>
+  curl -X PUT "http://localhost:8085/status?policyid=1&status=Accepted"
 
-  **Examples:**
+**Result**:
 
-    Call: ::
+200: ::
 
-      curl -X PUT "http://localhost:8085/status?policyid=Policy1&status=Accepted
+  Status set to Accepted for policy Policy1.
 
-    Result:
-      200
-        Status set to Accepted for policy Policy1
+A1 Standard 1.1.3
+-----------------
 
-/sendstatus
-~~~~~~~~~~~
+This section describes the available administrative functions for the A1 Standard 1.1.3 version of A1.
 
-POST
-++++
+To see the A1 functions for this version, see `A1 Standard 1.1.3 API`_.
 
-  Send status for policy.
+.. _A1 Standard 1.1.3 API: https://gerrit.o-ran-sc.org/r/gitweb?p=sim/a1-interface.git;a=blob;f=near-rt-ric-simulator/api/STD_1.1.3/STD_A1.yaml
 
-   **URL path:**
-    /sendstatus?policyid=<policy-id>
 
-  **Parameters:**
+/status
+~~~~~~~
 
-    policyid: (*Required*)
-      The ID of the policy to send status for.
+PUT
++++
 
-  **Responses:**
+Set status and optional reason, delete and time stamp.
 
-    200:
-      Is a JSON with the response of the actual post request to the callback server, whatever that is.
+**URL path:**
 
-  **Examples:**
+/status?policyid=<policyid>&status=<status>&reason=<reason>
 
-    Call: ::
+**Parameters:**
 
-      curl -X POST "http://localhost:8085/sendstatus?policyid=Policy2"
+policyid: (*Required*)
 
-    Result:
-      200
+The ID of a policy.
 
-1.1.x-alpha.2
--------------
+status: (*Required*)
 
-The available functions for the 1.1.x-alpha.2.
+The status of a policy.
 
-/deleteinstances
-~~~~~~~~~~~~~~~~
+reason: (*Optional*)
 
-DELETE
-++++++
+The reason for the status.
+
+**Responses:**
+
+200:
 
-  Delete all policy instances.
+Status set to <status> for policy <policy-id>
 
-   **URL path:**
-    /deleteinstances
+**Examples:**
 
-  **Parameters:**
+**Call**: ::
 
-    None.
+  curl -X PUT "http://localhost:8085/status?policyid=Policy1&status=Accepted"
 
-  **Responses:**
+**Result**:
 
-    200:
-      All policy instances deleted.
+200: ::
 
-  **Examples:**
+  Status set to Accepted for policy Policy1
 
-    Call: ::
+/sendstatus
+~~~~~~~~~~~
 
-      curl -X DELETE "http://localhost:8085/deleteinstances"
+POST
+++++
 
-    Result:
-      200
-        All policy instances deleted.
+Send status for policy.
 
-/deletetypes
-~~~~~~~~~~~~
+**URL path:**
 
-DELETE
-++++++
+/sendstatus?policyid=<policy-id>
 
-  Delete all policy types.
+**Parameters:**
 
-   **URL path:**
-    /deletetypes
+policyid: (*Required*)
 
-  **Parameters:**
+The ID of the policy to send status for.
 
-    None.
+**Responses:**
 
-  **Responses:**
+200:
 
-    200:
-      All policy types deleted.
+Is a JSON with the response of the actual post request to the callback server, whatever that is.
 
-  **Examples:**
+**Examples:**
 
-    Call: ::
+**Call**: ::
 
-      curl -X DELETE "http://localhost:8085/deletetypes"
+  curl -X POST "http://localhost:8085/sendstatus?policyid=Policy2"
 
-    Result:
-      200
-        All policy types deleted.
+**Result**:
 
-/policytypes
-~~~~~~~~~~~~
+200
+
+
+A1 Standard 2.0.0
+-----------------
+
+This section describes the available administrative functions for the A1 Standard 2.0.0 version of A1.
+
+To see the A1 functions for this version, see `A1 Standard 2.0.0 API`_.
+
+.. _A1 Standard 2.0.0 API: https://gerrit.o-ran-sc.org/r/gitweb?p=sim/a1-interface.git;a=blob;f=near-rt-ric-simulator/api/STD_2.0.0/ORAN_A1-p_V2.0.0_api.yaml
+
+
+/policytype
+~~~~~~~~~~~
 
 PUT
 +++
 
-  Create or update a policy type.
+Create or update a policy type.
+
+**URL path:**
+
+/policytype?id={policy-type-id}
 
-   **URL path:**
-    /policytypes/{policy-type-id}
+**Parameters:**
 
-  **Parameters:**
+policy-type-id: (*Required*)
 
-    None.
+The ID of the policy type.
 
-  **Body:** (*Required*)
-      A JSON object containing the schema for the type.
+**Body:** (*Required*)
 
-  **Responses:**
+A JSON object containing the schema for the type.
 
-    200:
-      The policy type was either created or updated for policy type id: <policy-type-id>
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+The policy type <policy-type-id> is ok
 
-      curl -X PUT "http://localhost:8085/policytype/Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
-        -H  "Content-Type: application/json"
-        -d "
-          {
+201:
+
+The policy type <policy-type-id> is ok
+
+**Examples:**
+
+**Call**: ::
+
+  curl -X PUT "http://localhost:8085/policytype?id=STD_PolicyModelUnconstrained_0.2.0"
+    -H  "Content-Type: application/json"
+    -d '{
+          "policySchema": {
             "$schema": "http://json-schema.org/draft-07/schema#",
-            "title": "STD_PolicyModelUnconstrained_0.2.0",
-            "description": "Standard model of a policy with unconstrained scope id combinations",
+            "title": "STD_1_0.2.0",
+            "description": "STD 1 policy type",
             "type": "object",
             "properties": {
               "scope": {
                 "type": "object",
                 "properties": {
-                  "ueId": {"type": "string"},
-                  "groupId": {"type": "string"},
-                  "sliceId": {"type": "string"},
-                  "qosId": {"type": "string"},
-                  "cellId": {"type": "string"}
+                  "ueId": {
+                    "type": "string"
+                  },
+                  "qosId": {
+                    "type": "string"
+                  }
                 },
-                "minProperties": 1,
-                "additionalProperties": false
+                "additionalProperties": false,
+                "required": [
+                  "ueId",
+                  "qosId"
+                ]
               },
-              "qosObjectives": {
+              "statement": {
                 "type": "object",
                 "properties": {
-                  "gfbr": {"type": "number"},
-                  "mfbr": {"type": "number"},
-                  "priorityLevel": {"type": "number"},
-                  "pdb": {"type": "number"}
+                  "priorityLevel": {
+                    "type": "number"
+                  }
                 },
-                "additionalProperties": false
+                "additionalProperties": false,
+                "required": [
+                  "priorityLevel"
+                ]
+              }
+            }
+          },
+          "statusSchema": {
+            "$schema": "http://json-schema.org/draft-07/schema#",
+            "title": "STD_1_0.2.0",
+            "description": "STD 1 policy type status",
+            "type": "object",
+            "properties": {
+              "enforceStatus": {
+                "type": "string"
               },
-              "qoeObjectives": {
-                "type": "object",
-                "properties": {
-                  "qoeScore": {"type": "number"},
-                  "initialBuffering": {"type": "number"},
-                  "reBuffFreq": {"type": "number"},
-                  "stallRatio": {"type": "number"}
-                },
-                "additionalProperties": false
+              "enforceReason": {
+                "type": "string"
               },
-              "resources": {
-                "type": "array",
-                "items": {
-                  "type": "object",
-                  "properties": {
-                    "cellIdList": {
-                      "type": "array",
-                      "minItems": 1,
-                      "uniqueItems": true,
-                      "items": {
-                        "type": "string"
-                      }
-                    },
-                    "preference": {
-                      "type": "string",
-                      "enum": [
-                        "SHALL",
-                        "PREFER",
-                        "AVOID",
-                        "FORBID"
-                      ]
-                    },
-                    "primary": {"type": "boolean"}
-                  },
-                  "additionalProperties": false,
-                  "required": ["cellIdList", "preference"]
-                }
-              }
-            },
-            "minProperties": 2,
-            "additionalProperties": false,
-            "required": ["scope"]
+              "additionalProperties": false,
+              "required": [
+                "enforceStatus"
+              ]
+            }
           }
-        "
+        }'
+
+**Result**:
+
+200: ::
+
+  Policy type STD_PolicyModelUnconstrained_0.2.0 is OK
+
+201: ::
 
-    Result:
-      200
-        The policy type was either created or updated for policy type id: STD_PolicyModelUnconstrained_0.2.0
+  Policy type STD_PolicyModelUnconstrained_0.2.0 is OK
 
 DELETE
 ++++++
 
-  Delete a policy type.
+Delete a policy type.
+
+**URL path:**
+
+/policytype?id={policy-type-id}
+
+**Parameters:**
+
+None.
+
+**Responses:**
+
+204
+
+
+**Examples:**
+
+**Call**: ::
+
+  curl -X DELETE "http://localhost:8085/policytype?id=STD_PolicyModelUnconstrained_0.2.0"
+
+**Result**:
+
+204
+
 
-   **URL path:**
-    /policytypes/{policy-type-id}
 
-  **Parameters:**
+/policytypes
+~~~~~~~~~~~~
+
+GET
++++
+
+Get a list of policy types.
+
+**URL path:**
+
+/policytypes
+
+**Parameters:**
+
+None.
+
+**Responses:**
+
+200:
+
+A list of policy types.
 
-    None.
+**Examples:**
 
-  **Responses:**
+**Call**: ::
 
-    200:
-      policy type successfully deleted for policy type id: <policy-type-id>
+  curl -X GET "http://localhost:8085/policytypes"
 
-  **Examples:**
+**Result**:
 
-    Call: ::
+200: ::
 
-     curl -X DELETE "http://localhost:8085/policytype?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
+  ["STD_PolicyModelUnconstrained_0.2.0"]
 
-     Result:
-      200
-        policy type successfully deleted for policy type id: STD_PolicyModelUnconstrained_0.2.0
 
 /{policyId}/{enforceStatus}
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -865,56 +817,67 @@ DELETE
 PUT
 +++
 
-  Set a status to a policy instance with an enforceStatus parameter only.
+Set a status to a policy instance with an enforceStatus parameter only.
 
-   **URL path:**
-    /{policyId}/{enforceStatus}
+**URL path:**
 
-  **Parameters:**
+/status?policyid={policyId}&status={status}&reason={reason}
 
-    None.
+**Parameters:**
 
-  **Responses:**
+None.
 
-    200:
-      Status updated for policy: <policyId>
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+Status updated for policy: <policyId>
 
-      curl -X PUT "http://localhost:8085/Policy1/ENFORCED
+**Examples:**
 
-    Result:
-      200
-        Status updated for policy: Policy1
+**Call**: ::
+
+  curl -X PUT "http://localhost:8085/status?policyid=Policy1&status=ENFORCED"
+
+**Result**:
+
+200: ::
+
+  Status updated for policy: Policy1
 
 /{policyId}/{enforceStatus}/{enforceReason}
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-PUT
+/sendstatus
+~~~~~~~~~~~
+
+POST
 ++++
 
-  Send a status to a policy instance with both enforceStatus and enforceReason.
+Send status for policy.
+
+**URL path:**
+
+/sendstatus?policyid=<policy-id>
+
+**Parameters:**
+
+policyid: (*Required*)
 
-   **URL path:**
-    /{policyId}/{enforceStatus}/{enforceReason}
+The ID of the policy to send status for.
 
-  **Parameters:**
+**Responses:**
 
-    None.
+200:
 
-  **Responses:**
+Is a JSON with the response of the actual post request to the callback server, whatever that is.
 
-    200:
-      Status updated for policy: <policyId>
+**Examples:**
 
-  **Examples:**
+**Call**: ::
 
-    Call: ::
+  curl -X POST "http://localhost:8085/sendstatus?policyid=Policy2"
 
-      curl -X PUT "http://localhost:8085/Policy1/NOT_ENFORCED/100"
+**Result**:
 
-    Result:
-      200
-        Status updated for policy: Policy1
+200