summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml1
-rw-r--r--models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml1
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java10
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java6
-rw-r--r--models-tosca/src/test/resources/onap.policies.NoVersion.yaml30
12 files changed, 47 insertions, 8 deletions
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml
index ce2538c66..abac21922 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.AffinityPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.AffinityPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
applicableResources:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml
index 4137fc7eb..3c9150d9e 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.DistancePolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.DistancePolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
applicableResources:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml
index 62bc4afca..dbb5e9ef1 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.HpaPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.HpaPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
flavorFeatures:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml
index f8652dda5..e03ceeea6 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.OptimizationPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.OptimizationPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
objective:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml
index 5efb8f218..097a5f173 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.PciPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.PciPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
pciProperties:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml
index 778d24b37..41b923ad7 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.QueryPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.QueryPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
queryProperties:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml
index e821aae83..010a1534b 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.SubscriberPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.SubscriberPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
subscriberProperties:
type: policy.data.subscriberProperties_properties
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml
index d2b4ef6a6..b70dddb2f 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.Vim_fit.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.Vim_fit:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
applicableResources:
type: list
diff --git a/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml b/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml
index f825f449d..18a0ccfd0 100644
--- a/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml
+++ b/models-examples/src/main/resources/policytypes/onap.policies.optimization.VnfPolicy.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0
policy_types:
onap.policies.optimization.VnfPolicy:
derived_from: onap.policies.Optimization
+ version: 1.0.0
properties:
applicableResources:
type: list
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
index 28836a981..d9ffec566 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
@@ -144,19 +144,19 @@ public class ToscaPolicyTypeFilterTest {
List<ToscaPolicyType> filteredList = filter.filter(typeList);
assertEquals(20, filteredList.size());
assertEquals(VERSION_100, filteredList.get(0).getVersion());
- assertEquals(VERSION_000, filteredList.get(11).getVersion());
+ assertEquals(VERSION_100, filteredList.get(11).getVersion());
typeList.get(12).setVersion("2.0.0");
filteredList = filter.filter(typeList);
assertEquals(20, filteredList.size());
assertEquals("2.0.0", filteredList.get(11).getVersion());
- assertEquals(VERSION_000, filteredList.get(18).getVersion());
+ assertEquals(VERSION_100, filteredList.get(18).getVersion());
typeList.get(12).setVersion(VERSION_100);
filteredList = filter.filter(typeList);
assertEquals(20, filteredList.size());
assertEquals(VERSION_100, filteredList.get(0).getVersion());
- assertEquals(VERSION_000, filteredList.get(18).getVersion());
+ assertEquals(VERSION_100, filteredList.get(18).getVersion());
}
@Test
@@ -175,12 +175,12 @@ public class ToscaPolicyTypeFilterTest {
filter = ToscaPolicyTypeFilter.builder().version(VERSION_000).build();
filteredList = filter.filter(typeList);
- assertEquals(9, filteredList.size());
+ assertEquals(1, filteredList.size());
filter = ToscaPolicyTypeFilter.builder().name("onap.policies.optimization.Vim_fit").version(VERSION_000)
.build();
filteredList = filter.filter(typeList);
- assertEquals(1, filteredList.size());
+ assertEquals(0, filteredList.size());
filter = ToscaPolicyTypeFilter.builder().name("onap.policies.optimization.Vim_fit").version("0.0.1").build();
filteredList = filter.filter(typeList);
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
index d77b52daa..20b8e5d1e 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTypeTest.java
@@ -56,8 +56,8 @@ import org.yaml.snakeyaml.Yaml;
*/
public class AuthorativeToscaProviderPolicyTypeTest {
private static final String VERSION = "version";
- private static final String POLICY_AFFINITY_VERSION0 = "onap.policies.optimization.AffinityPolicy:0.0.0";
- private static final String POLICY_AFFINITY = "onap.policies.optimization.AffinityPolicy";
+ private static final String POLICY_AFFINITY_VERSION0 = "onap.policies.NoVersion:0.0.0";
+ private static final String POLICY_AFFINITY = "onap.policies.NoVersion";
private static final String MISSING_POLICY_TYPES = "no policy types specified on service template";
private static final String DAO_IS_NULL = "dao is marked @NonNull but is null";
private static final String VERSION_000 = "0.0.0";
@@ -74,7 +74,7 @@ public class AuthorativeToscaProviderPolicyTypeTest {
@BeforeClass
public static void readPolicyDefinition() {
String yamlString =
- ResourceUtils.getResourceAsString("policytypes/onap.policies.optimization.AffinityPolicy.yaml");
+ ResourceUtils.getResourceAsString("src/test/resources/onap.policies.NoVersion.yaml");
Object yamlObject = new Yaml().load(yamlString);
yamlAsJsonString = new GsonBuilder().setPrettyPrinting().create().toJson(yamlObject);
diff --git a/models-tosca/src/test/resources/onap.policies.NoVersion.yaml b/models-tosca/src/test/resources/onap.policies.NoVersion.yaml
new file mode 100644
index 000000000..7d1262b7d
--- /dev/null
+++ b/models-tosca/src/test/resources/onap.policies.NoVersion.yaml
@@ -0,0 +1,30 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ onap.policies.NoVersion:
+ 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 \ No newline at end of file