From bbb2390ab68bd81d6c1c456607939ae5b34bc6cd Mon Sep 17 00:00:00 2001 From: Ruoyu Ying Date: Thu, 30 Apr 2020 18:32:55 +0800 Subject: Add new policy api for Frankfurt release Issue-ID: CLI-269 Signed-off-by: Ruoyu Ying Change-Id: I8036303cfe4e5147e66674b46ee1c5b1e12986c0 Signed-off-by: Ruoyu Ying --- .../basic-login-onap-policy-elalto.yaml | 10 --- .../policy/policy-create-schema-elalto.yaml | 71 ++++++++++++++++++++++ .../policy/policy-list-outdated-schema-elalto.yaml | 69 ++++++++------------- .../policy/policy-list-schema-elalto.yaml | 35 +++++------ 4 files changed, 110 insertions(+), 75 deletions(-) create mode 100644 products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-create-schema-elalto.yaml (limited to 'products/onap-elalto') diff --git a/products/onap-elalto/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-elalto.yaml b/products/onap-elalto/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-elalto.yaml index 0916c202..e539c603 100644 --- a/products/onap-elalto/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-elalto.yaml +++ b/products/onap-elalto/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-elalto.yaml @@ -33,13 +33,3 @@ results: description: Authorization scope: short type: string - - name: Environment - description: Environment - scope: short - type: string - default_value: TEST - - name: ClientAuth - description: Client Auth - scope: short - type: string - default_value: cHl0aG9uOnRlc3Q= diff --git a/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-create-schema-elalto.yaml b/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-create-schema-elalto.yaml new file mode 100644 index 00000000..b03ccba2 --- /dev/null +++ b/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-create-schema-elalto.yaml @@ -0,0 +1,71 @@ +# Copyright © Intel Corporation 2019 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +open_cli_schema_version: 1.0 +name: policy-create +description: Create a policy thru policy-api + +info: + product: onap-elalto + service: policy + author: ONAP CLI Team onap-discuss@lists.onap.org + +parameters: + - name: policy-name + description: Onap policy Name + type: string + short_option: x + long_option: policy-name + is_optional: false + - name: policy-body + description: Policy body + type: json + long_option: policy-body + short_option: b + is_optional: false + - name: policy-type + description: Onap policy type + type: string + short_option: T + long_option: policy-type + is_optional: false + - name: policy-version + description: Onap policy Version + type: string + short_option: S + long_option: policy-version + is_optional: false + +http: + service: + name: policy + version: v1.0 + auth: basic + mode: direct + request: + uri: /policy/api/v1/policytypes/${policy-type}/versions/${policy-version}/policies + method: POST + context: + remove_empty_node: true + body: '{"tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [{ + "${policy-name}": "${policy-body}"}]}}' + headers: + Content-Type: application/json + Accept: application/json + + success_codes: + - 200 + - 201 diff --git a/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-elalto.yaml b/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-elalto.yaml index 4d607f30..0b847b0f 100644 --- a/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-elalto.yaml +++ b/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-elalto.yaml @@ -1,4 +1,4 @@ -# Copyright 2019 Intel Corporation. +# Copyright 2019 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,53 +13,42 @@ # limitations under the License. open_cli_schema_version: 1.0 -name: policy-list-outdated -description: List policies +name: policy-list +description: Retrieve all version details of a policy created for a particular policy type version info: product: onap-elalto service: policy - author: ONAP HPA Team onap-discuss@lists.onap.org + author: ONAP CLI Team onap-discuss@lists.onap.org parameters: - - name: policy-name - description: ONAP policy name + - name: policy-type-id + description: Policy type ID type: string - long_option: policy-name + long_option: policy-type-id short_option: x is_optional: false - default_value: .* - - name: config-attributes - description: Configuration Attributes - type: json - long_option: config-attributes - short_option: A - is_optional: true - default_value: {} + - name: version-id + description: Policy type version ID + type: string + long_option: version-id + short_option: y + is_optional: false + - name: policy-id + description: Policy ID + type: string + long_option: policy-id + short_option: z + is_optional: false results: direction: landscape attributes: - - name: name - description: Policy Name - scope: short - type: string - - name: type - description: Policy type + - name: Policy properties + description: Policy properties scope: short - type: string - - name: config - description: Policy configuration - scope: short - type: json - - name: version - description: Policy version - scope: long - type: string - - name: rules - description: Policy rules - scope: long type: json + http: service: name: policy @@ -67,22 +56,14 @@ http: auth: basic mode: direct request: - uri: /pdp/api/getConfig - method: POST - body: '{"configAttributes": "${config-attributes}", "policyName": "${policy-name}"}' + uri: /policy/api/v1/policytypes/${policy-type-id}/versions/${version-id}/policies/${policy-id} + method: GET headers: Accept: application/json - ClientAuth: cHl0aG9uOnRlc3Q= Environment: TEST - success_codes: - 200 result_map: - name: $b{$.[*].policyName} - type: $b{$.[*].policyType} - version: $b{$.[*].policyVersion} - config: $b{$.[*].config} - rules: $b{$.[*].matchingConditions} - + Policy properties: $b{$.[*]} diff --git a/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-elalto.yaml b/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-elalto.yaml index 0b847b0f..c25a64a7 100644 --- a/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-elalto.yaml +++ b/products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-elalto.yaml @@ -13,8 +13,8 @@ # limitations under the License. open_cli_schema_version: 1.0 -name: policy-list -description: Retrieve all version details of a policy created for a particular policy type version +name: policy-list-with-config +description: Retrieve policies according to configs info: product: onap-elalto @@ -22,24 +22,12 @@ info: author: ONAP CLI Team onap-discuss@lists.onap.org parameters: - - name: policy-type-id - description: Policy type ID - type: string - long_option: policy-type-id + - name: config-attributes + description: Policy retrieval config attributes + type: json + long_option: config-attributes short_option: x is_optional: false - - name: version-id - description: Policy type version ID - type: string - long_option: version-id - short_option: y - is_optional: false - - name: policy-id - description: Policy ID - type: string - long_option: policy-id - short_option: z - is_optional: false results: direction: landscape @@ -56,11 +44,16 @@ http: auth: basic mode: direct request: - uri: /policy/api/v1/policytypes/${policy-type-id}/versions/${version-id}/policies/${policy-id} - method: GET + uri: /policy/pdpx/v1/decision + method: POST + body: '{"ONAPName": "OOF", + "ONAPComponent": "OOF_Component", + "ONAPInstance": "OOF_Component_Instance", + "action": "optimize", + "resources": "${config-attributes}"}' headers: Accept: application/json - Environment: TEST + success_codes: - 200 -- cgit 1.2.3-korg