aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java44
-rw-r--r--tosca-controlloop/runtime/pom.xml4
-rw-r--r--tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java193
-rw-r--r--tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java211
-rw-r--r--tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml3
-rw-r--r--tosca-controlloop/runtime/src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml221
6 files changed, 665 insertions, 11 deletions
diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
index b2a5e43a3..520e9b864 100644
--- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
+++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProvider.java
@@ -29,6 +29,7 @@ import lombok.NonNull;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop;
import org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop;
import org.onap.policy.common.parameters.BeanValidationResult;
+import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfKey;
import org.onap.policy.models.base.PfModelException;
@@ -36,7 +37,10 @@ import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.provider.impl.AbstractModelsProvider;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate;
/**
* This class provides information on control loop concepts in the database to callers.
@@ -88,7 +92,7 @@ public class ControlLoopProvider extends AbstractModelsProvider {
*/
public List<ControlLoop> getControlLoops(final String name, final String version) throws PfModelException {
- return asControlLoopList(getPfDao().getFiltered(JpaControlLoop.class, name, version));
+ return asEntityList(getPfDao().getFiltered(JpaControlLoop.class, name, version));
}
/**
@@ -96,12 +100,12 @@ public class ControlLoopProvider extends AbstractModelsProvider {
*
* @param filter the filter for the control loops to get
* @return the control loops found
- * @throws PfModelException on errors getting policies
+ * @throws PfModelException on errors getting control loops
*/
public List<ControlLoop> getFilteredControlLoops(@NonNull final ToscaTypedEntityFilter<ControlLoop> filter) {
- return filter.filter(asControlLoopList(
- getPfDao().getFiltered(JpaControlLoop.class, filter.getName(), PfKey.NULL_KEY_VERSION)));
+ return filter.filter(
+ asEntityList(getPfDao().getFiltered(JpaControlLoop.class, filter.getName(), PfKey.NULL_KEY_VERSION)));
}
/**
@@ -207,12 +211,38 @@ public class ControlLoopProvider extends AbstractModelsProvider {
}
/**
+ * Get Node Templates.
+ *
+ * @param name the name of the node template to get, null to get all node templates
+ * @param version the version of the node template to get, null to get all node templates
+ * @return the node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ public List<ToscaNodeTemplate> getNodeTemplates(final String name, final String version) {
+ return asEntityList(getPfDao().getFiltered(JpaToscaNodeTemplate.class, name, version));
+ }
+
+ /**
+ * Get filtered node templates.
+ *
+ * @param filter the filter for the node templates to get
+ * @return the node templates found
+ * @throws PfModelException on errors getting node templates
+ */
+ public List<ToscaNodeTemplate> getFilteredNodeTemplates(
+ @NonNull final ToscaTypedEntityFilter<ToscaNodeTemplate> filter) {
+
+ return filter.filter(asEntityList(
+ getPfDao().getFiltered(JpaToscaNodeTemplate.class, filter.getName(), filter.getVersion())));
+ }
+
+ /**
* Convert JPA control loop list to an authorative control loop list.
*
- * @param jpaControlLoopList the list to convert
+ * @param jpaEntityList the list to convert
* @return the authorative list
*/
- private List<ControlLoop> asControlLoopList(List<JpaControlLoop> jpaControlLoopList) {
- return jpaControlLoopList.stream().map(JpaControlLoop::toAuthorative).collect(Collectors.toList());
+ private <T extends ToscaEntity, J extends PfAuthorative<T>> List<T> asEntityList(List<J> jpaEntityList) {
+ return jpaEntityList.stream().map(J::toAuthorative).collect(Collectors.toList());
}
}
diff --git a/tosca-controlloop/runtime/pom.xml b/tosca-controlloop/runtime/pom.xml
index 76af73d33..6f336b9e4 100644
--- a/tosca-controlloop/runtime/pom.xml
+++ b/tosca-controlloop/runtime/pom.xml
@@ -34,12 +34,12 @@
<name>${project.artifactId}</name>
<dependencies>
- <dependency>
+ <dependency>
<groupId>org.onap.policy.clamp.controlloop</groupId>
<artifactId>controlloop-common</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.onap.policy.clamp.controlloop</groupId>
<artifactId>controlloop-models</artifactId>
<version>${project.version}</version>
diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java
new file mode 100644
index 000000000..41d85726e
--- /dev/null
+++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java
@@ -0,0 +1,193 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 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.clamp.controlloop.runtime.commissioning;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException;
+import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider;
+import org.onap.policy.clamp.controlloop.models.messages.rest.commissioning.CommissioningResponse;
+import org.onap.policy.models.base.PfModelException;
+import org.onap.policy.models.base.PfModelRuntimeException;
+import org.onap.policy.models.provider.PolicyModelsProvider;
+import org.onap.policy.models.provider.PolicyModelsProviderFactory;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
+
+/**
+ * This class provides the create, read and delete actions on Commissioning of Control Loop concepts in the database to
+ * the callers.
+ */
+public class CommissioningProvider implements Closeable {
+ public static final String CONTROL_LOOP_NODE_TYPE = "org.onap.policy.clamp.controlloop.ControlLoop";
+
+ private final PolicyModelsProvider modelsProvider;
+ private final ControlLoopProvider clProvider;
+
+ private static final Object lockit = new Object();
+
+ /**
+ * Create a commissioning provider.
+ *
+ * @throws ControlLoopRuntimeException on errors creating the provider
+ */
+ public CommissioningProvider(PolicyModelsProviderParameters databaseProviderParameters)
+ throws ControlLoopRuntimeException {
+ try {
+ modelsProvider = new PolicyModelsProviderFactory()
+ .createPolicyModelsProvider(databaseProviderParameters);
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(e);
+ }
+
+ try {
+ clProvider = new ControlLoopProvider(databaseProviderParameters);
+ } catch (PfModelException e) {
+ throw new PfModelRuntimeException(e);
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ try {
+ modelsProvider.close();
+ } catch (PfModelException e) {
+ throw new IOException("error closing modelsProvider", e);
+ }
+ }
+
+ /**
+ * Create control loops from a service template.
+ *
+ * @param serviceTemplate the service template
+ * @return the result of the commissioning operation
+ * @throws PfModelException on creation errors
+ */
+ public CommissioningResponse createControlLoopDefinitions(ToscaServiceTemplate serviceTemplate)
+ throws PfModelException {
+ synchronized (lockit) {
+ modelsProvider.createServiceTemplate(serviceTemplate);
+ }
+
+ CommissioningResponse response = new CommissioningResponse();
+ // @formatter:off
+ response.setAffectedControlLoopDefinitions(serviceTemplate.getToscaTopologyTemplate().getNodeTemplates()
+ .values()
+ .stream()
+ .map(template -> template.getKey().asIdentifier())
+ .collect(Collectors.toList()));
+ // @formatter:on
+
+ return response;
+ }
+
+ /**
+ * Delete the control loop definition with the given name and version.
+ *
+ * @param name the name of the control loop definition to delete
+ * @param version the version of the control loop to delete
+ * @return the result of the deletion
+ * @throws PfModelException on deletion errors
+ */
+ public CommissioningResponse deleteControlLoopDefinition(String name, String version) throws PfModelException {
+ synchronized (lockit) {
+ modelsProvider.deleteServiceTemplate(name, version);
+ }
+
+ CommissioningResponse response = new CommissioningResponse();
+ response.setAffectedControlLoopDefinitions(
+ Collections.singletonList(new ToscaConceptIdentifier(name, version)));
+
+ return response;
+ }
+
+ /**
+ * Get control loop node templates.
+ *
+ * @param clName the name of the control loop, null for all
+ * @param clVersion the version of the control loop, null for all
+ * @return list of control loop node templates
+ * @throws PfModelException on errors getting control loop definitions
+ */
+ public List<ToscaNodeTemplate> getControlLoopDefinitions(String clName, String clVersion) throws PfModelException {
+
+ // @formatter:off
+ ToscaTypedEntityFilter<ToscaNodeTemplate> nodeTemplateFilter = ToscaTypedEntityFilter
+ .<ToscaNodeTemplate>builder()
+ .name(clName)
+ .version(clVersion)
+ .type(CONTROL_LOOP_NODE_TYPE)
+ .build();
+ // @formatter:on
+
+ return clProvider.getFilteredNodeTemplates(nodeTemplateFilter);
+ }
+
+ /**
+ * Get the control loop elements from a control loop node template.
+ *
+ * @param controlLoopNodeTemplate the control loop node template
+ * @return a list of the control loop element node templates in a control loop node template
+ * @throws PfModelException on errors get control loop element node templates
+ */
+ public List<ToscaNodeTemplate> getControlLoopElementDefinitions(ToscaNodeTemplate controlLoopNodeTemplate)
+ throws PfModelException {
+ if (!CONTROL_LOOP_NODE_TYPE.equals(controlLoopNodeTemplate.getType())) {
+ return Collections.emptyList();
+ }
+
+ if (MapUtils.isEmpty(controlLoopNodeTemplate.getProperties())) {
+ return Collections.emptyList();
+ }
+
+ @SuppressWarnings("unchecked")
+ List<Map<String, String>> controlLoopElements =
+ (List<Map<String, String>>) controlLoopNodeTemplate.getProperties().get("elements");
+
+ if (CollectionUtils.isEmpty(controlLoopElements)) {
+ return Collections.emptyList();
+ }
+
+ List<ToscaNodeTemplate> controlLoopElementList = new ArrayList<>();
+ // @formatter:off
+ controlLoopElementList.addAll(
+ controlLoopElements
+ .stream()
+ .map(elementMap -> clProvider.getNodeTemplates(elementMap.get("name"),
+ elementMap.get("version")))
+ .flatMap(List::stream)
+ .collect(Collectors.toList())
+ );
+ // @formatter:on
+
+ return controlLoopElementList;
+ }
+}
diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java
new file mode 100644
index 000000000..97599cd64
--- /dev/null
+++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java
@@ -0,0 +1,211 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 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.clamp.controlloop.runtime.commissioning;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.YamlJsonTranslator;
+import org.onap.policy.common.utils.resources.ResourceUtils;
+import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeType;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+public class CommissioningProviderTest {
+ private static final String TOSCA_SERVICE_TEMPLATE_YAML =
+ "src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml";
+ private static final String TEMPLATE_IS_NULL = ".*serviceTemplate is marked non-null but is null";
+ private static final Coder CODER = new StandardCoder();
+ private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+ private static int dbNum = 0;
+ private static final Object lockit = new Object();
+ private PolicyModelsProviderParameters databaseProviderParameters;
+
+ private static String getParameterGroupAsString() {
+ dbNum++;
+ return ResourceUtils.getResourceAsString("src/test/resources/parameters/TestParameters.json")
+ .replace("jdbc:h2:mem:testdb", "jdbc:h2:mem:commissioningdb" + dbNum);
+ }
+
+ /**
+ * Sets up db provider parameters before each test.
+ *
+ * @throws CoderException .
+ */
+ @Before
+ public void setupDbProviderParameters() throws CoderException {
+ synchronized (lockit) {
+ databaseProviderParameters = CODER.decode(getParameterGroupAsString(), ClRuntimeParameterGroup.class)
+ .getDatabaseProviderParameters();
+ }
+ }
+
+ /**
+ * Test the fetching of control loop definitions (ToscaServiceTemplates).
+ *
+ * @throws Exception .
+ */
+ @Test
+ public void testGetControlLoopDefinitions() throws Exception {
+ List<ToscaNodeTemplate> listOfTemplates;
+
+ try (CommissioningProvider provider = new CommissioningProvider(databaseProviderParameters)) {
+ ToscaServiceTemplate serviceTemplate = yamlTranslator
+ .fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML),
+ ToscaServiceTemplate.class);
+
+
+ listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ assertThat(listOfTemplates).isEmpty();
+
+ provider.createControlLoopDefinitions(serviceTemplate);
+ listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ assertThat(listOfTemplates).hasSize(2);
+
+ //Test Filtering
+ listOfTemplates = provider.getControlLoopDefinitions("org.onap.domain.pmsh.PMSHControlLoopDefinition",
+ "1.2.3");
+ assertThat(listOfTemplates).hasSize(1);
+ for (ToscaNodeTemplate template : listOfTemplates) {
+ //Other CL elements contain PMSD instead of PMSH in their name
+ assertFalse(template.getName().contains("PMSD"));
+ }
+
+ //Test Wrong Name
+ listOfTemplates = provider.getControlLoopDefinitions("WrongControlLoopName", "0.0.0");
+ assertThat(listOfTemplates).isEmpty();
+ }
+ }
+
+ /**
+ * Test the creation of control loop definitions (ToscaServiceTemplates).
+ *
+ * @throws Exception .
+ */
+ @Test
+ public void testCreateControlLoopDefinitions() throws Exception {
+ List<ToscaNodeTemplate> listOfTemplates;
+
+ try (CommissioningProvider provider = new CommissioningProvider(databaseProviderParameters)) {
+ //Test Service template is null
+ assertThatThrownBy(() -> provider.createControlLoopDefinitions(null)).hasMessageMatching(TEMPLATE_IS_NULL);
+ listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ assertThat(listOfTemplates).isEmpty();
+
+ ToscaServiceTemplate serviceTemplate = yamlTranslator
+ .fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML),
+ ToscaServiceTemplate.class);
+
+ // Response should return the number of node templates present in the service template
+ List<ToscaConceptIdentifier> affectedDefinitions =
+ provider.createControlLoopDefinitions(serviceTemplate).getAffectedControlLoopDefinitions();
+ assertThat(affectedDefinitions).hasSize(13);
+ listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ assertThat(listOfTemplates).hasSize(2);
+ }
+ }
+
+ /**
+ * Test the deletion of control loop definitions (ToscaServiceTemplate).
+ *
+ * @throws Exception .
+ */
+ @Test
+ public void testDeleteControlLoopDefinitions() throws Exception {
+ List<ToscaNodeTemplate> listOfTemplates;
+
+ try (CommissioningProvider provider = new CommissioningProvider(databaseProviderParameters)) {
+ ToscaServiceTemplate serviceTemplate = yamlTranslator
+ .fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML),
+ ToscaServiceTemplate.class);
+
+ provider.createControlLoopDefinitions(serviceTemplate);
+ listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ assertThat(listOfTemplates).hasSize(2);
+
+ provider.deleteControlLoopDefinition(serviceTemplate.getName(), serviceTemplate.getVersion());
+ listOfTemplates = provider.getControlLoopDefinitions(null, null);
+ assertThat(listOfTemplates).isEmpty();
+ }
+ }
+
+ /**
+ * Test the fetching of control loop element definitions.
+ *
+ * @throws Exception .
+ */
+ @Test
+ public void testGetControlLoopElementDefinitions() throws Exception {
+ try (CommissioningProvider provider = new CommissioningProvider(databaseProviderParameters)) {
+ ToscaServiceTemplate serviceTemplate = yamlTranslator
+ .fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML),
+ ToscaServiceTemplate.class);
+
+ provider.createControlLoopDefinitions(serviceTemplate);
+ List<ToscaNodeTemplate> controlLoopDefinitionList = provider.getControlLoopDefinitions(
+ "org.onap.domain.pmsh.PMSHControlLoopDefinition", "1.2.3");
+
+ List<ToscaNodeTemplate> controlLoopElementNodeTemplates =
+ provider.getControlLoopElementDefinitions(controlLoopDefinitionList.get(0));
+
+ // 4 PMSH control loop elements definitions.
+ assertThat(controlLoopElementNodeTemplates).hasSize(4);
+
+ List<ToscaNodeType> derivedTypes = getDerivedNodeTypes(serviceTemplate);
+ for (ToscaNodeTemplate template : controlLoopElementNodeTemplates) {
+ assertTrue(checkNodeType(template, derivedTypes));
+ }
+ }
+ }
+
+ private boolean checkNodeType(ToscaNodeTemplate template, List<ToscaNodeType> derivedNodeTypes) {
+ String controlLoopElementType = "org.onap.policy.clamp.controlloop.ControlLoopElement";
+ for (ToscaNodeType derivedType : derivedNodeTypes) {
+ if (template.getType().equals(derivedType.getName()) || template.getType().equals(controlLoopElementType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private List<ToscaNodeType> getDerivedNodeTypes(ToscaServiceTemplate serviceTemplate) {
+ String type = "org.onap.policy.clamp.controlloop.ControlLoopElement";
+ List<ToscaNodeType> nodeTypes = new ArrayList<>();
+ for (ToscaNodeType nodeType : serviceTemplate.getNodeTypes().values()) {
+ if (nodeType.getDerivedFrom().equals(type)) {
+ nodeTypes.add(nodeType);
+ }
+ }
+ return nodeTypes;
+ }
+}
diff --git a/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml b/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml
index ff532fe97..610bfe97e 100644
--- a/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml
+++ b/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml
@@ -48,7 +48,7 @@
<class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoopElement</class>
<properties>
- <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level" value="INFO" />
</properties>
@@ -56,4 +56,3 @@
</persistence-unit>
</persistence>
-
diff --git a/tosca-controlloop/runtime/src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml b/tosca-controlloop/runtime/src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml
new file mode 100644
index 000000000..099e2e945
--- /dev/null
+++ b/tosca-controlloop/runtime/src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml
@@ -0,0 +1,221 @@
+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
+node_types:
+ org.onap.policy.clamp.controlloop.Participant:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ org.onap.policy.clamp.controlloop.ControlLoopElement:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ participant_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.ControlLoop:
+ version: 1.0.1
+ derived_from: tosca.nodetypes.Root
+ properties:
+ provider:
+ type: string
+ requred: false
+ elements:
+ type: list
+ required: true
+ entry_schema:
+ type: onap.datatypes.ToscaConceptIdentifier
+ org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ dcae_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ policy_type_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+ org.onap.policy.clamp.controlloop.CDSControlLoopElement:
+ version: 1.0.1
+ derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement
+ properties:
+ cds_blueprint_id:
+ type: onap.datatypes.ToscaConceptIdentifier
+ requred: true
+topology_template:
+ node_templates:
+ org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:
+ version: 2.3.4
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.policy.controlloop.PolicyControlLoopParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant:
+ version: 2.2.1
+ type: org.onap.policy.clamp.controlloop.Participant
+ type_version: 1.0.1
+ description: Participant for DCAE microservices
+ properties:
+ provider: ONAP
+ org.onap.domain.pmsh.PMSH_DCAEMicroservice:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSHBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_Id:
+ name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSHCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSHControlLoopDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoop
+ type_version: 1.0.0
+ description: Control loop for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ elements:
+ - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement
+ version: 1.2.3
+ org.onap.domain.pmsh.PMSD_DCAEMicroservice:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the DCAE microservice for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant
+ version: 2.3.4
+ dcae_blueprint_id:
+ name: org.onap.dcae.blueprints.PMSDBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the monitoring policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.monitoring.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for the operational policy for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_id:
+ name: org.onap.policy.controlloop.PolicyControlLoopParticipant
+ version: 2.2.1
+ policy_type_id:
+ name: onap.policies.operational.pm-subscription-handler
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoopElement
+ type_version: 1.0.0
+ description: Control loop element for CDS for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ participant_Id:
+ name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant
+ version: 3.2.1
+ cds_blueprint_id:
+ name: org.onap.ccsdk.cds.PMSDCdsBlueprint
+ version: 1.0.0
+ org.onap.domain.pmsh.PMSDControlLoopDefinition:
+ version: 1.2.3
+ type: org.onap.policy.clamp.controlloop.ControlLoop
+ type_version: 1.0.0
+ description: Control loop for Performance Management Subscription Handling
+ properties:
+ provider: Ericsson
+ elements:
+ - name: org.onap.domain.pmsh.PMSD_DCAEMicroservice
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement
+ version: 1.2.3
+ - name: org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement
+ version: 1.2.3