aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-03-19 10:29:30 -0700
committerSébastien Determe <sebastien.determe@intl.att.com>2020-03-23 22:34:41 +0000
commitafac3121bfacc4d81903b1d8492613b0b77d3298 (patch)
treeb5f7bee2b2cc4ff1668c87a980e89b52d300ce53 /src/test
parent3c327c1fe313cb31dcc914dcaee7f38255240099 (diff)
Fix the CDS calls
Fix the CDS calls for generic tosca policies, the new tosca parser must be interrupted so that clamp can do json schema enrichment Issue-ID: CLAMP-786 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ib7e85a6cc3849f614a3025779d29e8024f7a2ef2
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java10
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java10
-rw-r--r--src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java33
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file10
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file10
-rw-r--r--src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json475
-rw-r--r--src/test/resources/tosca/new-converter/tosca_metadata_clamp_possible_values.yaml184
7 files changed, 709 insertions, 23 deletions
diff --git a/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java b/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java
index 5208f7ffd..2faf38f0a 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/DictionaryRepositoriesTestItCase.java
@@ -76,13 +76,13 @@ public class DictionaryRepositoriesTestItCase {
dictionaryRepository.save(dictionaryTest1);
List<String> res1 = dictionaryRepository.getAllDictionaryNames();
- assertThat(res1.size()).isEqualTo(1);
- assertThat(res1.get(0)).isEqualTo("testDictionary1");
+ assertThat(res1.size()).isGreaterThan(1);
+ assertThat(res1).contains("testDictionary1");
dictionaryRepository.save(dictionaryTest2);
List<String> res2 = dictionaryRepository.getAllDictionaryNames();
- assertThat(res2.size()).isEqualTo(2);
- assertThat(res2.get(0)).isEqualTo("testDictionary1");
- assertThat(res2.get(1)).isEqualTo("testDictionary2");
+ assertThat(res2.size()).isGreaterThan(2);
+ assertThat(res2).contains("testDictionary1");
+ assertThat(res2).contains("testDictionary2");
}
}
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
index 693377ee0..0a0710c65 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
@@ -50,7 +50,7 @@ public class JsonTemplateManagerTest extends TestCase {
"clds/tosca-converter/default-tosca-types.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app";
- jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null);
+ jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
/**
@@ -68,7 +68,7 @@ public class JsonTemplateManagerTest extends TestCase {
"clds/tosca-converter/default-tosca-types.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter";
- jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null);
+ jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
/**
@@ -86,7 +86,7 @@ public class JsonTemplateManagerTest extends TestCase {
"clds/tosca-converter/default-tosca-types.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.operational.common.Apex";
- jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null);
+ jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
/**
@@ -104,7 +104,7 @@ public class JsonTemplateManagerTest extends TestCase {
"clds/tosca-converter/default-tosca-types.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.operational.common.Drools";
- jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null);
+ jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
@@ -121,7 +121,7 @@ public class JsonTemplateManagerTest extends TestCase {
ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
String componentName = "onap.policies.controlloop.operational.common.Drools";
- jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null);
+ jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
}
/**
diff --git a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
index b4f8b1245..3ff6ffb33 100644
--- a/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
+++ b/src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2020 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.
* You may obtain a copy of the License at
@@ -29,10 +29,12 @@ import javax.transaction.Transactional;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.clamp.clds.Application;
+import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataExecutor;
import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport;
import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.service.Service;
import org.onap.clamp.tosca.Dictionary;
import org.onap.clamp.tosca.DictionaryElement;
import org.onap.clamp.tosca.DictionaryService;
@@ -51,6 +53,9 @@ public class ToscaConverterWithDictionarySupportItCase {
@Autowired
private ToscaMetadataParserWithDictionarySupport toscaMetadataParserWithDictionarySupport;
+ @Autowired
+ private ToscaMetadataExecutor toscaMetadataExecutor;
+
/**
* This Test validates Tosca yaml with metadata tag that contains policy_model_type and acronym
* parameters which defines the Tosca Policy name and its short name.
@@ -103,16 +108,38 @@ public class ToscaConverterWithDictionarySupportItCase {
JsonTemplateManager jsonTemplateManager =
new JsonTemplateManager(
- ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml"),
+ ResourceFileUtil.getResourceAsString("tosca/new-converter/tosca_metadata_clamp_possible_values.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType(
- "onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport);
+ "onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport, null);
JSONAssert.assertEquals(
ResourceFileUtil
.getResourceAsString("tosca/new-converter/tca-with-metadata.json"),
JsonUtils.GSON.toJson(jsonSchema), true);
}
+
+ @Test
+ @Transactional
+ public final void testMetadataClampPossibleValueWithExecutor() throws IOException, UnknownComponentException {
+ Service service = new Service(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
+ ResourceFileUtil.getResourceAsString("tosca/resource-details.json"));
+ JsonTemplateManager jsonTemplateManager =
+ new JsonTemplateManager(
+ ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+ + ".policies.controlloop.operational.common.Apex/versions/1.0"
+ + ".0&#63;connectionTimeToLive=5000/.file"),
+ ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+ ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+
+ JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType(
+ "onap.policies.controlloop.operational.common.Apex", toscaMetadataParserWithDictionarySupport, service);
+
+ JSONAssert.assertEquals(
+ ResourceFileUtil
+ .getResourceAsString("tosca/new-converter/tosca_apex_with_metadata.json"),
+ JsonUtils.GSON.toJson(jsonSchema), true);
+ }
}
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file
index 7d694eb8b..ae0dfbfc3 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Apex/versions/1.0.0&#63;connectionTimeToLive=5000/.file
@@ -72,7 +72,7 @@ data_types:
entity that generated the ONSET event will be the target.
required: false
metadata:
- clamp_possible_values: test
+ clamp_possible_values: ClampExecution:CSAR_RESOURCES
entry_schema:
type: string
@@ -85,23 +85,23 @@ data_types:
description: The actor performing the operation.
required: true
metadata:
- clamp_possible_values: test
+ clamp_possible_values: Dictionary:DefaultActor
operation:
type: string
description: The operation the actor is performing.
required: true
metadata:
- clamp_possible_values: test
+ clamp_possible_values: ClampExecution:CDS/operation
target:
type: onap.datatype.controlloop.Target
description: The resource the operation should be performed on.
required: true
- metadata:
- clamp_possible_values: test
payload:
type: map
description: Name/value pairs of payload information passed by Policy to the actor
required: false
+ metadata:
+ clamp_possible_values: ClampExecution:CDS/payload
entry_schema:
type: string
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file
index 240009932..1f8723c3d 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes/onap.policies.controlloop.operational.common.Drools/versions/1.0.0&#63;connectionTimeToLive=5000/.file
@@ -60,7 +60,7 @@ data_types:
entity that generated the ONSET event will be the target.
required: false
metadata:
- clamp_possible_values: test
+ clamp_possible_values: ClampExecution:CSAR_RESOURCES
entry_schema:
type: string
@@ -73,23 +73,23 @@ data_types:
description: The actor performing the operation.
required: true
metadata:
- clamp_possible_values: test
+ clamp_possible_values: Dictionary:DefaultActor
operation:
type: string
description: The operation the actor is performing.
required: true
metadata:
- clamp_possible_values: test
+ clamp_possible_values: ClampExecution:CDS/operation
target:
type: onap.datatype.controlloop.Target
description: The resource the operation should be performed on.
required: true
- metadata:
- clamp_possible_values: test
payload:
type: map
description: Name/value pairs of payload information passed by Policy to the actor
required: false
+ metadata:
+ clamp_possible_values: ClampExecution:CDS/payload
entry_schema:
type: string
diff --git a/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json
new file mode 100644
index 000000000..a44b94e07
--- /dev/null
+++ b/src/test/resources/tosca/new-converter/tosca_apex_with_metadata.json
@@ -0,0 +1,475 @@
+{
+ "title": "onap.policies.controlloop.operational.common.Apex",
+ "type": "object",
+ "description": "Operational policies for Apex PDP",
+ "required": [
+ "id",
+ "timeout",
+ "abatement",
+ "trigger",
+ "operations",
+ "engineServiceParameters",
+ "eventInputParameters",
+ "eventOutputParameters"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "The unique control loop id."
+ },
+ "timeout": {
+ "type": "integer",
+ "description": "Overall timeout for executing all the operations. This timeout should equal or exceed the total\ntimeout for each operation listed.\n"
+ },
+ "abatement": {
+ "type": "boolean",
+ "description": "Whether an abatement event message will be expected for the control loop from DCAE.",
+ "default": false
+ },
+ "trigger": {
+ "type": "string",
+ "description": "Initial operation to execute upon receiving an Onset event message for the Control Loop."
+ },
+ "operations": {
+ "type": "array",
+ "description": "List of operations to be performed when Control Loop is triggered.",
+ "items": {
+ "title": "onap.datatype.controlloop.Operation",
+ "type": "object",
+ "description": "An operation supported by an actor",
+ "required": [
+ "id",
+ "operation",
+ "timeout",
+ "retries"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "description": "Unique identifier for the operation"
+ },
+ "description": {
+ "type": "string",
+ "description": "A user-friendly description of the intent for the operation"
+ },
+ "operation": {
+ "title": "onap.datatype.controlloop.Actor",
+ "type": "object",
+ "description": "An actor/operation/target definition",
+ "required": [
+ "actor",
+ "operation",
+ "target"
+ ],
+ "properties": {
+ "actor": {
+ "type": "string",
+ "description": "The actor performing the operation.",
+ "enum": [
+ "CDS",
+ "SDNC",
+ "SO"
+ ],
+ "options": {
+ "enum_titles": [
+ "CDS",
+ "SDNC",
+ "SO"
+ ]
+ }
+ },
+ "operation": {
+ "type": "string",
+ "description": "The operation the actor is performing.",
+ "enum": [
+ "resource-assignment",
+ "activate",
+ "activate-restconf",
+ "activate-cli",
+ "assign-activate",
+ "imperative-test-wf"
+ ]
+ },
+ "target": {
+ "title": "onap.datatype.controlloop.Target",
+ "type": "object",
+ "description": "Definition for a entity in A&AI to perform a control loop operation on",
+ "required": [
+ "targetType"
+ ],
+ "properties": {
+ "targetType": {
+ "type": "string",
+ "description": "Category for the target type",
+ "enum": [
+ "VNF",
+ "VM",
+ "VFMODULE",
+ "PNF"
+ ]
+ },
+ "entityIds": {
+ "type": "object",
+ "description": "Map of values that identify the resource. If none are provided, it is assumed that the\nentity that generated the ONSET event will be the target.\n",
+ "anyOf": [
+ {
+ "title": "VNF-vLoadBalancerMS 0",
+ "properties": {
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "vLoadBalancerMS",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..vpkg..module-1",
+ "properties": {
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..vpkg..module-1",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..vpkg..module-1",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..vdns..module-3",
+ "properties": {
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..vdns..module-3",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..vdns..module-3",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..base_template..module-0",
+ "properties": {
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..base_template..module-0",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "63734409-f745-4e4d-a38b-131638a0edce",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..base_template..module-0",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..vlb..module-2",
+ "properties": {
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..vlb..module-2",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..vlb..module-2",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "readOnly": "True"
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ "payload": {
+ "type": "object",
+ "description": "Name/value pairs of payload information passed by Policy to the actor",
+ "anyOf": [
+ {
+ "title": "resource-assignment",
+ "properties": {
+ "artifact_name": "baseconfiguration",
+ "artifact_version": "1.0.0",
+ "mode": "async",
+ "data": {
+ "resource-assignment-properties": {
+ "request-id": "",
+ "service-instance-id": "",
+ "vnf-id": "",
+ "action-name": "",
+ "scope-type": "",
+ "hostname": "",
+ "vnf_name": ""
+ }
+ }
+ }
+ },
+ {
+ "title": "activate",
+ "properties": {
+ "artifact_name": "baseconfiguration",
+ "artifact_version": "1.0.0",
+ "mode": "async",
+ "data": {
+ "resource-assignment-properties": {
+ "request-id": "",
+ "service-instance-id": "",
+ "vnf-id": "",
+ "action-name": "",
+ "scope-type": "",
+ "hostname": "",
+ "vnf_name": ""
+ }
+ }
+ }
+ },
+ {
+ "title": "activate-restconf",
+ "properties": {
+ "artifact_name": "baseconfiguration",
+ "artifact_version": "1.0.0",
+ "mode": "async",
+ "data": {
+ "resource-assignment-properties": {
+ "request-id": "",
+ "service-instance-id": "",
+ "vnf-id": "",
+ "action-name": "",
+ "scope-type": "",
+ "hostname": "",
+ "vnf_name": ""
+ }
+ }
+ }
+ },
+ {
+ "title": "activate-cli",
+ "properties": {
+ "artifact_name": "baseconfiguration",
+ "artifact_version": "1.0.0",
+ "mode": "async",
+ "data": {
+ "resource-assignment-properties": {
+ "request-id": "",
+ "service-instance-id": "",
+ "vnf-id": "",
+ "action-name": "",
+ "scope-type": "",
+ "hostname": "",
+ "vnf_name": ""
+ }
+ }
+ }
+ },
+ {
+ "title": "assign-activate",
+ "properties": {
+ "artifact_name": "baseconfiguration",
+ "artifact_version": "1.0.0",
+ "mode": "async",
+ "data": {
+ "resource-assignment-properties": {
+ "request-id": "",
+ "service-instance-id": "",
+ "vnf-id": "",
+ "action-name": "",
+ "scope-type": "",
+ "hostname": "",
+ "vnf_name": ""
+ }
+ }
+ }
+ },
+ {
+ "title": "imperative-test-wf",
+ "properties": {
+ "artifact_name": "baseconfiguration",
+ "artifact_version": "1.0.0",
+ "mode": "async",
+ "data": {
+ "resource-assignment-properties": {
+ "request-id": "",
+ "service-instance-id": "",
+ "vnf-id": "",
+ "action-name": "",
+ "scope-type": "",
+ "hostname": "",
+ "vnf_name": ""
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ },
+ "timeout": {
+ "type": "integer",
+ "description": "The amount of time for the actor to perform the operation."
+ },
+ "retries": {
+ "type": "integer",
+ "description": "The number of retries the actor should attempt to perform the operation.",
+ "default": 0
+ },
+ "success": {
+ "type": "string",
+ "description": "Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.",
+ "default": "final_success"
+ },
+ "failure": {
+ "type": "string",
+ "description": "Points to the operation to invoke on Actor operation failure.",
+ "default": "final_failure"
+ },
+ "failure_timeout": {
+ "type": "string",
+ "description": "Points to the operation to invoke when the time out for the operation occurs.",
+ "default": "final_failure_timeout"
+ },
+ "failure_retries": {
+ "type": "string",
+ "description": "Points to the operation to invoke when the current operation has exceeded its max retries.",
+ "default": "final_failure_retries"
+ },
+ "failure_exception": {
+ "type": "string",
+ "description": "Points to the operation to invoke when the current operation causes an exception.",
+ "default": "final_failure_exception"
+ },
+ "failure_guard": {
+ "type": "string",
+ "description": "Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.",
+ "default": "final_failure_guard"
+ }
+ }
+ }
+ },
+ "engineServiceParameters": {
+ "type": "string",
+ "description": "The engine parameters like name, instanceCount, policy implementation, parameters etc."
+ },
+ "eventInputParameters": {
+ "type": "string",
+ "description": "The event input parameters."
+ },
+ "eventOutputParameters": {
+ "type": "string",
+ "description": "The event output parameters."
+ },
+ "javaProperties": {
+ "type": "string",
+ "description": "Name/value pairs of properties to be set for APEX if needed."
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/tosca/new-converter/tosca_metadata_clamp_possible_values.yaml b/src/test/resources/tosca/new-converter/tosca_metadata_clamp_possible_values.yaml
new file mode 100644
index 000000000..7fe9d5398
--- /dev/null
+++ b/src/test/resources/tosca/new-converter/tosca_metadata_clamp_possible_values.yaml
@@ -0,0 +1,184 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+policy_types:
+ onap.policies.Monitoring:
+ derived_from: tosca.policies.Root
+ description: a base policy type for all policies that governs monitoring provisioning
+ onap.policies.monitoring.cdap.tca.hi.lo.app:
+ derived_from: onap.policies.Monitoring
+ version: 1.0.0
+ properties:
+ tca_policy:
+ type: map
+ description: TCA Policy JSON
+ entry_schema:
+ type: onap.datatypes.monitoring.tca_policy
+ metadata:
+ policy_model_type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ acronym: tca
+
+data_types:
+ onap.datatypes.monitoring.metricsPerEventName:
+ derived_from: tosca.datatypes.Root
+ properties:
+ controlLoopSchemaType:
+ type: string
+ required: true
+ description: Specifies Control Loop Schema Type for the event Name e.g. VNF, VM
+ constraints:
+ - valid_values:
+ - VM
+ - VNF
+ eventName:
+ type: string
+ required: true
+ description: Event name to which thresholds need to be applied
+ policyName:
+ type: string
+ required: true
+ description: TCA Policy Scope Name
+ policyScope:
+ type: string
+ required: true
+ description: TCA Policy Scope
+ policyVersion:
+ type: string
+ required: true
+ description: TCA Policy Scope Version
+ thresholds:
+ type: list
+ required: true
+ description: Thresholds associated with eventName
+ entry_schema:
+ type: onap.datatypes.monitoring.thresholds
+ context:
+ type: string
+ required: true
+ description: TCA Policy Dummy Context
+ metadata:
+ clamp_possible_values: Dictionary:Context
+
+ signature:
+ type: onap.datatypes.monitoring.Dummy_Signature
+ description: Signature
+ required: true
+
+ onap.datatypes.monitoring.Dummy_Signature:
+ derived_from: tosca.datatypes.Root
+ properties:
+ filter_clause:
+ type: string
+ description: Filter Clause
+ required: true
+ metadata:
+ clamp_possible_values: Dictionary:EventDictionary#Operators
+
+ onap.datatypes.monitoring.tca_policy:
+ derived_from: tosca.datatypes.Root
+ properties:
+ domain:
+ type: string
+ required: true
+ description: Domain name to which TCA needs to be applied
+ default: measurementsForVfScaling
+ constraints:
+ - equal: measurementsForVfScaling
+ metricsPerEventName:
+ type: list
+ required: true
+ description: Contains eventName and threshold details that need to be applied to given eventName
+ entry_schema:
+ type: onap.datatypes.monitoring.metricsPerEventName
+ onap.datatypes.monitoring.thresholds:
+ derived_from: tosca.datatypes.Root
+ properties:
+ closedLoopControlName:
+ type: string
+ required: true
+ description: Closed Loop Control Name associated with the threshold
+ closedLoopEventStatus:
+ type: string
+ required: true
+ description: Closed Loop Event Status of the threshold
+ constraints:
+ - valid_values:
+ - ONSET
+ - ABATED
+ direction:
+ type: string
+ required: true
+ description: Direction of the threshold
+ constraints:
+ - valid_values:
+ - LESS
+ - LESS_OR_EQUAL
+ - GREATER
+ - GREATER_OR_EQUAL
+ - EQUAL
+ fieldPath:
+ type: string
+ required: true
+ description: Json field Path as per CEF message which needs to be analyzed for TCA
+ constraints:
+ - valid_values:
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedTotalPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedOctetsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedUnicastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedMulticastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedBroadcastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedDiscardedPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].receivedErrorPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsDelta
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedTotalPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedOctetsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedUnicastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedMulticastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedBroadcastPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedDiscardedPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.vNicPerformanceArray[*].transmittedErrorPacketsAccumulated
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuIdle
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageInterrupt
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageNice
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSoftIrq
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSteal
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuUsageSystem
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].cpuWait
+ - $.event.measurementsForVfScalingFields.cpuUsageArray[*].percentUsage
+ - $.event.measurementsForVfScalingFields.meanRequestLatency
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryBuffered
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryCached
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryConfigured
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryFree
+ - $.event.measurementsForVfScalingFields.memoryUsageArray[*].memoryUsed
+ - $.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value
+ severity:
+ type: string
+ required: true
+ description: Threshold Event Severity
+ constraints:
+ - valid_values:
+ - CRITICAL
+ - MAJOR
+ - MINOR
+ - WARNING
+ - NORMAL
+ thresholdValue:
+ type: integer
+ required: true
+ description: Threshold value for the field Path inside CEF message
+ version:
+ type: string
+ required: true
+ description: Version number associated with the threshold