CLI: policy-list 23/39023/1
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 27 Mar 2018 10:07:43 +0000 (15:37 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 27 Mar 2018 10:07:43 +0000 (15:37 +0530)
Issue-ID: CLI-78

Change-Id: If61f2f738e308b24d67424b922c653c53c965e53
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-moco.json [new file with mode: 0644]
products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-sample.yaml [new file with mode: 0644]
products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-beijing.yaml [new file with mode: 0644]

diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-moco.json b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-moco.json
new file mode 100644 (file)
index 0000000..650edeb
--- /dev/null
@@ -0,0 +1,45 @@
+[
+  {
+    "request": {
+      "method": "post",
+      "uri": "/pdp/api/getConfig",
+      "headers": {
+        "Authorization": "Basic dGVzdHBkcDphbHBoYTEyMw==",
+        "ClientAuth": "cHl0aG9uOnRlc3Q=",
+        "Environment": "ONAP-CLI",
+        "Accept": "application/json",
+        "Content-Type": "application/json"
+      },
+      "json": {
+        "configAttributes": {},
+        "unique": false,
+        "ecompName": "DCAE",
+        "configName": ".*",
+        "policyName": ".*vCPE*"
+      }
+    },
+    "response": {
+      "status": 200,
+      "json": [
+        {
+          "policyConfigMessage": "Config Retrieved! ",
+          "policyConfigStatus": "CONFIG_RETRIEVED",
+          "type": "JSON",
+          "config": "{\"service\":\"tca_policy\",\"location\":\"SampleServiceLocation\",\"uuid\":\"test\",\"policyName\":\"MicroServicevCPE\",\"description\":\"MicroService vCPE Policy\",\"configName\":\"SampleConfigName\",\"templateVersion\":\"OpenSource.version.1\",\"version\":\"1.1.0\",\"priority\":\"1\",\"policyScope\":\"resource=SampleResource,service=SampleService,type=SampleType,closedLoopControlName=ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"riskType\":\"SampleRiskType\",\"riskLevel\":\"1\",\"guard\":\"False\",\"content\":{\"policyVersion\":\"v0.0.1\",\"threshholds\":[{\"severity\":\"MAJOR\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":\"0\",\"closedLoopEventStatus\":\"ABATED\",\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"direction\":\"EQUAL\"},{\"severity\":\"CRITICAL\",\"fieldPath\":\"$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value\",\"thresholdValue\":\"0\",\"closedLoopEventStatus\":\"ONSET\",\"closedLoopControlName\":\"ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e\",\"version\":\"1.0.2\",\"direction\":\"GREATER\"}],\"policyName\":\"DCAE.Config_tca-hi-lo\",\"controlLoopSchemaType\":\"VNF\",\"policyScope\":\"DCAE\",\"eventName\":\"Measurement_vGMUX\"}}",
+          "policyName": "com.Config_MS_CSIT_285k2x28vv6flay_vCPE.1.xml",
+          "policyType": "MicroService",
+          "policyVersion": "1",
+          "matchingConditions": {
+            "ONAPName": "DCAE",
+            "ConfigName": "SampleConfigName",
+            "service": "tca_policy",
+            "uuid": "test",
+            "Location": "SampleServiceLocation"
+          },
+          "responseAttributes": {},
+          "property": null
+        }
+      ]
+    }
+  }
+]
\ No newline at end of file
diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-sample.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-sample.yaml
new file mode 100644 (file)
index 0000000..27a96b6
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright 2018 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.
+# 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_sample_version: 1.0
+name: policy-list
+version: onap-beijing
+samples:
+  sample1:
+    name: policy-list
+    input: --no-title --format csv
+    moco: policy-list-schema-beijing-moco.json
+    output: com.Config_MS_CSIT_285k2x28vv6flay_vCPE.1.xml,MicroService
diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-beijing.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-beijing.yaml
new file mode 100644 (file)
index 0000000..9e17616
--- /dev/null
@@ -0,0 +1,71 @@
+# Copyright 2018 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.
+# 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
+description: List policies
+
+info:
+  product: onap-beijing
+  service: policy
+  author: ONAP CLI Team onap-discuss@lists.onap.org
+  state: experimental
+
+parameters:
+  - name: policy-onap-component-name
+    description: ONAP component name
+    type: string
+    long_option: policy-onap-component-name
+    short_option: x
+    is_optional: true
+    default_value: DCAE
+
+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: long
+      type: json
+    - 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": {}, "unique": false, "ecompName": "${policy-onap-component-name}", "configName": ".*", "policyName": ".*"}'
+
+  success_codes:
+    - 200
+
+  result_map:
+    name: $b{$.[*].policyName}
+    type: $b{$.[*].policyType}
+    config: $b{$.[*].config}
+    rules: $b{$.[*].matchingConditions}
\ No newline at end of file