diff options
author | liamfallon <liam.fallon@est.tech> | 2019-09-05 22:25:55 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-09-05 22:25:55 +0000 |
commit | 5b7f107c2120100b502e1e82ab644b3da5a80a22 (patch) | |
tree | 6db33b71943b88187868535eb025de8341eaff23 /main | |
parent | 834ab314c29303e71c14fc9f55f626b21ccc6fcf (diff) |
Knock on of changing policy types to map
This review adapts policy-api for the change in the structure
of the toasca service template from a list of maps to a plain map.
DUplication of policy types and policies removed and policy-models
examples used instead.
Issue-ID: POLICY-2047
Change-Id: Ie1fdeef79289348005314c5de9b2e37c0c45d786
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'main')
71 files changed, 331 insertions, 3765 deletions
diff --git a/main/pom.xml b/main/pom.xml index 46c34935..502448b7 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -19,8 +19,7 @@ SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= --> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> @@ -64,6 +63,11 @@ <version>${policy.models.version}</version> </dependency> <dependency> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models-examples</artifactId> + <version>${policy.models.version}</version> + </dependency> + <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <scope>provided</scope> diff --git a/main/src/main/java/org/onap/policy/api/main/rest/provider/CommonModelProvider.java b/main/src/main/java/org/onap/policy/api/main/rest/provider/CommonModelProvider.java index f3634b3c..fc0f4368 100644 --- a/main/src/main/java/org/onap/policy/api/main/rest/provider/CommonModelProvider.java +++ b/main/src/main/java/org/onap/policy/api/main/rest/provider/CommonModelProvider.java @@ -3,6 +3,7 @@ * ONAP Policy API
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.
@@ -101,14 +102,26 @@ public class CommonModelProvider implements AutoCloseable { }
/**
- * Checks if the first element of a list contains data.
+ * Checks if the first element of a list of maps contains data.
*
- * @param list list to be examined
+ * @param listOfMapsToCheck list of maps to be examined
* @return {@code true} if the list contains data, {@code false} otherwise
*/
- protected <T> boolean hasData(List<Map<String, T>> list) {
+ protected <T> boolean hasData(List<Map<String, T>> listOfMapsToCheck) {
- return (list != null && !list.isEmpty() && !list.get(0).isEmpty());
+ return (listOfMapsToCheck != null && !listOfMapsToCheck.isEmpty() && !listOfMapsToCheck.get(0).isEmpty());
+ }
+
+
+ /**
+ * Checks if a maps contains data.
+ *
+ * @param mapToCheck map to be examined
+ * @return {@code true} if the list contains data, {@code false} otherwise
+ */
+ protected <T> boolean hasData(Map<String, T> mapToCheck) {
+
+ return (mapToCheck != null && !mapToCheck.isEmpty());
}
/**
@@ -341,4 +354,4 @@ public class CommonModelProvider implements AutoCloseable { return "could not find policy with ID " + policyId + " and type "
+ policyType.getName() + ":" + policyType.getVersion() + " deployed in any pdp group";
}
-}
\ No newline at end of file +}
diff --git a/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java b/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java index ad82d4bb..6e4321e3 100644 --- a/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java +++ b/main/src/main/java/org/onap/policy/api/main/startstop/ApiDatabaseInitializer.java @@ -3,6 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -22,8 +23,7 @@ package org.onap.policy.api.main.startstop; -import java.util.ArrayList; -import java.util.Map; +import java.util.LinkedHashMap; import org.onap.policy.api.main.exception.PolicyApiException; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -36,6 +36,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.yaml.snakeyaml.Yaml; /** * This class creates initial policy types in the database. @@ -49,24 +50,26 @@ public class ApiDatabaseInitializer { private StandardCoder standardCoder; private PolicyModelsProviderFactory factory; + // @formatter:off private static final String[] PRELOAD_POLICYTYPES = { - "preloadedPolicyTypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json", - "preloadedPolicyTypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json", - "preloadedPolicyTypes/onap.policies.optimization.AffinityPolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.DistancePolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.HpaPolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.OptimizationPolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.PciPolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.QueryPolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.SubscriberPolicy.json", - "preloadedPolicyTypes/onap.policies.optimization.Vim_fit.json", - "preloadedPolicyTypes/onap.policies.optimization.VnfPolicy.json", - "preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json", - "preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json", - "preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json", - "preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json", - "preloadedPolicyTypes/onap.policies.controlloop.Operational.json" + "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml", + "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", + "policytypes/onap.policies.optimization.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.PciPolicy.yaml", + "policytypes/onap.policies.optimization.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.Vim_fit.yaml", + "policytypes/onap.policies.optimization.VnfPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.Blacklist.yaml", + "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml", + "policytypes/onap.policies.controlloop.guard.MinMax.yaml", + "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", + "policytypes/onap.policies.controlloop.Operational.yaml" }; + // @formatter:on /** * Constructs the object. @@ -87,27 +90,29 @@ public class ApiDatabaseInitializer { try (PolicyModelsProvider databaseProvider = factory.createPolicyModelsProvider(policyModelsProviderParameters)) { - ToscaServiceTemplate policyTypes = new ToscaServiceTemplate(); - policyTypes.setPolicyTypes(new ArrayList<Map<String,ToscaPolicyType>>()); - policyTypes.setToscaDefinitionsVersion("tosca_simple_yaml_1_0_0"); + ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate(); + serviceTemplate.setPolicyTypes(new LinkedHashMap<String, ToscaPolicyType>()); + serviceTemplate.setToscaDefinitionsVersion("tosca_simple_yaml_1_0_0"); for (String pt : PRELOAD_POLICYTYPES) { - String policyTypeAsString = ResourceUtils.getResourceAsString(pt); - if (policyTypeAsString == null) { + String policyTypeAsStringYaml = ResourceUtils.getResourceAsString(pt); + if (policyTypeAsStringYaml == null) { throw new PolicyApiException("Preloading policy type cannot be found: " + pt); } - ToscaServiceTemplate singlePolicyType = standardCoder.decode(policyTypeAsString, - ToscaServiceTemplate.class); + + Object yamlObject = new Yaml().load(policyTypeAsStringYaml); + String policyTypeAsString = new StandardCoder().encode(yamlObject); + + ToscaServiceTemplate singlePolicyType = + standardCoder.decode(policyTypeAsString, ToscaServiceTemplate.class); if (singlePolicyType == null) { throw new PolicyApiException("Error deserializing policy type from file: " + pt); } // Consolidate policy types - for (Map<String, ToscaPolicyType> eachPolicyType : singlePolicyType.getPolicyTypes()) { - policyTypes.getPolicyTypes().add(eachPolicyType); - } + serviceTemplate.getPolicyTypes().putAll(singlePolicyType.getPolicyTypes()); } - ToscaServiceTemplate createdPolicyTypes = databaseProvider.createPolicyTypes(policyTypes); + ToscaServiceTemplate createdPolicyTypes = databaseProvider.createPolicyTypes(serviceTemplate); if (createdPolicyTypes == null) { - throw new PolicyApiException("Error preloading policy types: " + policyTypes); + throw new PolicyApiException("Error preloading policy types: " + serviceTemplate); } else { LOGGER.debug("Created initial policy types in DB - {}", createdPolicyTypes); } diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json deleted file mode 100644 index 2d36a258..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.Operational.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.controlloop.Operational": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Operational Policy for Control Loops" - } - } - ] -}
\ No newline at end of file diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json deleted file mode 100644 index cc59ca4b..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.Blacklist.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.controlloop.Guard": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Guard Policies for Control Loop Operational Policies" - } - }, - { - "onap.policies.controlloop.guard.Blacklist": { - "derived_from": "onap.policies.controlloop.Guard", - "version": "1.0.0", - "description": "Supports blacklist of VNF's from performing control loop actions on.", - "properties": { - "blacklist_policy": { - "type": "map", - "description": null, - "entry_schema": { - "type": "onap.datatypes.guard.Blacklist" - } - } - } - } - } - ], - "data_types": [ - { - "onap.datatypes.guard.Blacklist": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "actor": { - "type": "string", - "description": "Specifies the Actor", - "required": true - }, - "recipe": { - "type": "string", - "description": "Specifies the Recipe", - "required": true - }, - "time_range": { - "type": "tosca.datatypes.TimeInterval", - "description": "An optional range of time during the day the blacklist is valid for.", - "required": false - }, - "controlLoopName": { - "type": "string", - "description": "An optional specific control loop to apply this guard to.", - "required": false - }, - "blacklist": { - "type": "list", - "description": "List of VNF's", - "required": true - } - } - } - } - ] -}
\ No newline at end of file diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json deleted file mode 100644 index d0e50b74..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.FrequencyLimiter.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.controlloop.Guard": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Guard Policies for Control Loop Operational Policies" - } - }, - { - "onap.policies.controlloop.guard.FrequencyLimiter": { - "derived_from": "onap.policies.controlloop.Guard", - "version": "1.0.0", - "description": "Supports limiting the frequency of actions being taken by a Actor.", - "properties": { - "frequency_policy": { - "type": "map", - "description": null, - "entry_schema": { - "type": "onap.datatypes.guard.FrequencyLimiter" - } - } - } - } - } - ], - "data_types": [ - { - "onap.datatypes.guard.FrequencyLimiter": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "actor": { - "type": "string", - "description": "Specifies the Actor", - "required": true - }, - "recipe": { - "type": "string", - "description": "Specifies the Recipe", - "required": true - }, - "time_window": { - "type": "scalar-unit.time", - "description": "The time window to count the actions against.", - "required": true - }, - "limit": { - "type": "integer", - "description": "The limit", - "required": true, - "constraints": [ - { - "greater_than": 0 - } - ] - }, - "time_range": { - "type": "tosca.datatypes.TimeInterval", - "description": "An optional range of time during the day the frequency is valid for.", - "required": false - }, - "controlLoopName": { - "type": "string", - "description": "An optional specific control loop to apply this guard to.", - "required": false - }, - "target": { - "type": "string", - "description": "An optional specific VNF to apply this guard to.", - "required": false - } - } - } - } - ] -}
\ No newline at end of file diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json deleted file mode 100644 index c9ea671b..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.MinMax.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "policy_types": [ - { - "onap.policies.controlloop.Guard": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Guard Policies for Control Loop Operational Policies" - } - }, - { - "onap.policies.controlloop.guard.MinMax": { - "derived_from": "onap.policies.controlloop.Guard", - "version": "1.0.0", - "description": "Supports Min/Max number of VF Modules", - "properties": { - "minmax_policy": { - "type": "map", - "description": null, - "entry_schema": { - "type": "onap.datatypes.guard.MinMax" - } - } - } - } - } - ], - "data_types": [ - { - "onap.datatypes.guard.MinMax": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "actor": { - "type": "string", - "description": "Specifies the Actor", - "required": true - }, - "recipe": { - "type": "string", - "description": "Specifies the Recipe", - "required": true - }, - "time_range": { - "type": "tosca.datatypes.TimeInterval", - "description": "An optional range of time during the day the Min/Max limit is valid for.", - "required": false - }, - "controlLoopName": { - "type": "string", - "description": "An optional specific control loop to apply this guard to.", - "required": false - }, - "min_vf_module_instances": { - "type": "integer", - "required": true, - "description": "The minimum instances of this VF-Module" - }, - "max_vf_module_instances": { - "type": "integer", - "required": false, - "description": "The maximum instances of this VF-Module" - } - } - } - } - ] -}
\ No newline at end of file diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json deleted file mode 100644 index 43539d02..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "policy_types": [ - { - "onap.policies.controlloop.Guard": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Guard Policies for Control Loop Operational Policies" - } - }, - { - "onap.policies.controlloop.guard.Coordination": { - "derived_from": "onap.policies.controlloop.Guard", - "version": "1.0.0", - "description": "Guard Policies for Control Loop Coordination" - } - }, - { - "onap.policies.controlloop.guard.coordination.FirstBlocksSecond": { - "derived_from": "onap.policies.controlloop.guard.Coordination", - "version": "1.0.0", - "description": "Supports one Control Loop blocking another", - "properties": { - "controlLoop": { - "type": "list", - "description": "Specific Control Loops to which to apply this guard", - "required": true, - "constraint": { - "length": 2 - }, - "entry_schema": { - "type": "string" - } - } - } - } - } - ] -}
\ No newline at end of file diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json deleted file mode 100644 index ce46dac8..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json +++ /dev/null @@ -1,224 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Monitoring": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "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" - } - } - } - } - } - ], - "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" - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json deleted file mode 100644 index 26f4c021..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json +++ /dev/null @@ -1,28 +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 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/main/resources/preloadedPolicyTypes/onap.policies.optimization.AffinityPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.AffinityPolicy.json deleted file mode 100644 index 62ad6efa..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.AffinityPolicy.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.AffinityPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "zone" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "applicableResources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "any", - "all" - ] - } - ] - } - }, - "affinityProperties": { - "type": "policy.data.affinityProperties_properties", - "required": true - }, - "resources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - } - } - } - } - ], - "data_types": [ - { - "policy.data.affinityProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "qualifier": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "same", - "different" - ] - } - ] - } - }, - "category": { - "type": "string", - "required": true - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.DistancePolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.DistancePolicy.json deleted file mode 100644 index 16cd649f..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.DistancePolicy.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.DistancePolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "distance_to_location" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "resources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "applicableResources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "any", - "all" - ] - } - ] - } - }, - "distanceProperties": { - "type": "policy.data.distanceProperties_properties", - "required": true - } - } - } - } - ], - "data_types": [ - { - "policy.data.distanceProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "locationInfo": { - "type": "string", - "required": true - }, - "distance": { - "type": "policy.data.distance_properties", - "required": true - } - } - }, - "policy.data.distance_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "value": { - "type": "string", - "required": true - }, - "operator": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "<", - "<=", - ">", - ">=", - "=" - ] - } - ] - } - }, - "unit": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "km" - ] - } - ] - } - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.HpaPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.HpaPolicy.json deleted file mode 100644 index b02e17c4..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.HpaPolicy.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.HpaPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "hpa" - ] - } - ] - } - }, - "resources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "identity": { - "type": "string", - "required": true - }, - "flavorFeatures": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.flavorFeatures_properties" - } - } - } - } - } - ], - "data_types": [ - { - "policy.data.flavorFeatures_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "id": { - "type": "string", - "required": true - }, - "type": { - "type": "string", - "required": true - }, - "directives": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.directives_properties" - } - }, - "flavorProperties": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.flavorProperties_properties" - } - } - } - } - }, - { - "policy.data.directives_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "type": { - "type": "string" - }, - "attributes": { - "type": "list", - "entry_schema": { - "type": "policy.data.directives_attributes_properties" - } - } - } - } - }, - { - "policy.data.directives_attributes_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "attribute_name": { - "type": "string" - }, - "attribute_value": { - "type": "string" - } - } - } - }, - { - "policy.data.flavorProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "hpa-feature": { - "type": "string", - "required": true - }, - "mandatory": { - "type": "string", - "required": true - }, - "score": { - "type": "string", - "required": false - }, - "architecture": { - "type": "string", - "required": true - }, - "hpa-version": { - "type": "string", - "required": true - }, - "directives": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.directives_properties" - } - }, - "hpa-feature-attributes": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.hpa-feature-attributes_properties" - } - } - } - } - }, - { - "policy.data.hpa-feature-attributes_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "hpa-attribute-key": { - "type": "string", - "required": true - }, - "hpa-attribute-value": { - "type": "string", - "required": true - }, - "operator": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "<", - "<=", - ">", - ">=", - "=", - "!=", - "any", - "all", - "subset" - ] - } - ] - } - }, - "unit": { - "type": "string", - "required": false - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.OptimizationPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.OptimizationPolicy.json deleted file mode 100644 index 153b1e30..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.OptimizationPolicy.json +++ /dev/null @@ -1,141 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.OptimizationPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "placement_optimization" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "objective": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "minimize", - "maximize" - ] - } - ] - } - }, - "objectiveParameter": { - "type": "policy.data.objectiveParameter_properties", - "required": true - } - } - } - } - ], - "data_types": [ - { - "policy.data.objectiveParameter_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "parameterAttributes": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.parameterAttributes_properties" - } - }, - "operator": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "*", - "+", - "-", - "/", - "%" - ] - } - ] - } - } - } - }, - "policy.data.parameterAttributes_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "resources": { - "type": "string", - "required": true - }, - "customerLocationInfo": { - "type": "string", - "required": true - }, - "parameter": { - "type": "string", - "required": true - }, - "weight": { - "type": "string", - "required": true - }, - "operator": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "*", - "+", - "-", - "/", - "%" - ] - } - ] - } - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.PciPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.PciPolicy.json deleted file mode 100644 index 4adb631d..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.PciPolicy.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.PciPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "pciPolicy" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "resources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "pciProperties": { - "type": "list", - "required": false, - "entry_schema": { - "type": "policy.data.pciProperties_properties" - } - } - } - } - } - ], - "data_types": [ - { - "policy.data.pciProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "algoCategory": { - "type": "string", - "required": false - }, - "pciOptmizationAlgoName": { - "type": "string", - "required": false - }, - "pciOptimizationNwConstraint": { - "type": "string", - "required": false - }, - "pciOptimizationPriority": { - "type": "string", - "required": false - }, - "pciOptimizationTimeConstraint": { - "type": "string", - "required": false - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.QueryPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.QueryPolicy.json deleted file mode 100644 index 98bd3408..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.QueryPolicy.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.QueryPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "request_param_query" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "queryProperties": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.queryProperties_properties" - } - } - } - } - } - ], - "data_types": [ - { - "policy.data.queryProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "attribute": { - "type": "string", - "required": true - }, - "value": { - "type": "string", - "required": true - }, - "attribute_location": { - "type": "string", - "required": true - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.SubscriberPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.SubscriberPolicy.json deleted file mode 100644 index 81e0b0a7..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.SubscriberPolicy.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.SubscriberPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "subscriberPolicy" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "properties": { - "type": "policy.data.properties_properties", - "required": true - } - } - } - } - ], - "data_types": [ - { - "policy.data.properties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "subscriberName": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "subscriberRole": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "provStatus": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.Vim_fit.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.Vim_fit.json deleted file mode 100644 index a7894b3f..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.Vim_fit.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.Vim_fit": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "vim_fit" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "applicableResources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "any", - "all" - ] - } - ] - } - }, - "resources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "capacityProperties": { - "type": "policy.data.capacityProperties_properties", - "required": true - } - } - } - } - ], - "data_types": [ - { - "policy.data.capacityProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "controller": { - "type": "string", - "required": true - }, - "request": { - "type": "string", - "required": true - } - } - } - } - ] -} diff --git a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.VnfPolicy.json b/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.VnfPolicy.json deleted file mode 100644 index 8c7c1be4..00000000 --- a/main/src/main/resources/preloadedPolicyTypes/onap.policies.optimization.VnfPolicy.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.Optimization": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "a base policy type for all policies that govern optimization" - } - }, - { - "onap.policies.optimization.VnfPolicy": { - "derived_from": "onap.policies.Optimization", - "version": "1.0.0", - "properties": { - "policyScope": { - "type": "list", - "description": "scope where the policy is applicable", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string" - } - }, - "policyType": { - "type": "list", - "description": "type of a policy", - "required": true, - "matchable": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "vnfPolicy" - ] - } - ] - } - }, - "identity": { - "type": "string", - "required": true - }, - "resources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string" - } - }, - "applicableResources": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "any", - "all" - ] - } - ] - } - }, - "vnfProperties": { - "type": "list", - "required": true, - "entry_schema": { - "type": "policy.data.vnfProperties_properties" - } - } - } - } - } - ], - "data_types": [ - { - "policy.data.vnfProperties_properties": { - "derived_from": "tosca.nodes.Root", - "properties": { - "inventoryProvider": { - "type": "string", - "required": true - }, - "serviceType": { - "type": "string", - "required": true - }, - "inventoryType": { - "type": "list", - "required": true, - "entry_schema": { - "type": "string", - "constraints": [ - { - "valid_values": [ - "serviceInstanceId", - "vnfName", - "cloudRegionId", - "vimId" - ] - } - ] - } - }, - "customerId": { - "type": "string", - "required": true - } - } - } - } - ] -} diff --git a/main/src/test/java/org/onap/policy/api/main/ApiTestSupportUtilities.java b/main/src/test/java/org/onap/policy/api/main/ApiTestSupportUtilities.java new file mode 100644 index 00000000..79a33ffb --- /dev/null +++ b/main/src/test/java/org/onap/policy/api/main/ApiTestSupportUtilities.java @@ -0,0 +1,48 @@ +/*- + * ============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========================================================= + */ + +package org.onap.policy.api.main; + +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; +import org.yaml.snakeyaml.Yaml; + +/** + * Utility class to support API tests. + * + * @author Liam Fallon (liam.fallon@est.tech) + */ +public final class ApiTestSupportUtilities { + private ApiTestSupportUtilities() { + // prevent instantiation of this class + } + + /** + * Convert a YAML string to a JSON string. + * + * @param yamlString the Yaml string. + * @return the JSON string + * @throws CoderException on encoding JSON errors + */ + public static final String yaml2Json(final String yamlString) throws CoderException { + Object yamlObject = new Yaml().load(yamlString); + return new StandardCoder().encode(yamlObject); + } +} diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java index 81547295..8b396fc7 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved. * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -52,6 +53,7 @@ import org.glassfish.jersey.client.ClientProperties; import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature; import org.junit.After; import org.junit.Test; +import org.onap.policy.api.main.ApiTestSupportUtilities; import org.onap.policy.api.main.exception.PolicyApiException; import org.onap.policy.api.main.parameters.ApiParameterGroup; import org.onap.policy.api.main.parameters.CommonTestData; @@ -109,48 +111,47 @@ public class TestApiRestServer { private static final String POLICYTYPES_TCA_POLICIES_VCPE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca"; private static final String POLICYTYPES_TCA_POLICIES_VCPE_VERSION = "policytypes/" - + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0"; + + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/1.0.0"; private static final String POLICYTYPES_TCA_POLICIES_VCPE_LATEST = "policytypes/" - + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/latest"; + + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/latest"; private static final String POLICYTYPES_TCA_POLICIES_VCPE_DEPLOYED = "policytypes/" + "onap.policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0/policies/onap.restart.tca/versions/deployed"; - private static final String GUARD_POLICIES = - "policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"; + private static final String GUARD_POLICIES = "policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"; private static final String GUARD_POLICIES_VDNS_FL_LATEST = "policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.frequency.scaleout" - + "/versions/latest"; + + "/versions/latest"; private static final String GUARD_POLICIES_VDNS_FL_DEPLOYED = "policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.frequency.scaleout" - + "/versions/deployed"; + + "/versions/deployed"; private static final String GUARD_POLICIES_VDNS_MINMAX_LATEST = "policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.minmax.scaleout" - + "/versions/latest"; + + "/versions/latest"; private static final String GUARD_POLICIES_VDNS_FL_VERSION = "policytypes/" - + "onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.frequency.scaleout/versions/1"; - private static final String GUARD_POLICIES_VDNS_MINMAX_VERSION = "policytypes/" - + "onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.minmax.scaleout/versions/1"; + + "onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.frequency.scaleout/versions/1"; + private static final String GUARD_POLICIES_VDNS_MINMAX_VERSION = + "policytypes/" + "onap.policies.controlloop.Guard/versions/1.0.0/policies/guard.minmax.scaleout/versions/1"; private static final String OPS_POLICIES = "policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"; private static final String OPS_POLICIES_VCPE_LATEST = "policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.restart" - + "/versions/latest"; + + "/versions/latest"; private static final String OPS_POLICIES_VCPE_DEPLOYED = "policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.restart" - + "/versions/deployed"; + + "/versions/deployed"; private static final String OPS_POLICIES_VDNS_LATEST = "policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.scaleout" - + "/versions/latest"; + + "/versions/latest"; private static final String OPS_POLICIES_VFIREWALL_LATEST = "policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfig" - + "/versions/latest"; + + "/versions/latest"; private static final String OPS_POLICIES_VCPE_VERSION = "policytypes/" - + "onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.restart/versions/1"; + + "onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.restart/versions/1"; private static final String OPS_POLICIES_VDNS_VERSION = "policytypes/" - + "onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.scaleout/versions/1"; + + "onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.scaleout/versions/1"; private static final String OPS_POLICIES_VFIREWALL_VERSION = "policytypes/" - + "onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfig/versions/1"; + + "onap.policies.controlloop.Operational/versions/1.0.0/policies/operational.modifyconfig/versions/1"; private static final String KEYSTORE = System.getProperty("user.dir") + "/src/test/resources/ssl/policy-keystore"; private static final CommonTestData COMMON_TEST_DATA = new CommonTestData(); @@ -167,8 +168,8 @@ public class TestApiRestServer { }; private String[] toscaPolicyTypeResourceNames = { - "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json", - "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json" + "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml", + "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml" }; private String[] legacyGuardPolicyResourceNames = { @@ -349,7 +350,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } }).doesNotThrowAnyException(); } @@ -386,21 +387,21 @@ public class TestApiRestServer { assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); assertEquals("policy type with ID " - + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:null does not exist", + + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:null does not exist", error.getErrorMessage()); rawResponse = readResource(POLICYTYPES_COLLECTOR_VERSION, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); assertEquals("policy type with ID " - + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:1.0.0 does not exist", + + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:1.0.0 does not exist", error.getErrorMessage()); rawResponse = readResource(POLICYTYPES_COLLECTOR_LATEST, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); assertEquals("policy type with ID " - + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:null does not exist", + + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:null does not exist", error.getErrorMessage()); }).doesNotThrowAnyException(); } @@ -415,7 +416,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } for (String resrcName : toscaPolicyResourceNames) { @@ -462,7 +463,7 @@ public class TestApiRestServer { assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); assertEquals("policy type with ID " - + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:1.0.0 does not exist", + + "onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server:1.0.0 does not exist", error.getErrorMessage()); }).doesNotThrowAnyException(); } @@ -470,7 +471,7 @@ public class TestApiRestServer { @Test public void testDeletePolicyTypePersistent() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true);// create policy types for (String resrcName : toscaPolicyTypeResourceNames) { @@ -478,7 +479,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } Response rawResponse = deleteResource(POLICYTYPES_TCA_VERSION, true); assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); @@ -508,29 +509,33 @@ public class TestApiRestServer { Response rawResponse = readResource(POLICYTYPES_TCA_POLICIES, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy with ID null:null and " - + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", + assertEquals( + "policy with ID null:null and " + + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", error.getErrorMessage()); rawResponse = readResource(POLICYTYPES_TCA_POLICIES_VCPE, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy with ID onap.restart.tca:null and " - + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", + assertEquals( + "policy with ID onap.restart.tca:null and " + + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", error.getErrorMessage()); rawResponse = readResource(POLICYTYPES_TCA_POLICIES_VCPE_VERSION, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy with ID onap.restart.tca:1.0.0 and " - + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", + assertEquals( + "policy with ID onap.restart.tca:1.0.0 and " + + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", error.getErrorMessage()); rawResponse = readResource(POLICYTYPES_TCA_POLICIES_VCPE_LATEST, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy with ID onap.restart.tca:null and " - + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", + assertEquals( + "policy with ID onap.restart.tca:null and " + + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", error.getErrorMessage()); }).doesNotThrowAnyException(); } @@ -545,7 +550,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } for (String resrcName : toscaPolicyResourceNames) { @@ -576,8 +581,9 @@ public class TestApiRestServer { Response rawResponse = deleteResource(POLICYTYPES_TCA_POLICIES_VCPE_VERSION, true); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("policy with ID onap.restart.tca:1.0.0 and " - + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", + assertEquals( + "policy with ID onap.restart.tca:1.0.0 and " + + "type onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist", error.getErrorMessage()); }).doesNotThrowAnyException(); } @@ -585,7 +591,7 @@ public class TestApiRestServer { @Test public void testDeletePolicyVersion() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true);// create policy types for (String resrcName : toscaPolicyTypeResourceNames) { @@ -593,7 +599,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } for (String resrcName : toscaPolicyResourceNames) { Response rawResponse = createResource(POLICYTYPES_TCA_POLICIES, resrcName, true); @@ -606,7 +612,7 @@ public class TestApiRestServer { @Test public void testGetAllVersionOfPolicy() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true);// create policy types for (String resrcName : toscaPolicyTypeResourceNames) { @@ -614,7 +620,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } for (String resrcName : toscaPolicyResourceNames) { Response rawResponse = createResource(POLICYTYPES_TCA_POLICIES, resrcName, true); @@ -640,7 +646,7 @@ public class TestApiRestServer { @Test public void testCreateGuardPolicies1() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true); for (String resrcName : legacyGuardPolicyResourceNames) { @@ -665,7 +671,7 @@ public class TestApiRestServer { @Test public void testCreateOperationalPolicies1() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true); for (String resrcName : legacyOperationalPolicyResourceNames) { @@ -683,33 +689,29 @@ public class TestApiRestServer { Response rawResponse = readResource(GUARD_POLICIES_VDNS_FL_LATEST, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: guard.frequency.scaleout:null", - error.getErrorMessage()); + assertEquals("no policy found for policy: guard.frequency.scaleout:null", error.getErrorMessage()); rawResponse = readResource(GUARD_POLICIES_VDNS_FL_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: guard.frequency.scaleout:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: guard.frequency.scaleout:1", error.getErrorMessage()); rawResponse = readResource(GUARD_POLICIES_VDNS_MINMAX_LATEST, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: guard.minmax.scaleout:null", - error.getErrorMessage()); + assertEquals("no policy found for policy: guard.minmax.scaleout:null", error.getErrorMessage()); rawResponse = readResource(GUARD_POLICIES_VDNS_MINMAX_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: guard.minmax.scaleout:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: guard.minmax.scaleout:1", error.getErrorMessage()); }).doesNotThrowAnyException(); } @Test public void testReadGuardPolicies1() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true); for (String resrcName : legacyGuardPolicyResourceNames) { @@ -741,45 +743,39 @@ public class TestApiRestServer { Response rawResponse = readResource(OPS_POLICIES_VCPE_LATEST, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.restart:null", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.restart:null", error.getErrorMessage()); rawResponse = readResource(OPS_POLICIES_VCPE_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.restart:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.restart:1", error.getErrorMessage()); rawResponse = readResource(OPS_POLICIES_VDNS_LATEST, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.scaleout:null", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.scaleout:null", error.getErrorMessage()); rawResponse = readResource(OPS_POLICIES_VDNS_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.scaleout:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.scaleout:1", error.getErrorMessage()); rawResponse = readResource(OPS_POLICIES_VFIREWALL_LATEST, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.modifyconfig:null", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.modifyconfig:null", error.getErrorMessage()); rawResponse = readResource(OPS_POLICIES_VFIREWALL_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.modifyconfig:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.modifyconfig:1", error.getErrorMessage()); }).doesNotThrowAnyException(); } @Test public void testReadOperationalPolicies1() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true); for (String resrcName : legacyOperationalPolicyResourceNames) { @@ -821,15 +817,14 @@ public class TestApiRestServer { Response rawResponse = deleteResource(GUARD_POLICIES_VDNS_FL_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: guard.frequency.scaleout:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: guard.frequency.scaleout:1", error.getErrorMessage()); }).doesNotThrowAnyException(); } @Test public void testDeleteGuardPolicy1() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true); for (String resrcName : legacyGuardPolicyResourceNames) { @@ -859,15 +854,14 @@ public class TestApiRestServer { Response rawResponse = deleteResource(OPS_POLICIES_VCPE_VERSION, true); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), rawResponse.getStatus()); ErrorResponse error = rawResponse.readEntity(ErrorResponse.class); - assertEquals("no policy found for policy: operational.restart:1", - error.getErrorMessage()); + assertEquals("no policy found for policy: operational.restart:1", error.getErrorMessage()); }).doesNotThrowAnyException(); } @Test public void testDeleteOperationalPolicy1() throws Exception { - setupParameters(); //setup DB + setupParameters(); // setup DB main = startApiService(true); for (String resrcName : legacyOperationalPolicyResourceNames) { @@ -889,7 +883,7 @@ public class TestApiRestServer { assertEquals(Response.Status.OK.getStatusCode(), rawResponse.getStatus()); ToscaServiceTemplate response = rawResponse.readEntity(ToscaServiceTemplate.class); assertNotNull(response); - assertFalse(response.getPolicyTypes().get(0).isEmpty()); + assertFalse(response.getPolicyTypes().isEmpty()); } }).doesNotThrowAnyException(); } @@ -979,9 +973,10 @@ public class TestApiRestServer { } private Response createResource(String endpoint, String resourceName, boolean http) throws Exception { - - ToscaServiceTemplate rawServiceTemplate = standardCoder.decode( - ResourceUtils.getResourceAsString(resourceName), ToscaServiceTemplate.class); + String serviceTamplateAsJson = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(resourceName)); + ToscaServiceTemplate rawServiceTemplate = + standardCoder.decode(serviceTamplateAsJson, ToscaServiceTemplate.class); final Invocation.Builder invocationBuilder; if (http) { @@ -996,8 +991,8 @@ public class TestApiRestServer { private Response createGuardPolicy(String endpoint, String resourceName, boolean http) throws Exception { - LegacyGuardPolicyInput rawGuardPolicy = standardCoder.decode( - ResourceUtils.getResourceAsString(resourceName), LegacyGuardPolicyInput.class); + LegacyGuardPolicyInput rawGuardPolicy = + standardCoder.decode(ResourceUtils.getResourceAsString(resourceName), LegacyGuardPolicyInput.class); final Invocation.Builder invocationBuilder; if (http) { @@ -1012,8 +1007,8 @@ public class TestApiRestServer { private Response createOperationalPolicy(String endpoint, String resourceName, boolean http) throws Exception { - LegacyOperationalPolicy rawOpsPolicy = standardCoder.decode( - ResourceUtils.getResourceAsString(resourceName), LegacyOperationalPolicy.class); + LegacyOperationalPolicy rawOpsPolicy = + standardCoder.decode(ResourceUtils.getResourceAsString(resourceName), LegacyOperationalPolicy.class); final Invocation.Builder invocationBuilder; if (http) { @@ -1059,7 +1054,7 @@ public class TestApiRestServer { final String[] apiConfigParameters = new String[2]; if (http) { COMMON_TEST_DATA.makeParameters("src/test/resources/parameters/ApiConfigParameters.json", - "src/test/resources/parameters/ApiConfigParametersXXX.json", port); + "src/test/resources/parameters/ApiConfigParametersXXX.json", port); apiConfigParameters[0] = "-c"; apiConfigParameters[1] = "src/test/resources/parameters/ApiConfigParametersXXX.json"; } else { @@ -1068,7 +1063,7 @@ public class TestApiRestServer { systemProps.put("javax.net.ssl.keyStorePassword", "Pol1cy_0nap"); System.setProperties(systemProps); COMMON_TEST_DATA.makeParameters("src/test/resources/parameters/ApiConfigParameters_Https.json", - "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", port); + "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", port); apiConfigParameters[0] = "-c"; apiConfigParameters[1] = "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json"; } @@ -1120,8 +1115,8 @@ public class TestApiRestServer { final SSLContext sc = SSLContext.getInstance("TLSv1.2"); sc.init(null, noopTrustManager, new SecureRandom()); - final ClientBuilder clientBuilder = ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, - session) -> true); + final ClientBuilder clientBuilder = + ClientBuilder.newBuilder().sslContext(sc).hostnameVerifier((host, session) -> true); final Client client = clientBuilder.build(); final HttpAuthenticationFeature feature = HttpAuthenticationFeature.basic("healthcheck", "zb!XztG34"); client.register(feature); diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java b/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java index f2999975..3b6fad5a 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java @@ -3,6 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -31,10 +32,9 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; import org.junit.Test; -/* + +/** * Class to perform unit testing of CommonRestController. - * - * */ public class TestCommonRestController { private CommonRestController crc = new CommonRestController(); diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java index 1f0077db..bfd126ea 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyGuardPolicyProvider.java @@ -3,6 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -38,6 +39,7 @@ import java.util.Map; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onap.policy.api.main.ApiTestSupportUtilities; import org.onap.policy.api.main.parameters.ApiParameterGroup; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.coder.StandardCoder; @@ -59,7 +61,7 @@ import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput; import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput; /** - * This class performs unit test of {@link LegacyGuardPolicyProvider} + * This class performs unit test of {@link LegacyGuardPolicyProvider}. * * @author Chenfei Gao (cgao@research.att.com) */ @@ -75,7 +77,7 @@ public class TestLegacyGuardPolicyProvider { private static final String POLICY_RESOURCE_VER1 = "policies/vDNS.policy.guard.frequency.input.ver1.json"; private static final String POLICY_RESOURCE_VER2 = "policies/vDNS.policy.guard.frequency.input.ver2.json"; private static final String POLICY_TYPE_RESOURCE = - "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json"; + "policytypes/onap.policies.controlloop.guard.FrequencyLimiter.yaml"; private static final String POLICY_TYPE_ID = "onap.policies.controlloop.guard.FrequencyLimiter:1.0.0"; private static final String POLICY_TYPE_NAME = "onap.policies.controlloop.guard.FrequencyLimiter"; private static final String POLICY_TYPE_VERSION = "1.0.0"; @@ -131,7 +133,8 @@ public class TestLegacyGuardPolicyProvider { }).hasMessage("legacy policy version is not an integer"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -203,8 +206,8 @@ public class TestLegacyGuardPolicyProvider { pdpSubGroup.setPdpType("type"); pdpSubGroup.setDesiredInstanceCount(123); pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>()); - pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier( - POLICY_TYPE_NAME, POLICY_TYPE_VERSION)); + pdpSubGroup.getSupportedPolicyTypes() + .add(new ToscaPolicyTypeIdentifier(POLICY_TYPE_NAME, POLICY_TYPE_VERSION)); pdpGroup.getPdpSubgroups().add(pdpSubGroup); Pdp pdp = new Pdp(); @@ -222,7 +225,8 @@ public class TestLegacyGuardPolicyProvider { // Create Policy Type assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -233,41 +237,36 @@ public class TestLegacyGuardPolicyProvider { String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); LegacyGuardPolicyInput policyToCreate = standardCoder.decode(policyString, LegacyGuardPolicyInput.class); - Map<String, LegacyGuardPolicyOutput> policyCreated = guardPolicyProvider - .createGuardPolicy(policyToCreate); + Map<String, LegacyGuardPolicyOutput> policyCreated = + guardPolicyProvider.createGuardPolicy(policyToCreate); assertFalse(policyCreated.isEmpty()); }).doesNotThrowAnyException(); // Test fetchDeployedPolicies (deployedPolicyMap.isEmpty())==true - assertThatThrownBy( - () -> { - guardPolicyProvider.fetchDeployedGuardPolicies(POLICY_NAME); - }).hasMessage("could not find policy with ID " + POLICY_NAME + " and type " - + POLICY_TYPE_ID + " deployed in any pdp group"); + assertThatThrownBy(() -> { + guardPolicyProvider.fetchDeployedGuardPolicies(POLICY_NAME); + }) .hasMessage("could not find policy with ID " + POLICY_NAME + " and type " + POLICY_TYPE_ID + + " deployed in any pdp group"); // Update pdpSubGroup pdpSubGroup.setPolicies(new ArrayList<>()); - pdpSubGroup.getPolicies().add( - new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION + LEGACY_MINOR_PATCH_SUFFIX)); - assertEquals(1, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0) - .getPolicies().size()); + pdpSubGroup.getPolicies() + .add(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION + LEGACY_MINOR_PATCH_SUFFIX)); + assertEquals(1, + databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size()); // Test fetchDeployedPolicies - assertThatCode( - () -> { - guardPolicyProvider.fetchDeployedGuardPolicies(POLICY_NAME); - }).doesNotThrowAnyException(); + assertThatCode(() -> { + guardPolicyProvider.fetchDeployedGuardPolicies(POLICY_NAME); + }).doesNotThrowAnyException(); // Test validateDeleteEligibility exception path(!pdpGroups.isEmpty()) - assertThatThrownBy( - () -> { - guardPolicyProvider.deleteGuardPolicy( - POLICY_NAME, POLICY_VERSION); - }).hasMessageContaining("policy with ID " + POLICY_NAME + ":" + POLICY_VERSION + assertThatThrownBy(() -> { + guardPolicyProvider.deleteGuardPolicy(POLICY_NAME, POLICY_VERSION); + }) .hasMessageContaining("policy with ID " + POLICY_NAME + ":" + POLICY_VERSION + " cannot be deleted as it is deployed in pdp groups"); - } - catch (Exception exc) { + } catch (Exception exc) { fail("Test should not throw an exception"); } } @@ -282,7 +281,8 @@ public class TestLegacyGuardPolicyProvider { }).hasMessage("policy type " + POLICY_TYPE_ID + " for policy " + POLICY_ID + " does not exist"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -327,8 +327,7 @@ public class TestLegacyGuardPolicyProvider { pdpSubGroup.setPdpType("type"); pdpSubGroup.setDesiredInstanceCount(123); pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>()); - pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier( - policyTypeId, policyTypeVersion)); + pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion)); pdpGroup.getPdpSubgroups().add(pdpSubGroup); Pdp pdp = new Pdp(); @@ -346,17 +345,18 @@ public class TestLegacyGuardPolicyProvider { // Create Policy Type assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = - standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); + standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); }).doesNotThrowAnyException(); // Create Policy assertThatCode(() -> { String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); - LegacyGuardPolicyInput policyToCreate = standardCoder.decode(policyString, - LegacyGuardPolicyInput.class); + LegacyGuardPolicyInput policyToCreate = + standardCoder.decode(policyString, LegacyGuardPolicyInput.class); Map<String, LegacyGuardPolicyOutput> createdPolicy = guardPolicyProvider.createGuardPolicy(policyToCreate); assertNotNull(createdPolicy); @@ -366,14 +366,12 @@ public class TestLegacyGuardPolicyProvider { // Update pdpSubGroup pdpSubGroup.setPolicies(new ArrayList<>()); pdpSubGroup.getPolicies().add(new ToscaPolicyIdentifier(policyId, policyVersion + legacyMinorPatchSuffix)); - assertEquals(1, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0) - .getPolicies().size()); + assertEquals(1, + databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size()); assertThatThrownBy(() -> { - guardPolicyProvider - .deleteGuardPolicy("guard.frequency.scaleout", "1"); + guardPolicyProvider.deleteGuardPolicy("guard.frequency.scaleout", "1"); }).hasMessageContaining("cannot be deleted as it is deployed in pdp groups"); - } - catch (Exception exc) { + } catch (Exception exc) { fail("Test should not throw an exception"); } } @@ -389,7 +387,8 @@ public class TestLegacyGuardPolicyProvider { }).hasMessage("legacy policy version is not an integer"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -400,8 +399,8 @@ public class TestLegacyGuardPolicyProvider { assertNotNull(createdPolicy); assertFalse(createdPolicy.isEmpty()); - Map<String, LegacyGuardPolicyOutput> deletedPolicy = guardPolicyProvider - .deleteGuardPolicy("guard.frequency.scaleout", "1"); + Map<String, LegacyGuardPolicyOutput> deletedPolicy = + guardPolicyProvider.deleteGuardPolicy("guard.frequency.scaleout", "1"); assertNotNull(deletedPolicy); assertFalse(deletedPolicy.isEmpty()); assertTrue(deletedPolicy.containsKey("guard.frequency.scaleout")); diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java index 2479223e..f1784a53 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java @@ -3,6 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -37,6 +38,7 @@ import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onap.policy.api.main.ApiTestSupportUtilities; import org.onap.policy.api.main.parameters.ApiParameterGroup; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.coder.StandardCoder; @@ -57,7 +59,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy; /** - * This class performs unit test of {@link LegacyOperationalPolicyProvider} + * This class performs unit test of {@link LegacyOperationalPolicyProvider}. * * @author Chenfei Gao (cgao@research.att.com) */ @@ -70,7 +72,7 @@ public class TestLegacyOperationalPolicyProvider { private static StandardCoder standardCoder; private static final String POLICY_RESOURCE = "policies/vCPE.policy.operational.input.json"; - private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.controlloop.Operational.json"; + private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.controlloop.Operational.yaml"; private static final String POLICY_TYPE_ID = "onap.policies.controlloop.Operational:1.0.0"; private static final String POLICY_ID = "operational.restart:1.0.0"; private static final String POLICY_NAME = "operational.restart"; @@ -125,7 +127,8 @@ public class TestLegacyOperationalPolicyProvider { }).hasMessage("legacy policy version is not an integer"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -143,14 +146,12 @@ public class TestLegacyOperationalPolicyProvider { LegacyOperationalPolicy firstVersion = operationalPolicyProvider.fetchOperationalPolicy("operational.restart", "1"); assertNotNull(firstVersion); - assertEquals("1", - firstVersion.getPolicyVersion()); + assertEquals("1", firstVersion.getPolicyVersion()); LegacyOperationalPolicy latestVersion = operationalPolicyProvider.fetchOperationalPolicy("operational.restart", null); assertNotNull(latestVersion); - assertEquals("2", - latestVersion.getPolicyVersion()); + assertEquals("2", latestVersion.getPolicyVersion()); }).doesNotThrowAnyException(); assertThatThrownBy(() -> { @@ -195,8 +196,8 @@ public class TestLegacyOperationalPolicyProvider { pdpSubGroup.setPdpType("type"); pdpSubGroup.setDesiredInstanceCount(123); pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>()); - pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier( - POLICY_TYPE_NAME, POLICY_TYPE_VERSION)); + pdpSubGroup.getSupportedPolicyTypes() + .add(new ToscaPolicyTypeIdentifier(POLICY_TYPE_NAME, POLICY_TYPE_VERSION)); pdpGroup.getPdpSubgroups().add(pdpSubGroup); Pdp pdp = new Pdp(); @@ -214,7 +215,8 @@ public class TestLegacyOperationalPolicyProvider { // Create Policy Type assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -225,43 +227,38 @@ public class TestLegacyOperationalPolicyProvider { String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); LegacyOperationalPolicy policyToCreate = standardCoder.decode(policyString, LegacyOperationalPolicy.class); - LegacyOperationalPolicy policyCreated = operationalPolicyProvider - .createOperationalPolicy(policyToCreate); + LegacyOperationalPolicy policyCreated = + operationalPolicyProvider.createOperationalPolicy(policyToCreate); assertEquals("operational.restart", policyCreated.getPolicyId()); assertEquals("1", policyCreated.getPolicyVersion()); assertFalse(policyCreated.getContent() == null); }).doesNotThrowAnyException(); // Test fetchDeployedPolicies (deployedPolicyMap.isEmpty())==true - assertThatThrownBy( - () -> { - operationalPolicyProvider.fetchDeployedOperationalPolicies(POLICY_NAME); - }).hasMessage("could not find policy with ID " + POLICY_NAME + " and type " - + POLICY_TYPE_ID + " deployed in any pdp group"); + assertThatThrownBy(() -> { + operationalPolicyProvider.fetchDeployedOperationalPolicies(POLICY_NAME); + }) .hasMessage("could not find policy with ID " + POLICY_NAME + " and type " + POLICY_TYPE_ID + + " deployed in any pdp group"); // Update pdpSubGroup pdpSubGroup.setPolicies(new ArrayList<>()); - pdpSubGroup.getPolicies().add( - new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION + LEGACY_MINOR_PATCH_SUFFIX)); - assertEquals(1, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0) - .getPolicies().size()); + pdpSubGroup.getPolicies() + .add(new ToscaPolicyIdentifier(POLICY_NAME, POLICY_VERSION + LEGACY_MINOR_PATCH_SUFFIX)); + assertEquals(1, + databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size()); // Test fetchDeployedPolicies - assertThatCode( - () -> { - operationalPolicyProvider.fetchDeployedOperationalPolicies(POLICY_NAME); - }).doesNotThrowAnyException(); + assertThatCode(() -> { + operationalPolicyProvider.fetchDeployedOperationalPolicies(POLICY_NAME); + }).doesNotThrowAnyException(); // Test validateDeleteEligibility exception path(!pdpGroups.isEmpty()) - assertThatThrownBy( - () -> { - operationalPolicyProvider.deleteOperationalPolicy( - POLICY_NAME, POLICY_VERSION); - }).hasMessageContaining("policy with ID " + POLICY_NAME + ":" + POLICY_VERSION + assertThatThrownBy(() -> { + operationalPolicyProvider.deleteOperationalPolicy(POLICY_NAME, POLICY_VERSION); + }) .hasMessageContaining("policy with ID " + POLICY_NAME + ":" + POLICY_VERSION + " cannot be deleted as it is deployed in pdp groups"); - } - catch (Exception exc) { + } catch (Exception exc) { fail("Test should not throw an exception"); } } @@ -276,7 +273,8 @@ public class TestLegacyOperationalPolicyProvider { }).hasMessage("policy type " + POLICY_TYPE_ID + " for policy " + POLICY_ID + " does not exist"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -286,8 +284,7 @@ public class TestLegacyOperationalPolicyProvider { LegacyOperationalPolicy createdPolicy = operationalPolicyProvider.createOperationalPolicy(policyToCreate); assertNotNull(createdPolicy); assertEquals("operational.restart", createdPolicy.getPolicyId()); - assertTrue(createdPolicy.getContent() - .startsWith("controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20")); + assertTrue(createdPolicy.getContent().startsWith("controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20")); }).doesNotThrowAnyException(); } @@ -319,8 +316,7 @@ public class TestLegacyOperationalPolicyProvider { pdpSubGroup.setPdpType("type"); pdpSubGroup.setDesiredInstanceCount(123); pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>()); - pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier( - policyTypeId, policyTypeVersion)); + pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion)); pdpGroup.getPdpSubgroups().add(pdpSubGroup); Pdp pdp = new Pdp(); @@ -338,9 +334,10 @@ public class TestLegacyOperationalPolicyProvider { // Create Policy Type assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = - standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); + standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); }).doesNotThrowAnyException(); @@ -357,13 +354,12 @@ public class TestLegacyOperationalPolicyProvider { // Update pdpSubGroup pdpSubGroup.setPolicies(new ArrayList<>()); pdpSubGroup.getPolicies().add(new ToscaPolicyIdentifier(policyId, policyVersion + legacyMinorPatchSuffix)); - assertEquals(1, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0) - .getPolicies().size()); + assertEquals(1, + databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size()); assertThatThrownBy(() -> { operationalPolicyProvider.deleteOperationalPolicy(policyId, policyVersion); }).hasMessageContaining("cannot be deleted as it is deployed in pdp groups"); - } - catch (Exception exc) { + } catch (Exception exc) { fail("Test should not throw an exception"); } } @@ -380,7 +376,8 @@ public class TestLegacyOperationalPolicyProvider { }).hasMessage("legacy policy version is not an integer"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -390,12 +387,11 @@ public class TestLegacyOperationalPolicyProvider { LegacyOperationalPolicy createdPolicy = operationalPolicyProvider.createOperationalPolicy(policyToCreate); assertNotNull(createdPolicy); - LegacyOperationalPolicy deletedPolicy = operationalPolicyProvider - .deleteOperationalPolicy("operational.restart", "1"); + LegacyOperationalPolicy deletedPolicy = + operationalPolicyProvider.deleteOperationalPolicy("operational.restart", "1"); assertNotNull(deletedPolicy); assertEquals("operational.restart", deletedPolicy.getPolicyId()); - assertTrue(deletedPolicy.getContent() - .startsWith("controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20")); + assertTrue(deletedPolicy.getContent().startsWith("controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20")); }).doesNotThrowAnyException(); assertThatThrownBy(() -> { diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java index ea886370..282f8a08 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyProvider.java @@ -3,6 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -36,6 +37,7 @@ import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onap.policy.api.main.ApiTestSupportUtilities; import org.onap.policy.api.main.parameters.ApiParameterGroup; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.coder.StandardCoder; @@ -55,7 +57,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** - * This class performs unit test of {@link PolicyProvider} + * This class performs unit test of {@link PolicyProvider}. * * @author Chenfei Gao (cgao@research.att.com) */ @@ -68,7 +70,7 @@ public class TestPolicyProvider { private static StandardCoder standardCoder; private static final String POLICY_RESOURCE = "policies/vCPE.policy.monitoring.input.tosca.json"; - private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json"; + private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"; private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_ID = "policies/vCPE.policy.bad.policytypeid.json"; private static final String POLICY_RESOURCE_WITH_BAD_POLICYTYPE_VERSION = "policies/vCPE.policy.bad.policytypeversion.json"; @@ -139,7 +141,7 @@ public class TestPolicyProvider { String policyTypeVersion = "1.0.0"; String policyTypeId = "onap.policies.monitoring.cdap.tca.hi.lo.app"; - //Basic Exception Throw + // Basic Exception Throw assertThatThrownBy(() -> { policyProvider.fetchDeployedPolicies("dummy", "1.0.0", "dummy"); }).hasMessage("could not find policy with ID dummy and type dummy:1.0.0 deployed in any pdp group"); @@ -164,8 +166,7 @@ public class TestPolicyProvider { pdpSubGroup.setPdpType("type"); pdpSubGroup.setDesiredInstanceCount(123); pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>()); - pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier( - policyTypeId, policyTypeVersion)); + pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion)); pdpGroup.getPdpSubgroups().add(pdpSubGroup); Pdp pdp = new Pdp(); @@ -183,7 +184,8 @@ public class TestPolicyProvider { // Create Policy Type assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -194,43 +196,36 @@ public class TestPolicyProvider { String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class); - ToscaServiceTemplate serviceTemplate = policyProvider - .createPolicy(policyTypeId, policyTypeVersion, policyServiceTemplate); + ToscaServiceTemplate serviceTemplate = + policyProvider.createPolicy(policyTypeId, policyTypeVersion, policyServiceTemplate); assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty()); }).doesNotThrowAnyException(); // Test fetchDeployedPolicies (deployedPolicyMap.isEmpty())==true - assertThatThrownBy( - () -> { - policyProvider.fetchDeployedPolicies( - policyTypeId, policyTypeVersion, policyId); - }).hasMessage("could not find policy with ID " + policyId + " and type " - + policyTypeId + ":" + policyTypeVersion + " deployed in any pdp group"); + assertThatThrownBy(() -> { + policyProvider.fetchDeployedPolicies(policyTypeId, policyTypeVersion, policyId); + }) .hasMessage("could not find policy with ID " + policyId + " and type " + policyTypeId + ":" + + policyTypeVersion + " deployed in any pdp group"); // Update pdpSubGroup pdpSubGroup.setPolicies(new ArrayList<>()); pdpSubGroup.getPolicies().add(new ToscaPolicyIdentifier(policyId, policyVersion)); - assertEquals(1, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0) - .getPolicies().size()); + assertEquals(1, + databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getPolicies().size()); // Test fetchDeployedPolicies - assertThatCode( - () -> { - policyProvider.fetchDeployedPolicies( - policyTypeId, policyTypeVersion, policyId); - }).doesNotThrowAnyException(); + assertThatCode(() -> { + policyProvider.fetchDeployedPolicies(policyTypeId, policyTypeVersion, policyId); + }).doesNotThrowAnyException(); // Test validateDeleteEligibility exception path(!pdpGroups.isEmpty()) - assertThatThrownBy( - () -> { - policyProvider.deletePolicy( - "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", - "onap.restart.tca", "1.0.0"); - }).hasMessageContaining("policy with ID " + policyId + ":" + policyVersion + assertThatThrownBy(() -> { + policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", + "1.0.0"); + }) .hasMessageContaining("policy with ID " + policyId + ":" + policyVersion + " cannot be deleted as it is deployed in pdp groups"); - } - catch (Exception exc) { + } catch (Exception exc) { fail("Test should not throw an exception"); } } @@ -243,7 +238,8 @@ public class TestPolicyProvider { }).hasMessage("policy type with ID dummy:1.0.0 does not exist"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -267,8 +263,7 @@ public class TestPolicyProvider { assertThatCode(() -> { String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); - ToscaServiceTemplate policyServiceTemplate = - standardCoder.decode(policyString, ToscaServiceTemplate.class); + ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyProvider .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate); assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty()); @@ -283,7 +278,8 @@ public class TestPolicyProvider { }).hasMessage("policy with ID dummy:1.0.0 and type dummy:1.0.0 does not exist"); assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); policyTypeProvider.createPolicyType(policyTypeServiceTemplate); @@ -291,24 +287,23 @@ public class TestPolicyProvider { assertThatCode(() -> { String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); - ToscaServiceTemplate policyServiceTemplate = - standardCoder.decode(policyString, ToscaServiceTemplate.class); + ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyProvider .createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate); assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty()); }).doesNotThrowAnyException(); assertThatCode(() -> { - ToscaServiceTemplate serviceTemplate = policyProvider.deletePolicy( - "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0"); + ToscaServiceTemplate serviceTemplate = policyProvider + .deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0"); assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty()); }).doesNotThrowAnyException(); String exceptionMessage = "policy with ID onap.restart.tca:1.0.0 and type " - + "onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist"; + + "onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 does not exist"; assertThatThrownBy(() -> { - policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", - "onap.restart.tca", "1.0.0"); + policyProvider.deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", + "1.0.0"); }).hasMessage(exceptionMessage); } diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java index 7865453f..07675b79 100644 --- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java +++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestPolicyTypeProvider.java @@ -3,6 +3,7 @@ * ONAP Policy API * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications 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. @@ -30,6 +31,7 @@ import java.util.Base64; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.onap.policy.api.main.ApiTestSupportUtilities; import org.onap.policy.api.main.parameters.ApiParameterGroup; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.coder.StandardCoder; @@ -39,7 +41,7 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** - * This class performs unit test of {@link PolicyTypeProvider} + * This class performs unit test of {@link PolicyTypeProvider}. * * @author Chenfei Gao (cgao@research.att.com) */ @@ -51,8 +53,8 @@ public class TestPolicyTypeProvider { private static ApiParameterGroup apiParamGroup; private static StandardCoder standardCoder; - private static final String POLICY_RESOURCE = "policies/vCPE.policy.monitoring.input.tosca.json"; - private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json"; + private static final String POLICY_RESOURCE = "policies/vCPE.policy.monitoring.input.tosca.yaml"; + private static final String POLICY_TYPE_RESOURCE = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"; /** * Initializes parameters. @@ -117,11 +119,12 @@ public class TestPolicyTypeProvider { public void testCreatePolicyType() { assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); - assertFalse(serviceTemplate.getPolicyTypes().get(0).isEmpty()); + assertFalse(serviceTemplate.getPolicyTypes().isEmpty()); }).doesNotThrowAnyException(); } @@ -129,37 +132,36 @@ public class TestPolicyTypeProvider { public void testDeletePolicyType() { assertThatCode(() -> { - String policyTypeString = ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE); + String policyTypeString = + ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_TYPE_RESOURCE)); ToscaServiceTemplate policyTypeServiceTemplate = standardCoder.decode(policyTypeString, ToscaServiceTemplate.class); ToscaServiceTemplate serviceTemplate = policyTypeProvider.createPolicyType(policyTypeServiceTemplate); - assertFalse(serviceTemplate.getPolicyTypes().get(0).isEmpty()); + assertFalse(serviceTemplate.getPolicyTypes().isEmpty()); }).doesNotThrowAnyException(); assertThatCode(() -> { - String policyString = ResourceUtils.getResourceAsString(POLICY_RESOURCE); - ToscaServiceTemplate policyServiceTemplate = - standardCoder.decode(policyString, ToscaServiceTemplate.class); - policyProvider.createPolicy( - "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate); + String policyString = ApiTestSupportUtilities.yaml2Json(ResourceUtils.getResourceAsString(POLICY_RESOURCE)); + ToscaServiceTemplate policyServiceTemplate = standardCoder.decode(policyString, ToscaServiceTemplate.class); + policyProvider.createPolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", policyServiceTemplate); }).doesNotThrowAnyException(); String exceptionMessage = "policy type with ID onap.policies.monitoring.cdap.tca.hi.lo.app:1.0.0 " - + "cannot be deleted as it is parameterized by policies onap.restart.tca:1.0.0"; + + "cannot be deleted as it is parameterized by policies onap.restart.tca:1.0.0"; assertThatThrownBy(() -> { policyTypeProvider.deletePolicyType("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"); }).hasMessage(exceptionMessage); assertThatCode(() -> { - ToscaServiceTemplate serviceTemplate = policyProvider.deletePolicy( - "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0"); + ToscaServiceTemplate serviceTemplate = policyProvider + .deletePolicy("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0", "onap.restart.tca", "1.0.0"); assertFalse(serviceTemplate.getToscaTopologyTemplate().getPolicies().get(0).isEmpty()); }).doesNotThrowAnyException(); assertThatCode(() -> { - ToscaServiceTemplate serviceTemplate = policyTypeProvider.deletePolicyType( - "onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"); - assertFalse(serviceTemplate.getPolicyTypes().get(0).isEmpty()); + ToscaServiceTemplate serviceTemplate = + policyTypeProvider.deletePolicyType("onap.policies.monitoring.cdap.tca.hi.lo.app", "1.0.0"); + assertFalse(serviceTemplate.getPolicyTypes().isEmpty()); }).doesNotThrowAnyException(); assertThatThrownBy(() -> { diff --git a/main/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml b/main/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml deleted file mode 100644 index 17f20dfd..00000000 --- a/main/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml +++ /dev/null @@ -1,173 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - OSDF_CASABLANCA.Affinity_vCPE_1: - type: onap.policies.optimization.AffinityPolicy - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.Affinity_vCPE_1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vGMuxInfra, vG] - geography: [US, INTERNATIONAL] - identity: affinity_vCPE - applicableResources: any - affinityProperties: - qualifier: same - category: complex - - - OSDF_CASABLANCA.Capacity_vG_1: - type: onap.policies.optimization.Vim_fit - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.Capacity_vG_1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: capacity_vG - applicableResources: any - capacityProperty: - controller: multicloud - request: "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}" - - - OSDF_CASABLANCA.Distance_vG_1: - type: onap.policies.optimization.DistancePolicy - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.Distance_vG_1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: distance-vG - applicableResources: any - distanceProperties: - locationInfo: customer_loc - distance: - value: 1500 - operator: "<" - unit: km - - - OSDF_CASABLANCA.hpa_policy_vG_1: - type: onap.policies.optimization.HpaPolicy - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.hpa_policy_vG_1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: hpa-vG - flavorFeatures: - - - id: vg_1 - type: vnfc - directives: - - type: flavor_directives - attributes: - - attribute_name: flavor_label_vm_01 - attribute_value: "" - flavorProperties: - - - hpa-feature: basicCapabilities - mandatory: True - architecture: generic - directives: [] - hpa-feature-attributes: - - hpa-attribute-key: numVirtualCpu - hpa-attribute-value: 6 - operator: ['>='] - unit: "" - - hpa-attribute-key: virtualMemSize - hpa-attribute-value: 4 - operator: ['<='] - unit: "" - - - hpa-feature: ovsDpdk - mandatory: False - architecture: generic - directives: [] - hpa-feature-attributes: - - hpa-attribute-key: dataProcessingAccelerationLibrary - hpa-attribute-value: ovsDpdk_version - operator: [=] - unit: "" - - - OSDF_CASABLANCA.queryPolicy_vCPE: - type: onap.policies.optimization.QueryPolicy - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.queryPolicy_vCPE - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vGMuxInfra, vG] - geography: [US, INTERNATIONAL] - identity: vCPE_Query_Policy - queryProperties: - - - attribute: locationId - attribute_location: customerLocation - value: "" - - - attribute: id - attribute_location: "vpnInfo.vpnId" - value: "" - - - attribute: upstreamBW - attribute_location: "vpnInfo.upstreamBW" - value: "" - - - attribute: customerLatitude - attribute_location: customerLatitude - value: 1.1 - - - attribute: customerLongitude - attribute_location: customerLongitude - value: 2.2 - - - OSDF_CASABLANCA.SubscriberPolicy_v1: - type: onap.policies.optimization.SubscriberPolicy - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.SubscriberPolicy_v1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - identity: subscriber_vCPE - properties: - subscriberName: [subscriber_x, subscriber_y] - subscriberRole: ["PVT Homing"] - provStatus: [CAPPED] - - - OSDF_CASABLANCA.vnfPolicy_vG: - type: onap.policies.optimization.VnfPolicy - version: 1.0.0 - metadata: - policy-id: OSDF_CASABLANCA.vnfPolicy_vG - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: vnf_vG - applicableResources: any - vnfProperties: - - - inventoryProvider: aai - serviceType: "" - inventoryType: cloudRegionId - customerId: "" diff --git a/main/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json b/main/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json deleted file mode 100644 index 7a63f658..00000000 --- a/main/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "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" - } - ] - } - ] - } - } - } - } - ] - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml b/main/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml deleted file mode 100644 index 00afec39..00000000 --- a/main/src/test/resources/policies/vCPE.policy.monitoring.input.tosca.yaml +++ /dev/null @@ -1,36 +0,0 @@ -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 - 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 diff --git a/main/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml b/main/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml deleted file mode 100644 index a8a1cdac..00000000 --- a/main/src/test/resources/policies/vCPE.policy.monitoring.output.tosca.yaml +++ /dev/null @@ -1,37 +0,0 @@ -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 - metadata: - policy-id: onap.restart.tca - policy-version: 1 - 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 diff --git a/main/src/test/resources/policies/vCPE.policy.operational.input.json b/main/src/test/resources/policies/vCPE.policy.operational.input.json deleted file mode 100644 index 393cb028..00000000 --- a/main/src/test/resources/policies/vCPE.policy.operational.input.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "policy-id" : "operational.restart", - "content" : "controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0A%20%20trigger_policy%3A%20unique-policy-id-1-restart%0A%20%20timeout%3A%203600%0A%20%20abatement%3A%20true%0A%20%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-restart%0A%20%20%20%20name%3A%20Restart%20the%20VM%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20APPC%0A%20%20%20%20recipe%3A%20Restart%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20type%3A%20VM%0A%20%20%20%20retry%3A%203%0A%20%20%20%20timeout%3A%201200%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard" -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml b/main/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml deleted file mode 100644 index dda0169f..00000000 --- a/main/src/test/resources/policies/vCPE.policy.operational.input.tosca.yaml +++ /dev/null @@ -1,33 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - operational.restart: - type: onap.policies.controlloop.Operational - version: 1.0.0 - metadata: - policy-id: operational.restart - properties: - controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e - trigger_policy: unique-policy-id-1-restart - timeout: 3600 - abatement: true - - policies: - - id: unique-policy-id-1-restart - name: Restart the VM - description: - actor: APPC - recipe: Restart - target: - type: VM - retry: 3 - timeout: 1200 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard
\ No newline at end of file diff --git a/main/src/test/resources/policies/vCPE.policy.operational.output.json b/main/src/test/resources/policies/vCPE.policy.operational.output.json deleted file mode 100644 index 7d26e8e6..00000000 --- a/main/src/test/resources/policies/vCPE.policy.operational.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policy-id" : "operational.restart", - "policy-version" : "1", - "content" : "controlLoop%3A%0A%20%20version%3A%202.0.0%0A%20%20controlLoopName%3A%20ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e%0A%20%20trigger_policy%3A%20unique-policy-id-1-restart%0A%20%20timeout%3A%203600%0A%20%20abatement%3A%20true%0A%20%0Apolicies%3A%0A%20%20-%20id%3A%20unique-policy-id-1-restart%0A%20%20%20%20name%3A%20Restart%20the%20VM%0A%20%20%20%20description%3A%0A%20%20%20%20actor%3A%20APPC%0A%20%20%20%20recipe%3A%20Restart%0A%20%20%20%20target%3A%0A%20%20%20%20%20%20type%3A%20VM%0A%20%20%20%20retry%3A%203%0A%20%20%20%20timeout%3A%201200%0A%20%20%20%20success%3A%20final_success%0A%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20failure_guard%3A%20final_failure_guard" -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vCPE.policy.operational.output.tosca.json b/main/src/test/resources/policies/vCPE.policy.operational.output.tosca.json deleted file mode 100644 index d7385373..00000000 --- a/main/src/test/resources/policies/vCPE.policy.operational.output.tosca.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "topology_template": { - "policies": [ - { - "operational.restart": { - "type": "onap.policies.controlloop.Operational", - "version": "1.0.0", - "metadata": { - "policy-id": "operational.restart", - "policy-version": 1 - }, - "properties": { - "controlLoop": { - "version": "2.0.0", - "controlLoopName": "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e", - "trigger_policy": "unique-policy-id-1-restart", - "timeout": 3600, - "abatement": true - }, - "policies": [ - { - "id": "unique-policy-id-1-restart", - "name": "Restart the VM", - "description": null, - "actor": "APPC", - "recipe": "Restart", - "target": { - "type": "VM" - }, - "retry": 3, - "timeout": 1200, - "success": "final_success", - "failure": "final_failure", - "failure_timeout": "final_failure_timeout", - "failure_retries": "final_failure_retries", - "failure_exception": "final_failure_exception", - "failure_guard": "final_failure_guard" - } - ] - } - } - } - ] - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml b/main/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml deleted file mode 100644 index e4a06947..00000000 --- a/main/src/test/resources/policies/vCPE.policy.operational.output.tosca.yaml +++ /dev/null @@ -1,34 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - operational.restart: - type: onap.policies.controlloop.Operational - version: 1.0.0 - metadata: - policy-id: operational.restart - policy-version: 1 - properties: - controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e - trigger_policy: unique-policy-id-1-restart - timeout: 3600 - abatement: true - - policies: - - id: unique-policy-id-1-restart - name: Restart the VM - description: - actor: APPC - recipe: Restart - target: - type: VM - retry: 3 - timeout: 1200 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.guard.frequency.input.json b/main/src/test/resources/policies/vDNS.policy.guard.frequency.input.json deleted file mode 100644 index 442f3ec4..00000000 --- a/main/src/test/resources/policies/vDNS.policy.guard.frequency.input.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "policy-id" : "guard.frequency.scaleout", - "content" : { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "limit": "1", - "timeWindow": "10", - "timeUnits": "minute", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } -} diff --git a/main/src/test/resources/policies/vDNS.policy.guard.frequency.output.json b/main/src/test/resources/policies/vDNS.policy.guard.frequency.output.json deleted file mode 100644 index 48c92c3b..00000000 --- a/main/src/test/resources/policies/vDNS.policy.guard.frequency.output.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "guard.frequency.scaleout": { - "type": "onap.policies.controlloop.guard.FrequencyLimiter", - "version": "1.0.0", - "metadata": { - "policy-id": "guard.frequency.scaleout", - "policy-version": 1 - }, - "properties": { - "content": { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "limit": "1", - "timeWindow": "10", - "timeUnits": "minute", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } - } - } -}
\ 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 deleted file mode 100644 index 45a7d41d..00000000 --- a/main/src/test/resources/policies/vDNS.policy.guard.minmax.input.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "policy-id" : "guard.minmax.scaleout", - "content" : { - "actor": "SO", - "recipe": "scaleOut", - "targets": ".*", - "clname": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "min": "1", - "max": "5", - "guardActiveStart": "00:00:01-05:00", - "guardActiveEnd": "23:59:59-05:00" - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.guard.minmax.output.json b/main/src/test/resources/policies/vDNS.policy.guard.minmax.output.json deleted file mode 100644 index 83d2f272..00000000 --- a/main/src/test/resources/policies/vDNS.policy.guard.minmax.output.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "guard.minmax.scaleout": { - "type": "onap.policies.controlloop.guard.MinMax", - "version": "1.0.0", - "metadata": { - "policy-id": "guard.minmax.scaleout", - "policy-version": 1 - } - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json b/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json deleted file mode 100644 index d2f9584e..00000000 --- a/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "topology_template": { - "policies": [ - { - "onap.scaleout.tca": { - "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", - "version": "1.0.0", - "metadata": { - "policy-id": "onap.scaleout.tca" - }, - "properties": { - "tca_policy": { - "domain": "measurementsForVfScaling", - "metricsPerEventName": [ - { - "eventName": "vLoadBalancer", - "controlLoopSchemaType": "VNF", - "policyScope": "type=configuration", - "policyName": "onap.scaleout.tca", - "policyVersion": "v0.0.1", - "thresholds": [ - { - "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "thresholdValue": 500, - "direction": "LESS_OR_EQUAL", - "severity": "MAJOR" - }, - { - "closedLoopControlName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "thresholdValue": 5000, - "direction": "GREATER_OR_EQUAL", - "severity": "CRITICAL" - } - ] - } - ] - } - } - } - } - ] - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml b/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml deleted file mode 100644 index 6735c39c..00000000 --- a/main/src/test/resources/policies/vDNS.policy.monitoring.input.tosca.yaml +++ /dev/null @@ -1,36 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - onap.scaleout.tca: - type: onap.policies.monitoring.cdap.tca.hi.lo.app - version: 1.0.0 - metadata: - policy-id: onap.scaleout.tca - properties: - tca_policy: - domain: measurementsForVfScaling - metricsPerEventName: - - - eventName: vLoadBalancer - controlLoopSchemaType: VNF - policyScope: "type=configuration" - policyName: "onap.scaleout.tca" - policyVersion: "v0.0.1" - thresholds: - - - closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 500 - direction: LESS_OR_EQUAL - severity: MAJOR - - - closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 5000 - direction: GREATER_OR_EQUAL - severity: CRITICAL diff --git a/main/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml b/main/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml deleted file mode 100644 index 669e8946..00000000 --- a/main/src/test/resources/policies/vDNS.policy.monitoring.output.tosca.yaml +++ /dev/null @@ -1,37 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - onap.scaleout.tca: - type: onap.policies.monitoring.cdap.tca.hi.lo.app - version: 1.0.0 - metadata: - policy-id: onap.scaleout.tca - policy-version: 1 - properties: - tca_policy: - domain: measurementsForVfScaling - metricsPerEventName: - - - eventName: vLoadBalancer - controlLoopSchemaType: VNF - policyScope: "type=configuration" - policyName: "onap.scaleout.tca" - policyVersion: "v0.0.1" - thresholds: - - - closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 500 - direction: LESS_OR_EQUAL - severity: MAJOR - - - closedLoopControlName: "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 5000 - direction: GREATER_OR_EQUAL - severity: CRITICAL diff --git a/main/src/test/resources/policies/vDNS.policy.operational.input.json b/main/src/test/resources/policies/vDNS.policy.operational.input.json deleted file mode 100644 index dabde011..00000000 --- a/main/src/test/resources/policies/vDNS.policy.operational.input.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "policy-id" : "operational.scaleout", - "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20Create%20a%20new%20VF%20Module%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20SO%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20VF%20Module%20Create%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20payload%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20requestParameters%3A%20'%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20configurationParameters%3A%20'%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B9%5D%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B16%5D%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B23%5D%22%7D%5D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard" -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml b/main/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml deleted file mode 100644 index 0f549880..00000000 --- a/main/src/test/resources/policies/vDNS.policy.operational.input.tosca.yaml +++ /dev/null @@ -1,35 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - operational.scaleout: - type: onap.policies.controlloop.Operational - version: 1.0.0 - metadata: - policy-id: operational.scaleout - properties: - controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 - trigger_policy: unique-policy-id-1-scale-up - timeout: 1200 - abatement: false - policies: - - id: unique-policy-id-1-scale-up - name: Create a new VF Module - description: - actor: SO - recipe: VF Module Create - target: - type: VNF - payload: - requestParameters: '{"usePreload":true,"userParams":[]}' - configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]' - retry: 0 - timeout: 1200 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.operational.output.json b/main/src/test/resources/policies/vDNS.policy.operational.output.json deleted file mode 100644 index 5ce44e0b..00000000 --- a/main/src/test/resources/policies/vDNS.policy.operational.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policy-id" : "operational.scaleout", - "policy-version" : "1", - "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-scale-up%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20Create%20a%20new%20VF%20Module%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20SO%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20VF%20Module%20Create%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20payload%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20requestParameters%3A%20'%7B%22usePreload%22%3Atrue%2C%22userParams%22%3A%5B%5D%7D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20configurationParameters%3A%20'%5B%7B%22ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B9%5D%22%2C%22oam-ip-addr%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B16%5D%22%2C%22enabled%22%3A%22%24.vf-module-topology.vf-module-parameters.param%5B23%5D%22%7D%5D'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard" -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.operational.output.tosca.json b/main/src/test/resources/policies/vDNS.policy.operational.output.tosca.json deleted file mode 100644 index 2478ff07..00000000 --- a/main/src/test/resources/policies/vDNS.policy.operational.output.tosca.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "topology_template": { - "policies": [ - { - "operational.scaleout": { - "type": "onap.policies.controlloop.Operational", - "version": "1.0.0", - "metadata": { - "policy-id": "operational.scaleout", - "policy-version": 1 - }, - "properties": null, - "controlLoop": { - "version": "2.0.0", - "controlLoopName": "ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3", - "trigger_policy": "unique-policy-id-1-scale-up", - "timeout": 1200, - "abatement": false - }, - "policies": [ - { - "id": "unique-policy-id-1-scale-up", - "name": "Create a new VF Module", - "description": null, - "actor": "SO", - "recipe": "VF Module Create", - "target": { - "type": "VNF" - }, - "payload": { - "requestParameters": "{\"usePreload\":true,\"userParams\":[]}", - "configurationParameters": "[{\"ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[9]\",\"oam-ip-addr\":\"$.vf-module-topology.vf-module-parameters.param[16]\",\"enabled\":\"$.vf-module-topology.vf-module-parameters.param[23]\"}]" - }, - "retry": 0, - "timeout": 1200, - "success": "final_success", - "failure": "final_failure", - "failure_timeout": "final_failure_timeout", - "failure_retries": "final_failure_retries", - "failure_exception": "final_failure_exception", - "failure_guard": "final_failure_guard" - } - ] - } - } - ] - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml b/main/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml deleted file mode 100644 index a09a235a..00000000 --- a/main/src/test/resources/policies/vDNS.policy.operational.output.tosca.yaml +++ /dev/null @@ -1,36 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - operational.scaleout: - type: onap.policies.controlloop.Operational - version: 1.0.0 - metadata: - policy-id: operational.scaleout - policy-version: 1 - properties: - controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3 - trigger_policy: unique-policy-id-1-scale-up - timeout: 1200 - abatement: false - policies: - - id: unique-policy-id-1-scale-up - name: Create a new VF Module - description: - actor: SO - recipe: VF Module Create - target: - type: VNF - payload: - requestParameters: '{"usePreload":true,"userParams":[]}' - configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]' - retry: 0 - timeout: 1200 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json b/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json deleted file mode 100644 index a0046fb5..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "topology_template": { - "policies": [ - { - "onap.vfirewall.tca": { - "type": "onap.policies.monitoring.cdap.tca.hi.lo.app", - "version": "1.0.0", - "metadata": { - "policy-id": "onap.vfirewall.tca" - }, - "properties": { - "tca_policy": { - "domain": "measurementsForVfScaling", - "metricsPerEventName": [ - { - "eventName": "vLoadBalancer", - "controlLoopSchemaType": "VNF", - "policyScope": "resource=vLoadBalancer;type=configuration", - "policyName": "onap.vfirewall.tca", - "policyVersion": "v0.0.1", - "thresholds": [ - { - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "thresholdValue": 500, - "direction": "LESS_OR_EQUAL", - "severity": "MAJOR" - }, - { - "closedLoopControlName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "closedLoopEventStatus": "ONSET", - "version": "1.0.2", - "fieldPath": "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated", - "thresholdValue": 5000, - "direction": "GREATER_OR_EQUAL", - "severity": "CRITICAL" - } - ] - } - ] - } - } - } - } - ] - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml b/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml deleted file mode 100644 index bce8b366..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml +++ /dev/null @@ -1,36 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - onap.vfirewall.tca: - type: onap.policy.monitoring.cdap.tca.hi.lo.app - version: 1.0.0 - metadata: - policy-id: onap.vfirewall.tca - properties: - tca_policy: - domain: measurementsForVfScaling - metricsPerEventName: - - - eventName: vLoadBalancer - controlLoopSchemaType: VNF - policyScope: "resource=vLoadBalancer;type=configuration" - policyName: "onap.vfirewall.tca" - policyVersion: "v0.0.1" - thresholds: - - - closedLoopControlName: "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 500 - direction: LESS_OR_EQUAL - severity: MAJOR - - - closedLoopControlName: "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 5000 - direction: GREATER_OR_EQUAL - severity: CRITICAL
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml b/main/src/test/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml deleted file mode 100644 index eb3165f6..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml +++ /dev/null @@ -1,37 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - onap.vfirewall.tca: - type: onap.policy.monitoring.cdap.tca.hi.lo.app - version: 1.0.0 - metadata: - policy-id: onap.vfirewall.tca - policy-version: 1 - properties: - tca_policy: - domain: measurementsForVfScaling - metricsPerEventName: - - - eventName: vLoadBalancer - controlLoopSchemaType: VNF - policyScope: "resource=vLoadBalancer;type=configuration" - policyName: "onap.vfirewall.tca" - policyVersion: "v0.0.1" - thresholds: - - - closedLoopControlName: "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 500 - direction: LESS_OR_EQUAL - severity: MAJOR - - - closedLoopControlName: "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a" - closedLoopEventStatus: ONSET - version: "1.0.2" - fieldPath: "$.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated" - thresholdValue: 5000 - direction: GREATER_OR_EQUAL - severity: CRITICAL
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.operational.input.json b/main/src/test/resources/policies/vFirewall.policy.operational.input.json deleted file mode 100644 index 623a6899..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.operational.input.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "policy-id" : "operational.modifyconfig", - "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20modify%20packet%20gen%20config%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20APPC%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20ModifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20TBD%20-%20Cannot%20be%20known%20until%20instantiation%20is%20done%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20resourceID%3A%20Eace933104d443b496b8.nodes.heat.vpg%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%20300%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard" -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json b/main/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json deleted file mode 100644 index 63c0d8b8..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.operational.input.tosca.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "topology_template": { - "policies": [ - { - "operational.modifyconfig": { - "type": "onap.policies.controlloop.Operational", - "version": "1.0.0", - "metadata": { - "policy-id": "operational.modifyconfig" - }, - "properties": { - "controlLoop": { - "version": "2.0.0", - "controlLoopName": "ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a", - "trigger_policy": "unique-policy-id-1-modifyConfig", - "timeout": 1200, - "abatement": false - }, - "policies": [ - { - "id": "unique-policy-id-1-modifyConfig", - "name": "modify packet gen config", - "description": null, - "actor": "APPC", - "recipe": "ModifyConfig", - "target": { - "resourceID": "Eace933104d443b496b8.nodes.heat.vpg", - "type": "VNF" - }, - "retry": 0, - "timeout": 300, - "success": "final_success", - "failure": "final_failure", - "failure_timeout": "final_failure_timeout", - "failure_retries": "final_failure_retries", - "failure_exception": "final_failure_exception", - "failure_guard": "final_failure_guard" - } - ] - } - } - } - ] - } -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml b/main/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml deleted file mode 100644 index ca36d530..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.operational.input.tosca.yaml +++ /dev/null @@ -1,35 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - operational.modifyconfig: - type: onap.policies.controlloop.Operational - version: 1.0.0 - metadata: - policy-id: operational.modifyconfig - properties: - controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a - trigger_policy: unique-policy-id-1-modifyConfig - timeout: 1200 - abatement: false - - policies: - - id: unique-policy-id-1-modifyConfig - name: modify packet gen config - description: - actor: APPC - recipe: ModifyConfig - target: - # TBD - Cannot be known until instantiation is done - resourceID: Eace933104d443b496b8.nodes.heat.vpg - type: VNF - retry: 0 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.operational.output.json b/main/src/test/resources/policies/vFirewall.policy.operational.output.json deleted file mode 100644 index bb8b907f..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.operational.output.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "policy-id" : "operational.modifyconfig", - "policy-version" : "1", - "content" : "controlLoop%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20version%3A%202.0.0%0A%20%20%20%20%20%20%20%20%20%20%20%20%20controlLoopName%3A%20ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a%0A%20%20%20%20%20%20%20%20%20%20%20%20%20trigger_policy%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%201200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20abatement%3A%20false%0A%20%0A%20%20%20%20%20%20%20%20%20%20%20policies%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20id%3A%20unique-policy-id-1-modifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20name%3A%20modify%20packet%20gen%20config%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20description%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20actor%3A%20APPC%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20recipe%3A%20ModifyConfig%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20target%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20TBD%20-%20Cannot%20be%20known%20until%20instantiation%20is%20done%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20resourceID%3A%20Eace933104d443b496b8.nodes.heat.vpg%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20type%3A%20VNF%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20retry%3A%200%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20timeout%3A%20300%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20success%3A%20final_success%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure%3A%20final_failure%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_timeout%3A%20final_failure_timeout%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_retries%3A%20final_failure_retries%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_exception%3A%20final_failure_exception%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20failure_guard%3A%20final_failure_guard" -}
\ No newline at end of file diff --git a/main/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml b/main/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml deleted file mode 100644 index 42ea511d..00000000 --- a/main/src/test/resources/policies/vFirewall.policy.operational.output.tosca.yaml +++ /dev/null @@ -1,36 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -topology_template: - policies: - - - operational.modifyconfig: - type: onap.policies.controlloop.Operational - version: 1.0.0 - metadata: - policy-id: operational.modifyconfig - policy-version: 1 - properties: - controlLoop: - version: 2.0.0 - controlLoopName: ControlLoop-vFirewall-d0a1dfc6-94f5-4fd4-a5b5-4630b438850a - trigger_policy: unique-policy-id-1-modifyConfig - timeout: 1200 - abatement: false - - policies: - - id: unique-policy-id-1-modifyConfig - name: modify packet gen config - description: - actor: APPC - recipe: ModifyConfig - target: - # TBD - Cannot be known until instantiation is done - resourceID: Eace933104d443b496b8.nodes.heat.vpg - type: VNF - retry: 0 - timeout: 300 - success: final_success - failure: final_failure - failure_timeout: final_failure_timeout - failure_retries: final_failure_retries - failure_exception: final_failure_exception - failure_guard: final_failure_guard
\ No newline at end of file diff --git a/main/src/test/resources/policytypes/onap.policies.Optimization.yaml b/main/src/test/resources/policytypes/onap.policies.Optimization.yaml deleted file mode 100644 index 6e99f6a8..00000000 --- a/main/src/test/resources/policytypes/onap.policies.Optimization.yaml +++ /dev/null @@ -1,39 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.Optimization: - derived_from: tosca.policies.Root - version: 1.0.0 - description: The base policy type for all policies that govern optimization - properties: - scope: - description: Scope for the policy - could be for a specific release. - type: list - matchable: true - required: true - services: - description: One or more services that the policy applies to. - type: list - matchable: true - required: true - entry_schema: - type: string - resources: - description: One or more VNF resources that the policy applies to. - type: list - matchable: true - required: true - entry_schema: - type: string - geography: - description: One or more geographic regions - type: list - matchable: true - required: true - entry_schema: - type: string - constraints: - - valid_values: ["US", "International"] - identity: - description: Used internally for identification - type: string - required: true diff --git a/main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json b/main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json deleted file mode 100644 index 2d36a258..00000000 --- a/main/src/test/resources/policytypes/onap.policies.controlloop.Operational.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.controlloop.Operational": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Operational Policy for Control Loops" - } - } - ] -}
\ No newline at end of file diff --git a/main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json b/main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json deleted file mode 100644 index 598bd3c7..00000000 --- a/main/src/test/resources/policytypes/onap.policies.controlloop.guard.FrequencyLimiter.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "tosca_definitions_version": "tosca_simple_yaml_1_0_0", - "policy_types": [ - { - "onap.policies.controlloop.Guard": { - "derived_from": "tosca.policies.Root", - "version": "1.0.0", - "description": "Guard Policies for Control Loop Operational Policies" - } - }, - { - "onap.policies.controlloop.guard.FrequencyLimiter": { - "derived_from": "onap.policies.controlloop.Guard", - "version": "1.0.0", - "description": "Supports limiting the frequency of actions being taken by a Actor.", - "properties": { - "frequency_policy": { - "type": "map", - "description": null, - "entry_schema": { - "type": "onap.datatypes.guard.FrequencyLimiter" - } - } - } - } - } - ], - "data_types": [ - { - "onap.datatypes.guard.FrequencyLimiter": { - "derived_from": "tosca.datatypes.Root", - "properties": { - "actor": { - "type": "string", - "description": "Specifies the Actor", - "required": true - }, - "recipe": { - "type": "string", - "description": "Specified the Recipe", - "required": true - }, - "time_window": { - "type": "scalar-unit.time", - "description": "The time window to count the actions against.", - "required": true - }, - "limit": { - "type": "integer", - "description": "The limit", - "required": true, - "constraints": [ - { - "greater_than": 0 - } - ] - }, - "time_range": { - "type": "tosca.datatypes.TimeInterval", - "description": "An optional range of time during the day the frequency is valid for.", - "required": false - }, - "controlLoopName": { - "type": "string", - "description": "An optional specific control loop to apply this guard to.", - "required": false - }, - "target": { - "type": "string", - "description": "An optional specific VNF to apply this guard to.", - "required": false - } - } - } - } - ] -}
\ No newline at end of file diff --git a/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json b/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json deleted file mode 100644 index 1d1a4d64..00000000 --- a/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.json +++ /dev/null @@ -1,223 +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" - } - } - } - } - } - ], - "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.policies.monitoring.cdap.tca.hi.lo.app.yaml b/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml deleted file mode 100644 index 2985603a..00000000 --- a/main/src/test/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml +++ /dev/null @@ -1,163 +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 -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.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 deleted file mode 100644 index 26f4c021..00000000 --- a/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.json +++ /dev/null @@ -1,28 +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 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 deleted file mode 100644 index 63796fa3..00000000 --- a/main/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml +++ /dev/null @@ -1,18 +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 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.optimization.AffinityPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml deleted file mode 100644 index f0d47ed6..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml +++ /dev/null @@ -1,30 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.AffinityPolicy: - derived_from: onap.policies.Optimization - properties: - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - affinityProperties: - type: policy.data.affinityProperties_properties - required: true -data_types: - policy.data.affinityProperties_properties: - derived_from: tosca.nodes.Root - properties: - qualifier: - type: string - constraints: - - valid_values: - - same - - different - category: - type: string - required: true diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml deleted file mode 100644 index 9bcdd7a6..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml +++ /dev/null @@ -1,55 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.DistancePolicy: - derived_from: onap.policies.Optimization - properties: - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - distanceProperties: - type: policy.data.distanceProperties_properties - required: true -data_types: - policy.data.distanceProperties_properties: - derived_from: tosca.nodes.Root - properties: - locationInfo: - type: string - required: true - distance: - type: policy.data.distance_properties - required: true - entry_schema: - type: policy.data.distance_properties - policy.data.distance_properties: - derived_from: tosca.nodes.Root - properties: - value: - type: string - required: true - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - < - - <= - - > - - >= - - = - unit: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - km diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml deleted file mode 100644 index 21a2e722..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml +++ /dev/null @@ -1,102 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.HpaPolicy: - derived_from: onap.policies.Optimization - properties: - flavorFeatures: - type: list - required: true - entry_schema: - type: policy.data.flavorFeatures_properties -data_types: - policy.data.flavorFeatures_properties: - derived_from: tosca.nodes.Root - properties: - id: - type: string - required: true - type: - type: string - required: true - directives: - type: list - required: true - entry_schema: - type: policy.data.directives_properties - flavorProperties: - type: list - required: true - entry_schema: - type: policy.data.flavorProperties_properties - policy.data.directives_properties: - derived_from: tosca.nodes.Root - properties: - type: - type: string - attributes: - type: list - entry_schema: - type: policy.data.directives_attributes_properties - policy.data.directives_attributes_properties: - derived_from: tosca.nodes.Root - properties: - attribute_name: - type: string - attribute_value: - type: string - policy.data.flavorProperties_properties: - derived_from: tosca.nodes.Root - properties: - hpa-feature: - type: string - required: true - mandatory: - type: string - required: true - score: - type: string - required: false - architecture: - type: string - required: true - hpa-version: - type: string - required: true - directives: - type: list - required: true - entry_schema: - type: policy.data.directives_properties - hpa-feature-attributes: - type: list - required: true - entry_schema: - type: policy.data.hpa-feature-attributes_properties - policy.data.hpa-feature-attributes_properties: - derived_from: tosca.nodes.Root - properties: - hpa-attribute-key: - type: string - required: true - hpa-attribute-value: - type: string - required: true - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - < - - <= - - > - - >= - - = - - != - - any - - all - - subset - unit: - type: string - required: false diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml deleted file mode 100644 index 76bc550d..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml +++ /dev/null @@ -1,65 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.OptimizationPolicy: - derived_from: onap.policies.Optimization - properties: - objective: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - minimize - - maximize - objectiveParameter: - type: policy.data.objectiveParameter_properties - required: true -data_types: - policy.data.objectiveParameter_properties: - derived_from: tosca.nodes.Root - properties: - parameterAttributes: - type: list - required: true - entry_schema: - type: policy.data.parameterAttributes_properties - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - '*' - - + - - '-' - - / - - '%' - policy.data.parameterAttributes_properties: - derived_from: tosca.nodes.Root - properties: - resources: - type: string - required: true - customerLocationInfo: - type: string - required: true - parameter: - type: string - required: true - weight: - type: string - required: true - operator: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - '*' - - + - - '-' - - / - - '%' diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml deleted file mode 100644 index 81187964..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml +++ /dev/null @@ -1,29 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.PciPolicy: - derived_from: onap.policies.Optimization - properties: - pciProperties: - type: list - required: false - entry_schema: - type: policy.data.pciProperties_properties -data_types: - policy.data.pciProperties_properties: - derived_from: tosca.nodes.Root - properties: - algoCategory: - type: string - required: false - pciOptmizationAlgoName: - type: string - required: false - pciOptimizationNwConstraint: - type: string - required: false - pciOptimizationPriority: - type: string - required: false - pciOptimizationTimeConstraint: - type: string - required: false diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml deleted file mode 100644 index 7f85c777..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml +++ /dev/null @@ -1,23 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.QueryPolicy: - derived_from: onap.policies.Optimization - properties: - queryProperties: - type: list - required: true - entry_schema: - type: policy.data.queryProperties_properties -data_types: - policy.data.queryProperties_properties: - derived_from: tosca.nodes.Root - properties: - attribute: - type: string - required: true - value: - type: string - required: true - attribute_location: - type: string - required: true diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml deleted file mode 100644 index 6b24fbc9..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml +++ /dev/null @@ -1,27 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.SubscriberPolicy: - derived_from: onap.policies.Optimization - properties: - subscriberProperties: - type: policy.data.subscriberProperties_properties - required: true -data_types: - policy.data.subscriberProperties_properties: - derived_from: tosca.nodes.Root - properties: - subscriberName: - type: list - required: true - entry_schema: - type: string - subscriberRole: - type: list - required: true - entry_schema: - type: string - provStatus: - type: list - required: true - entry_schema: - type: string diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml deleted file mode 100644 index 2d35741a..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml +++ /dev/null @@ -1,27 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.Vim_fit: - derived_from: onap.policies.Optimization - properties: - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - capacityProperties: - type: policy.data.capacityProperties_properties - required: true -data_types: - policy.data.capacityProperties_properties: - derived_from: tosca.nodes.Root - properties: - controller: - type: string - required: true - request: - type: string - required: true diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml deleted file mode 100644 index 3ee62483..00000000 --- a/main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml +++ /dev/null @@ -1,44 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0 -policy_types: - onap.policies.optimization.VnfPolicy: - derived_from: onap.policies.Optimization - properties: - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - vnfProperties: - type: list - required: true - entry_schema: - type: policy.data.vnfProperties_properties -data_types: - policy.data.vnfProperties_properties: - derived_from: tosca.nodes.Root - properties: - inventoryProvider: - type: string - required: true - serviceType: - type: string - required: true - inventoryType: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - serviceInstanceId - - vnfName - - cloudRegionId - - vimId - customerId: - type: string - required: true - |