aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/src/main/resources/clamp/acm/test/tosca-template-additional-properties.yaml226
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java21
2 files changed, 247 insertions, 0 deletions
diff --git a/examples/src/main/resources/clamp/acm/test/tosca-template-additional-properties.yaml b/examples/src/main/resources/clamp/acm/test/tosca-template-additional-properties.yaml
new file mode 100644
index 000000000..55990b404
--- /dev/null
+++ b/examples/src/main/resources/clamp/acm/test/tosca-template-additional-properties.yaml
@@ -0,0 +1,226 @@
+# ============LICENSE_START=======================================================
+# Copyright (C) 2022 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=========================================================
+tosca_definitions_version: tosca_simple_yaml_1_3
+data_types:
+ onap.datatypes.ToscaConceptIdentifier:
+ derived_from: tosca.datatypes.Root
+ properties:
+ name:
+ type: string
+ required: true
+ version:
+ type: string
+ required: true
+ derived_from: tosca.datatypes.Root
+ description: Definition for a entity in A&AI to perform a control loop operation
+ on
+ properties:
+ targetType:
+ type: string
+ description: Category for the target type
+ required: true
+ constraints:
+ - valid_values:
+ - VNF
+ - VM
+ - VFMODULE
+ - PNF
+ entityIds:
+ type: map
+ description: |
+ Map of values that identify the resource. If none are provided, it is assumed that the
+ entity that generated the ONSET event will be the target.
+ required: false
+ metadata:
+ clamp_possible_values: ClampExecution:CSAR_RESOURCES
+ entry_schema:
+ type: string
+ version: 1.0.0
+ derived_from: tosca.datatypes.Root
+ properties:
+ configurationEntityId:
+ type: onap.datatypes.ToscaConceptIdentifier
+ required: true
+ description: The name and version of a Configuration Entity to be handled
+ by the HTTP Automation Composition Element
+ restSequence:
+ type: list
+ entry_schema:
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest
+ type_version: 1.0.0
+ description: A sequence of REST commands to send to the REST endpoint
+policy_types:
+ onap.policies.controlloop.operational.common.Apex:
+ derived_from: onap.policies.controlloop.operational.Common
+ type_version: 1.0.0
+ version: 1.0.0
+ name: onap.policies.controlloop.operational.common.Apex
+ description: Operational policies for Apex PDP
+ properties:
+ engineServiceParameters:
+ type: string
+ description: The engine parameters like name, instanceCount, policy implementation,
+ parameters etc.
+ required: true
+ eventInputParameters:
+ type: string
+ description: The event input parameters.
+ required: true
+ eventOutputParameters:
+ type: string
+ description: The event output parameters.
+ required: true
+ javaProperties:
+ type: string
+ description: Name/value pairs of properties to be set for APEX if needed.
+ required: false
+
+node_types:
+ org.onap.policy.clamp.acm.Participant:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ required: false
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
+ properties:
+ baseUrl:
+ type: string
+ required: true
+ description: The base URL to be prepended to each path, identifies the host for the REST endpoints.
+ httpHeaders:
+ type: map
+ required: false
+ entry_schema:
+ type: string
+ description: HTTP headers to send on REST requests
+ configurationEntities:
+ type: map
+ required: true
+ entry_schema:
+ type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity
+ type_version: 1.0.0
+ description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests
+
+topology_template:
+ inputs:
+ pmsh_operational_policy:
+ type: onap.datatypes.ToscaConceptIdentifier
+ description: The ID of the PMSH operational policy to use
+ default:
+ name: operational.apex.pmcontrol
+ version: 1.0.0
+ node_templates:
+ org.onap.policy.clamp.acm.PolicyParticipant:
+ version: 2.3.1
+ type: org.onap.policy.clamp.acm.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ requirements:
+ -
+ org.onap.policy.clamp.acm.Required:
+ type: org.onap
+ type_version: 1.0.1
+ name: org.onap.policy.clamp.acm.Required
+ version: 1.0.0
+ capability: Capable
+ node: node1
+ occurrences:
+ - V1
+ - V2
+ capabilities:
+ org.onap.policy.clamp.acm.Capability:
+ type: org.onap
+ type_version: 1.0.1
+ name: org.onap.policy.clamp.acm.Capability
+ version: 1.0.0
+ attributes:
+ attribute: attribute0
+ occurrences:
+ - V1
+ - V2
+capability_types:
+ org.onap.policy.clamp.acm.capability.Type:
+ name: org.onap.policy.clamp.acm.capability.Type
+ version: 1.0.0
+ metadata:
+ key0: value0
+ description: Capability Type
+ properties:
+ prop1:
+ name: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement2
+ type: string
+ type_version: 1.0.0
+ description: Test RelationshipType
+ deafault: 0
+ key_schema:
+ name: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement3
+ type: string
+ type_version: 1.0.0
+ description: Test Schema
+ constraints:
+ - valid_values:
+ - V1
+ - V2
+ entry_schema:
+ name: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement4
+ type: string
+ type_version: 1.0.0
+ description: Test Schema
+ constraints:
+ - valid_values:
+ - V1
+ - V2
+relationship_types:
+ org.onap.policy.clamp.acm.Relationship:
+ version: 1.0.0
+ metadata:
+ key: value
+ key2: value2
+ description: Hello
+ properties:
+ prop1:
+ name: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement2
+ type: string
+ type_version: 1.0.0
+ description: Test RelationshipType
+ deafault: 0
+ key_schema:
+ name: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement3
+ type: string
+ type_version: 1.0.0
+ description: Test Schema
+ constraints:
+ - valid_values:
+ - V1
+ - V2
+ entry_schema:
+ name: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement4
+ type: string
+ type_version: 1.0.0
+ description: Test Schema
+ constraints:
+ - valid_values:
+ - V1
+ - V2
+ metadata:
+ clamp_possible_values: ClampExecution:CSAR_RESOURCES
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
index a2d6d69c2..50953d692 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.clamp.models.acm.persistence.provider;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
@@ -46,6 +47,8 @@ import org.springframework.data.domain.Example;
class AcDefinitionProviderTest {
private static final String TOSCA_SERVICE_TEMPLATE_YAML = "clamp/acm/pmsh/funtional-pmsh-usecase.yaml";
+ private static final String TOSCA_SERVICE_TEMPLATE_YAML_PROP =
+ "clamp/acm/test/tosca-template-additional-properties.yaml";
private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder();
@@ -57,6 +60,24 @@ class AcDefinitionProviderTest {
}
@Test
+ void testDocCopyCompare() {
+
+ var inputServiceTemplateProperties = getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML_PROP);
+ var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplateProperties);
+ var docServiceTemplateCopy = new DocToscaServiceTemplate(docServiceTemplate);
+
+ assertTrue(docServiceTemplate.compareTo(docServiceTemplateCopy) < -1);
+ assertThat(docServiceTemplate.compareToWithoutEntities(docServiceTemplateCopy)).isZero();
+
+ var acmDefinition = getAcDefinition(docServiceTemplate);
+ var acmDefinitionCopy = getAcDefinition(docServiceTemplateCopy);
+
+ assertThat(acmDefinition.getServiceTemplate().getName()).isEqualTo(
+ acmDefinitionCopy.getServiceTemplate().getName());
+
+ }
+
+ @Test
void testCreateServiceTemplate() {
var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplate);
var acmDefinition = getAcDefinition(docServiceTemplate);