diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2018-03-27 11:19:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-27 11:19:57 +0000 |
commit | 4debf9645be8400ac9b6a087b1d9d829f5ee924a (patch) | |
tree | bc8c1706e842b3b2ef042553672253082e3e74da | |
parent | 1728b94a35c33719e87c664ecc726db4b07dc20c (diff) | |
parent | f3d14df9c66cef6ea1eb84d542fbc47dd6e0d7fc (diff) |
Merge changes Iffcf11d8,If61f2f73,I382d6ece,Ib24080e7,Iafbe217a, ...
* changes:
CLI: policy-operational-create
CLI: policy-list
CLI: policy-config-create
CLI: policy-push
Correct policy auth CLI yaml
Macro fails to subsitute map param
15 files changed, 538 insertions, 18 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java index 9bdd8a51..b10629f4 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java @@ -16,27 +16,43 @@ package org.onap.cli.fw.utils; -import com.fasterxml.jackson.databind.ObjectMapper; +import static org.onap.cli.fw.conf.OnapCommandConstants.DATA_DIRECTORY; +import static org.onap.cli.fw.conf.OnapCommandConstants.DATA_PATH_JSON_PATTERN; +import static org.onap.cli.fw.conf.OnapCommandConstants.DISCOVERY_FILE; +import static org.onap.cli.fw.conf.OnapCommandConstants.NAME; +import static org.onap.cli.fw.conf.OnapCommandConstants.OPEN_CLI_SAMPLE_VERSION; +import static org.onap.cli.fw.conf.OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION; +import static org.onap.cli.fw.conf.OnapCommandConstants.SCHEMA_DIRECTORY; +import static org.onap.cli.fw.conf.OnapCommandConstants.SCHEMA_PATH_PATERN; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.ServiceLoader; + import org.apache.commons.io.FileUtils; import org.onap.cli.fw.cmd.OnapCommand; import org.onap.cli.fw.conf.OnapCommandConfig; import org.onap.cli.fw.conf.OnapCommandConstants; -import org.onap.cli.fw.error.*; -import org.onap.cli.fw.registrar.OnapCommandRegistrar; +import org.onap.cli.fw.error.OnapCommandDiscoveryFailed; +import org.onap.cli.fw.error.OnapCommandException; +import org.onap.cli.fw.error.OnapCommandInstantiationFailed; +import org.onap.cli.fw.error.OnapCommandInvalidSample; +import org.onap.cli.fw.error.OnapCommandInvalidSchema; import org.onap.cli.fw.schema.OnapCommandSchemaInfo; -import org.onap.cli.fw.schema.OnapCommandSchemaLoader; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; import org.yaml.snakeyaml.Yaml; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.*; - -import static org.onap.cli.fw.conf.OnapCommandConstants.*; +import com.fasterxml.jackson.databind.ObjectMapper; public class OnapCommandDiscoveryUtils { diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java index c5ebbc21..accea717 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java @@ -39,6 +39,8 @@ import org.onap.cli.fw.input.OnapCommandParameterType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.jayway.jsonpath.JsonPath; /** @@ -247,18 +249,24 @@ public class OnapCommandUtils { throw new OnapCommandParameterNotFound(paramName); } - String value = params.get(paramName).getValue().toString(); - OnapCommandParameter param = params.get(paramName); if (OnapCommandParameterType.ARRAY.equals(param.getParameterType()) - || OnapCommandParameterType.MAP.equals(param.getParameterType()) || OnapCommandParameterType.JSON.equals(param.getParameterType()) || OnapCommandParameterType.YAML.equals(param.getParameterType())) { // ignore the front and back double quotes in json body - result += line.substring(currentIdx, idxS - 1) + value; + result += line.substring(currentIdx, idxS - 1) + params.get(paramName).getValue().toString(); + currentIdx = idxE + 2; + } else if (OnapCommandParameterType.MAP.equals(param.getParameterType())) { + try { + String value = new ObjectMapper().writeValueAsString(params.get(paramName).getValue()); + result += line.substring(currentIdx, idxS - 1) + value; + } catch (JsonProcessingException e) { // NOSONAR + //never occur as map is coverted to json string here + } + currentIdx = idxE + 2; - } else { - result += line.substring(currentIdx, idxS) + value; + }else { + result += line.substring(currentIdx, idxS) + params.get(paramName).getValue().toString(); currentIdx = idxE + 1; } } diff --git a/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java b/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java index faa4a1f2..b76ec201 100644 --- a/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java +++ b/products/onap-beijing/auth/src/main/java/org/onap/cli/cmd/auth/OnapPolicyBasicAuthLoginCommandBeijing.java @@ -20,7 +20,7 @@ import org.onap.cli.fw.error.OnapCommandException; import org.onap.cli.fw.http.cmd.BasicAuthLoginCommand; import org.onap.cli.fw.schema.OnapCommandSchema; -@OnapCommandSchema(schema = "basic-login-onap-sdc-beijing.yaml") +@OnapCommandSchema(schema = "basic-login-onap-policy-beijing.yaml") public class OnapPolicyBasicAuthLoginCommandBeijing extends BasicAuthLoginCommand { @Override diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-config-create-schema-beijing-moco.json b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-config-create-schema-beijing-moco.json new file mode 100644 index 00000000..746e7f5f --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-config-create-schema-beijing-moco.json @@ -0,0 +1,25 @@ +[ + { + "request": { + "method": "put", + "uri": "/pdp/api/createPolicy", + "headers": { + "Authorization": "Basic dGVzdHBkcDphbHBoYTEyMw==", + "ClientAuth": "cHl0aG9uOnRlc3Q=", + "Environment": "ONAP-CLI", + "Accept": "application/json", + "Content-Type": "application/json" + }, + "json": { + "configBody": "{}", + "policyConfigType": "MicroService", + "policyName": "com.MicroServicevFirewall", + "onapName": "DCAE" + } + }, + "response": { + "status": 200, + "json": {} + } + } +]
\ No newline at end of file diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-config-create-schema-beijing-sample.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-config-create-schema-beijing-sample.yaml new file mode 100644 index 00000000..93b2ea58 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-config-create-schema-beijing-sample.yaml @@ -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-config-create +version: onap-beijing +samples: + sample1: + name: policy-config-create + input: --policy-name com.MicroServicevFirewall --policy-type MicroService --policy-config {"service":"tca_policy"} + moco: policy-config-create-schema-beijing-moco.json + output:
\ 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-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 index 00000000..650edeb9 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-moco.json @@ -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 index 00000000..27a96b60 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-list-schema-beijing-sample.yaml @@ -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-sample/policy/policy-ops-create-schema-beijing-moco.json b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-ops-create-schema-beijing-moco.json new file mode 100644 index 00000000..2dcba161 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-ops-create-schema-beijing-moco.json @@ -0,0 +1,33 @@ +[ + { + "request": { + "method": "put", + "uri": "/pdp/api/createPolicy", + "headers": { + "Authorization": "Basic dGVzdHBkcDphbHBoYTEyMw==", + "ClientAuth": "cHl0aG9uOnRlc3Q=", + "Environment": "ONAP-CLI", + "Accept": "application/json", + "Content-Type": "application/json" + }, + "json": { + "policyConfigType": "BRMS_PARAM", + "policyName": "com.BRMSParamvCPE", + "policyDescription": "BRMS-policy", + "policyScope": "com", + "attributes": { + "MATCHING": { + "controller" : "amsterdam" + }, + "RULE": { + "templateName": "ClosedLoopControlName" + } + } + } + }, + "response": { + "status": 200, + "json": {} + } + } +]
\ No newline at end of file diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-ops-create-schema-beijing-sample.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-ops-create-schema-beijing-sample.yaml new file mode 100644 index 00000000..c99aad9b --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-ops-create-schema-beijing-sample.yaml @@ -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-operational-create +version: onap-beijing +samples: + sample1: + name: policy-operational-create + input: --policy-name com.BRMSParamvCPE --policy-description BRMS-policy --policy-type BRMS_PARAM --policy-scope com --policy-match controller=amsterdam --policy-rule templateName=ClosedLoopControlName + moco: policy-ops-create-schema-beijing-moco.json + output:
\ No newline at end of file diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-push-schema-beijing-moco.json b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-push-schema-beijing-moco.json new file mode 100644 index 00000000..c718c6cf --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-push-schema-beijing-moco.json @@ -0,0 +1,24 @@ +[ + { + "request": { + "method": "put", + "uri": "/pdp/api/pushPolicy", + "headers": { + "Authorization": "Basic dGVzdHBkcDphbHBoYTEyMw==", + "ClientAuth": "cHl0aG9uOnRlc3Q=", + "Environment": "ONAP-CLI", + "Accept": "application/json", + "Content-Type": "application/json" + }, + "json": { + "policyName": "com.CSIT_zojumpfzo0zijii_VoLTE", + "policyType": "BRMS_PARAM", + "pdpGroup": "default" + } + }, + "response": { + "status": 200, + "json": {} + } + } +]
\ No newline at end of file diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-push-schema-beijing-sample.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-push-schema-beijing-sample.yaml new file mode 100644 index 00000000..b9e08029 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-sample/policy/policy-push-schema-beijing-sample.yaml @@ -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-push +version: onap-beijing +samples: + sample1: + name: policy-push + input: --policy-group default --policy-name com.CSIT_zojumpfzo0zijii_VoLTE --policy-type BRMS_PARAM + moco: policy-push-schema-beijing-moco.json + output:
\ No newline at end of file diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-config-create-schema-beijing.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-config-create-schema-beijing.yaml new file mode 100644 index 00000000..036aa736 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-config-create-schema-beijing.yaml @@ -0,0 +1,68 @@ +# 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-config-create +description: Create config policy + +info: + product: onap-beijing + service: policy + author: ONAP CLI Team onap-discuss@lists.onap.org + state: experimental + +parameters: + - name: policy-name + description: Onap policy Name + type: string + short_option: x + long_option: policy-name + is_optional: false + - name: policy-config + description: Configuration of policy + type: json + short_option: y + long_option: policy-config + is_optional: false + - name: policy-onap-component-name + description: ONAP component name + type: string + long_option: policy-onap-component-name + short_option: z + is_optional: false + default_value: DCAE + - name: policy-type + description: Policy cofig type + type: string + long_option: policy-type + short_option: b + is_optional: false + +http: + service: + name: policy + version: v1.0 + auth: basic + mode: direct + request: + uri: /pdp/api/createPolicy + method: PUT + context: + remove_empty_node: true + body: '{"configBody": "${policy-config}","policyConfigType": "${policy-type}","policyName": "${ policy-name}","onapName": "${policy-onap-component-name}"}' + headers: + accept: text/html + + success_codes: + - 200
\ No newline at end of file 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 index 00000000..9e17616e --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-list-schema-beijing.yaml @@ -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 diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-operational-create-schema-beijing.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-operational-create-schema-beijing.yaml new file mode 100644 index 00000000..055764f9 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-operational-create-schema-beijing.yaml @@ -0,0 +1,79 @@ +# 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-operational-create +description: Create operational policy + +info: + product: onap-beijing + service: policy + author: ONAP CLI Team onap-discuss@lists.onap.org + state: experimental + +parameters: + - name: policy-name + description: Onap policy Name + type: string + short_option: x + long_option: policy-name + is_optional: false + - name: policy-description + description: Description for policy + type: string + short_option: y + long_option: policy-description + is_optional: false + - name: policy-scope + description: Policy scope + type: string + long_option: policy-scope + short_option: z + is_optional: false + - name: policy-type + description: Policy type + type: string + long_option: policy-type + short_option: b + is_optional: false + - name: policy-match + description: Policy matching attributes + type: map + long_option: policy-match + short_option: c + is_optional: false + - name: policy-rule + description: Policy rule attributes + type: map + long_option: policy-rule + short_option: i + is_optional: false + +http: + service: + name: policy + version: v1.0 + auth: basic + mode: direct + request: + uri: /pdp/api/createPolicy + method: PUT + context: + remove_empty_node: true + body: '{"policyConfigType":"${policy-type}","policyName":"${policy-name}","policyDescription":"${policy-description}","policyScope":"${policy-scope}","attributes":{"MATCHING":"${policy-match}","RULE":"${policy-rule}"}}' + headers: + accept: text/html + + success_codes: + - 200 diff --git a/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-push-schema-beijing.yaml b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-push-schema-beijing.yaml new file mode 100644 index 00000000..66d75057 --- /dev/null +++ b/products/onap-beijing/features/policy/src/main/resources/open-cli-schema/policy/policy-push-schema-beijing.yaml @@ -0,0 +1,59 @@ +# 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-push +description: Push a policy in pdp + +info: + product: onap-beijing + service: policy + author: ONAP CLI Team onap-discuss@lists.onap.org + state: experimental + +parameters: + - name: policy-name + description: Onap policy Name + type: string + short_option: x + long_option: policy-name + is_optional: false + - name: policy-type + description: Policy type + type: string + long_option: policy-type + short_option: b + is_optional: false + - name: policy-group + description: Policy pdp group + type: string + long_option: policy-group + short_option: c + is_optional: false + +http: + service: + name: policy + version: v1.0 + auth: basic + mode: direct + request: + uri: /pdp/api/pushPolicy + method: PUT + context: + remove_empty_node: true + body: '{"policyName": "${policy-name}", "policyType": "${policy-type}", "pdpGroup": "${policy-group}"}' + + success_codes: + - 200 |