diff options
author | Chenfei Gao <cgao@research.att.com> | 2020-01-09 13:33:12 -0500 |
---|---|---|
committer | Chenfei Gao <cgao@research.att.com> | 2020-01-13 12:32:40 -0500 |
commit | c73f78ef267ec0bb4552cdaf74f0a42e8078e2ee (patch) | |
tree | 3ab1be8a1fb3dd19154090291e17eb6b691f19c7 /main/src/test/resources/policies/vCPE.policy.duplicate.policyversion.json | |
parent | 1d801e7c49105b19ac7bfd3f7addbac995fd1dc8 (diff) |
Added the new versioning validation for policy and policy type
The following rules are implemented to validate the version provided
in the POST payloads of policies and policy types:
1) If version field is not specified in POST payload, "406 - Not Acceptable"
would be returned along with the message "mandantory version field is missing".
2) If the version is not in the DB, we simply insert it.
3) If the version is in the DB, "406 - Not Acceptable" is returned along with
the message saying "specified version x.x.x" is already existing and the latest
version is x.x.x. It can force the user to create a newer version than the latest one.
4) The same versioning validation is applied to legacy types of policies too
so that everything is consistent.
Issue-ID: POLICY-2316
Change-Id: I395df0196a9d3073fd1f09060f943aeeb554d277
Signed-off-by: Chenfei Gao <cgao@research.att.com>
Diffstat (limited to 'main/src/test/resources/policies/vCPE.policy.duplicate.policyversion.json')
-rw-r--r-- | main/src/test/resources/policies/vCPE.policy.duplicate.policyversion.json | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/main/src/test/resources/policies/vCPE.policy.duplicate.policyversion.json b/main/src/test/resources/policies/vCPE.policy.duplicate.policyversion.json new file mode 100644 index 00000000..6caeb503 --- /dev/null +++ b/main/src/test/resources/policies/vCPE.policy.duplicate.policyversion.json @@ -0,0 +1,95 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_0_0", + "topology_template": { + "policies": [ + { + "onap.restart.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "type_version": "1.0.0", + "metadata": { + "policy-id": "onap.restart.tca" + }, + "properties": { + "tca_policy" : { + "domain": "measurementsForVfScaling", + "metricsPerEventName": [ + { + "eventName": "Measurement_vGMUX", + "controlLoopSchemaType": "VNF", + "policyScope": "DCAE", + "policyName": "DCAE.Config_tca-hi-lo", + "policyVersion": "v0.0.1", + "thresholds": [ + { + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", + "thresholdValue": 0, + "direction": "EQUAL", + "severity": "MAJOR", + "closedLoopEventStatus": "ABATED" + }, + { + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", + "thresholdValue": 0, + "direction": "GREATER", + "severity": "CRITICAL", + "closedLoopEventStatus": "ONSET" + } + ] + } + ] + } + } + } + }, + { + "onap.restart.tca": { + "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", + "version": "1.0.0", + "type_version": "1.0.0", + "metadata": { + "policy-id": "onap.restart.tca" + }, + "properties": { + "tca_policy" : { + "domain": "measurementsForVfScaling", + "metricsPerEventName": [ + { + "eventName": "Measurement_vGMUX", + "controlLoopSchemaType": "VNF", + "policyScope": "DCAE", + "policyName": "DCAE.Config_tca-hi-lo", + "policyVersion": "v0.0.1", + "thresholds": [ + { + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", + "thresholdValue": 0, + "direction": "EQUAL", + "severity": "MAJOR", + "closedLoopEventStatus": "ABATED" + }, + { + "closedLoopControlName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", + "version": "1.0.2", + "fieldPath": "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value", + "thresholdValue": 0, + "direction": "GREATER", + "severity": "CRITICAL", + "closedLoopEventStatus": "ONSET" + } + ] + } + ] + } + } + } + } + ] + } +}
\ No newline at end of file |