diff options
Diffstat (limited to 'src/test')
9 files changed, 0 insertions, 1153 deletions
diff --git a/src/test/java/org/onap/policy/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java b/src/test/java/org/onap/policy/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java deleted file mode 100644 index 6ff82b6d7..000000000 --- a/src/test/java/org/onap/policy/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java +++ /dev/null @@ -1,201 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights - * reserved. - * Modifications Copyright (C) 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. - * 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. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.policy.clamp.clds.tosca; - -import static org.junit.Assert.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import com.google.gson.JsonObject; -import java.io.IOException; -import javax.transaction.Transactional; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.policy.clamp.clds.Application; -import org.onap.policy.clamp.clds.util.ResourceFileUtils; -import org.onap.policy.clamp.tosca.Dictionary; -import org.onap.policy.clamp.tosca.DictionaryElement; -import org.onap.policy.clamp.tosca.DictionaryService; -import org.skyscreamer.jsonassert.JSONAssert; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = Application.class) -public class ToscaYamlToJsonConvertorTestItCase { - - @Autowired - private DictionaryService dictionaryService; - - @Autowired - private ToscaYamlToJsonConvertor toscaYamlToJsonConvertor; - - /** - * This Test validates TOSCA yaml to JSON Schema conversion based on JSON Editor - * Schema. - * - * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file - */ - @Test - public final void testParseToscaYaml() throws IOException { - String toscaModelYaml = ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml"); - ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); - - String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app"); - assertNotNull(parsedJsonSchema); - JSONAssert.assertEquals( - ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json.json"), - parsedJsonSchema, true); - } - - /** - * This Test validates TOSCA yaml with constraints to JSON Schema conversion - * based on JSON Editor Schema. - * - * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file - */ - @Test - public final void testParseToscaYamlWithConstraints() throws IOException { - String toscaModelYaml = - ResourceFileUtils.getResourceAsString("tosca/tosca-with-constraints.yaml"); - ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); - - String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); - assertNotNull(parsedJsonSchema); - JSONAssert.assertEquals( - ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"), - parsedJsonSchema, true); - } - - /** - * This Test validates TOSCA yaml with different datatypes to JSON Schema - * conversion based on JSON Editor Schema. - * - * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file - */ - @Test - public final void testParseToscaYamlWithTypes() throws IOException { - String toscaModelYaml = - ResourceFileUtils.getResourceAsString("tosca/tosca-with-datatypes.yaml"); - ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor(); - - String parsedJsonSchema = - convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app"); - assertNotNull(parsedJsonSchema); - JSONAssert.assertEquals( - ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"), - parsedJsonSchema, true); - } - - /** - * This Test validates Tosca yaml with metadata tag that contains policy_model_type and acronym - * parameters which defines the Tosca Policy name and its short name. - * - * @throws IOException In case of issue when opening the tosca yaml file and - * converted json file - */ - @Test - @Transactional - public final void testMetadataClampPossibleValues() throws IOException { - setupDictionary(); - String toscaModelYaml = - ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"); - - JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml); - assertNotNull(jsonObject); - String policyModelType = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, - ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE); - String acronym = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject, - ToscaSchemaConstants.METADATA_ACRONYM); - String parsedJsonSchema = - toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType); - - assertNotNull(parsedJsonSchema); - assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType); - assertEquals("tca", acronym); - JSONAssert.assertEquals( - ResourceFileUtils - .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"), - parsedJsonSchema, true); - - } - - private void setupDictionary() { - - // Set up dictionary elements - Dictionary dictionaryTest = new Dictionary(); - dictionaryTest.setName("Context"); - dictionaryTest.setSecondLevelDictionary(0); - - DictionaryElement element = new DictionaryElement(); - element.setName("PROD"); - element.setShortName("PROD"); - element.setType("string"); - element.setDescription("Production"); - dictionaryTest.addDictionaryElements(element); - - dictionaryService.saveOrUpdateDictionary(dictionaryTest); - - Dictionary dictionaryTest1 = new Dictionary(); - dictionaryTest1.setName("EventDictionary"); - dictionaryTest1.setSecondLevelDictionary(0); - - DictionaryElement element1 = new DictionaryElement(); - element1.setName("alarmCondition"); - element1.setShortName("alarmCondition"); - element1.setType("string"); - element1.setDescription("Alarm Condition"); - dictionaryTest1.addDictionaryElements(element1); - - dictionaryTest1 = dictionaryService.saveOrUpdateDictionary(dictionaryTest1); - - DictionaryElement element3 = new DictionaryElement(); - element3.setName("timeEpoch"); - element3.setShortName("timeEpoch"); - element3.setType("datetime"); - element3.setDescription("Time Epoch"); - dictionaryTest1.addDictionaryElements(element3); - - dictionaryService.saveOrUpdateDictionary(dictionaryTest1); - - Dictionary dictionaryTest2 = new Dictionary(); - dictionaryTest2.setName("Operators"); - dictionaryTest2.setSecondLevelDictionary(0); - - DictionaryElement element2 = new DictionaryElement(); - element2.setName("equals"); - element2.setShortName("equals"); - element2.setType("string|datetime"); - element2.setDescription("equals"); - dictionaryTest2.addDictionaryElements(element2); - dictionaryService.saveOrUpdateDictionary(dictionaryTest2); - } - -} diff --git a/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java index b6c60d84c..a2563b8d3 100644 --- a/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java +++ b/src/test/java/org/onap/policy/clamp/loop/PolicyModelServiceItCase.java @@ -121,24 +121,6 @@ public class PolicyModelServiceItCase { } /** - * This tests a create Policy Model from Tosca. - * - * @throws IOException In case of failure - */ - @Test - @Transactional - public void shouldCreatePolicyModelFromTosca() throws IOException { - String toscaModelYaml = - ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml"); - PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml); - - assertThat(policyModelsService.getAllPolicyModels()).contains(policyModel); - - assertThat(policyModelsService.getPolicyModelTosca(policyModel.getPolicyModelType(), - policyModel.getVersion())).contains(toscaModelYaml); - } - - /** * This tests the getPolicyModelJson. A json is expected. * * @throws IOException In case of failure @@ -162,27 +144,6 @@ public class PolicyModelServiceItCase { } /** - * This tests a update Policy Model. - * - * @throws IOException In case of failure - */ - @Test - @Transactional - public void shouldUpdatePolicyModel() throws IOException { - String toscaModelYaml = - ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml"); - PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml); - String newToscaModelYaml = - ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"); - - PolicyModel updatedPolicyModel = policyModelsService.updatePolicyModelTosca( - policyModel.getPolicyModelType(), policyModel.getVersion(), newToscaModelYaml); - - assertThat(updatedPolicyModel.getPolicyModelTosca()).isEqualTo(newToscaModelYaml); - - } - - /** * This tests a getAllPolicyModelTypes get. */ @Test diff --git a/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json b/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json deleted file mode 100644 index fe9b84d13..000000000 --- a/src/test/resources/tosca/policy-yaml-to-json-with-constraints.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "schema": { - "uniqueItems": "true", - "format": "tabs", - "type": "array", - "title": "Properties with constraints", - "items": { - "type": "object", - "title": "Properties with constraints", - "required": [ - "cpus", - "memSize" - ], - "properties": { - "appPassword": { - "propertyOrder": 1004, - "minLength": 6, - "title": "application password", - "type": "string", - "maxLength": 10 - }, - "cost": { - "exclusiveMaximum": 100.5, - "propertyOrder": 1005, - "type": "integer", - "exclusiveMinimum": 50.5 - }, - "keylength": { - "propertyOrder": 1007, - "type": "integer", - "enum": [ - 128, - 256 - ] - }, - "cpus": { - "propertyOrder": 1001, - "default": 1, - "minLength": 1, - "type": "string", - "maxLength": 4 - }, - "ports": { - "propertyOrder": 1002, - "maximum": 9010, - "type": "integer", - "minimum": 9000 - }, - "memSize": { - "propertyOrder": 1003, - "maximum": 10, - "title": "memory size", - "type": "integer", - "minimum": 2 - }, - "algorithm": { - "propertyOrder": 1006, - "type": "string" - } - } - } - } -} diff --git a/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json b/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json deleted file mode 100644 index ef9c2c03a..000000000 --- a/src/test/resources/tosca/policy-yaml-to-json-with-datatypes.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "schema": { - "uniqueItems": "true", - "format": "tabs", - "type": "array", - "title": "Properties with different types", - "items": { - "type": "object", - "title": "Properties with different types", - "required": [ - "memSize" - ], - "properties": { - "cpus": { - "propertyOrder": 1001, - "uniqueItems": "true", - "format": "tabs-top", - "type": "array", - "items": { - "type": "object", - "required": [], - "properties": { - "closedLoopControlName": { - "propertyOrder": 1002, - "type": "string" - } - } - } - }, - "domain": { - "propertyOrder": 1009, - "type": "object", - "required": [], - "properties": { - "closedLoopControlName": { - "propertyOrder": 1002, - "type": "string" - } - } - }, - "thresholdValue": { - "propertyOrder": 1007, - "uniqueItems": "true", - "format": "select", - "type": "array", - "items": { - "type": "string" - } - }, - "ports": { - "propertyOrder": 1003, - "type": "object", - "items": { - "type": "string" - } - }, - "closedLoopEventStatus": { - "propertyOrder": 1004, - "type": "object", - "items": { - "type": "integer" - } - }, - "version": { - "propertyOrder": 1008, - "uniqueItems": "true", - "format": "tabs-top", - "type": "array", - "items": { - "type": "object", - "required": [], - "properties": { - "closedLoopControlName": { - "propertyOrder": 1002, - "type": "string" - } - } - } - }, - "memSize": { - "propertyOrder": 1006, - "required": [], - "properties": { - "name": { - "propertyOrder": 20002, - "required": [ - "severity" - ], - "properties": { - "severity": { - "propertyOrder": 20003, - "type": "string" - } - } - } - } - }, - "direction": { - "propertyOrder": 1005, - "type": "object", - "items": { - "type": "integer" - } - } - } - } - } -}
\ No newline at end of file diff --git a/src/test/resources/tosca/policy-yaml-to-json.json b/src/test/resources/tosca/policy-yaml-to-json.json deleted file mode 100644 index b83d3f24f..000000000 --- a/src/test/resources/tosca/policy-yaml-to-json.json +++ /dev/null @@ -1,192 +0,0 @@ -{ - "schema": { - "uniqueItems": "true", - "format": "tabs", - "type": "array", - "title": "TCA Policy JSON", - "items": { - "type": "object", - "title": "TCA Policy JSON", - "required": [ - "domain", - "metricsPerEventName" - ], - "properties": { - "domain": { - "propertyOrder": 1001, - "default": "measurementsForVfScaling", - "title": "Domain name to which TCA needs to be applied", - "type": "string" - }, - "metricsPerEventName": { - "propertyOrder": 1002, - "uniqueItems": "true", - "format": "tabs-top", - "title": "Contains eventName and threshold details that need to be applied to given eventName", - "type": "array", - "items": { - "type": "object", - "required": [ - "controlLoopSchemaType", - "eventName", - "policyName", - "policyScope", - "policyVersion", - "thresholds" - ], - "properties": { - "policyVersion": { - "propertyOrder": 1007, - "title": "TCA Policy Scope Version", - "type": "string" - }, - "thresholds": { - "propertyOrder": 1008, - "uniqueItems": "true", - "format": "tabs-top", - "title": "Thresholds associated with eventName", - "type": "array", - "items": { - "type": "object", - "required": [ - "closedLoopControlName", - "closedLoopEventStatus", - "direction", - "fieldPath", - "severity", - "thresholdValue", - "version" - ], - "properties": { - "severity": { - "propertyOrder": 1013, - "title": "Threshold Event Severity", - "type": "string", - "enum": [ - "CRITICAL", - "MAJOR", - "MINOR", - "WARNING", - "NORMAL" - ] - }, - "fieldPath": { - "propertyOrder": 1012, - "title": "Json field Path as per CEF message which needs to be analyzed for TCA", - "type": "string", - "enum": [ - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", - "$.event.measurementsForVfScalingFields.meanRequestLatency", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", - "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" - ] - }, - "thresholdValue": { - "propertyOrder": 1014, - "title": "Threshold value for the field Path inside CEF message", - "type": "integer" - }, - "closedLoopEventStatus": { - "propertyOrder": 1010, - "title": "Closed Loop Event Status of the threshold", - "type": "string", - "enum": [ - "ONSET", - "ABATED" - ] - }, - "closedLoopControlName": { - "propertyOrder": 1009, - "title": "Closed Loop Control Name associated with the threshold", - "type": "string" - }, - "version": { - "propertyOrder": 1015, - "title": "Version number associated with the threshold", - "type": "string" - }, - "direction": { - "propertyOrder": 1011, - "title": "Direction of the threshold", - "type": "string", - "enum": [ - "LESS", - "LESS_OR_EQUAL", - "GREATER", - "GREATER_OR_EQUAL", - "EQUAL" - ] - } - } - } - }, - "policyName": { - "propertyOrder": 1005, - "title": "TCA Policy Scope Name", - "type": "string" - }, - "controlLoopSchemaType": { - "propertyOrder": 1003, - "title": "Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", - "type": "string", - "enum": [ - "VM", - "VNF" - ] - }, - "policyScope": { - "propertyOrder": 1006, - "title": "TCA Policy Scope", - "type": "string" - }, - "eventName": { - "propertyOrder": 1004, - "title": "Event name to which thresholds need to be applied", - "type": "string" - } - } - } - } - } - } - } -}
\ No newline at end of file diff --git a/src/test/resources/tosca/tosca-with-constraints.yaml b/src/test/resources/tosca/tosca-with-constraints.yaml deleted file mode 100644 index 959bc483b..000000000 --- a/src/test/resources/tosca/tosca-with-constraints.yaml +++ /dev/null @@ -1,54 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that governs monitoring provisioning - onap.policies.monitoring.example.app: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - example_policy: - type: map - description: Properties with constraints - entry_schema: - type: onap.datatypes.monitoring.example_policy -data_types: - onap.datatypes.monitoring.example_policy: - derived_from: tosca.datatypes.Root - properties: - cpus: - type: string - required: true - default: 1 - constraints: - - in_range: [ 1, 4 ] - ports: - type: integer - constraints: - - in_range: [ 9000, 9010 ] - memSize: - type: integer - required: true - description: memory size - constraints: - - greater_or_equal: 2 - - less_or_equal: 10 - appPassword: - type: string - description: application password - constraints: - - min_length: 6 - - max_length: 10 - cost: - type: float - constraints: - - less_than: 100.50 - - greater_than: 50.50 - algorithm: - type: string - constraints: - - equal: aes - keylength: - type: integer - constraints: - - valid_values: [ 128, 256 ] diff --git a/src/test/resources/tosca/tosca-with-datatypes.yaml b/src/test/resources/tosca/tosca-with-datatypes.yaml deleted file mode 100644 index 61d5dbcc8..000000000 --- a/src/test/resources/tosca/tosca-with-datatypes.yaml +++ /dev/null @@ -1,63 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that governs monitoring provisioning - onap.policies.monitoring.example.app: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - example_policy: - type: map - description: Properties with different types - entry_schema: - type: onap.datatypes.monitoring.example_policy -data_types: - onap.datatypes.monitoring.example2: - derived_from: tosca.datatypes.Root - properties: - closedLoopControlName: - type: string - onap.datatypes.monitoring.example3: - derived_from: tosca.datatypes.Root - properties: - name: - type: onap.datatypes.monitoring.example4 - onap.datatypes.monitoring.example4: - derived_from: tosca.datatypes.Root - properties: - severity: - type: string - required: true - onap.datatypes.monitoring.example_policy: - derived_from: tosca.datatypes.Root - properties: - cpus: - type: list - entry_schema: - type: onap.datatypes.monitoring.example2 - ports: - type: map - entry_schema: - type: string - closedLoopEventStatus: - type: map - entry_schema: - type: integer - direction: - type: map - entry_schema: - type: float - memSize: - type: onap.datatypes.monitoring.example3 - required: true - thresholdValue: - type: list - entry_schema: - type: string - version: - type: list - entry_schema: - type: onap.datatypes.monitoring.example2 - domain: - type: onap.datatypes.monitoring.example2
\ No newline at end of file diff --git a/src/test/resources/tosca/tosca_metadata_clamp_possible_values.yaml b/src/test/resources/tosca/tosca_metadata_clamp_possible_values.yaml deleted file mode 100644 index 4d3c3dff2..000000000 --- a/src/test/resources/tosca/tosca_metadata_clamp_possible_values.yaml +++ /dev/null @@ -1,184 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that governs monitoring provisioning - onap.policies.monitoring.cdap.tca.hi.lo.app: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - tca_policy: - type: map - description: TCA Policy JSON - entry_schema: - type: onap.datatypes.monitoring.tca_policy - metadata: - policy_model_type: onap.policies.monitoring.cdap.tca.hi.lo.app - acronym: tca - -data_types: - onap.datatypes.monitoring.metricsPerEventName: - derived_from: tosca.datatypes.Root - properties: - controlLoopSchemaType: - type: string - required: true - description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM - constraints: - - valid_values: - - VM - - VNF - eventName: - type: string - required: true - description: Event name to which thresholds need to be applied - policyName: - type: string - required: true - description: TCA Policy Scope Name - policyScope: - type: string - required: true - description: TCA Policy Scope - policyVersion: - type: string - required: true - description: TCA Policy Scope Version - thresholds: - type: list - required: true - description: Thresholds associated with eventName - entry_schema: - type: onap.datatypes.monitoring.thresholds - context: - type: string - required: true - description: TCA Policy Dummy Context - metadata: - clamp_possible_values: ["Dictionary:Context"] - - signature: - type: onap.datatypes.monitoring.Dummy_Signature - description: Signature - required: true - - onap.datatypes.monitoring.Dummy_Signature: - derived_from: tosca.datatypes.Root - properties: - filter_clause: - type: string - description: Filter Clause - required: true - metadata: - clamp_possible_values: ["Dictionary:EventDictionary#Operators"] - - onap.datatypes.monitoring.tca_policy: - derived_from: tosca.datatypes.Root - properties: - domain: - type: string - required: true - description: Domain name to which TCA needs to be applied - default: measurementsForVfScaling - constraints: - - equal: measurementsForVfScaling - metricsPerEventName: - type: list - required: true - description: Contains eventName and threshold details that need to be applied to given eventName - entry_schema: - type: onap.datatypes.monitoring.metricsPerEventName - onap.datatypes.monitoring.thresholds: - derived_from: tosca.datatypes.Root - properties: - closedLoopControlName: - type: string - required: true - description: Closed Loop Control Name associated with the threshold - closedLoopEventStatus: - type: string - required: true - description: Closed Loop Event Status of the threshold - constraints: - - valid_values: - - ONSET - - ABATED - direction: - type: string - required: true - description: Direction of the threshold - constraints: - - valid_values: - - LESS - - LESS_OR_EQUAL - - GREATER - - GREATER_OR_EQUAL - - EQUAL - fieldPath: - type: string - required: true - description: Json field Path as per CEF message which needs to be analyzed for TCA - constraints: - - valid_values: - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated - - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait - - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage - - $.event.measurementsForVfScalingFields.meanRequestLatency - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree - - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed - - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value - severity: - type: string - required: true - description: Threshold Event Severity - constraints: - - valid_values: - - CRITICAL - - MAJOR - - MINOR - - WARNING - - NORMAL - thresholdValue: - type: integer - required: true - description: Threshold value for the field Path inside CEF message - version: - type: string - required: true - description: Version number associated with the threshold diff --git a/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json b/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json deleted file mode 100644 index 418ee71be..000000000 --- a/src/test/resources/tosca/tosca_metadata_clamp_possible_values_json_schema.json +++ /dev/null @@ -1,249 +0,0 @@ -{ - "schema":{ - "uniqueItems":"true", - "format":"tabs", - "type":"array", - "title":"TCA Policy JSON", - "items":{ - "type":"object", - "title":"TCA Policy JSON", - "required":[ - "domain", - "metricsPerEventName" - ], - "properties":{ - "domain":{ - "propertyOrder":1001, - "default":"measurementsForVfScaling", - "title":"Domain name to which TCA needs to be applied", - "type":"string" - }, - "metricsPerEventName":{ - "propertyOrder":1002, - "uniqueItems":"true", - "format":"tabs-top", - "title":"Contains eventName and threshold details that need to be applied to given eventName", - "type":"array", - "items":{ - "type":"object", - "required":[ - "controlLoopSchemaType", - "eventName", - "policyName", - "policyScope", - "policyVersion", - "thresholds", - "context", - "signature" - ], - "properties":{ - "policyVersion":{ - "propertyOrder":1007, - "title":"TCA Policy Scope Version", - "type":"string" - }, - "thresholds":{ - "propertyOrder":1008, - "uniqueItems":"true", - "format":"tabs-top", - "title":"Thresholds associated with eventName", - "type":"array", - "items":{ - "type":"object", - "required":[ - "closedLoopControlName", - "closedLoopEventStatus", - "direction", - "fieldPath", - "severity", - "thresholdValue", - "version" - ], - "properties":{ - "severity":{ - "propertyOrder":1013, - "title":"Threshold Event Severity", - "type":"string", - "enum":[ - "CRITICAL", - "MAJOR", - "MINOR", - "WARNING", - "NORMAL" - ] - }, - "fieldPath":{ - "propertyOrder":1012, - "title":"Json field Path as per CEF message which needs to be analyzed for TCA", - "type":"string", - "enum":[ - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated", - "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait", - "$.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage", - "$.event.measurementsForVfScalingFields.meanRequestLatency", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree", - "$.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed", - "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value" - ] - }, - "thresholdValue":{ - "propertyOrder":1014, - "title":"Threshold value for the field Path inside CEF message", - "type":"integer" - }, - "closedLoopEventStatus":{ - "propertyOrder":1010, - "title":"Closed Loop Event Status of the threshold", - "type":"string", - "enum":[ - "ONSET", - "ABATED" - ] - }, - "closedLoopControlName":{ - "propertyOrder":1009, - "title":"Closed Loop Control Name associated with the threshold", - "type":"string" - }, - "version":{ - "propertyOrder":1015, - "title":"Version number associated with the threshold", - "type":"string" - }, - "direction":{ - "propertyOrder":1011, - "title":"Direction of the threshold", - "type":"string", - "enum":[ - "LESS", - "LESS_OR_EQUAL", - "GREATER", - "GREATER_OR_EQUAL", - "EQUAL" - ] - } - } - } - }, - "policyName":{ - "propertyOrder":1005, - "title":"TCA Policy Scope Name", - "type":"string" - }, - "signature":{ - "propertyOrder":1017, - "title":"Signature", - "required":[ - "filter_clause" - ], - "properties":{ - "filter_clause":{ - "propertyOrder":30002, - "qschema":{ - "filters":[ - { - "operators":[ - "equals" - ], - "minLength":1, - "id":"alarmCondition", - "label":"alarmCondition", - "type":"string" - }, - { - "plugin":"datetimepicker", - "operators":[ - "equals" - ], - "minLength":1, - "id":"timeEpoch", - "label":"timeEpoch", - "type":"datetime", - "input_event":"dp.change", - "validation":{ - "format":"YYYY/MM/DD HH:mm:ss" - } - } - ] - }, - "minLength":1, - "title":"Filter Clause", - "type":"qbldr" - } - } - }, - "controlLoopSchemaType":{ - "propertyOrder":1003, - "title":"Specifies Control Loop Schema Type for the event Name e.g. VNF, VM", - "type":"string", - "enum":[ - "VM", - "VNF" - ] - }, - "policyScope":{ - "propertyOrder":1006, - "title":"TCA Policy Scope", - "type":"string" - }, - "context":{ - "propertyOrder":1016, - "options":{ - "enum_titles":[ - "PROD" - ] - }, - "title":"TCA Policy Dummy Context", - "type":"string", - "enum":[ - "PROD" - ] - }, - "eventName":{ - "propertyOrder":1004, - "title":"Event name to which thresholds need to be applied", - "type":"string" - } - } - } - } - } - } - } -}
\ No newline at end of file |