From 800186b823c1a335553aa81ae6885ec9a7e429c4 Mon Sep 17 00:00:00 2001 From: Ruoyu Ying Date: Mon, 25 Mar 2019 00:44:48 +0800 Subject: Add policy list schema for dublin Add schema to list all available policies inside PDP. Change-Id: I67e326ad54f343b27e23a92dcf42263b55a7715c Issue-ID: CLI-140 Signed-off-by: Ruoyu Ying --- .../policy-list-outdated-schema-dublin-moco.json | 40 ++++++++++ .../policy-list-outdated-schema-dublin-sample.yaml | 25 ++++++ .../policy/policy-list-outdated-schema-dublin.yaml | 88 ++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-moco.json create mode 100644 products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-sample.yaml create mode 100644 products/onap-dublin/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-dublin.yaml (limited to 'products/onap-dublin/features') diff --git a/products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-moco.json b/products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-moco.json new file mode 100644 index 00000000..f9b2aaa0 --- /dev/null +++ b/products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-moco.json @@ -0,0 +1,40 @@ +[ { + "request" : { + "method" : "post", + "uri" : "/pdp/api/getConfig", + "headers" : { + "Authorization" : "Basic dGVzdHBkcDphbHBoYTEyMw==", + "X-FromAppId" : "ONAP CLI", + "Accept" : "application/json", + "Environment" : "TEST", + "X-TransactionId" : "req-6daad440-515a-4134-94bb-4fdf99cdc92e", + "ClientAuth" : "cHl0aG9uOnRlc3Q=", + "Content-Type" : "application/json" + }, + "json" : { + "configAttributes" : { }, + "policyName" : ".*" + } + }, + "response" : { + "status" : 200, + "json" : [ { + "policyConfigMessage" : "Config Retrieved! ", + "policyConfigStatus" : "CONFIG_RETRIEVED", + "type" : "JSON", + "config" : "{\"service\":\"distancePolicy\",\"guard\":\"False\",\"content\":{\"policyType\":\"distance_to_location\",\"applicableResources\":\"any\",\"identity\":\"distance-vLB\",\"policyScope\":[\"vlb\",\"us\",\"international\",\"ip\"],\"distanceProperties\":{\"distance\":{\"value\":\"100\",\"unit\":\"km\",\"operator\":\"<\"},\"locationInfo\":\"customer_loc\"},\"resources\":[\"vLB\",\"VlbhpaSriov\"]},\"priority\":\"3\",\"templateVersion\":\"OpenSource.version.1\",\"riskLevel\":\"2\",\"description\":\"Distance Policy for vLB\",\"policyName\":\"OSDF_CASABLANCA.Distance_vLBHPA_SRIOV_1\",\"version\":\"test1\",\"riskType\":\"test\"}", + "policyName" : "OSDF_CASABLANCA.Config_MS_Distance_vLBHPA_SRIOV_1.1.xml", + "policyType" : "MicroService", + "policyVersion" : "1", + "matchingConditions" : { + "ECOMPName" : "SampleDemo", + "ONAPName" : "SampleDemo", + "service" : "distancePolicy", + "policyScope" : "vlb,us,international,ip", + "policyType" : "distance_to_location" + }, + "responseAttributes" : { }, + "property" : null + } ] + } +} ] diff --git a/products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-sample.yaml b/products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-sample.yaml new file mode 100644 index 00000000..176f822e --- /dev/null +++ b/products/onap-dublin/features/policy/src/main/resources/open-cli-sample/policy/policy-list-outdated-schema-dublin-sample.yaml @@ -0,0 +1,25 @@ +open_cli_sample_version: 1.0 +name: policy-list-outdated +version: onap-dublin +samples: + sample1: + name: policy-list-outdated + input: -m https://10.12.6.129:30694 -u testpdp -p alpha123 + moco: policy-list-outdated-schema-dublin-moco.json + output: | + +----------------------------------------------------+--------------+----------------------------------------------------+ + |name |type |config | + +----------------------------------------------------+--------------+----------------------------------------------------+ + |OSDF_CASABLANCA.Config_MS_Distance_vLBHPA_SRIOV_1. |MicroService |{"service":"distancePolicy","guard":"False","conte | + |1.xml | |nt":{"policyType":"distance_to_location","applicab | + | | |leResources":"any","identity":"distance-vLB","poli | + | | |cyScope":["vlb","us","international","ip"],"distan | + | | |ceProperties":{"distance":{"value":"100","unit":"k | + | | |m","operator":"<"},"locationInfo":"customer_loc"}, | + | | |"resources":["vLB","VlbhpaSriov"]},"priority":"3", | + | | |"templateVersion":"OpenSource.version.1","riskLeve | + | | |l":"2","description":"Distance Policy for vLB","po | + | | |licyName":"OSDF_CASABLANCA.Distance_vLBHPA_SRIOV_1 | + | | |","version":"test1","riskType":"test"} | + +----------------------------------------------------+--------------+----------------------------------------------------+ + diff --git a/products/onap-dublin/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-dublin.yaml b/products/onap-dublin/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-dublin.yaml new file mode 100644 index 00000000..17769848 --- /dev/null +++ b/products/onap-dublin/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-dublin.yaml @@ -0,0 +1,88 @@ +# Copyright 2019 Intel Corporation. +# +# 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-list-outdated +description: List policies + +info: + product: onap-dublin + service: policy + author: ONAP HPA Team onap-discuss@lists.onap.org + +parameters: + - name: policy-name + description: ONAP policy name + type: string + long_option: policy-name + 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: {} + +results: + direction: landscape + attributes: + - name: name + description: Policy Name + scope: short + type: string + - name: type + description: Policy type + 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 + version: v1.0 + auth: basic + mode: direct + request: + uri: /pdp/api/getConfig + method: POST + body: '{"configAttributes": "${config-attributes}", "policyName": "${policy-name}"}' + 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} + -- cgit 1.2.3-korg