Merge "Fix Sonar and CheckStyle warnings"
[nonrtric.git] / docs / policy-agent-api.rst
index 2a79b26..ce94b3d 100644 (file)
@@ -1,5 +1,6 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
+.. Copyright (C) 2020 Nordix
 
 .. |nbsp| unicode:: 0xA0
    :trim:
@@ -9,9 +10,9 @@
 
 .. _policy-agent-api:
 
-############################
-A1 Policy Management Service
-############################
+################################
+A1 Policy Management Service API
+################################
 
 
 *******************************************
@@ -52,20 +53,17 @@ The Policy Agent also keeps an updated view of the policy types available, and w
 support which types. Also, the Policy Agent can tell if a Managed Element is managed by a certain
 Near |nbh| RT |nbsp| RIC.
 
-The Policy Agent NBI has four distinct parts, described in the sections below:
+The Policy Agent NBI has five distinct parts, described in the sections below:
 
 * Service Management
+* Policy Types
 * Policy Management
 * Near-RT RIC Repository
 * Health Check
 
-.. contents:: Operations
-   :depth: 4
-   :local:
-
-
+******************
 Service Management
-==================
+******************
 
 A service can register itself in the Policy Agent.
 
@@ -79,67 +77,75 @@ Near |nbh| RT |nbsp| RICs where they were earlier created. **Note!** |nbsp| If t
 "*Keep Alive Interval*", then the service maintains full responsibility to delete all of its policies when they are no
 longer needed.
 
-Service Management Operations
------------------------------
-
 /service
 ~~~~~~~~
 
 PUT
 +++
 
-  Register a service.
+Register a service.
 
-  **URL path:**
-    /service
+Definition
+""""""""""
 
-  **Parameters:**
+**URL path:**
 
-    None.
+/service
 
-  **Body:**  (*Required*)
-      A JSON object (ServiceRegistrationInfo): ::
+**Parameters:**
 
-        {
-          "callbackUrl": "string",         (An empty string means the service will never get any callbacks.)
-          "keepAliveIntervalSeconds": 0,   (0 means the service will always be considered alive.)
-          "serviceName": "string"          (Required, must be unique.)
-        }
+None.
+
+**Body:**  (*Required*)
+
+A JSON object (ServiceRegistrationInfo): ::
+
+  {
+    "callbackUrl": "string",         (An empty string means the service will never get any callbacks.)
+    "keepAliveIntervalSeconds": 0,   (0 means the service will always be considered alive.)
+    "serviceName": "string"          (Required, must be unique.)
+  }
+
+**Responses:**
+
+200:
+
+Service updated.
+
+201:
 
-  **Responses:**
+Service created.
 
-    200:
-          Service updated.
+400:
 
-    201:
-          Service created.
+The ServiceRegistrationInfo is not accepted.
 
-    400:
-          The ServiceRegistrationInfo is not accepted.
+Examples
+""""""""
 
-  **Examples:**
+**Call**: ::
 
-    Call: ::
+  curl -X PUT "http://localhost:8081/service" -H "Content-Type: application/json" -d '{
+      "callbackUrl": "URL",
+      "keepAliveIntervalSeconds": 0,
+      "serviceName": "existing"
+    }'
 
-      curl -X PUT "http://localhost:8081/service" -H "Content-Type: application/json" -d "{
-          \"callbackUrl\": \"URL\",
-          \"keepAliveIntervalSeconds\": 0,
-          \"serviceName\": \"existing\"
-        }"
+**Result**:
 
-    Result:
-      201: ::
+201: ::
 
-         OK
+   OK
 
-    Call: ::
+**Call**: ::
 
-       curl -X PUT "http://localhost:8081/service" -H  "Content-Type: application/json" -d "{}"
+   curl -X PUT "http://localhost:8081/service" -H  "Content-Type: application/json" -d "{}"
 
-    Result:
-       400: ::
+**Result**:
 
-         Missing mandatory parameter 'serviceName'
+400: ::
+
+  Missing mandatory parameter 'serviceName'
 
 /services
 ~~~~~~~~~
@@ -147,98 +153,116 @@ PUT
 GET
 +++
 
-  Query service information.
+Query service information.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/services?name=<service-name>
 
-  **URL path:**
-    /services?name=<service-name>
+**Parameters:**
 
-  **Parameters:**
+name: (*Optional*)
 
-    name: (*Optional*)
-      The name of the service.
+The name of the service.
 
-  **Responses:**
+**Responses:**
 
-    200:
-          Array of JSON objects (ServiceStatus). ::
+200:
 
-           {
-               "callbackUrl": "string",             (Callback URL)
-               "keepAliveIntervalSeconds": 0,       (Policy keep alive interval)
-               "serviceName": "string",             (Identity of the service)
-               "timeSinceLastActivitySeconds": 0    (Time since last invocation by the service)
-           }
+Array of JSON objects (ServiceStatus). ::
+
+  {
+    "callbackUrl": "string",             (Callback URL)
+    "keepAliveIntervalSeconds": 0,       (Policy keep alive interval)
+    "serviceName": "string",             (Identity of the service)
+    "timeSinceLastActivitySeconds": 0    (Time since last invocation by the service)
+  }
 
-    404:
-          Service is not found.
+404:
 
-  **Examples:**
+Service is not found.
 
-    Call: ::
+Examples
+""""""""
 
-      curl -X GET "http://localhost:8081/services?name=existing"
+**Call**: ::
 
-    Result:
-      200: ::
+  curl -X GET "http://localhost:8081/services?name=existing"
 
-         [
-           {
-             "serviceName":"existing",
-             "keepAliveIntervalSeconds":0,
-             "timeSinceLastActivitySeconds":7224,
-             "callbackUrl":"URL"
-           }
-        ]
+**Result**:
 
-    Call: ::
+200: ::
 
-      curl -X GET "http://localhost:8081/services?name=nonexistent"
+  [
+    {
+      "serviceName":"existing",
+      "keepAliveIntervalSeconds":0,
+      "timeSinceLastActivitySeconds":7224,
+      "callbackUrl":"URL"
+    }
+  ]
 
-    Result:
-       404: ::
+**Call**: ::
 
-         Service not found
+  curl -X GET "http://localhost:8081/services?name=nonexistent"
+
+Result:
+
+404: ::
+
+  Service not found
 
 DELETE
 ++++++
 
-  Delete a service.
+Delete a service.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/services?name=<service-name>
 
-  **URL path:**
-    /services?name=<service-name>
+**Parameters:**
 
-  **Parameters:**
+name: (*Required*)
 
-    name: (*Required*)
-      The name of the service.
+The name of the service.
 
-  **Responses:**
+**Responses:**
 
-    204:
-          OK
+204:
+  OK
 
-    404:
-          Service not found.
+404:
+  Service not found.
 
-  **Examples:**
+Examples
+""""""""
 
-    Call: ::
+**Call**: ::
 
-      curl -X DELETE "http://localhost:8081/services?name=existing"
+  curl -X DELETE "http://localhost:8081/services?name=existing"
 
-    Result:
-      204: ::
+**Result**:
 
-         OK
+204: ::
 
-    Call: ::
+  OK
 
-      curl -X DELETE "http://localhost:8081/services?name=nonexistent"
+**Call**: ::
 
-    Result:
-       404: ::
+  curl -X DELETE "http://localhost:8081/services?name=nonexistent"
 
-         Could not find service: nonexistent
+Result:
+
+404: ::
+
+  Could not find service: nonexistent
 
 /services/keepalive
 ~~~~~~~~~~~~~~~~~~~
@@ -246,48 +270,59 @@ DELETE
 PUT
 +++
 
-  Heart beat from a service.
+Heart beat from a service.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/services/keepalive?name=<service-name>
+
+**Parameters:**
+
+name: (*Required*)
 
-  **URL path:**
-    /services/keepalive?name=<service-name>
+The name of the service.
 
-  **Parameters:**
+**Responses:**
 
-    name: (*Required*)
-      The name of the service.
+200:
 
-  **Responses:**
+OK
 
-    200:
-          OK
+404:
 
-    404:
-          Service is not found.
+Service is not found.
 
-  **Examples:**
+Examples
+""""""""
 
-    Call: ::
+**Call**: ::
 
-      curl -X PUT "http://localhost:8081/services/keepalive?name=existing"
+  curl -X PUT "http://localhost:8081/services/keepalive?name=existing"
 
-    Result:
-      200: ::
+**Result**:
 
-         OK
+200: ::
 
-    Call: ::
+  OK
 
-      curl -X PUT "http://localhost:8081/services/keepalive?name=nonexistent"
+**Call**: ::
 
-    Result:
-       404: ::
+  curl -X PUT "http://localhost:8081/services/keepalive?name=nonexistent"
 
-         Could not find service: nonexistent
+**Result**:
+
+404: ::
+
+  Could not find service: nonexistent
 
 .. _policy-management:
 
-Policy Management
-=================
+************
+Policy Types
+************
 
 Policies are based on types. The set of available policy types is determined by the set of policy types supported by
 Near |nbh| RT |nbsp| RICs. At startup, the Policy Agent queries all Near |nbh| RT |nbsp| RICs for their supported types
@@ -295,20 +330,6 @@ and stores them in its internal repository. It then checks this at regular inter
 to date. Policy types cannot be created, updated or deleted using this interface since this must be done via the
 Near |nbh| RT |nbsp| RICs.
 
-Policies can be queried, created, updated, and deleted. A policy is always created in a specific
-Near |nbh| RT |nbsp| RIC.
-
-When a policy is created, the Policy Agent stores information about it in its internal repository. At regular intervals,
-it then checks with all Near |nbh| RT |nbsp| RICs that this repository is synchronized. If, for some reason, there is an
-inconsistency, the Policy Agent will start a synchronization job and try to reflect the status of the
-Near |nbh| RT |nbsp| RIC. If this fails, the Policy Agent will delete all policies for the specific
-Near |nbh| RT |nbsp| RIC in the internal repository and set its state to *UNKNOWN*. This means that no interaction with
-the Near |nbh| RT |nbsp| RIC is possible until the Policy Agent has been able to contact it again and re-synchronize its
-state in the repository.
-
-Policy Types
-------------
-
 A policy type defines a name and a JSON schema that constrains the content of a policy of that type.
 
 /policy_types
@@ -317,47 +338,57 @@ A policy type defines a name and a JSON schema that constrains the content of a
 GET
 +++
 
-  Query policy type names.
+Query policy type names.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/policy_types?ric=<name-of-ric>
 
-  **URL path:**
-    /policy_types?ric=<name-of-ric>
+**Parameters:**
 
-  **Parameters:**
+ric: (*Optional*)
 
-    ric: (*Optional*)
-      The name of the Near |nbh| RT |nbsp| RIC to get types for.
+The name of the Near |nbh| RT |nbsp| RIC to get types for.
 
-  **Responses:**
+**Responses:**
 
-    200:
-          Array of policy type names.
+200:
 
-    404:
-          Near |nbh| RT |nbsp| RIC is not found.
+  Array of policy type names.
 
-  **Examples:**
+404:
 
-    Call: ::
+  Near |nbh| RT |nbsp| RIC is not found.
 
-      curl -X GET "http://localhost:8081/policy_types"
+Examples
+""""""""
 
-    Result:
-      200: ::
+**Call**: ::
 
-         [
-           "STD_PolicyModelUnconstrained_0.2.0",
-           "Example_QoETarget_1.0.0",
-           "ERIC_QoSNudging_0.2.0"
-        ]
+  curl -X GET "http://localhost:8081/policy_types"
 
-    Call: ::
+**Result**:
 
-      curl -X GET "http://localhost:8081/policy_types?ric=nonexistent"
+200: ::
 
-    Result:
-       404: ::
+  [
+    "STD_PolicyModelUnconstrained_0.2.0",
+    "Example_QoETarget_1.0.0",
+    "ERIC_QoSNudging_0.2.0"
+  ]
 
-         org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy_types?ric=nonexistent"
+
+**Result**:
+
+404: ::
+
+  org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
 
 /policy_schema
 ~~~~~~~~~~~~~~
@@ -365,87 +396,97 @@ GET
 GET
 +++
 
-  Returns one policy type schema definition.
+Returns one policy type schema definition.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/policy_schema?id=<name-of-type>
 
-  **URL path:**
-    /policy_schema?id=<name-of-type>
+**Parameters:**
 
-   **Parameters:**
+id: (*Required*)
 
-    id: (*Required*)
-      The ID of the policy type to get the definition for.
+The ID of the policy type to get the definition for.
 
-  **Responses:**
+**Responses:**
 
-    200:
-          Policy schema as JSON schema.
+200:
 
-    404:
-          Policy type is not found.
+Policy schema as JSON schema.
 
-  **Examples:**
+404:
 
-    Call: ::
+Policy type is not found.
 
-      curl -X GET "http://localhost:8081/policy_schema?id=STD_PolicyModelUnconstrained_0.2.0"
+Examples
+""""""""
 
-    Result:
-      200: ::
+**Call**: ::
 
-        {
-          "$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",
+ curl -X GET "http://localhost:8081/policy_schema?id=STD_PolicyModelUnconstrained_0.2.0"
+
+**Result**:
+
+200: ::
+
+  {
+    "$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"}
+        },
+        "minProperties": 1,
+        "additionalProperties": false
+      },
+      "qosObjectives": {
+        "type": "object",
+        "properties": {
+          "gfbr": {"type": "number"},
+          "mfbr": {"type": "number"}
+        },
+        "additionalProperties": false
+      },
+      "resources": {
+        "type": "array",
+        "items": {
           "type": "object",
           "properties": {
-           "scope": {
-              "type": "object",
-              "properties": {
-                "ueId": {"type": "string"},
-                "groupId": {"type": "string"}
-              },
-              "minProperties": 1,
-              "additionalProperties": false
-            },
-            "qosObjectives": {
-              "type": "object",
-              "properties": {
-                "gfbr": {"type": "number"},
-                "mfbr": {"type": "number"}
-              },
-              "additionalProperties": false
-            },
-            "resources": {
+            "cellIdList": {
               "type": "array",
+              "minItems": 1,
+              "uniqueItems": true,
               "items": {
-                "type": "object",
-                "properties": {
-                  "cellIdList": {
-                    "type": "array",
-                    "minItems": 1,
-                    "uniqueItems": true,
-                    "items": {
-                      "type": "string"
-                    }
-                  },
-                "additionalProperties": false,
-                "required": ["cellIdList"]
+                "type": "string"
               }
-            }
-          },
-          "minProperties": 1,
+            },
           "additionalProperties": false,
-          "required": ["scope"]
+          "required": ["cellIdList"]
         }
+      }
+    },
+    "minProperties": 1,
+    "additionalProperties": false,
+    "required": ["scope"]
+  }
+
+**Call**: ::
 
-    Call: ::
+  curl -X GET "http://localhost:8081/policy_schema?id=nonexistent"
 
-      curl -X GET "http://localhost:8081/policy_schema?id=nonexistent"
+**Result**:
 
-    Result:
-       404: ::
+404: ::
 
-         org.oransc.policyagent.exceptions.ServiceException: Could not find type: nonexistent
+  org.oransc.policyagent.exceptions.ServiceException: Could not find type: nonexistent
 
 /policy_schemas
 ~~~~~~~~~~~~~~~
@@ -453,75 +494,104 @@ GET
 GET
 +++
 
-  Returns policy type schema definitions.
+Returns policy type schema definitions.
 
-  **URL path:**
-    /policy_schemas?ric=<name-of-ric>
+Definition
+""""""""""
 
-   **Parameters:**
+**URL path:**
 
-    ric: (*Optional*)
-      The name of the Near |nbh| RT |nbsp| RIC to get the definitions for.
+/policy_schemas?ric=<name-of-ric>
 
-  **Responses:**
+**Parameters:**
 
-    200:
-          An array of policy schemas as JSON schemas.
+ric: (*Optional*)
 
-    404:
-          Near |nbh| RT |nbsp| RIC is not found.
+The name of the Near |nbh| RT |nbsp| RIC to get the definitions for.
 
-  **Examples:**
+**Responses:**
 
-    Call: ::
+200:
 
-      curl -X GET "http://localhost:8081/policy_schemas"
+An array of policy schemas as JSON schemas.
 
-    Result:
-      200: ::
+404:
 
-        [{
-          "$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",
-              .
-              .
-              .
-          "additionalProperties": false,
-          "required": ["scope"]
-        },
-         .
-         .
-         .
-        {
-          "$schema": "http://json-schema.org/draft-07/schema#",
-          "title": "Example_QoETarget_1.0.0",
-          "description": "Example QoE Target policy type",
+Near |nbh| RT |nbsp| RIC is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy_schemas"
+
+**Result**:
+
+200: ::
+
+  [
+    {
+      "$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",
+            .
+            .
+            .
+        }
+        "additionalProperties": false,
+        "required": ["scope"]
+      },
+        .
+        .
+        .
+      {
+        "$schema": "http://json-schema.org/draft-07/schema#",
+        "title": "Example_QoETarget_1.0.0",
+        "description": "Example QoE Target policy type",
+        "type": "object",
           "properties": {
-           "scope": {
+            "scope": {
               "type": "object",
-              .
-              .
-              .
-          "additionalProperties": false,
-          "required": ["scope"]
-        }]
+                .
+                .
+                .
+            }
+            "additionalProperties": false,
+           "required": ["scope"]
+        }
+      }
+    }
+  ]
+
+**Call**: ::
 
-    Call:
-      curl -X GET "http://localhost:8081/policy_schemas?ric=nonexistent"
+  curl -X GET "http://localhost:8081/policy_schemas?ric=nonexistent"
 
-    Result:
-       404: ::
+**Result**:
 
-         org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
+404: ::
 
-Policy
-------
+  org.oransc.policyagent.exceptions.ServiceException: Could not find ric: nonexistent
+
+*****************
+Policy Management
+*****************
+
+Policies can be queried, created, updated, and deleted. A policy is always created in a specific
+Near |nbh| RT |nbsp| RIC.
+
+When a policy is created, the Policy Agent stores information about it in its internal repository. At regular intervals,
+it then checks with all Near |nbh| RT |nbsp| RICs that this repository is synchronized. If, for some reason, there is an
+inconsistency, the Policy Agent will start a synchronization job and try to reflect the status of the
+Near |nbh| RT |nbsp| RIC. If this fails, the Policy Agent will delete all policies for the specific
+Near |nbh| RT |nbsp| RIC in the internal repository and set its state to *UNKNOWN*. This means that no interaction with
+the Near |nbh| RT |nbsp| RIC is possible until the Policy Agent has been able to contact it again and re-synchronize its
+state in the repository.
 
 A policy is defined by its type schema.
 
@@ -541,89 +611,100 @@ policy it has created. There are only two exceptions, see below:
 GET
 +++
 
-  Query policies.
+Query policies.
 
-  **URL path:**
-    /policies?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-type>
+Definition
+""""""""""
 
-  **Parameters:**
+**URL path:**
 
-    ric: (*Optional*)
-      The name of the Near |nbh| RT |nbsp| RIC to get policies for.
+/policies?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-type>
 
-    service: (*Optional*)
-      The name of the service to get policies for.
+**Parameters:**
 
-    type: (*Optional*)
-      The name of the policy type to get policies for.
+ric: (*Optional*)
 
-  **Responses:**
+The name of the Near |nbh| RT |nbsp| RIC to get policies for.
 
-    200:
-          Array of JSON objects (PolicyInfo). ::
+service: (*Optional*)
 
-            {
-              "id": "string",              (Identity of the policy)
-              "json": "object",            (The configuration of the policy)
-              "lastModified": "string",    (Timestamp, last modification time)
-              "ric": "string",             (Identity of the target Near |nbh| RT |nbsp| RIC)
-              "service": "string",         (The name of the service owning the policy)
-              "type": "string"             (Name of the policy type)
-            }
+The name of the service to get policies for.
+
+type: (*Optional*)
+
+The name of the policy type to get policies for.
+
+**Responses:**
+
+200:
+
+Array of JSON objects (PolicyInfo). ::
+
+  {
+    "id": "string",              (Identity of the policy)
+    "json": "object",            (The configuration of the policy)
+    "lastModified": "string",    (Timestamp, last modification time)
+    "ric": "string",             (Identity of the target Near |nbh| RT |nbsp| RIC)
+    "service": "string",         (The name of the service owning the policy)
+    "type": "string"             (Name of the policy type)
+  }
+
+404:
+  Near |nbh| RT |nbsp| RIC or policy type not found.
 
-    404:
-          Near |nbh| RT |nbsp| RIC or policy type not found.
-
-  **Examples:**
-
-    Call: ::
-
-      curl -X GET "http://localhost:8081/policies?ric=existing"
-
-    Result:
-      200: ::
-
-         [
-           {
-             "id": "Policy 1",
-             "json": {
-               "scope": {
-                 "ueId": "UE 1",
-                 "groupId": "Group 1"
-               },
-               "qosObjectives": {
-                 "gfbr": 1,
-                 "mfbr": 2
-               },
-               "cellId": "Cell 1"
-             },
-             "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
-             "ric": "existing",
-             "service": "Service 1",
-             "type": "STD_PolicyModelUnconstrained_0.2.0"
-           },
-           {
-             "id": "Policy 2",
-             "json": {
-                 .
-                 .
-                 .
-             },
-             "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
-             "ric": "existing",
-             "service": "Service 2",
-             "type": "Example_QoETarget_1.0.0"
-           }
-        ]
-
-    Call: ::
-
-      curl -X GET "http://localhost:8081/policies?type=nonexistent"
-
-    Result:
-       404: ::
-
-         Policy type not found
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policies?ric=existing"
+
+**Result**:
+
+200: ::
+
+  [
+    {
+      "id": "Policy 1",
+      "json": {
+        "scope": {
+          "ueId": "UE 1",
+          "groupId": "Group 1"
+        },
+        "qosObjectives": {
+          "gfbr": 1,
+          "mfbr": 2
+        },
+        "cellId": "Cell 1"
+      },
+      "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
+      "ric": "existing",
+      "service": "Service 1",
+      "type": "STD_PolicyModelUnconstrained_0.2.0"
+    },
+    {
+      "id": "Policy 2",
+      "json": {
+          .
+          .
+          .
+      },
+      "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT",
+      "ric": "existing",
+      "service": "Service 2",
+      "type": "Example_QoETarget_1.0.0"
+    }
+  ]
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policies?type=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Policy type not found
 
 /policy
 ~~~~~~~
@@ -631,180 +712,215 @@ GET
 GET
 +++
 
-  Returns a policy configuration.
+Returns a policy configuration.
 
-  **URL path:**
-    /policy?id=<policy-id>
+Definition
+""""""""""
 
-  **Parameters:**
+**URL path:**
 
-    id: (*Required*)
-      The ID of the policy instance.
+/policy?id=<policy-id>
 
-  **Responses:**
+**Parameters:**
 
-    200:
-          JSON object containing policy information. ::
+id: (*Required*)
 
-            {
-              "id": "string",                  (ID of policy)
-              "json": "object",                (JSON with policy data speified by the type)
-              "ownerServiceName": "string",    (Name of the service that created the policy)
-              "ric": "string",                 (Name of the Near |nbh| RT |nbsp| RIC where the policy resides)
-              "type": "string",                (Name of the policy type of the policy)
-              "lastModified"                   (Timestamp, last modification time)
-            }
+The ID of the policy instance.
+
+**Responses:**
+
+200:
 
-    404:
-          Policy is not found.
-
-  **Examples:**
-
-    Call: ::
-
-      curl -X GET "http://localhost:8081/policy?id=Policy 1"
-
-    Result:
-      200: ::
-
-         {
-           "id": "Policy 1",
-           "json", {
-             "scope": {
-               "ueId": "UE1 ",
-               "cellId": "Cell 1"
-             },
-             "qosObjectives": {
-               "gfbr": 319.5,
-               "mfbr": 782.75,
-               "priorityLevel": 268.5,
-               "pdb": 44.0
-             },
-             "qoeObjectives": {
-               "qoeScore": 329.0,
-               "initialBuffering": 27.75,
-               "reBuffFreq": 539.0,
-               "stallRatio": 343.0
-             },
-             "resources": []
-           },
-           "ownerServiceName": "Service 1",
-           "ric": "ric1",
-           "type": "STD_PolicyModelUnconstrained_0.2.0",
-           "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT"
-         }
-
-    Call: ::
-
-      curl -X GET "http://localhost:8081/policy?id=nonexistent"
-
-    Result:
-       404: ::
-
-         Policy is not found
+JSON object containing policy information. ::
+
+  {
+    "id": "string",                  (ID of policy)
+    "json": "object",                (JSON with policy data speified by the type)
+    "ownerServiceName": "string",    (Name of the service that created the policy)
+    "ric": "string",                 (Name of the Near |nbh| RT |nbsp| RIC where the policy resides)
+    "type": "string",                (Name of the policy type of the policy)
+    "lastModified"                   (Timestamp, last modification time)
+  }
+
+404:
+
+Policy is not found.
+
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy?id=Policy 1"
+
+**Result**:
+
+200: ::
+
+  {
+    "id": "Policy 1",
+    "json", {
+      "scope": {
+        "ueId": "UE1 ",
+        "cellId": "Cell 1"
+      },
+      "qosObjectives": {
+        "gfbr": 319.5,
+        "mfbr": 782.75,
+        "priorityLevel": 268.5,
+        "pdb": 44.0
+      },
+      "qoeObjectives": {
+        "qoeScore": 329.0,
+        "initialBuffering": 27.75,
+        "reBuffFreq": 539.0,
+        "stallRatio": 343.0
+      },
+      "resources": []
+    },
+    "ownerServiceName": "Service 1",
+    "ric": "ric1",
+    "type": "STD_PolicyModelUnconstrained_0.2.0",
+    "lastModified": "Wed, 01 Apr 2020 07:45:45 GMT"
+  }
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy?id=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Policy is not found
 
 PUT
 +++
 
-  Create/Update a policy. **Note!** Calls to this method will also trigger "*Keep Alive*" for a service which has a
-  "*Keep Alive Interval*" registered.
+Create/Update a policy. **Note!** Calls to this method will also trigger "*Keep Alive*" for a service which has a
+"*Keep Alive Interval*" registered.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/policy?id=<policy-id>&ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
+
+**Parameters:**
+
+id: (*Required*)
+
+The ID of the policy instance.
+
+ric: (*Required*)
+
+The name of the Near |nbh| RT |nbsp| RIC where the policy will be created.
+
+service: (*Required*)
+
+The name of the service creating the policy.
+
+type: (*Optional*)
 
-  **URL path:**
-    /policy?id=<policy-id>&ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
+The name of the policy type.
 
-  **Parameters:**
+**Body:** (*Required*)
 
-    id: (*Required*)
-      The ID of the policy instance.
+A JSON object containing the data specified by the type.
 
-    ric: (*Required*)
-      The name of the Near |nbh| RT |nbsp| RIC where the policy will be created.
+**Responses:**
 
-    service: (*Required*)
-      The name of the service creating the policy.
+200:
 
-    type: (*Optional*)
-      The name of the policy type.
+Policy updated.
 
-  **Body:** (*Required*)
-      A JSON object containing the data specified by the type.
+201:
 
-  **Responses:**
+Policy created.
 
-    200:
-          Policy updated.
+404:
 
-    201:
-          Policy created.
+Near |nbh| RT |nbsp| RIC or policy type is not found.
 
-    404:
-          Near |nbh| RT |nbsp| RIC or policy type is not found.
+423:
 
-    423:
-          Near |nbh| RT |nbsp| RIC is not operational.
+Near |nbh| RT |nbsp| RIC is not operational.
 
-  **Examples:**
+Examples
+""""""""
 
-    Call: ::
+**Call**: ::
 
-      curl -X PUT "http://localhost:8081/policy?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
-        -H  "Content-Type: application/json"
-        -d "{
-              \"scope\": {
-                \"ueId\": \"UE 1\",
-                \"cellId\": \"Cell 1\"
-              },
-              \"qosObjectives\": {
-                \"gfbr\": 319.5,
-                \"mfbr\": 782.75,
-                \"priorityLevel\": 268.5,
-                \"pdb\": 44.0
-              },
-              \"qoeObjectives\": {
-                \"qoeScore\": 329.0,
-                \"initialBuffering\": 27.75,
-                \"reBuffFreq\": 539.0,
-                \"stallRatio\": 343.0
-              },
-              \"resources\": []
-            }"
+  curl -X PUT "http://localhost:8081/policy?id=Policy%201&ric=ric1&service=Service%201&type=STD_PolicyModelUnconstrained_0.2.0"
+    -H  "Content-Type: application/json"
+    -d '{
+          "scope": {
+            "ueId": "UE 1",
+            "cellId": "Cell 1"
+          },
+          "qosObjectives": {
+            "gfbr": 319.5,
+            "mfbr": 782.75,
+            "priorityLevel": 268.5,
+            "pdb": 44.0
+          },
+          "qoeObjectives": {
+            "qoeScore": 329.0,
+            "initialBuffering": 27.75,
+            "reBuffFreq": 539.0,
+            "stallRatio": 343.0
+          },
+          "resources": []
+        }'
+
+**Result**:
 
-    Result:
-      200
+200
 
 DELETE
 ++++++
 
-  Deletes a policy. **Note!** Calls to this method will also trigger "*Keep Alive*" for a service which has a
-  "*Keep Alive Interval*" registered.
+Deletes a policy. **Note!** Calls to this method will also trigger "*Keep Alive*" for a service which has a
+"*Keep Alive Interval*" registered.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/policy?id=<policy-id>
 
-  **URL path:**
-    /policy?id=<policy-id>
+**Parameters:**
 
-  **Parameters:**
+id: (*Required*)
 
-    id: (*Required*)
-      The ID of the policy instance.
+The ID of the policy instance.
 
-  **Responses:**
+**Responses:**
 
-    204:
-          Policy deleted.
+204:
 
-    404:
-          Policy is not found.
+Policy deleted.
 
-    423:
-          Near |nbh| RT |nbsp| RIC is not operational.
+404:
 
-  **Examples:**
+Policy is not found.
 
-    Call: ::
+423:
 
-      curl -X DELETE "http://localhost:8081/policy?id=Policy 1"
+Near |nbh| RT |nbsp| RIC is not operational.
 
-    Result:
-      204
+Examples
+""""""""
+
+**Call**: ::
+
+  curl -X DELETE "http://localhost:8081/policy?id=Policy 1"
+
+**Result**:
+
+204
 
 /policy_ids
 ~~~~~~~~~~~
@@ -812,53 +928,65 @@ DELETE
 GET
 +++
 
-  Query policy type IDs.
+Query policy type IDs.
+
+Definition
+""""""""""
+
+**URL path:**
+
+/policy_ids?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
 
-  **URL path:**
-    /policy_ids?ric=<name-of-ric>&service=<name-of-service>&type=<name-of-policy-type>
+**Parameters:**
 
-  **Parameters:**
+ric: (*Optional*)
 
-    ric: (*Optional*)
-      The name of the Near |nbh| RT |nbsp| RIC to get policies for.
+The name of the Near |nbh| RT |nbsp| RIC to get policies for.
 
-    service: (*Optional*)
-      The name of the service to get policies for.
+service: (*Optional*)
 
-    type: (*Optional*)
-      The name of the policy type to get policies for.
+The name of the service to get policies for.
 
-  **Responses:**
+type: (*Optional*)
 
-    200:
-          Array of policy type names.
+The name of the policy type to get policies for.
 
-    404:
-          RIC or policy type not found.
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+Array of policy type names.
 
-      curl -X GET "http://localhost:8081/policy_ids"
+404:
 
-    Result:
-      200: ::
+RIC or policy type not found.
 
-         [
-           "Policy 1",
-           "Policy 2",
-           "Policy 3"
-        ]
+Examples
+""""""""
 
-    Call: ::
+**Call**: ::
 
-      curl -X GET "http://localhost:8081/policy_ids?ric=nonexistent"
+  curl -X GET "http://localhost:8081/policy_ids"
 
-    Result:
-       404: ::
+**Result**:
 
-         Ric not found
+200: ::
+
+  [
+    "Policy 1",
+    "Policy 2",
+    "Policy 3"
+  ]
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/policy_ids?ric=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Ric not found
 
 /policy_status
 ~~~~~~~~~~~~~~
@@ -866,75 +994,90 @@ GET
 GET
 +++
 
-  Returns the status of a policy.
+Returns the status of a policy.
+
+Definition
+""""""""""
 
-  **URL path:**
-    /policy_status?id=<policy-id>
+**URL path:**
 
-  **Parameters:**
+/policy_status?id=<policy-id>
 
-    id: (*Required*)
-      The ID of the policy.
+**Parameters:**
 
-  **Responses:**
+id: (*Required*)
 
-    200:
-          JSON object with policy status.
+The ID of the policy.
 
-    404:
-          Policy not found.
+**Responses:**
 
+200:
+
+JSON object with policy status.
+
+404:
+
+Policy not found.
+
+**********************
 Near-RT RIC Repository
-======================
+**********************
 
 The Policy Agent keeps an updated view of the Near |nbh| RT |nbsp| RICs that are available in the system. A service can
 find out which Near |nbh| RT |nbsp| RIC that manages a specific element in the network or which
 Near |nbh| RT |nbsp| RICs that support a specific policy type.
 
-Near-RT RIC
------------
-
 /ric
 ~~~~
 
 GET
 +++
 
-  Returns the name of a Near |nbh| RT |nbsp| RIC managing a specific Mananged Element.
+Returns the name of a Near |nbh| RT |nbsp| RIC managing a specific Mananged Element.
+
+Definition
+""""""""""
 
-   **URL path:**
-    /ric?managedElementId=<id-of-managed-element>
+**URL path:**
 
-  **Parameters:**
+/ric?managedElementId=<id-of-managed-element>
 
-    managedElementId: (*Required*)
-      The ID of the Managed Element.
+**Parameters:**
 
-  **Responses:**
+managedElementId: (*Required*)
 
-    200:
-          Name of the Near |nbh| RT |nbsp| RIC managing the Managed Element.
+The ID of the Managed Element.
 
-    404:
-          No Near |nbh| RT |nbsp| RIC manages the given Managed Element.
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+Name of the Near |nbh| RT |nbsp| RIC managing the Managed Element.
 
-      curl -X GET "http://localhost:8081/ric?managedElementId=Node 1"
+404:
 
-    Result:
-      200: ::
+No Near |nbh| RT |nbsp| RIC manages the given Managed Element.
 
-        Ric 1
+Examples
+""""""""
 
-    Call: ::
+**Call**: ::
 
-      curl -X GET "http://localhost:8081/ric?managedElementId=notmanaged"
+  curl -X GET "http://localhost:8081/ric?managedElementId=Node 1"
 
-    Result:
-       404
+**Result**:
+
+200: ::
+
+  Ric 1
+
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/ric?managedElementId=notmanaged"
+
+**Result**:
+
+404
 
 /rics
 ~~~~~
@@ -942,91 +1085,99 @@ GET
 GET
 +++
 
-  Query Near |nbh| RT |nbsp| RIC information.
+Query Near |nbh| RT |nbsp| RIC information.
 
-   **URL path:**
-    /rics?policyType=<name-of-policy-type>
+Definition
+""""""""""
 
-  **Parameters:**
+**URL path:**
 
-    policyType: (*Optional*)
-      The name of the policy type.
+/rics?policyType=<name-of-policy-type>
 
-  **Responses:**
+**Parameters:**
 
-    200:
-          Array of JSON objects containing Near |nbh| RT |nbsp| RIC information. ::
+policyType: (*Optional*)
 
-            [
-              {
-                "managedElementIds": [
-                  "string"
-                ],
-                "policyTypes": [
-                  "string"
-                ],
-                "ricName": "string",
-                "state": "string"
-              }
-            ]
+The name of the policy type.
 
-    404:
-          Policy type is not found.
+**Responses:**
 
-  **Examples:**
+200:
 
-    Call: ::
+Array of JSON objects containing Near |nbh| RT |nbsp| RIC information. ::
 
-      curl -X GET "http://localhost:8081/rics?policyType=STD_PolicyModelUnconstrained_0.2.0"
+  [
+    {
+      "managedElementIds": [
+        "string"
+      ],
+      "policyTypes": [
+        "string"
+      ],
+      "ricName": "string",
+      "state": "string"
+    }
+  ]
 
-    Result:
-      200: ::
+404:
 
-        [
-          {
-            "managedElementIds": [
-              "ME 1",
-              "ME 2"
-            ],
-            "policyTypes": [
-              "STD_PolicyModelUnconstrained_0.2.0",
-              "Example_QoETarget_1.0.0",
-              "ERIC_QoSNudging_0.2.0"
-            ],
-            "ricName": "Ric 1",
-            "state": "AVAILABLE"
-          },
-            .
-            .
-            .
-          {
-            "managedElementIds": [
-              "ME 3"
-            ],
-            "policyTypes": [
-              "STD_PolicyModelUnconstrained_0.2.0"
-            ],
-            "ricName": "Ric X",
-            "state": "UNAVAILABLE"
-          }
-        ]
+Policy type is not found.
 
-    Call: ::
+Examples
+""""""""
 
-      curl -X GET "http://localhost:8081/rics?policyType=nonexistent"
+**Call**: ::
 
-    Result:
-       404: ::
+  curl -X GET "http://localhost:8081/rics?policyType=STD_PolicyModelUnconstrained_0.2.0"
 
-        Policy type not found
+**Result**:
 
-Health Check
-============
+200: ::
 
-The status of the Policy Agent.
+  [
+    {
+      "managedElementIds": [
+        "ME 1",
+        "ME 2"
+      ],
+      "policyTypes": [
+        "STD_PolicyModelUnconstrained_0.2.0",
+        "Example_QoETarget_1.0.0",
+        "ERIC_QoSNudging_0.2.0"
+      ],
+      "ricName": "Ric 1",
+      "state": "AVAILABLE"
+    },
+      .
+      .
+      .
+    {
+      "managedElementIds": [
+        "ME 3"
+      ],
+      "policyTypes": [
+        "STD_PolicyModelUnconstrained_0.2.0"
+      ],
+      "ricName": "Ric X",
+      "state": "UNAVAILABLE"
+    }
+  ]
 
+**Call**: ::
+
+  curl -X GET "http://localhost:8081/rics?policyType=nonexistent"
+
+**Result**:
+
+404: ::
+
+  Policy type not found
+
+************
 Health Check
-------------
+************
+
+The status of the Policy Agent.
 
 /status
 ~~~~~~~
@@ -1034,28 +1185,35 @@ Health Check
 GET
 +++
 
-  Returns the status of the Policy Agent.
+Returns the status of the Policy Agent.
 
-   **URL path:**
-    /status
+Definition
+""""""""""
 
-  **Parameters:**
+**URL path:**
 
-    None.
+/status
+
+**Parameters:**
+
+None.
 
-  **Responses:**
+**Responses:**
 
-    200:
-          Service is living.
+200:
 
-  **Examples:**
+Service is living.
 
-    Call: ::
+Examples
+""""""""
 
-      curl -X GET "http://localhost:8081/status"
+**Call**: ::
 
-    Result:
-      200
+  curl -X GET "http://localhost:8081/status"
+
+**Result**:
+
+200
 
 ****************
 A1 through DMaaP
@@ -1066,7 +1224,7 @@ Policy Agent polls the DMaaP Message Router regularly and processes any messages
 published back to the DMaaP Message Router with the result of the call.
 
 Send Message
-============
+~~~~~~~~~~~~
 
 The message to send is a JSON like the one below. The "*url*" is one of the URLs described under
 :ref:`policy-management`. The "*target*" must always be "*policy-agent*" for the message to be processed by the Policy
@@ -1085,7 +1243,7 @@ Agent. The "*operation*" can be one of the following: "*GET | PUT | POST | DELET
   }
 
 Example
--------
++++++++
 
 To get all policy types for a specific Near |nbh| RT |nbsp| RIC the following message should be sent to DMaaP Message
 Router: ::
@@ -1103,7 +1261,7 @@ Router: ::
   }
 
 Receive Message
-===============
+~~~~~~~~~~~~~~~
 
 The message the Policy Agent sends back to the DMaaP Message Router is a JSON like the one below. The "*requestId*"
 "*correlationId*", and "*originatorId*" are the same as in the message sent to DMaaP MR. ::
@@ -1114,13 +1272,13 @@ The message the Policy Agent sends back to the DMaaP Message Router is a JSON li
     "originatorId": "string",
     "type": "string",
     "message": "string",
-    "type":  string",
+    "type":  "string",
     "timestamp": "string",
     "status": "string"
   }
 
 Example
--------
++++++++
 
 The response containing all policy types for a specific Near |nbh| RT |nbsp| RIC sent to the DMaaP Message Router from
 the Policy Agent: ::