Add new policy api for Frankfurt release 63/106863/3
authorRuoyu Ying <ruoyu.ying@intel.com>
Thu, 30 Apr 2020 10:32:55 +0000 (18:32 +0800)
committerRuoyu Ying <ruoyu.ying@intel.com>
Tue, 5 May 2020 20:19:06 +0000 (04:19 +0800)
Issue-ID: CLI-269
Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
Change-Id: I8036303cfe4e5147e66674b46ee1c5b1e12986c0
Signed-off-by: Ruoyu Ying <ruoyu.ying@intel.com>
products/onap-elalto/auth/src/main/resources/open-cli-schema/basic-login-onap-policy-elalto.yaml
products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-create-schema-elalto.yaml [new file with mode: 0644]
products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-outdated-schema-elalto.yaml
products/onap-elalto/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-elalto.yaml

index 0916c20..e539c60 100644 (file)
@@ -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 (file)
index 0000000..b03ccba
--- /dev/null
@@ -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
index 4d607f3..0b847b0 100644 (file)
@@ -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.
 # 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{$.[*]}
index 0b847b0..c25a64a 100644 (file)
@@ -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