diff options
Diffstat (limited to 'main/src/test/resources')
11 files changed, 387 insertions, 17 deletions
diff --git a/main/src/test/resources/META-INF/persistence.xml b/main/src/test/resources/META-INF/persistence.xml new file mode 100644 index 00000000..23e8567f --- /dev/null +++ b/main/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2019 Nordix Foundation. + ================================================================================ + 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. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> + +<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> + <persistence-unit name="ToscaConceptTest" transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + + <class>org.onap.policy.models.dao.converters.CDataConditioner</class> + <class>org.onap.policy.models.dao.converters.Uuid2String</class> + <class>org.onap.policy.models.base.PfConceptKey</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class> + + <properties> + <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /> + <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" /> + <property name="javax.persistence.jdbc.user" value="policy" /> + <property name="javax.persistence.jdbc.password" value="P01icY" /> + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> + <property name="eclipselink.ddl-generation.output-mode" value="database" /> + <property name="eclipselink.logging.level" value="INFO" /> + </properties> + </persistence-unit> + + <persistence-unit name="ToscaConceptMariaDBTest" transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + + <class>org.onap.policy.models.dao.converters.CDataConditioner</class> + <class>org.onap.policy.models.dao.converters.Uuid2String</class> + <class>org.onap.policy.models.base.PfConceptKey</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class> + + <properties> + <property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" /> + <property name="javax.persistence.jdbc.url" value="jdbc:mariadb://localhost:3306/policy" /> + <property name="javax.persistence.jdbc.user" value="policy" /> + <property name="javax.persistence.jdbc.password" value="P01icY" /> + <property name="javax.persistence.schema-generation.database.action" value="create" /> + + <!-- property name="eclipselink.logging.level" value="ALL" /> + <property name="eclipselink.logging.level.jpa" value="ALL" /> + <property name="eclipselink.logging.level.ddl" value="ALL" /> + <property name="eclipselink.logging.level.connection" value="ALL" /> + <property name="eclipselink.logging.level.sql" value="ALL" /> + <property name="eclipselink.logging.level.transaction" value="ALL" /> + <property name="eclipselink.logging.level.sequencing" value="ALL" /> + <property name="eclipselink.logging.level.server" value="ALL" /> + <property name="eclipselink.logging.level.query" value="ALL" /> + <property name="eclipselink.logging.level.properties" value="ALL" /--> + + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> + <property name="eclipselink.ddl-generation.output-mode" value="database" /> + <property name="eclipselink.logging.level" value="INFO" /> + </properties> + </persistence-unit> +</persistence> diff --git a/main/src/test/resources/parameters/ApiConfigParameters.json b/main/src/test/resources/parameters/ApiConfigParameters.json index 8fae1238..c64271c7 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters.json +++ b/main/src/test/resources/parameters/ApiConfigParameters.json @@ -5,5 +5,13 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34" + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseUrl": "jdbc:mariadb://localhost:3306/policy", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "ToscaConceptMariaDBTest" } } diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json index ec732132..878dc1ff 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json @@ -6,5 +6,13 @@ "userName":"healthcheck", "password":"zb!XztG34", "https":true + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "ToscaConceptTest" } } diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json index 2d394fbc..67e461e0 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json @@ -5,5 +5,13 @@ "port":-1, "userName":"", "password":"" + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "ToscaConceptTest" } } diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json index 61c6c869..2600d20f 100644 --- a/main/src/test/resources/parameters/MinimumParameters.json +++ b/main/src/test/resources/parameters/MinimumParameters.json @@ -5,5 +5,13 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34" + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "ToscaConceptTest" } } diff --git a/main/src/test/resources/parameters/NoParameters.json b/main/src/test/resources/parameters/NoParameters.json index 6b0805d3..ed2fbde2 100644 --- a/main/src/test/resources/parameters/NoParameters.json +++ b/main/src/test/resources/parameters/NoParameters.json @@ -4,5 +4,13 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34" + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "ToscaConceptTest" } }
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.guard.minmax.input.json b/main/src/test/resources/policies/vDNS.policy.guard.minmax.input.json index c62a229a..2dbfe8ce 100644 --- a/main/src/test/resources/policies/vDNS.policy.guard.minmax.input.json +++ b/main/src/test/resources/policies/vDNS.policy.guard.minmax.input.json @@ -1,5 +1,4 @@ { -{ "policy-id" : "guard.minmax.scaleout", "contents" : { "actor": "SO", diff --git a/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json b/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json new file mode 100644 index 00000000..26f4c021 --- /dev/null +++ b/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json @@ -0,0 +1,28 @@ +{ + "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 govern monitoring provision", + "version": "1.0.0" + } + }, + { + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server": { + "derived_from": "policy.nodes.Root", + "version": "1.0.0", + "properties": { + "buscontroller_feed_publishing_endpoint": { + "type": "string", + "description": "DMAAP Bus Controller feed endpoint" + }, + "datafile.policy": { + "type": "string", + "description": "datafile Policy JSON as string" + } + } + } + } + ] +}
\ No newline at end of file diff --git a/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml b/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml index 5a093ddb..63796fa3 100644 --- a/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml +++ b/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml @@ -1,17 +1,18 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 policy_types: - version: 1.0.0 - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that govern monitoring provision - version: 1.0.0 - onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server: - derived_from: policy.nodes.Root - version: 1.0.0 - properties: - buscontroller_feed_publishing_endpoint: - type: string - description: DMAAP Bus Controller feed endpoint - datafile.policy: - type: string - description: datafile Policy JSON as string + - + onap.policies.Monitoring: + derived_from: tosca.policies.Root + description: a base policy type for all policies that govern monitoring provision + version: 1.0.0 + - + onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server: + derived_from: policy.nodes.Root + version: 1.0.0 + properties: + buscontroller_feed_publishing_endpoint: + type: string + description: DMAAP Bus Controller feed endpoint + datafile.policy: + type: string + description: datafile Policy JSON as string
\ No newline at end of file diff --git a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json new file mode 100644 index 00000000..95d7a53b --- /dev/null +++ b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json @@ -0,0 +1,223 @@ +{ + "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.policy.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" + } + } + } + } + } + ], + "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" + } + } + } + } + }, + { + "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" + } + } + } + } + ] +}
\ No newline at end of file diff --git a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml index 699cffd7..f8e9b752 100644 --- a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml +++ b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml @@ -1,8 +1,10 @@ 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.policy.monitoring.cdap.tca.hi.lo.app: derived_from: onap.policies.Monitoring version: 1.0.0 @@ -13,6 +15,7 @@ policy_types: entry_schema: type: onap.datatypes.monitoring.tca_policy data_types: + - onap.datatypes.monitoring.metricsPerEventName: derived_from: tosca.datatypes.Root properties: @@ -46,6 +49,7 @@ data_types: description: Thresholds associated with eventName entry_schema: type: onap.datatypes.monitoring.thresholds + - onap.datatypes.monitoring.tca_policy: derived_from: tosca.datatypes.Root properties: @@ -62,6 +66,7 @@ data_types: 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: @@ -155,4 +160,4 @@ data_types: version: type: string required: true - description: Version number associated with the threshold + description: Version number associated with the threshold
\ No newline at end of file |