From 03a0083c52637cf25f75f41169da9de0f33cb786 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Fri, 22 Nov 2019 09:15:35 -0500 Subject: [PATCH] Update AC, break out xapp contract from a1 api spec Change-Id: I931e421a2524e4ac923aef48858151c9f273ec3d Signed-off-by: Tommy Carpenter --- a1/openapi.yaml | 65 --------------------------- docs/a1_xapp_contract_openapi.yaml | 84 +++++++++++++++++++++++++++++++++++ docs/overview.rst | 4 +- integration_tests/test_a1.tavern.yaml | 37 ++++++++------- 4 files changed, 107 insertions(+), 83 deletions(-) create mode 100644 docs/a1_xapp_contract_openapi.yaml diff --git a/a1/openapi.yaml b/a1/openapi.yaml index bc5ee12..c8c0bd9 100644 --- a/a1/openapi.yaml +++ b/a1/openapi.yaml @@ -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" - - 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 index 0000000..3a0427f --- /dev/null +++ b/docs/a1_xapp_contract_openapi.yaml @@ -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 diff --git a/docs/overview.rst b/docs/overview.rst index c015097..183f655 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -39,7 +39,7 @@ Integrating Xapps with A1 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 @@ -47,6 +47,6 @@ Xapps 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) diff --git a/integration_tests/test_a1.tavern.yaml b/integration_tests/test_a1.tavern.yaml index 78628cd..44eeb3d 100644 --- a/integration_tests/test_a1.tavern.yaml +++ b/integration_tests/test_a1.tavern.yaml @@ -48,32 +48,34 @@ stages: create_schema: "$schema": http://json-schema.org/draft-07/schema# type: object + additionalProperties: false properties: + class: + type: integer + minimum: 1 + maximum: 256 + description: integer id representing class to which we are applying policy enforce: type: boolean - default: true + description: Whether to enable or disable enforcement of policy on this class window_length: type: integer - default: 1 + minimum: 15 + maximum: 300 + description: Sliding window length in seconds + trigger_threshold: + type: integer minimum: 1 - maximum: 60 - description: Sliding window length (in minutes) blocking_rate: type: number - default: 10 - minimum: 1 + minimum: 0 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: + - class - enforce - - blocking_rate - - trigger_threshold - window_length + - trigger_threshold + - blocking_rate 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: + class: 12 enforce: true - window_length: 10 + window_length: 20 blocking_rate: 20 trigger_threshold: 10 headers: @@ -164,11 +167,13 @@ stages: response: status_code: 200 body: + class: 12 enforce: true - window_length: 10 + window_length: 20 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: -- 2.16.6