aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
authorChenfei Gao <cgao@research.att.com>2019-04-07 21:33:02 -0400
committerChenfei Gao <cgao@research.att.com>2019-04-09 21:41:41 -0400
commitd95c395499b88834e2f1d767180302512f077a52 (patch)
tree825bc91f295808f8c50ceebbcb45005df090d8cb /main/src/test
parent74d69a2a262f78d76abfec4dcee19421a5cd6ec9 (diff)
Modify policy provider to support GET/CREATE
Modify policy and policy type providers to better support GET/CREATE policy/policy types. Issue-ID: POLICY-1442 Change-Id: I7a513be4f9dbd5b48b85a948e3bda7b6c6ab7ddb Signed-off-by: Chenfei Gao <cgao@research.att.com>
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/resources/META-INF/persistence.xml10
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml63
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml83
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml136
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml90
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml59
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml48
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml52
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml57
-rw-r--r--main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml74
-rw-r--r--main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json2
-rw-r--r--main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml2
12 files changed, 673 insertions, 3 deletions
diff --git a/main/src/test/resources/META-INF/persistence.xml b/main/src/test/resources/META-INF/persistence.xml
index 23e8567f..8812ebf6 100644
--- a/main/src/test/resources/META-INF/persistence.xml
+++ b/main/src/test/resources/META-INF/persistence.xml
@@ -2,6 +2,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2019 Nordix Foundation.
+ Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -28,6 +29,9 @@
<class>org.onap.policy.models.base.PfConceptKey</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
@@ -46,7 +50,11 @@
<class>org.onap.policy.models.dao.converters.CDataConditioner</class>
<class>org.onap.policy.models.dao.converters.Uuid2String</class>
<class>org.onap.policy.models.base.PfConceptKey</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />
@@ -66,7 +74,7 @@
<property name="eclipselink.logging.level.query" value="ALL" />
<property name="eclipselink.logging.level.properties" value="ALL" /-->
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
+ <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="INFO" />
</properties>
diff --git a/main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml
new file mode 100644
index 00000000..415e05e2
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml
@@ -0,0 +1,63 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml
new file mode 100644
index 00000000..a0571bc1
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml
@@ -0,0 +1,83 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml
new file mode 100644
index 00000000..e9e5436f
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml
@@ -0,0 +1,136 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml
new file mode 100644
index 00000000..cccd0b50
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml
@@ -0,0 +1,90 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml
new file mode 100644
index 00000000..2cc6d418
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.PciPolicy.yaml
@@ -0,0 +1,59 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml
new file mode 100644
index 00000000..7c54a8d0
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml
@@ -0,0 +1,48 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml
new file mode 100644
index 00000000..294dcdf4
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml
@@ -0,0 +1,52 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml
new file mode 100644
index 00000000..e4dc5009
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.Vim_fit.yaml
@@ -0,0 +1,57 @@
+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
+ 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/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml b/main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml
new file mode 100644
index 00000000..009df412
--- /dev/null
+++ b/main/src/test/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml
@@ -0,0 +1,74 @@
+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
+ 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/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json
index 95d7a53b..292c632c 100644
--- a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json
+++ b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.json
@@ -8,7 +8,7 @@
}
},
{
- "onap.policy.monitoring.cdap.tca.hi.lo.app": {
+ "onap.policies.monitoring.cdap.tca.hi.lo.app": {
"derived_from": "onap.policies.Monitoring",
"version": "1.0.0",
"properties": {
diff --git a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml
index f8e9b752..2985603a 100644
--- a/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml
+++ b/main/src/test/resources/policytypes/onap.policy.monitoring.cdap.tca.hi.lo.app.yaml
@@ -5,7 +5,7 @@ policy_types:
derived_from: tosca.policies.Root
description: a base policy type for all policies that governs monitoring provisioning
-
- onap.policy.monitoring.cdap.tca.hi.lo.app:
+ onap.policies.monitoring.cdap.tca.hi.lo.app:
derived_from: onap.policies.Monitoring
version: 1.0.0
properties: