Update AC, break out xapp contract from a1 api spec 37/1737/4
authorTommy Carpenter <tc677g@att.com>
Fri, 22 Nov 2019 14:15:35 +0000 (09:15 -0500)
committerTommy Carpenter <tc677g@att.com>
Fri, 22 Nov 2019 14:27:35 +0000 (09:27 -0500)
Change-Id: I931e421a2524e4ac923aef48858151c9f273ec3d
Signed-off-by: Tommy Carpenter <tc677g@att.com>
a1/openapi.yaml
docs/a1_xapp_contract_openapi.yaml [new file with mode: 0644]
docs/overview.rst
integration_tests/test_a1.tavern.yaml

index bc5ee12..c8c0bd9 100644 (file)
@@ -329,68 +329,3 @@ components:
         represents a policy instance identifier. UUIDs are advisable but can be any string
       type: string
       example: "3d2157af-6a8f-4a7c-810f-38c2f824bf12"
         represents a policy instance identifier. UUIDs are advisable but can be any string
       type: string
       example: "3d2157af-6a8f-4a7c-810f-38c2f824bf12"
-
-    downstream_message_schema:
-      type: object
-      required:
-        - operation
-        - policy_type_id
-        - policy_instance_id
-        - payload
-      additionalProperties: false
-      properties:
-        operation:
-          description: the operation being performed
-          type: string
-          enum:
-            - CREATE
-            - DELETE
-            - UPDATE
-            - READ
-        policy_type_id:
-          "$ref": "#/components/schemas/policy_type_id"
-        policy_instance_id:
-          "$ref": "#/components/schemas/policy_instance_id"
-        payload:
-          description: payload for this operation
-          type: object
-      example:
-        operation: CREATE
-        policy_type_id: 12345678
-        policy_instance_id: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
-        payload:
-          enforce: true
-          window_length: 10
-          blocking_rate: 20
-          trigger_threshold: 10
-
-    downstream_notification_schema:
-      type: object
-      required:
-        - policy_type_id
-        - policy_instance_id
-        - handler_id
-        - status
-      additionalProperties: false
-      properties:
-        policy_type_id:
-          "$ref": "#/components/schemas/policy_type_id"
-        policy_instance_id:
-          "$ref": "#/components/schemas/policy_instance_id"
-        handler_id:
-          description: >
-            id of the policy handler
-          type: string
-        status:
-          description: >
-            the status of this policy instance in this handler
-          type: string
-          enum:
-            - OK
-            - ERROR
-            - DELETED
-      example:
-        policy_type_id: 12345678
-        policy_instance_id: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
-        handler_id: 1234-5678
-        status: OK
diff --git a/docs/a1_xapp_contract_openapi.yaml b/docs/a1_xapp_contract_openapi.yaml
new file mode 100644 (file)
index 0000000..3a0427f
--- /dev/null
@@ -0,0 +1,84 @@
+openapi: 3.0.0
+info:
+  version: 1.0.0
+  title: Contract between A1 and RIC Xapps
+
+components:
+  schemas:
+
+    policy_type_id:
+      description: >
+        represents a policy type identifier. Currently this is restricted to an integer range.
+      type: integer
+      minimum: 1
+      maximum: 2147483647
+
+    policy_instance_id:
+      description: >
+        represents a policy instance identifier. UUIDs are advisable but can be any string
+      type: string
+      example: "3d2157af-6a8f-4a7c-810f-38c2f824bf12"
+
+    downstream_message_schema:
+      type: object
+      required:
+        - operation
+        - policy_type_id
+        - policy_instance_id
+        - payload
+      additionalProperties: false
+      properties:
+        operation:
+          description: the operation being performed
+          type: string
+          enum:
+            - CREATE
+            - DELETE
+            - UPDATE
+        policy_type_id:
+          "$ref": "#/components/schemas/policy_type_id"
+        policy_instance_id:
+          "$ref": "#/components/schemas/policy_instance_id"
+        payload:
+          description: payload for this operation
+          type: object
+      example:
+        operation: CREATE
+        policy_type_id: 12345678
+        policy_instance_id: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
+        payload:
+          enforce: true
+          window_length: 10
+          blocking_rate: 20
+          trigger_threshold: 10
+
+    downstream_notification_schema:
+      type: object
+      required:
+        - policy_type_id
+        - policy_instance_id
+        - handler_id
+        - status
+      additionalProperties: false
+      properties:
+        policy_type_id:
+          "$ref": "#/components/schemas/policy_type_id"
+        policy_instance_id:
+          "$ref": "#/components/schemas/policy_instance_id"
+        handler_id:
+          description: >
+            id of the policy handler
+          type: string
+        status:
+          description: >
+            the status of this policy instance in this handler
+          type: string
+          enum:
+            - OK
+            - ERROR
+            - DELETED
+      example:
+        policy_type_id: 12345678
+        policy_instance_id: 3d2157af-6a8f-4a7c-810f-38c2f824bf12
+        handler_id: 1234-5678
+        status: OK
index c015097..183f655 100644 (file)
@@ -39,7 +39,7 @@ Integrating Xapps with A1
 
 A1 to Xapps
 ~~~~~~~~~~~
 
 A1 to Xapps
 ~~~~~~~~~~~
-When A1 sends a message to xapps, the schema for messages from A1 to the xapp is defined here: https://gerrit.o-ran-sc.org/r/gitweb?p=ric-plt/a1.git;a=blob;f=a1/openapi.yaml;h=fed4b77546264cc8a390504dae725ca15060d81a;hb=97f5cc3e3d42e1525af61560d01c4a824b0b2ad9#l324
+When A1 sends a message to xapps, the schema for messages from A1 to the xapp is defined by ``downstream_message_schema`` in ``docs/a1_xapp_contract_openapi.yaml``
 
 All policy instance requests get sent from A1 using message type 20010
 
 
 All policy instance requests get sent from A1 using message type 20010
 
@@ -47,6 +47,6 @@ Xapps to A1
 ~~~~~~~~~~~
 There are three scenarios in which Xapps are to send a message to A1:
 
 ~~~~~~~~~~~
 There are three scenarios in which Xapps are to send a message to A1:
 
-1. When an xapp receives a CREATE or UPDATE message for a policy instance. Xapps must respond to these requests by sending a message of type 20011 to A1. The schema for that message is here: https://gerrit.o-ran-sc.org/r/gitweb?p=ric-plt/a1.git;a=blob;f=a1/openapi.yaml;h=fed4b77546264cc8a390504dae725ca15060d81a;hb=97f5cc3e3d42e1525af61560d01c4a824b0b2ad9#l358
+1. When an xapp receives a CREATE or UPDATE message for a policy instance. Xapps must respond to these requests by sending a message of type 20011 to A1. The schema for that message is defined by ``downstream_notification_schema`` in ``docs/a1_xapp_contract_openapi.yaml``
 2. Since policy instances can "deprecate" other instances, there are times when xapps need to asyncronously tell A1 that a policy is no longer active. Same message type and schema. The only difference between case 1 and 2 is that case 1 is a "reply" and case 2 is "unsolicited".
 3. Xapps can request A1 to re-send all instances of a type using a query, message 20012. When A1 receives this (TBD HERE, STILL BE WORKED OUT)
 2. Since policy instances can "deprecate" other instances, there are times when xapps need to asyncronously tell A1 that a policy is no longer active. Same message type and schema. The only difference between case 1 and 2 is that case 1 is a "reply" and case 2 is "unsolicited".
 3. Xapps can request A1 to re-send all instances of a type using a query, message 20012. When A1 receives this (TBD HERE, STILL BE WORKED OUT)
index 78628cd..44eeb3d 100644 (file)
@@ -48,32 +48,34 @@ stages:
         create_schema:
           "$schema": http://json-schema.org/draft-07/schema#
           type: object
         create_schema:
           "$schema": http://json-schema.org/draft-07/schema#
           type: object
+          additionalProperties: false
           properties:
           properties:
+            class:
+              type: integer
+              minimum: 1
+              maximum: 256
+              description: integer id representing class to which we are applying policy
             enforce:
               type: boolean
             enforce:
               type: boolean
-              default: true
+              description: Whether to enable or disable enforcement of policy on this class
             window_length:
               type: integer
             window_length:
               type: integer
-              default: 1
+              minimum: 15
+              maximum: 300
+              description: Sliding window length in seconds
+            trigger_threshold:
+              type: integer
               minimum: 1
               minimum: 1
-              maximum: 60
-              description: Sliding window length (in minutes)
             blocking_rate:
               type: number
             blocking_rate:
               type: number
-              default: 10
-              minimum: 1
+              minimum: 0
               maximum: 100
               maximum: 100
-              description: "% Connections to block"
-            trigger_threshold:
-              type: integer
-              default: 10
-              minimum: 1
-              description: Minimum number of events in window to trigger blocking
           required:
           required:
+            - class
             - enforce
             - enforce
-            - blocking_rate
-            - trigger_threshold
             - window_length
             - window_length
+            - trigger_threshold
+            - blocking_rate
           additionalProperties: false
     response:
       status_code: 201
           additionalProperties: false
     response:
       status_code: 201
@@ -140,8 +142,9 @@ stages:
       url: http://localhost:10000/a1-p/policytypes/6660666/policies/admission_control_policy
       method: PUT
       json:
       url: http://localhost:10000/a1-p/policytypes/6660666/policies/admission_control_policy
       method: PUT
       json:
+        class: 12
         enforce: true
         enforce: true
-        window_length: 10
+        window_length: 20
         blocking_rate: 20
         trigger_threshold: 10
       headers:
         blocking_rate: 20
         trigger_threshold: 10
       headers:
@@ -164,11 +167,13 @@ stages:
     response:
       status_code: 200
       body:
     response:
       status_code: 200
       body:
+        class: 12
         enforce: true
         enforce: true
-        window_length: 10
+        window_length: 20
         blocking_rate: 20
         trigger_threshold: 10
 
         blocking_rate: 20
         trigger_threshold: 10
 
+
   - name: test the admission control policy status get
     delay_before: 3 # give it a few seconds for rmr
     request:
   - name: test the admission control policy status get
     delay_before: 3 # give it a few seconds for rmr
     request: