diff options
Diffstat (limited to 'participant/participant-impl/participant-impl-policy')
58 files changed, 940 insertions, 3094 deletions
diff --git a/participant/participant-impl/participant-impl-policy/pom.xml b/participant/participant-impl/participant-impl-policy/pom.xml index fce29acae..052e959dc 100644 --- a/participant/participant-impl/participant-impl-policy/pom.xml +++ b/participant/participant-impl/participant-impl-policy/pom.xml @@ -30,7 +30,7 @@ <artifactId>policy-clamp-participant-impl-policy</artifactId> <name>${project.artifactId}</name> - <description>Policy participant, that allows Policy to partake in control loops</description> + <description>Policy participant, that allows Policy to partake in automation compositions</description> <build> <plugins> diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/PolicyParticipantApplication.java index 4869b7c2f..0ba2aa2ea 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/PolicyParticipantApplication.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/PolicyParticipantApplication.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy; +package org.onap.policy.clamp.acm.participant.policy; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -31,9 +31,10 @@ import org.springframework.context.annotation.ComponentScan; */ @SpringBootApplication @ComponentScan({ - "org.onap.policy.clamp.controlloop.participant.policy", - "org.onap.policy.clamp.controlloop.participant.intermediary"}) -@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.policy.main.parameters") + "org.onap.policy.clamp.acm.participant.policy", + "org.onap.policy.clamp.acm.participant.intermediary" +}) +@ConfigurationPropertiesScan("org.onap.policy.clamp.acm.participant.policy.main.parameters") public class PolicyParticipantApplication { public static void main(String[] args) { diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java index 2579585e5..4920d6550 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/AbstractHttpClient.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/AbstractHttpClient.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.client; +package org.onap.policy.clamp.acm.participant.policy.client; import java.io.Closeable; import java.io.IOException; @@ -29,7 +29,7 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; -import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; @@ -45,13 +45,13 @@ public abstract class AbstractHttpClient implements Closeable { * Constructor. * * @param policyParticipantParameters the parameters for the policy participant - * @throws ControlLoopRuntimeException on client start errors + * @throws AutomationCompositionRuntimeException on client start errors */ protected AbstractHttpClient(BusTopicParams policyParticipantParameters) { try { httpclient = HttpClientFactoryInstance.getClientFactory().build(policyParticipantParameters); } catch (final Exception e) { - throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, " Client failed to start", e); + throw new AutomationCompositionRuntimeException(Status.INTERNAL_SERVER_ERROR, " Client failed to start", e); } } diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java index 38a79f7f6..a86576eed 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyApiHttpClient.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyApiHttpClient.java @@ -18,12 +18,12 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.client; +package org.onap.policy.clamp.acm.participant.policy.client; import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters; +import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.springframework.stereotype.Component; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java index f835c6e04..584170ae4 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/client/PolicyPapHttpClient.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/client/PolicyPapHttpClient.java @@ -18,14 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.client; +package org.onap.policy.clamp.acm.participant.policy.client; import java.util.LinkedList; import java.util.List; import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.ParticipantPolicyParameters; +import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; import org.onap.policy.models.pdp.concepts.DeploymentGroup; import org.onap.policy.models.pdp.concepts.DeploymentGroups; import org.onap.policy.models.pdp.concepts.DeploymentSubGroup; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/ParticipantConfig.java index 7b49a9a6b..7f9ad243d 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/ParticipantConfig.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/ParticipantConfig.java @@ -18,10 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.config; +package org.onap.policy.clamp.acm.participant.policy.config; -import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; -import org.onap.policy.clamp.controlloop.participant.policy.main.handler.ControlLoopElementHandler; +import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.clamp.acm.participant.policy.main.handler.AutomationCompositionElementHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @@ -29,15 +29,15 @@ import org.springframework.context.annotation.Configuration; public class ParticipantConfig { /** - * Register ControlLoopElementListener. + * Register AutomationCompositionElementListener. * * @param intermediaryApi the ParticipantIntermediaryApi - * @param clElementHandler the ControlLoop Element Handler + * @param acElementHandler the Aotumation Composition Element Handler */ @Autowired - public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi, - ControlLoopElementHandler clElementHandler) { - intermediaryApi.registerControlLoopElementListener(clElementHandler); - clElementHandler.setIntermediaryApi(intermediaryApi); + public void registerAutomationCompositionElementListener(ParticipantIntermediaryApi intermediaryApi, + AutomationCompositionElementHandler acElementHandler) { + intermediaryApi.registerAutomationCompositionElementListener(acElementHandler); + acElementHandler.setIntermediaryApi(intermediaryApi); } } diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/SecurityConfig.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java index 4ee8c41b0..d7ce925e2 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/config/SecurityConfig.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/config/SecurityConfig.java @@ -16,7 +16,7 @@ * ========================LICENSE_END=================================== */ -package org.onap.policy.clamp.controlloop.participant.policy.config; +package org.onap.policy.clamp.acm.participant.policy.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java new file mode 100644 index 000000000..42d7526f8 --- /dev/null +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java @@ -0,0 +1,227 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2022 Nordix Foundation. + * ================================================================================ + * Modifications Copyright (C) 2021 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 + * + * 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.acm.participant.policy.main.handler; + +import java.time.Instant; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; +import lombok.Setter; +import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener; +import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient; +import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient; +import org.onap.policy.clamp.models.acm.concepts.AcElementStatistics; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; +import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.pdp.concepts.DeploymentSubGroup; +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.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * This class handles implementation of automationCompositionElement updates. + */ +@Component +public class AutomationCompositionElementHandler implements AutomationCompositionElementListener { + + private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionElementHandler.class); + private final Map<String, String> policyTypeMap = new LinkedHashMap<>(); + private final Map<String, String> policyMap = new LinkedHashMap<>(); + + private final PolicyApiHttpClient apiHttpClient; + private final PolicyPapHttpClient papHttpClient; + + @Setter + private ParticipantIntermediaryApi intermediaryApi; + + /** + * constructor. + * + * @param apiHttpClient the Policy Api Http Client + * @param papHttpClient the Policy Pap Http Client + */ + public AutomationCompositionElementHandler(PolicyApiHttpClient apiHttpClient, PolicyPapHttpClient papHttpClient) { + this.papHttpClient = papHttpClient; + this.apiHttpClient = apiHttpClient; + } + + /** + * Callback method to handle a automation composition element state change. + * + * @param automationCompositionId the ID of the automation composition + * @param automationCompositionElementId the ID of the automation composition element + * @param currentState the current state of the automation composition element + * @param orderedState the state to which the automation composition element is changing to + */ + @Override + public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId, + UUID automationCompositionElementId, + AutomationCompositionState currentState, + AutomationCompositionOrderedState orderedState) { + switch (orderedState) { + case UNINITIALISED: + try { + undeployPolicies(automationCompositionElementId); + deletePolicyData(automationCompositionId, automationCompositionElementId, orderedState); + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, + automationCompositionElementId, orderedState, AutomationCompositionState.UNINITIALISED, + ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); + } catch (PfModelRuntimeException e) { + LOGGER.debug("Undeploying/Deleting policy failed {}", automationCompositionElementId, e); + } + break; + case PASSIVE: + try { + undeployPolicies(automationCompositionElementId); + } catch (PfModelRuntimeException e) { + LOGGER.debug("Undeploying policies failed - no policies to undeploy {}", + automationCompositionElementId); + } + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, + automationCompositionElementId, orderedState, AutomationCompositionState.PASSIVE, + ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); + break; + case RUNNING: + LOGGER.info("Running state is not supported"); + break; + default: + LOGGER.debug("Unknown orderedstate {}", orderedState); + break; + } + } + + private void deletePolicyData(ToscaConceptIdentifier automationCompositionId, + UUID automationCompositionElementId, AutomationCompositionOrderedState newState) { + // Delete all policies of this automationComposition from policy framework + for (Entry<String, String> policy : policyMap.entrySet()) { + apiHttpClient.deletePolicy(policy.getKey(), policy.getValue()); + } + policyMap.clear(); + // Delete all policy types of this automation composition from policy framework + for (Entry<String, String> policyType : policyTypeMap.entrySet()) { + apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue()); + } + policyTypeMap.clear(); + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, + automationCompositionElementId, newState, AutomationCompositionState.UNINITIALISED, + ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); + } + + private void deployPolicies(ToscaConceptIdentifier automationCompositionId, UUID automationCompositionElementId, + AutomationCompositionOrderedState newState) { + // Deploy all policies of this automationComposition from Policy Framework + if (!policyMap.entrySet().isEmpty()) { + for (Entry<String, String> policy : policyMap.entrySet()) { + papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(), + DeploymentSubGroup.Action.POST); + } + LOGGER.debug("Policies deployed to {} successfully", automationCompositionElementId); + } else { + LOGGER.debug("No policies to deploy to {}", automationCompositionElementId); + } + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, + automationCompositionElementId, newState, AutomationCompositionState.PASSIVE, + ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); + } + + private void undeployPolicies(UUID automationCompositionElementId) { + // Undeploy all policies of this automation composition from Policy Framework + if (!policyMap.entrySet().isEmpty()) { + for (Entry<String, String> policy : policyMap.entrySet()) { + papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(), + DeploymentSubGroup.Action.DELETE); + } + LOGGER.debug("Undeployed policies from {} successfully", automationCompositionElementId); + } else { + LOGGER.debug("No policies are deployed to {}", automationCompositionElementId); + } + } + + /** + * Callback method to handle an update on a automation composition element. + * + * @param element the information on the automation composition element + * @param acElementDefinition toscaNodeTemplate + * @throws PfModelException in case of an exception + */ + @Override + public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId, + AutomationCompositionElement element, + ToscaNodeTemplate acElementDefinition) + throws PfModelException { + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), + element.getOrderedState(), + AutomationCompositionState.PASSIVE, ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE); + ToscaServiceTemplate automationCompositionDefinition = element.getToscaServiceTemplateFragment(); + if (automationCompositionDefinition.getToscaTopologyTemplate() != null) { + if (automationCompositionDefinition.getPolicyTypes() != null) { + for (ToscaPolicyType policyType : automationCompositionDefinition.getPolicyTypes().values()) { + policyTypeMap.put(policyType.getName(), policyType.getVersion()); + } + LOGGER.debug("Found Policy Types in automation composition definition: {} , Creating Policy Types", + automationCompositionDefinition.getName()); + apiHttpClient.createPolicyType(automationCompositionDefinition); + } + if (automationCompositionDefinition.getToscaTopologyTemplate().getPolicies() != null) { + for (Map<String, ToscaPolicy> gotPolicyMap : automationCompositionDefinition.getToscaTopologyTemplate() + .getPolicies()) { + for (ToscaPolicy policy : gotPolicyMap.values()) { + policyMap.put(policy.getName(), policy.getVersion()); + } + } + LOGGER.debug("Found Policies in automation composition definition: {} , Creating Policies", + automationCompositionDefinition.getName()); + apiHttpClient.createPolicy(automationCompositionDefinition); + } + } + deployPolicies(automationCompositionId, element.getId(), element.getOrderedState()); + } + + /** + * Handle automationCompositionElement statistics. + * + * @param automationCompositionElementId automation composition element id + */ + @Override + public void handleStatistics(UUID automationCompositionElementId) { + var acElement = intermediaryApi.getAutomationCompositionElement(automationCompositionElementId); + if (acElement != null) { + var acElementStatistics = new AcElementStatistics(); + acElementStatistics.setState(acElement.getState()); + acElementStatistics.setTimeStamp(Instant.now()); + intermediaryApi.updateAutomationCompositionElementStatistics(automationCompositionElementId, + acElementStatistics); + } + } +}
\ No newline at end of file diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java index 8e1de36b9..a57198126 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameters.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParameters.java @@ -18,15 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.main.parameters; +package org.onap.policy.clamp.acm.participant.policy.main.parameters; import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; -import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; -import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters; +import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantIntermediaryParameters; +import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters; import org.onap.policy.common.endpoints.parameters.RestClientParameters; import org.onap.policy.common.parameters.validation.ParameterGroupConstraint; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java deleted file mode 100644 index 663d6d5e9..000000000 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java +++ /dev/null @@ -1,220 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. - * ================================================================================ - * Modifications Copyright (C) 2021 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 - * - * 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.participant.policy.main.handler; - -import java.time.Instant; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.UUID; -import lombok.Setter; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType; -import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; -import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; -import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient; -import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyPapHttpClient; -import org.onap.policy.models.base.PfModelException; -import org.onap.policy.models.base.PfModelRuntimeException; -import org.onap.policy.models.pdp.concepts.DeploymentSubGroup; -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.ToscaPolicy; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -/** - * This class handles implementation of controlLoopElement updates. - */ -@Component -public class ControlLoopElementHandler implements ControlLoopElementListener { - - private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class); - private final Map<String, String> policyTypeMap = new LinkedHashMap<>(); - private final Map<String, String> policyMap = new LinkedHashMap<>(); - - private final PolicyApiHttpClient apiHttpClient; - private final PolicyPapHttpClient papHttpClient; - - @Setter - private ParticipantIntermediaryApi intermediaryApi; - - /** - * constructor. - * - * @param apiHttpClient the Policy Api Http Client - * @param papHttpClient the Policy Pap Http Client - */ - public ControlLoopElementHandler(PolicyApiHttpClient apiHttpClient, PolicyPapHttpClient papHttpClient) { - this.papHttpClient = papHttpClient; - this.apiHttpClient = apiHttpClient; - } - - /** - * Callback method to handle a control loop element state change. - * - * @param controlLoopId the ID of the control loop - * @param controlLoopElementId the ID of the control loop element - * @param currentState the current state of the control loop element - * @param orderedState the state to which the control loop element is changing to - */ - @Override - public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, - UUID controlLoopElementId, ControlLoopState currentState, - ControlLoopOrderedState orderedState) { - switch (orderedState) { - case UNINITIALISED: - try { - undeployPolicies(controlLoopElementId); - deletePolicyData(controlLoopId, controlLoopElementId, orderedState); - intermediaryApi.updateControlLoopElementState(controlLoopId, - controlLoopElementId, orderedState, ControlLoopState.UNINITIALISED, - ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); - } catch (PfModelRuntimeException e) { - LOGGER.debug("Undeploying/Deleting policy failed {}", controlLoopElementId, e); - } - break; - case PASSIVE: - try { - undeployPolicies(controlLoopElementId); - } catch (PfModelRuntimeException e) { - LOGGER.debug("Undeploying policies failed - no policies to undeploy {}", controlLoopElementId); - } - intermediaryApi.updateControlLoopElementState(controlLoopId, - controlLoopElementId, orderedState, ControlLoopState.PASSIVE, - ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); - break; - case RUNNING: - LOGGER.info("Running state is not supported"); - break; - default: - LOGGER.debug("Unknown orderedstate {}", orderedState); - break; - } - } - - private void deletePolicyData(ToscaConceptIdentifier controlLoopId, - UUID controlLoopElementId, ControlLoopOrderedState newState) { - // Delete all policies of this controlLoop from policy framework - for (Entry<String, String> policy : policyMap.entrySet()) { - apiHttpClient.deletePolicy(policy.getKey(), policy.getValue()); - } - policyMap.clear(); - // Delete all policy types of this control loop from policy framework - for (Entry<String, String> policyType : policyTypeMap.entrySet()) { - apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue()); - } - policyTypeMap.clear(); - intermediaryApi.updateControlLoopElementState(controlLoopId, - controlLoopElementId, newState, ControlLoopState.UNINITIALISED, - ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); - } - - private void deployPolicies(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId, - ControlLoopOrderedState newState) { - // Deploy all policies of this controlLoop from Policy Framework - if (policyMap.entrySet() != null) { - for (Entry<String, String> policy : policyMap.entrySet()) { - papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(), - DeploymentSubGroup.Action.POST); - } - LOGGER.debug("Policies deployed to {} successfully", controlLoopElementId); - } else { - LOGGER.debug("No policies to deploy to {}", controlLoopElementId); - } - intermediaryApi.updateControlLoopElementState(controlLoopId, - controlLoopElementId, newState, ControlLoopState.PASSIVE, - ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); - } - - private void undeployPolicies(UUID controlLoopElementId) { - // Undeploy all policies of this controlloop from Policy Framework - if (policyMap.entrySet() != null) { - for (Entry<String, String> policy : policyMap.entrySet()) { - papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(), - DeploymentSubGroup.Action.DELETE); - } - LOGGER.debug("Undeployed policies from {} successfully", controlLoopElementId); - } else { - LOGGER.debug("No policies are deployed to {}", controlLoopElementId); - } - } - - /** - * Callback method to handle an update on a control loop element. - * - * @param element the information on the control loop element - * @param clElementDefinition toscaNodeTemplate - * @throws PfModelException in case of an exception - */ - @Override - public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element, - ToscaNodeTemplate clElementDefinition) - throws PfModelException { - ToscaServiceTemplate controlLoopDefinition = element.getToscaServiceTemplateFragment(); - if (controlLoopDefinition.getToscaTopologyTemplate() != null) { - if (controlLoopDefinition.getPolicyTypes() != null) { - for (ToscaPolicyType policyType : controlLoopDefinition.getPolicyTypes().values()) { - policyTypeMap.put(policyType.getName(), policyType.getVersion()); - } - LOGGER.debug("Found Policy Types in control loop definition: {} , Creating Policy Types", - controlLoopDefinition.getName()); - apiHttpClient.createPolicyType(controlLoopDefinition); - } - if (controlLoopDefinition.getToscaTopologyTemplate().getPolicies() != null) { - for (Map<String, ToscaPolicy> foundPolicyMap : controlLoopDefinition.getToscaTopologyTemplate() - .getPolicies()) { - for (ToscaPolicy policy : foundPolicyMap.values()) { - policyMap.put(policy.getName(), policy.getVersion()); - } - } - LOGGER.debug("Found Policies in control loop definition: {} , Creating Policies", - controlLoopDefinition.getName()); - apiHttpClient.createPolicy(controlLoopDefinition); - } - } - deployPolicies(controlLoopId, element.getId(), element.getOrderedState()); - } - - /** - * Handle controlLoopElement statistics. - * - * @param controlLoopElementId controlloop element id - */ - @Override - public void handleStatistics(UUID controlLoopElementId) throws PfModelException { - var clElement = intermediaryApi.getControlLoopElement(controlLoopElementId); - if (clElement != null) { - var clElementStatistics = new ClElementStatistics(); - clElementStatistics.setControlLoopState(clElement.getState()); - clElementStatistics.setTimeStamp(Instant.now()); - intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics); - } - } -}
\ No newline at end of file diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml b/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml index 46db712b6..383bc7418 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml +++ b/participant/participant-impl/participant-impl-policy/src/main/resources/META-INF/persistence.xml @@ -52,11 +52,11 @@ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class> <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</class> <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTrigger</class> - <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoop</class> - <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaControlLoopElement</class> - <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipant</class> - <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaParticipantStatistics</class> - <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics</class> + <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaAutomationComposition</class> + <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaAutomationCompositionElement</class> + <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaParticipant</class> + <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaParticipantStatistics</class> + <class>org.onap.policy.clamp.acm.models.acm.persistence.concepts.JpaAcElementStatistics</class> <properties> <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml index 2aa33c1c4..c3338a993 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml @@ -30,19 +30,19 @@ participant: name: org.onap.PM_Policy version: 1.0.0 participantType: - name: org.onap.policy.controlloop.PolicyControlLoopParticipant + name: org.onap.policy.clamp.acm.PolicyParticipant version: 2.3.1 - clampControlLoopTopics: + clampAutomationCompositionTopics: topicSources: - - topic: POLICY-CLRUNTIME-PARTICIPANT + topic: POLICY-ACRUNTIME-PARTICIPANT servers: - ${topicServer:localhost} topicCommInfrastructure: dmaap fetchTimeout: 15000 topicSinks: - - topic: POLICY-CLRUNTIME-PARTICIPANT + topic: POLICY-ACRUNTIME-PARTICIPANT servers: - ${topicServer:localhost} topicCommInfrastructure: dmaap @@ -54,4 +54,4 @@ management: server: port: 8085 servlet: - context-path: /onap/policyparticipant + context-path: /onap/policy/clamp/acm/policyparticipant diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java index ce368eba1..c17d2c53d 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.endtoend; +package org.onap.policy.clamp.acm.participant.policy.endtoend; import static org.assertj.core.api.Assertions.assertThatCode; import static org.junit.Assert.assertEquals; @@ -30,19 +30,19 @@ import java.util.UUID; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegister; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantRegisterAck; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdateAck; -import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantDeregisterAckListener; -import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantMessagePublisher; -import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantRegisterAckListener; -import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantUpdateListener; -import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; -import org.onap.policy.clamp.controlloop.participant.policy.main.utils.TestListenerUtils; +import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantDeregisterAckListener; +import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher; +import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantRegisterAckListener; +import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantUpdateListener; +import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler; +import org.onap.policy.clamp.acm.participant.policy.main.utils.TestListenerUtils; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @@ -169,6 +169,6 @@ class ParticipantMessagesTest { } private ToscaConceptIdentifier getParticipantType() { - return new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1"); + return new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"); } } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java new file mode 100644 index 000000000..0d114db8d --- /dev/null +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java @@ -0,0 +1,102 @@ +/*- + * ============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.acm.participant.policy.main.handler; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.mockito.Mockito.when; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.clamp.acm.participant.policy.client.PolicyApiHttpClient; +import org.onap.policy.clamp.acm.participant.policy.client.PolicyPapHttpClient; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; +import org.onap.policy.models.base.PfModelException; +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; + +class AutomationCompositionElementHandlerTest { + + private static final String ID_NAME = "org.onap.PM_CDS_Blueprint"; + private static final String ID_VERSION = "1.0.1"; + private static final UUID automationCompositionElementId = UUID.randomUUID(); + private static final ToscaConceptIdentifier automationCompositionId = + new ToscaConceptIdentifier(ID_NAME, ID_VERSION); + + @Test + void testHandlerExceptions() { + AutomationCompositionElementHandler handler = getTestingHandler(); + + assertDoesNotThrow(() -> handler + .automationCompositionElementStateChange(automationCompositionId, + automationCompositionElementId, + AutomationCompositionState.UNINITIALISED, + AutomationCompositionOrderedState.PASSIVE)); + + assertDoesNotThrow(() -> handler + .automationCompositionElementStateChange(automationCompositionId, + automationCompositionElementId, + AutomationCompositionState.RUNNING, + AutomationCompositionOrderedState.UNINITIALISED)); + + assertDoesNotThrow(() -> handler + .automationCompositionElementStateChange(automationCompositionId, + automationCompositionElementId, + AutomationCompositionState.PASSIVE, + AutomationCompositionOrderedState.RUNNING)); + var element = getTestingAcElement(); + var acElementDefinition = Mockito.mock(ToscaNodeTemplate.class); + + assertDoesNotThrow(() -> handler + .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition)); + + assertDoesNotThrow(() -> handler + .handleStatistics(automationCompositionElementId)); + } + + AutomationCompositionElementHandler getTestingHandler() { + var api = Mockito.mock(PolicyApiHttpClient.class); + var pap = Mockito.mock(PolicyPapHttpClient.class); + var handler = new AutomationCompositionElementHandler(api, pap); + var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class); + var element = getTestingAcElement(); + when(intermediaryApi.getAutomationCompositionElement(automationCompositionElementId)).thenReturn(element); + handler.setIntermediaryApi(intermediaryApi); + return handler; + } + + AutomationCompositionElement getTestingAcElement() { + var element = new AutomationCompositionElement(); + element.setDefinition(automationCompositionId); + element.setDescription("Description"); + element.setId(automationCompositionElementId); + element.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); + element.setParticipantId(automationCompositionId); + element.setState(AutomationCompositionState.UNINITIALISED); + var template = Mockito.mock(ToscaServiceTemplate.class); + element.setToscaServiceTemplateFragment(template); + return element; + } +} diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java index e965370cc..b5cd9d442 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java @@ -18,12 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.main.parameters; +package org.onap.policy.clamp.acm.participant.policy.main.parameters; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.TreeMap; +import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; import org.onap.policy.common.endpoints.parameters.TopicParameters; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; @@ -34,7 +35,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; * Class to hold/create all parameters for test cases. */ public class CommonTestData { - public static final String PARTICIPANT_GROUP_NAME = "ControlLoopParticipantGroup"; + public static final String PARTICIPANT_GROUP_NAME = "AutomationCompositionParticipantGroup"; public static final String DESCRIPTION = "Participant description"; public static final long TIME_INTERVAL = 2000; public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams()); @@ -123,7 +124,7 @@ public class CommonTestData { map.put("description", DESCRIPTION); map.put("participantId", getParticipantId()); map.put("participantType", getParticipantId()); - map.put("clampControlLoopTopics", getTopicParametersMap(false)); + map.put("clampAutomationCompositionTopics", getTopicParametersMap(false)); } return map; @@ -151,7 +152,7 @@ public class CommonTestData { */ public static TopicParameters getTopicParams() { final TopicParameters topicParams = new TopicParameters(); - topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT"); + topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT"); topicParams.setTopicCommInfrastructure("dmaap"); topicParams.setServers(Arrays.asList("localhost")); return topicParams; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParametersTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java index 74e7cb1bc..89b2bce58 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParametersTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/ParticipantPolicyParametersTest.java @@ -18,17 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.main.parameters; +package org.onap.policy.clamp.acm.participant.policy.main.parameters; import static org.assertj.core.api.Assertions.assertThat; import javax.validation.Validation; import javax.validation.ValidatorFactory; import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.acm.participant.policy.main.parameters.ParticipantPolicyParameters; class ParticipantPolicyParametersTest { - private CommonTestData commonTestData = new CommonTestData(); - private ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); + private final CommonTestData commonTestData = new CommonTestData(); + private final ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); @Test void testParticipantPolicyParameters() { @@ -39,14 +40,14 @@ class ParticipantPolicyParametersTest { @Test void testParticipantPolicyParameters_NullTopicSinks() { final ParticipantPolicyParameters participantParameters = commonTestData.getParticipantPolicyParameters(); - participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSinks(null); + participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSinks(null); assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty(); } @Test void testParticipantPolicyParameters_NullTopicSources() { final ParticipantPolicyParameters participantParameters = commonTestData.getParticipantPolicyParameters(); - participantParameters.getIntermediaryParameters().getClampControlLoopTopics().setTopicSources(null); + participantParameters.getIntermediaryParameters().getClampAutomationCompositionTopics().setTopicSources(null); assertThat(validatorFactory.getValidator().validate(participantParameters)).isNotEmpty(); } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java index 9cc16e287..8543bf98a 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/rest/ActuatorControllerTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/rest/ActuatorControllerTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.main.rest; +package org.onap.policy.clamp.acm.participant.policy.main.rest; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -27,7 +27,7 @@ import javax.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.onap.policy.clamp.controlloop.participant.policy.main.utils.CommonActuatorController; +import org.onap.policy.clamp.acm.participant.policy.main.utils.CommonActuatorController; import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/CommonActuatorController.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java index ec6e30918..689977e3c 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/CommonActuatorController.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/CommonActuatorController.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.policy.main.utils; +package org.onap.policy.clamp.acm.participant.policy.main.utils; import static org.junit.Assert.assertEquals; @@ -40,7 +40,7 @@ import org.onap.policy.common.utils.network.NetworkUtil; public class CommonActuatorController { public static final String SELF = NetworkUtil.getHostname(); - public static final String CONTEXT_PATH = "onap/policyparticipant"; + public static final String CONTEXT_PATH = "onap/policy/clamp/acm/policyparticipant"; public static final String ACTUATOR_ENDPOINT = CONTEXT_PATH + "/actuator/"; private static String httpPrefix; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java new file mode 100644 index 000000000..a29831d56 --- /dev/null +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java @@ -0,0 +1,321 @@ +/*- + * ============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.acm.participant.policy.main.utils; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.FileNotFoundException; +import java.time.Instant; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; +import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates; +import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; +import org.onap.policy.clamp.models.acm.utils.AcmUtils; +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.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class TestListenerUtils { + + private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator(); + private static final Coder CODER = new StandardCoder(); + private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class); + + /** + * Method to create a automationComposition from a yaml file. + * + * @return AutomationComposition automation composition + */ + public static AutomationComposition createAutomationComposition() { + AutomationComposition automationComposition = new AutomationComposition(); + Map<UUID, AutomationCompositionElement> elements = new LinkedHashMap<>(); + ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead(); + Map<String, ToscaNodeTemplate> nodeTemplatesMap = + toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); + for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { + AutomationCompositionElement acElement = new AutomationCompositionElement(); + acElement.setId(UUID.randomUUID()); + + ToscaConceptIdentifier acElementParticipantId = new ToscaConceptIdentifier(); + acElementParticipantId.setName(toscaInputEntry.getKey()); + acElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion()); + acElement.setParticipantId(acElementParticipantId); + + acElement.setDefinition(acElementParticipantId); + acElement.setState(AutomationCompositionState.UNINITIALISED); + acElement.setDescription(toscaInputEntry.getValue().getDescription()); + acElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); + elements.put(acElement.getId(), acElement); + } + automationComposition.setElements(elements); + automationComposition.setName("PMSHInstance0"); + automationComposition.setVersion("1.0.0"); + + ToscaConceptIdentifier definition = new ToscaConceptIdentifier(); + definition.setName("PMSHInstance0"); + definition.setVersion("1.0.0"); + automationComposition.setDefinition(definition); + + return automationComposition; + } + + /** + * Method to create AutomationCompositionStateChange message from the arguments passed. + * + * @param automationCompositionOrderedState automationCompositionOrderedState + * @return AutomationCompositionStateChange message + */ + public static AutomationCompositionStateChange createAutomationCompositionStateChangeMsg( + final AutomationCompositionOrderedState automationCompositionOrderedState) { + final AutomationCompositionStateChange acStateChangeMsg = new AutomationCompositionStateChange(); + + ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier(); + automationCompositionId.setName("PMSHInstance0"); + automationCompositionId.setVersion("1.0.0"); + + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); + participantId.setName("org.onap.PM_Policy"); + participantId.setVersion("0.0.0"); + + acStateChangeMsg.setAutomationCompositionId(automationCompositionId); + acStateChangeMsg.setParticipantId(participantId); + acStateChangeMsg.setTimestamp(Instant.now()); + acStateChangeMsg.setOrderedState(automationCompositionOrderedState); + + return acStateChangeMsg; + } + + /** + * Method to create AutomationCompositionUpdateMsg. + * + * @return AutomationCompositionUpdate message + */ + public static AutomationCompositionUpdate createAutomationCompositionUpdateMsg() { + final AutomationCompositionUpdate acUpdateMsg = new AutomationCompositionUpdate(); + ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0"); + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0"); + + acUpdateMsg.setAutomationCompositionId(automationCompositionId); + acUpdateMsg.setParticipantId(participantId); + acUpdateMsg.setMessageId(UUID.randomUUID()); + acUpdateMsg.setTimestamp(Instant.now()); + + Map<UUID, AutomationCompositionElement> elements = new LinkedHashMap<>(); + ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead(); + TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate); + Map<String, ToscaNodeTemplate> nodeTemplatesMap = + toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); + for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { + if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(), + toscaServiceTemplate)) { + AutomationCompositionElement acElement = new AutomationCompositionElement(); + acElement.setId(UUID.randomUUID()); + var acParticipantType = + ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()); + + acElement.setParticipantId(acParticipantType); + acElement.setParticipantType(acParticipantType); + + acElement.setDefinition( + new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion())); + acElement.setState(AutomationCompositionState.UNINITIALISED); + acElement.setDescription(toscaInputEntry.getValue().getDescription()); + acElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE); + elements.put(acElement.getId(), acElement); + } + } + + List<ParticipantUpdates> participantUpdates = new ArrayList<>(); + for (AutomationCompositionElement element : elements.values()) { + AcmUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate); + AcmUtils.prepareParticipantUpdate(element, participantUpdates); + } + acUpdateMsg.setParticipantUpdatesList(participantUpdates); + return acUpdateMsg; + } + + /** + * Method to create participantUpdateMsg. + * + * @return ParticipantUpdate message + */ + public static ParticipantUpdate createParticipantUpdateMsg() { + final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate(); + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0"); + ToscaConceptIdentifier participantType = + new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"); + + participantUpdateMsg.setParticipantId(participantId); + participantUpdateMsg.setTimestamp(Instant.now()); + participantUpdateMsg.setParticipantType(participantType); + participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000)); + participantUpdateMsg.setMessageId(UUID.randomUUID()); + + ToscaServiceTemplate toscaServiceTemplate = testAutomationCompositionRead(); + // Add policies to the toscaServiceTemplate + TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate); + + List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>(); + for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate() + .getNodeTemplates().entrySet()) { + if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(), + toscaServiceTemplate)) { + AcmUtils.prepareParticipantDefinitionUpdate( + ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()), + toscaInputEntry.getKey(), toscaInputEntry.getValue(), + participantDefinitionUpdates, null); + } + } + + participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates); + return participantUpdateMsg; + } + + /** + * Method to create AutomationCompositionUpdate using the arguments passed. + * + * @param jsonFilePath the path of the automation composition content + * @return AutomationCompositionUpdate message + * @throws CoderException exception while reading the file to object + */ + public static AutomationCompositionUpdate createParticipantAcUpdateMsgFromJson(String jsonFilePath) + throws CoderException { + AutomationCompositionUpdate automationCompositionUpdateMsg = + CODER.decode(new File(jsonFilePath), AutomationCompositionUpdate.class); + return automationCompositionUpdateMsg; + } + + private static ToscaServiceTemplate testAutomationCompositionRead() { + Set<String> automationCompositionDirectoryContents = + ResourceUtils.getDirectoryContents("src/test/resources/utils/servicetemplates"); + + boolean atLeastOneAutomationCompositionTested = false; + ToscaServiceTemplate toscaServiceTemplate = null; + + for (String automationCompositionFilePath : automationCompositionDirectoryContents) { + if (!automationCompositionFilePath.endsWith(".yaml")) { + continue; + } + atLeastOneAutomationCompositionTested = true; + toscaServiceTemplate = testAutomationCompositionYamlSerialization(automationCompositionFilePath); + } + + // Add policy_types to the toscaServiceTemplate + addPolicyTypesToToscaServiceTemplate(toscaServiceTemplate); + + assertTrue(atLeastOneAutomationCompositionTested); + return toscaServiceTemplate; + } + + private static void addPolicyTypesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) { + Set<String> policyTypeDirectoryContents = ResourceUtils.getDirectoryContents("policytypes"); + + for (String policyTypeFilePath : policyTypeDirectoryContents) { + String policyTypeString = ResourceUtils.getResourceAsString(policyTypeFilePath); + + ToscaServiceTemplate foundPolicyTypeSt = + yamlTranslator.fromYaml(policyTypeString, ToscaServiceTemplate.class); + + toscaServiceTemplate.setDerivedFrom(foundPolicyTypeSt.getDerivedFrom()); + toscaServiceTemplate.setDescription(foundPolicyTypeSt.getDescription()); + toscaServiceTemplate.setMetadata(foundPolicyTypeSt.getMetadata()); + toscaServiceTemplate.setName(foundPolicyTypeSt.getName()); + toscaServiceTemplate.setToscaDefinitionsVersion(foundPolicyTypeSt.getToscaDefinitionsVersion()); + toscaServiceTemplate.setVersion(foundPolicyTypeSt.getVersion()); + + if (foundPolicyTypeSt.getDataTypes() != null) { + if (toscaServiceTemplate.getDataTypes() == null) { + toscaServiceTemplate.setDataTypes(foundPolicyTypeSt.getDataTypes()); + } else { + toscaServiceTemplate.getDataTypes().putAll(foundPolicyTypeSt.getDataTypes()); + } + } + + if (toscaServiceTemplate.getPolicyTypes() == null) { + toscaServiceTemplate.setPolicyTypes(foundPolicyTypeSt.getPolicyTypes()); + } else { + toscaServiceTemplate.getPolicyTypes().putAll(foundPolicyTypeSt.getPolicyTypes()); + } + } + } + + /** + * Method to add polcies to the toscaServiceTemplate. + * + * @param toscaServiceTemplate to add policies + */ + public static void addPoliciesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) { + Set<String> policiesDirectoryContents = ResourceUtils.getDirectoryContents("policies"); + + for (String policiesFilePath : policiesDirectoryContents) { + if (!policiesFilePath.endsWith("yaml")) { + continue; + } + + String policiesString = ResourceUtils.getResourceAsString(policiesFilePath); + + ToscaServiceTemplate foundPoliciesSt = + yamlTranslator.fromYaml(policiesString, ToscaServiceTemplate.class); + toscaServiceTemplate.getToscaTopologyTemplate() + .setPolicies(foundPoliciesSt.getToscaTopologyTemplate().getPolicies()); + } + } + + private static ToscaServiceTemplate testAutomationCompositionYamlSerialization( + String automationCompositionFilePath) { + try { + String automationCompositionString = ResourceUtils.getResourceAsString(automationCompositionFilePath); + if (automationCompositionString == null) { + throw new FileNotFoundException(automationCompositionFilePath); + } + + ToscaServiceTemplate serviceTemplate = + yamlTranslator.fromYaml(automationCompositionString, ToscaServiceTemplate.class); + return serviceTemplate; + } catch (FileNotFoundException e) { + LOGGER.error("cannot find YAML file", automationCompositionFilePath); + throw new IllegalArgumentException(e); + } + } +} diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java deleted file mode 100644 index b5c5e19cb..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandlerTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============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.participant.policy.main.handler; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.mockito.Mockito.when; - -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; -import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; -import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient; -import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyPapHttpClient; -import org.onap.policy.models.base.PfModelException; -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; - -class ControlLoopElementHandlerTest { - - private static final String ID_NAME = "org.onap.PM_CDS_Blueprint"; - private static final String ID_VERSION = "1.0.1"; - private static final UUID controlLoopElementId = UUID.randomUUID(); - private static final ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(ID_NAME, ID_VERSION); - - @Test - void testHandlerExceptions() throws PfModelException { - ControlLoopElementHandler handler = getTestingHandler(); - - assertDoesNotThrow(() -> handler - .controlLoopElementStateChange(controlLoopId, - controlLoopElementId, - ControlLoopState.UNINITIALISED, - ControlLoopOrderedState.PASSIVE)); - - assertDoesNotThrow(() -> handler - .controlLoopElementStateChange(controlLoopId, - controlLoopElementId, - ControlLoopState.RUNNING, - ControlLoopOrderedState.UNINITIALISED)); - - assertDoesNotThrow(() -> handler - .controlLoopElementStateChange(controlLoopId, - controlLoopElementId, - ControlLoopState.PASSIVE, - ControlLoopOrderedState.RUNNING)); - var element = getTestingClElement(); - var clElementDefinition = Mockito.mock(ToscaNodeTemplate.class); - - assertDoesNotThrow(() -> handler - .controlLoopElementUpdate(controlLoopId, element, clElementDefinition)); - - assertDoesNotThrow(() -> handler - .handleStatistics(controlLoopElementId)); - } - - ControlLoopElementHandler getTestingHandler() { - var api = Mockito.mock(PolicyApiHttpClient.class); - var pap = Mockito.mock(PolicyPapHttpClient.class); - var handler = new ControlLoopElementHandler(api, pap); - var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class); - var element = getTestingClElement(); - when(intermediaryApi.getControlLoopElement(controlLoopElementId)).thenReturn(element); - handler.setIntermediaryApi(intermediaryApi); - return handler; - } - - ControlLoopElement getTestingClElement() { - var element = new ControlLoopElement(); - element.setDefinition(controlLoopId); - element.setDescription("Description"); - element.setId(controlLoopElementId); - element.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - element.setParticipantId(controlLoopId); - element.setState(ControlLoopState.UNINITIALISED); - var template = Mockito.mock(ToscaServiceTemplate.class); - element.setToscaServiceTemplateFragment(template); - return element; - } - -} diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java deleted file mode 100644 index d517ef61e..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java +++ /dev/null @@ -1,317 +0,0 @@ -/*- - * ============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.participant.policy.main.utils; - -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.FileNotFoundException; -import java.time.Instant; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import org.onap.policy.clamp.controlloop.common.utils.CommonUtils; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantDefinition; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUpdates; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantUtils; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate; -import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData; -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.tosca.authorative.concepts.ToscaConceptIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; -import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class TestListenerUtils { - - private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator(); - private static final Coder CODER = new StandardCoder(); - static CommonTestData commonTestData = new CommonTestData(); - private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class); - - /** - * Method to create a controlLoop from a yaml file. - * - * @return ControlLoop controlloop - */ - public static ControlLoop createControlLoop() { - ControlLoop controlLoop = new ControlLoop(); - Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>(); - ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); - Map<String, ToscaNodeTemplate> nodeTemplatesMap = - toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); - for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { - ControlLoopElement clElement = new ControlLoopElement(); - clElement.setId(UUID.randomUUID()); - - ToscaConceptIdentifier clElementParticipantId = new ToscaConceptIdentifier(); - clElementParticipantId.setName(toscaInputEntry.getKey()); - clElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion()); - clElement.setParticipantId(clElementParticipantId); - - clElement.setDefinition(clElementParticipantId); - clElement.setState(ControlLoopState.UNINITIALISED); - clElement.setDescription(toscaInputEntry.getValue().getDescription()); - clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - elements.put(clElement.getId(), clElement); - } - controlLoop.setElements(elements); - controlLoop.setName("PMSHInstance0"); - controlLoop.setVersion("1.0.0"); - - ToscaConceptIdentifier definition = new ToscaConceptIdentifier(); - definition.setName("PMSHInstance0"); - definition.setVersion("1.0.0"); - controlLoop.setDefinition(definition); - - return controlLoop; - } - - /** - * Method to create ControlLoopStateChange message from the arguments passed. - * - * @param controlLoopOrderedState controlLoopOrderedState - * - * @return ControlLoopStateChange message - */ - public static ControlLoopStateChange createControlLoopStateChangeMsg( - final ControlLoopOrderedState controlLoopOrderedState) { - final ControlLoopStateChange clStateChangeMsg = new ControlLoopStateChange(); - - ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(); - controlLoopId.setName("PMSHInstance0"); - controlLoopId.setVersion("1.0.0"); - - ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); - participantId.setName("org.onap.PM_Policy"); - participantId.setVersion("0.0.0"); - - clStateChangeMsg.setControlLoopId(controlLoopId); - clStateChangeMsg.setParticipantId(participantId); - clStateChangeMsg.setTimestamp(Instant.now()); - clStateChangeMsg.setOrderedState(controlLoopOrderedState); - - return clStateChangeMsg; - } - - /** - * Method to create ControlLoopUpdateMsg. - * - * @return ControlLoopUpdate message - */ - public static ControlLoopUpdate createControlLoopUpdateMsg() { - final ControlLoopUpdate clUpdateMsg = new ControlLoopUpdate(); - ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0"); - ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0"); - - clUpdateMsg.setControlLoopId(controlLoopId); - clUpdateMsg.setParticipantId(participantId); - clUpdateMsg.setMessageId(UUID.randomUUID()); - clUpdateMsg.setTimestamp(Instant.now()); - - Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>(); - ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); - TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate); - Map<String, ToscaNodeTemplate> nodeTemplatesMap = - toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); - for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { - if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(), - toscaServiceTemplate)) { - ControlLoopElement clElement = new ControlLoopElement(); - clElement.setId(UUID.randomUUID()); - var clParticipantType = - ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()); - - clElement.setParticipantId(clParticipantType); - clElement.setParticipantType(clParticipantType); - - clElement.setDefinition( - new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion())); - clElement.setState(ControlLoopState.UNINITIALISED); - clElement.setDescription(toscaInputEntry.getValue().getDescription()); - clElement.setOrderedState(ControlLoopOrderedState.PASSIVE); - elements.put(clElement.getId(), clElement); - } - } - - List<ParticipantUpdates> participantUpdates = new ArrayList<>(); - for (ControlLoopElement element : elements.values()) { - CommonUtils.setServiceTemplatePolicyInfo(element, toscaServiceTemplate); - CommonUtils.prepareParticipantUpdate(element, participantUpdates); - } - clUpdateMsg.setParticipantUpdatesList(participantUpdates); - return clUpdateMsg; - } - - /** - * Method to create participantUpdateMsg. - * - * @return ParticipantUpdate message - */ - public static ParticipantUpdate createParticipantUpdateMsg() { - final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate(); - ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0"); - ToscaConceptIdentifier participantType = - new ToscaConceptIdentifier("org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1"); - - participantUpdateMsg.setParticipantId(participantId); - participantUpdateMsg.setTimestamp(Instant.now()); - participantUpdateMsg.setParticipantType(participantType); - participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000)); - participantUpdateMsg.setMessageId(UUID.randomUUID()); - - ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); - // Add policies to the toscaServiceTemplate - TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate); - - List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>(); - for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate() - .getNodeTemplates().entrySet()) { - if (ParticipantUtils.checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(), - toscaServiceTemplate)) { - CommonUtils.prepareParticipantDefinitionUpdate( - ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()), - toscaInputEntry.getKey(), toscaInputEntry.getValue(), - participantDefinitionUpdates, null); - } - } - - participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates); - return participantUpdateMsg; - } - - /** - * Method to create ControlLoopUpdate using the arguments passed. - * - * @param jsonFilePath the path of the controlloop content - * - * @return ControlLoopUpdate message - * @throws CoderException exception while reading the file to object - */ - public static ControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) throws CoderException { - ControlLoopUpdate controlLoopUpdateMsg = CODER.decode(new File(jsonFilePath), ControlLoopUpdate.class); - return controlLoopUpdateMsg; - } - - private static ToscaServiceTemplate testControlLoopRead() { - Set<String> controlLoopDirectoryContents = - ResourceUtils.getDirectoryContents("src/test/resources/utils/servicetemplates"); - - boolean atLeastOneControlLoopTested = false; - ToscaServiceTemplate toscaServiceTemplate = null; - - for (String controlLoopFilePath : controlLoopDirectoryContents) { - if (!controlLoopFilePath.endsWith(".yaml")) { - continue; - } - atLeastOneControlLoopTested = true; - toscaServiceTemplate = testControlLoopYamlSerialization(controlLoopFilePath); - } - - // Add policy_types to the toscaServiceTemplate - addPolicyTypesToToscaServiceTemplate(toscaServiceTemplate); - - assertTrue(atLeastOneControlLoopTested); - return toscaServiceTemplate; - } - - private static void addPolicyTypesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) { - Set<String> policyTypeDirectoryContents = ResourceUtils.getDirectoryContents("policytypes"); - - for (String policyTypeFilePath : policyTypeDirectoryContents) { - String policyTypeString = ResourceUtils.getResourceAsString(policyTypeFilePath); - - ToscaServiceTemplate foundPolicyTypeSt = - yamlTranslator.fromYaml(policyTypeString, ToscaServiceTemplate.class); - - toscaServiceTemplate.setDerivedFrom(foundPolicyTypeSt.getDerivedFrom()); - toscaServiceTemplate.setDescription(foundPolicyTypeSt.getDescription()); - toscaServiceTemplate.setMetadata(foundPolicyTypeSt.getMetadata()); - toscaServiceTemplate.setName(foundPolicyTypeSt.getName()); - toscaServiceTemplate.setToscaDefinitionsVersion(foundPolicyTypeSt.getToscaDefinitionsVersion()); - toscaServiceTemplate.setVersion(foundPolicyTypeSt.getVersion()); - - if (foundPolicyTypeSt.getDataTypes() != null) { - if (toscaServiceTemplate.getDataTypes() == null) { - toscaServiceTemplate.setDataTypes(foundPolicyTypeSt.getDataTypes()); - } else { - toscaServiceTemplate.getDataTypes().putAll(foundPolicyTypeSt.getDataTypes()); - } - } - - if (toscaServiceTemplate.getPolicyTypes() == null) { - toscaServiceTemplate.setPolicyTypes(foundPolicyTypeSt.getPolicyTypes()); - } else { - toscaServiceTemplate.getPolicyTypes().putAll(foundPolicyTypeSt.getPolicyTypes()); - } - } - } - - /** - * Method to add polcies to the toscaServiceTemplate. - * - * @param toscaServiceTemplate to add policies - */ - public static void addPoliciesToToscaServiceTemplate(ToscaServiceTemplate toscaServiceTemplate) { - Set<String> policiesDirectoryContents = ResourceUtils.getDirectoryContents("policies"); - - for (String policiesFilePath : policiesDirectoryContents) { - String policiesString = ResourceUtils.getResourceAsString(policiesFilePath); - - ToscaServiceTemplate foundPoliciesSt = yamlTranslator.fromYaml(policiesString, ToscaServiceTemplate.class); - toscaServiceTemplate.getToscaTopologyTemplate() - .setPolicies(foundPoliciesSt.getToscaTopologyTemplate().getPolicies()); - } - } - - private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) { - try { - String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath); - if (controlLoopString == null) { - throw new FileNotFoundException(controlLoopFilePath); - } - - ToscaServiceTemplate serviceTemplate = - yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class); - return serviceTemplate; - } catch (FileNotFoundException e) { - LOGGER.error("cannot find YAML file", controlLoopFilePath); - throw new IllegalArgumentException(e); - } - } -} diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties b/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties index 49781407d..932d9f2c3 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/application_test.properties @@ -1,6 +1,6 @@ spring.security.user.name=participantUser spring.security.user.password=zb!XztG34 -server.servlet.context-path=/onap/policyparticipant +server.servlet.context-path=/onap/policy/clamp/acm/policyparticipant server.error.path=/error server.http-port=8085 @@ -15,14 +15,14 @@ participant.intermediaryParameters.reportingTimeInterval: 120000 participant.intermediaryParameters.description: Participant Description participant.intermediaryParameters.participantId.name: org.onap.PM_Policy participant.intermediaryParameters.participantId.version: 1.0.0 -participant.intermediaryParameters.participantType.name: org.onap.policy.controlloop.PolicyControlLoopParticipant +participant.intermediaryParameters.participantType.name: org.onap.policy.acm.PolicyAutomationCompositionParticipant participant.intermediaryParameters.participantType.version: 2.3.1 -participant.intermediaryParameters.clampControlLoopTopics.name=ControlLoop Topics -participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topic=POLICY-CLRUNTIME-PARTICIPANT -participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].servers[0]=localhost -participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].topicCommInfrastructure=dmaap -participant.intermediaryParameters.clampControlLoopTopics.topicSources[0].fetchTimeout=15000 -participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topic=POLICY-CLRUNTIME-PARTICIPANT -participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].servers[0]=localhost -participant.intermediaryParameters.clampControlLoopTopics.topicSinks[0].topicCommInfrastructure=dmaap +participant.intermediaryParameters.clampAutomationCompositionTopics.name=Automation Composition Topics +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topic=POLICY-ACRUNTIME-PARTICIPANT +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].servers[0]=localhost +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].topicCommInfrastructure=dmaap +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSources[0].fetchTimeout=15000 +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topic=POLICY-ACRUNTIME-PARTICIPANT +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].servers[0]=localhost +participant.intermediaryParameters.clampAutomationCompositionTopics.topicSinks[0].topicCommInfrastructure=dmaap management.endpoints.web.exposure.include=health,metrics,prometheus diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml new file mode 100644 index 000000000..3e5782cdc --- /dev/null +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestACParams.yaml @@ -0,0 +1,172 @@ +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.acm.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + org.onap.policy.clamp.acm.AutomationCompositionElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + participantType: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + startPhase: + type: integer + required: false + constraints: + - greater-or-equal: 0 + metadata: + common: true + description: A value indicating the start phase in which this automation composition element will be started, + the first start phase is zero. Automation Composition Elements are started in their start_phase + order and stopped in reverse start phase order. Automation Composition Elements with the same start phase are + started and stopped simultaneously + org.onap.policy.clamp.acm.AutomationComposition: + 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.acm.DCAEMicroserviceAutomationCompositionElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + dcae_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + policy_type_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.acm.CDSAutomationCompositionElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + cds_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true +topology_template: + node_templates: + org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.acm.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.policy.acm.MonitoringPolicyAutomationCompositionParticipant: + version: 2.3.1 + type: org.onap.policy.clamp.acm.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.policy.acm.OperationalPolicyAutomationCompositionParticipant: + version: 3.2.1 + type: org.onap.policy.clamp.acm.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant: + version: 2.2.1 + type: org.onap.policy.clamp.acm.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.acm.DCAEMicroserviceAutomationCompositionElement + type_version: 1.0.0 + description: Automation composition element, DCAE microservice for Performance Management Subscription Handling + properties: + provider: Ericsson + participantType: + name: org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant + version: 2.3.4 + dcae_blueprint_id: + name: org.onap.dcae.blueprints.PMSHBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement: + version: 1.2.3 + type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement + type_version: 1.0.0 + description: Automation composition element, monitoring policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participantType: + name: org.onap.policy.acm.MonitoringPolicyAutomationCompositionParticipant + version: 2.3.1 + policy_type_id: + name: onap.policies.monitoring.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement: + version: 1.2.3 + type: org.onap.policy.clamp.acm.PolicyTypeAutomationCompositionElement + type_version: 1.0.0 + description: Automation composition element, operational policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participantType: + name: org.onap.policy.acm.OperationalPolicyAutomationCompositionParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.operational.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement: + version: 1.2.3 + type: org.onap.policy.clamp.acm.AutomationCompositionElement + type_version: 1.0.0 + description: Automation composition element for CDS for Performance Management Subscription Handling + properties: + provider: Ericsson + participantType: + name: org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant + version: 3.2.1 + cds_blueprint_id: + name: org.onap.ccsdk.cds.PMSHCdsBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSHAutomationCompositionDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.acm.AutomationComposition + type_version: 1.0.0 + description: Automation composition 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_MonitoringPolicyAutomationCompositionElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement + version: 1.2.3 + diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml deleted file mode 100644 index 2ef3c6da0..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml +++ /dev/null @@ -1,172 +0,0 @@ -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 - participantType: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - startPhase: - type: integer - required: false - constraints: - - greater-or-equal: 0 - metadata: - common: true - description: A value indicating the start phase in which this control loop element will be started, the - first start phase is zero. Control Loop Elements are started in their start_phase order and stopped - in reverse start phase order. Control Loop Elements with the same start phase are started and - stopped simultaneously - 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.MonitoringPolicyControlLoopParticipant: - version: 2.3.1 - type: org.onap.policy.clamp.controlloop.Participant - type_version: 1.0.1 - description: Participant for DCAE microservices - properties: - provider: ONAP - org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant: - version: 3.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 - participantType: - 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 - participantType: - name: org.onap.policy.controlloop.MonitoringPolicyControlLoopParticipant - version: 2.3.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 - participantType: - name: org.onap.policy.controlloop.OperationalPolicyControlLoopParticipant - 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 - participantType: - 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 - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml index cf6b89eb9..0f1d28be7 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml @@ -36,7 +36,7 @@ <appender-ref ref="STDOUT" /> </root> - <logger name="org.onap.policy.clamp.controlloop.participant" level="trace" additivity="false"> + <logger name="org.onap.policy.clamp.acm.participant" level="trace" additivity="false"> <appender-ref ref="STDOUT" /> </logger> </configuration> diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml deleted file mode 100644 index 126e8e6e2..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policies/vCPE.policies.optimization.input.tosca.yaml +++ /dev/null @@ -1,348 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -topology_template: - policies: - - - OSDF_CASABLANCA.Affinity_Default: - type: onap.policies.optimization.resource.AffinityPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Affinity_Default - metadata: - policy-id: OSDF_CASABLANCA.Affinity_Default - policy-version: 1 - properties: - scope: [] - services: [] - resources: [] - geography: [] - identity: affinity_vCPE - applicableResources: any - affinityProperties: - qualifier: same - category: complex - - - OSDF_CASABLANCA.Affinity_Default_US: - type: onap.policies.optimization.resource.AffinityPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Affinity_Default_US - metadata: - policy-id: OSDF_CASABLANCA.Affinity_Default_US - policy-version: 1 - properties: - scope: [] - services: [] - resources: [] - geography: [US] - identity: affinity_vCPE - applicableResources: any - affinityProperties: - qualifier: same - category: complex - - - OSDF_CASABLANCA.Affinity_Default_vCPE_US_0: - type: onap.policies.optimization.resource.AffinityPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Affinity_Default_vCPE_US_0 - metadata: - policy-id: OSDF_CASABLANCA.Affinity_Default_vCPE_US_0 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [] - geography: [US] - identity: affinity_vCPE - applicableResources: any - affinityProperties: - qualifier: different - category: complex - - - OSDF_CASABLANCA.Affinity_vCPE_US_Gold_1: - type: onap.policies.optimization.resource.AffinityPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Affinity_vCPE_US_Gold_1 - metadata: - policy-id: OSDF_CASABLANCA.Affinity_vCPE_1 - policy-version: 1 - properties: - scope: [gold] - services: [vCPE] - resources: [vGMuxInfra, vG] - geography: [US, INTERNATIONAL] - identity: affinity_vCPE - applicableResources: any - affinityProperties: - qualifier: same - category: availabilityZone - - - OSDF_CASABLANCA.Affinity_vCPE_US_Platinum_1: - type: onap.policies.optimization.resource.AffinityPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Affinity_vCPE_US_Platinum_1 - metadata: - policy-id: OSDF_CASABLANCA.Affinity_vCPE_1 - policy-version: 1 - properties: - scope: [platinum] - services: [vCPE] - resources: [vGMuxInfra, vG] - geography: [US, INTERNATIONAL] - identity: affinity_vCPE - applicableResources: any - affinityProperties: - qualifier: different - category: availabilityZone - - - OSDF_CASABLANCA.Capacity_vG_1: - type: onap.policies.optimization.resource.Vim_fit - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Capacity_vG_1 - metadata: - policy-id: OSDF_CASABLANCA.Capacity_vG_1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: capacity_vG - applicableResources: any - capacityProperty: - controller: multicloud - request: "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}" - - - OSDF_CASABLANCA.Capacity_vG_2: - type: onap.policies.optimization.resource.Vim_fit - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Capacity_vG_2 - metadata: - policy-id: OSDF_CASABLANCA.Capacity_vG_2 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: capacity_vG - applicableResources: any - capacityProperty: - controller: multicloud - request: "{\"vCPU\": 15, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"MB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}" - - - OSDF_CASABLANCA.Distance_vG_1: - type: onap.policies.optimization.resource.DistancePolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.Distance_vG_1 - metadata: - policy-id: OSDF_CASABLANCA.Distance_vG_1 - policy-version: 1 - properties: - scope: [platinum] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: distance-vG - applicableResources: any - distanceProperties: - locationInfo: customer_loc - distance: - value: 1500 - operator: "<" - unit: km - - - OSDF_CASABLANCA.hpa_policy_Default: - type: onap.policies.optimization.resource.HpaPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.hpa_policy_Default - metadata: - policy-id: OSDF_CASABLANCA.hpa_policy_Default - policy-version: 1 - properties: - scope: [] - services: [] - resources: [] - geography: [] - identity: hpa-vG - flavorFeatures: - - - id: vg_1 - type: vnfc - directives: - - type: flavor_directives - attributes: - - attribute_name: flavor_label_vm_01 - attribute_value: "" - flavorProperties: - - - hpa-feature: basicCapabilities - mandatory: True - architecture: generic - directives: [] - hpa-feature-attributes: - - hpa-attribute-key: numVirtualCpu - hpa-attribute-value: 8 - operator: ['>='] - unit: "" - - hpa-attribute-key: virtualMemSize - hpa-attribute-value: 6 - operator: ['<='] - unit: "" - - - hpa-feature: ovsDpdk - mandatory: False - architecture: generic - directives: [] - hpa-feature-attributes: - - hpa-attribute-key: dataProcessingAccelerationLibrary - hpa-attribute-value: ovsDpdk_version - operator: [=] - unit: "" - - - OSDF_CASABLANCA.hpa_policy_vG_1: - type: onap.policies.optimization.resource.HpaPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.hpa_policy_vG_1 - metadata: - policy-id: OSDF_CASABLANCA.hpa_policy_vG_1 - policy-version: 1 - properties: - scope: [] - services: [vCPE, vOtherService] - resources: [vG] - geography: [] - identity: hpa-vG - flavorFeatures: - - - id: vg_1 - type: vnfc - directives: - - type: flavor_directives - attributes: - - attribute_name: flavor_label_vm_01 - attribute_value: "" - flavorProperties: - - - hpa-feature: basicCapabilities - mandatory: True - architecture: generic - directives: [] - hpa-feature-attributes: - - hpa-attribute-key: numVirtualCpu - hpa-attribute-value: 6 - operator: ['>='] - unit: "" - - hpa-attribute-key: virtualMemSize - hpa-attribute-value: 4 - operator: ['<='] - unit: "" - - - hpa-feature: ovsDpdk - mandatory: False - architecture: generic - directives: [] - hpa-feature-attributes: - - hpa-attribute-key: dataProcessingAccelerationLibrary - hpa-attribute-value: ovsDpdk_version - operator: [=] - unit: "" - - - OSDF_CASABLANCA.queryPolicy_vCPE: - type: onap.policies.optimization.service.QueryPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.queryPolicy_vCPE - metadata: - policy-id: OSDF_CASABLANCA.queryPolicy_vCPE - policy-version: 1 - properties: - scope: [] - services: [vCPE] - geography: [US, INTERNATIONAL] - identity: vCPE_Query_Policy - queryProperties: - - - attribute: locationId - attribute_location: customerLocation - value: "" - - - attribute: id - attribute_location: "vpnInfo.vpnId" - value: "" - - - attribute: upstreamBW - attribute_location: "vpnInfo.upstreamBW" - value: "" - - - attribute: customerLatitude - attribute_location: customerLatitude - value: 1.1 - - - attribute: customerLongitude - attribute_location: customerLongitude - value: 2.2 - - - OSDF_CASABLANCA.SubscriberPolicy_v1: - type: onap.policies.optimization.service.SubscriberPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.SubscriberPolicy_v1 - metadata: - policy-id: OSDF_CASABLANCA.SubscriberPolicy_v1 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - identity: subscriber_vCPE - subscriberProperties: - subscriberName: [subscriber_x, subscriber_y] - subscriberRole: [platinum] - provStatus: [CAPPED] - - - OSDF_CASABLANCA.SubscriberPolicy_v2: - type: onap.policies.optimization.service.SubscriberPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.SubscriberPolicy_v2 - metadata: - policy-id: OSDF_CASABLANCA.SubscriberPolicy_v2 - policy-version: 1 - properties: - scope: [] - services: [vCPE] - identity: subscriber_vCPE - subscriberProperties: - subscriberName: [subscriber_a, subscriber_b] - subscriberRole: [gold] - provStatus: [CAPPED] - - - OSDF_CASABLANCA.vnfPolicy_vG: - type: onap.policies.optimization.resource.VnfPolicy - version: 1.0.0 - type_version: 1.0.0 - name: OSDF_CASABLANCA.vnfPolicy_vG - metadata: - policy-id: OSDF_CASABLANCA.vnfPolicy_vG - policy-version: 1 - properties: - scope: [] - services: [vCPE] - resources: [vG] - geography: [US, INTERNATIONAL] - identity: vnf_vG - applicableResources: any - vnfProperties: - - - inventoryProvider: aai - serviceType: "" - inventoryType: cloudRegionId - customerId: "" - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml deleted file mode 100644 index 88b870580..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Match.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Match: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Match - description: Base Policy Type for matchable Policies - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml deleted file mode 100644 index bde730cd7..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Naming.yaml +++ /dev/null @@ -1,102 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Naming: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Naming - description: Virtual policy node for naming - properties: - policy-instance-name: - type: string - naming-models: - type: list - entry_schema: - type: policy.data.naming-model-entity -data_types: - policy.data.naming-model-entity: - derived_from: tosca.datatypes.Root - properties: - nfRole: - type: string - required: false - metadata: - matchable: true - naming-type: - type: string - required: true - metadata: - matchable: true - naming-recipe: - type: string - required: true - name-operation: - type: string - required: false - naming-properties: - type: list - required: true - entry_schema: - type: policy.data.naming-property - policy.data.naming-property: - derived_from: tosca.datatypes.Root - properties: - property-name: - type: string - required: true - metadata: - matchable: true - property-value: - type: string - required: false - property-operation: - type: string - required: false - source-system: - type: string - required: false - source-endpoint: - type: string - required: false - increment-sequence: - type: policy.data.increment-sequence - required: false - policy.data.increment-sequence: - derived_from: tosca.datatypes.Root - properties: - scope: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - CLOUD_REGION_ID - - LOCATION_CLLI - - VNF - - VM - - VFMODULE - - PRECEEDING - - TRAILING - - ENTIRETY - sequence-type: - type: string - require: true - entry_schema: - type: string - constraints: - - valid_values: - - numeric - - alpha-numeric - start-value: - type: string - required: true - max: - type: string - required: false - increment: - type: string - required: true - length: - type: string - required: true - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml deleted file mode 100644 index 7fe0e59de..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.Optimization.yaml +++ /dev/null @@ -1,33 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Optimization: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Optimization - description: The base policy type for all policies that govern optimization - properties: - scope: - description: Scope for the policy - could be for a specific release. - type: list - metadata: - matchable: true - required: true - entry_schema: - type: string - geography: - description: One or more geographic regions - type: list - metadata: - matchable: true - required: true - entry_schema: - type: string - constraints: - - valid_values: - - US - - International - identity: - description: Used internally for identification - type: string - required: true - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml deleted file mode 100644 index 3dc979220..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.Common.yaml +++ /dev/null @@ -1,28 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.guard.Common: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.controlloop.guard.Common - description: | - This is the base Policy Type for Guard policies that guard the execution of Operational - Policies. - properties: - actor: - type: string - description: Specifies the Actor the guard applies to. - required: true - operation: - type: string - description: Specified the operation that the actor is performing the guard applies to. - required: true - timeRange: - type: tosca.datatypes.TimeInterval - description: | - An optional range of time during the day the guard policy is valid for. - required: false - id: - type: string - description: The Control Loop id this applies to. - required: false - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml deleted file mode 100644 index f2b67e18f..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml +++ /dev/null @@ -1,16 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.guard.common.Blacklist: - derived_from: onap.policies.controlloop.guard.Common - type_version: 1.0.0 - version: 1.0.0 - name: onap.policies.controlloop.guard.common.Blacklist - description: Supports blacklist of entity id's from performing control loop actions on. - properties: - blacklist: - type: list - description: List of entity id's not allowed to have control loop operations on. - required: true - entry_schema: - type: string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml deleted file mode 100644 index ea8e92aaf..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.Filter.yaml +++ /dev/null @@ -1,66 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.guard.common.Filter: - derived_from: onap.policies.controlloop.guard.Common - type_version: 1.0.0 - version: 1.0.0 - name: onap.policies.controlloop.guard.common.Filter - description: Supports filtering of A&AI entities such as vnf-id, type, service, geographic region, etc. - properties: - algorithm: - type: string - description: Designates the precendence of blacklist vs whitelist - required: true - default: blacklist-overrides - constraints: - - valid_values: ["blacklist-overrides", "whitelist-overrides"] - filters: - type: list - description: List of filters to be applied. - required: true - entry_schema: - type: onap.datatypes.guard.filter -data_types: - onap.datatypes.guard.filter: - derived_from: tosca.nodes.Root - properties: - field: - type: string - description: Name of the field to perform the filter on using the A&AI <node>.<property> syntax. - required: true - constraints: - - valid_values: - - generic-vnf.vnf-name - - generic-vnf.vnf-id - - generic-vnf.vnf-type - - generic-vnf.nf-naming-code - - vserver.vserver-id - - cloud-region.cloud-region-id - filter: - type: string - description: The filter value itself. For example, "RegionOne" "vFWCL*" - required: true - function: - type: string - description: The function applied to the filter. - required: true - constraints: - - valid_values: - - string-equal - - string-equal-ignore-case - - string-regexp-match - - string-contains - - string-greater-than - - string-greater-than-or-equal - - string-less-than - - string-less-than-or-equal - - string-starts-with - - string-ends-with - blacklist: - type: boolean - description: | - Indicates if the filter should be treated as a blacklist (true) - or whitelist (false). - required: true - default: true - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml deleted file mode 100644 index 3e31ec218..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml +++ /dev/null @@ -1,26 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.guard.common.FrequencyLimiter: - derived_from: onap.policies.controlloop.guard.Common - type_version: 1.0.0 - version: 1.0.0 - name: onap.policies.controlloop.guard.common.FrequencyLimiter - description: Supports limiting the frequency of actions being taken by a Actor. - properties: - timeWindow: - type: integer - description: The time window to count the actions against. - required: true - timeUnits: - type: string - description: The units of time the window is counting. - required: true - constraints: - - valid_values: ["second", "minute", "hour", "day", "week", "month", "year"] - limit: - type: integer - description: The limit - required: true - constraints: - - greater_than: 0 - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml deleted file mode 100644 index 8f93572bf..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.common.MinMax.yaml +++ /dev/null @@ -1,24 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.guard.common.MinMax: - derived_from: onap.policies.controlloop.guard.Common - type_version: 1.0.0 - version: 1.0.0 - name: onap.policies.controlloop.guard.common.MinMax - description: | - Supports Min/Max number of entity for scaling operations. Although min and max fields are marked as not - required, you need to have at least one or the other. - properties: - target: - type: string - required: true - description: The target entity that has scaling restricted - min: - type: integer - required: false - description: The minimum instances of this entity - max: - type: integer - required: false - description: The maximum instances of this entity - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml deleted file mode 100644 index eaeee605d..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml +++ /dev/null @@ -1,27 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.Guard: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.controlloop.Guard - description: Guard Policies for Control Loop Operational Policies - onap.policies.controlloop.guard.Coordination: - derived_from: onap.policies.controlloop.Guard - version: 1.0.0 - name: onap.policies.controlloop.guard.Coordination - description: Guard Policies for Control Loop Coordination - onap.policies.controlloop.guard.coordination.FirstBlocksSecond: - derived_from: onap.policies.controlloop.guard.Coordination - version: 1.0.0 - name: onap.policies.controlloop.guard.coordination.FirstBlocksSecond - description: Supports one Control Loop blocking another - properties: - controlLoop: - type: list - description: Specific Control Loops to which to apply this guard - required: true - constraint: - length: 2 - entry_schema: - type: string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml deleted file mode 100644 index 9b3b057b8..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.Common.yaml +++ /dev/null @@ -1,143 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.operational.Common: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.controlloop.operational.Common - description: | - Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant - Policy Types. This does NOT support the legacy Policy YAML policy type. - properties: - id: - type: string - description: The unique control loop id. - required: true - timeout: - type: integer - description: | - Overall timeout for executing all the operations. This timeout should equal or exceed the total - timeout for each operation listed. - required: true - abatement: - type: boolean - description: Whether an abatement event message will be expected for the control loop from DCAE. - required: true - default: false - trigger: - type: string - description: Initial operation to execute upon receiving an Onset event message for the Control Loop. - required: true - operations: - type: list - description: List of operations to be performed when Control Loop is triggered. - required: true - entry_schema: - type: onap.datatype.controlloop.Operation - -data_types: - onap.datatype.controlloop.Target: - 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 - - onap.datatype.controlloop.Actor: - derived_from: tosca.datatypes.Root - description: An actor/operation/target definition - properties: - actor: - type: string - description: The actor performing the operation. - required: true - metadata: - clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor - operation: - type: string - description: The operation the actor is performing. - metadata: - clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation - required: true - target: - type: onap.datatype.controlloop.Target - description: The resource the operation should be performed on. - required: true - 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 - - onap.datatype.controlloop.Operation: - derived_from: tosca.datatypes.Root - description: An operation supported by an actor - properties: - id: - type: string - description: Unique identifier for the operation - required: true - description: - type: string - description: A user-friendly description of the intent for the operation - required: false - operation: - type: onap.datatype.controlloop.Actor - description: The definition of the operation to be performed. - required: true - timeout: - type: integer - description: The amount of time for the actor to perform the operation. - required: true - retries: - type: integer - description: The number of retries the actor should attempt to perform the operation. - required: true - 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. - required: false - default: final_success - failure: - type: string - description: Points to the operation to invoke on Actor operation failure. - required: false - default: final_failure - failure_timeout: - type: string - description: Points to the operation to invoke when the time out for the operation occurs. - required: false - default: final_failure_timeout - failure_retries: - type: string - description: Points to the operation to invoke when the current operation has exceeded its max retries. - required: false - default: final_failure_retries - failure_exception: - type: string - description: Points to the operation to invoke when the current operation causes an exception. - required: false - 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. - required: false - default: final_failure_guard - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml deleted file mode 100644 index a0c5b2456..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Apex.yaml +++ /dev/null @@ -1,26 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -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 - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml deleted file mode 100644 index 69d73db58..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.controlloop.operational.common.Drools.yaml +++ /dev/null @@ -1,14 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.controlloop.operational.common.Drools: - derived_from: onap.policies.controlloop.operational.Common - type_version: 1.0.0 - version: 1.0.0 - name: onap.policies.controlloop.operational.common.Drools - description: Operational policies for Drools PDP - properties: - controllerName: - type: string - description: Drools controller properties - required: false - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml deleted file mode 100644 index c50392eca..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-mapper.yaml +++ /dev/null @@ -1,50 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Monitoring - description: a base policy type for all policies that govern monitoring provisioning - onap.policies.monitoring.dcae-pm-mapper: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - pm-mapper-filter: - type: map - description: PM mapper filter on measInfo, measInfoId, measType, instanceId - entry_schema: - type: onap.datatypes.monitoring.pm-mapper-filter -data_types: - onap.datatypes.monitoring.pm-mapper-filter: - derived_from: tosca.datatypes.Root - properties: - filters: - type: list - description: Filter configuration - #default: [] - required: true - entry_schema: - type: onap.datatypes.monitoring.filters - onap.datatypes.monitoring.filters: - derived_from: tosca.datatypes.Root - properties: - pmDefVsn: - type: string - description: PM Dictionary version - required: true - nfType: - type: string - description: NF type - required: true - vendor: - type: string - description: Vendor name - required: true - measTypes: - type: list - description: Measurement types to collect - #default: [] - required: true - entry_schema: - type: string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml deleted file mode 100644 index 8ac9b7484..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-pm-subscription-handler.yaml +++ /dev/null @@ -1,132 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Monitoring - description: a base policy type for all policies that govern monitoring provisioning - onap.policies.monitoring.dcae-pm-subscription-handler: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - subscription: - type: map - description: PM Subscription Handler Subscription - entry_schema: - type: onap.datatypes.monitoring.subscription -data_types: - onap.datatypes.monitoring.subscription: - derived_from: tosca.datatypes.Root - properties: - subscriptionName: - type: string - description: Name of the subscription - required: true - administrativeState: - type: string - description: State of the subscription - required: true - constraints: - - valid_values: - - LOCKED - - UNLOCKED - fileBasedGP: - type: integer - description: File based granularity period - required: true - fileLocation: - type: string - description: ROP file location - required: true - nfTypeModelInvariantId: - type: string - description: Network function invariant ID - required: true - nfFilter: - type: map - description: Network function filter - required: true - entry_schema: - type: onap.datatypes.monitoring.nfFilter - measurementGroups: - type: list - description: Measurement Groups - required: true - entry_schema: - type: onap.datatypes.monitoring.measurementGroups - onap.datatypes.monitoring.nfFilter: - derived_from: tosca.datatypes.Root - properties: - nfNames: - type: list - description: List of network functions - required: true - #default: [] - entry_schema: - type: string - swVersions: - type: list - description: List of software versions - required: true - #default: [] - entry_schema: - type: string - onap.datatypes.monitoring.measurementGroups: - derived_from: tosca.datatypes.Root - properties: - measurementGroup: - type: map - description: Measurement Group - required: true - entry_schema: - type: onap.datatypes.monitoring.measurementGroup - onap.datatypes.monitoring.measurementGroup: - derived_from: tosca.datatypes.Root - properties: - measurementTypes: - type: list - description: List of measurement types - required: true - #default: [] - entry_schema: - type: onap.datatypes.monitoring.measurementTypes - managedObjectDNsBasic: - type: list - description: List of managed object distinguished names - required: true - #default: [] - entry_schema: - type: onap.datatypes.monitoring.managedObjectDNsBasics - onap.datatypes.monitoring.measurementTypes: - derived_from: tosca.datatypes.Root - properties: - measurementType: - type: map - description: Measurement type object - required: true - entry_schema: - type: onap.datatypes.monitoring.measurementType - onap.datatypes.monitoring.measurementType: - derived_from: tosca.datatypes.Root - properties: - measurementType: - type: string - description: Measurement type - required: true - onap.datatypes.monitoring.managedObjectDNsBasics: - derived_from: tosca.datatypes.Root - properties: - managedObjectDNsBasic: - type: map - description: Managed object distinguished name object - required: true - entry_schema: - type: onap.datatypes.monitoring.managedObjectDNsBasic - onap.datatypes.monitoring.managedObjectDNsBasic: - derived_from: tosca.datatypes.Root - properties: - DN: - type: string - description: Managed object distinguished name - required: true - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml deleted file mode 100644 index 58e60e98d..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml +++ /dev/null @@ -1,128 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Monitoring - description: a base policy type for all policies that govern monitoring provisioning - onap.policies.monitoring.dcae-restconfcollector: - derived_from: onap.policies.Monitoring - version: 1.0.0 - properties: - rcc_policy: - type: list - description: RCC Policy JSON - entry_schema: - type: onap.datatypes.monitoring.rcc_policy -data_types: - onap.datatypes.monitoring.rcc_policy: - derived_from: tosca.datatypes.Root - properties: - controller_name: - type: string - description: Name of controller - required: true - controller_restapiUrl: - type: string - description: Controller's ip and port - required: true - controller_restapiUser: - type: string - description: Controller's username - required: true - controller_restapiPassword: - type: string - description: Controller's password - required: true - controller_accessTokenUrl: - type: string - description: URL to get access token - required: true - controller_accessTokenFile: - type: string - description: Access token file path - required: true - controller_accessTokenMethod: - type: string - description: Access token method POST/GET/PUT etc - required: true - constraints: - - valid_values: - - post - - get - - put - controller_subsMethod: - type: string - description: Subscription method POST/GET/PUT etc - required: true - default: post - constraints: - - valid_values: - - post - - get - - put - controller_subscriptionUrl: - type: string - description: URL to establish subscription - required: true - controller_disableSsl: - type: boolean - description: Option to disable ssl - required: true - default: true - event_details: - type: list - description: event details - required: true - entry_schema: - type: onap.datatypes.monitoring.rcc_event_details - onap.datatypes.monitoring.rcc_event_details: - derived_from: tosca.datatypes.Root - properties: - event_name: - type: string - description: event name - required: true - event_description: - type: string - description: description of event - required: false - event_sseventUrlEmbed: - type: boolean - description: Whether SSE url is embedded in subscription response - required: true - default: true - event_sseventsField: - type: string - description: Field name to access SSE url in subscription response - required: true - event_sseventsUrl: - type: string - description: Explicit SSE url - required: true - event_subscriptionTemplate: - type: string - description: Subscription template file path - required: true - event_unSubscriptionTemplate: - type: string - description: Unsubscription template file path - required: false - event_ruleId: - type: integer - description: Rule Id - required: false - modifyData: - type: boolean - description: Whether to modify the received SSE event - required: true - default: false - modifyMethod: - type: string - description: The java method name to modify data - required: false - userData: - type: string - description: The user specific data - required: false - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml deleted file mode 100644 index 408e8cd00..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml +++ /dev/null @@ -1,19 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - description: a base policy type for all policies that govern monitoring provisioning - version: 1.0.0 - name: onap.policies.Monitoring - onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server: - derived_from: onap.policies.Monitoring - version: 1.0.0 - name: onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server - properties: - buscontroller_feed_publishing_endpoint: - type: string - description: DMAAP Bus Controller feed endpoint - datafile.policy: - type: string - description: datafile Policy JSON as string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml deleted file mode 100644 index 04026b323..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.monitoring.tcagen2.yaml +++ /dev/null @@ -1,161 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Monitoring: - derived_from: tosca.policies.Root - version: 1.0.0 - name: onap.policies.Monitoring - description: a base policy type for all policies that govern monitoring provisioning - onap.policies.monitoring.tcagen2: - derived_from: onap.policies.Monitoring - version: 1.0.0 - name: onap.policies.monitoring.tcagen2 - properties: - tca.policy: - type: onap.datatypes.monitoring.tca_policy - description: TCA Policy JSON - required: true -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 - 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 - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml deleted file mode 100644 index d2a7632f3..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Apex.yaml +++ /dev/null @@ -1,203 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Native: - derived_from: tosca.policies.Root - description: a base policy type for all native PDP policies - version: 1.0.0 - name: onap.policies.Native - onap.policies.native.Apex: - derived_from: onap.policies.Native - description: a policy type for native apex policies - version: 1.0.0 - name: onap.policies.native.Apex - properties: - engine_service: - type: onap.datatypes.native.apex.EngineService - description: APEX Engine Service Parameters - inputs: - type: map - description: Inputs for handling events coming into the APEX engine - entry_schema: - type: onap.datatypes.native.apex.EventHandler - outputs: - type: map - description: Outputs for handling events going out of the APEX engine - entry_schema: - type: onap.datatypes.native.apex.EventHandler - environment: - type: list - description: Envioronmental parameters for the APEX engine - entry_schema: - type: onap.datatypes.native.apex.Environment - -data_types: - onap.datatypes.native.apex.EngineService: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - description: Specifies the engine name - required: false - default: "ApexEngineService" - version: - type: string - description: Specifies the engine version in double dotted format - required: false - default: "1.0.0" - id: - type: integer - description: Specifies the engine id - required: true - instance_count: - type: integer - description: Specifies the number of engine threads that should be run - required: true - deployment_port: - type: integer - description: Specifies the port to connect to for engine administration - required: false - default: 1 - policy_model_file_name: - type: string - description: The name of the file from which to read the APEX policy model - required: false - policy_type_impl: - type: string - description: The policy type implementation from which to read the APEX policy model - required: false - periodic_event_period: - type: string - description: The time interval in milliseconds for the periodic scanning event, 0 means don't scan - required: false - engine: - type: onap.datatypes.native.apex.engineservice.Engine - description: The parameters for all engines in the APEX engine service - required: true - onap.datatypes.native.apex.EventHandler: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - description: Specifies the event handler name, if not specified this is set to the key name - required: false - carrier_technology: - type: onap.datatypes.native.apex.CarrierTechnology - description: Specifies the carrier technology of the event handler (such as REST/Web Socket/Kafka) - required: true - event_protocol: - type: onap.datatypes.native.apex.EventProtocol - description: Specifies the event protocol of events for the event handler (such as Yaml/JSON/XML/POJO) - required: true - event_name: - type: string - description: Specifies the event name for events on this event handler, if not specified, the event name is read from or written to the event being received or sent - required: false - event_name_filter: - type: string - description: Specifies a filter as a regular expression, events that do not match the filter are dropped, the default is to let all events through - required: false - synchronous_mode: - type: boolean - description: Specifies the event handler is syncronous (receive event and send response) - required: false - default: false - synchronous_peer: - type: string - description: The peer event handler (output for input or input for output) of this event handler in synchronous mode, this parameter is mandatory if the event handler is in synchronous mode - required: false - synchronous_timeout: - type: integer - description: The timeout in milliseconds for responses to be issued by APEX torequests, this parameter is mandatory if the event handler is in synchronous mode - required: false - requestor_mode: - type: boolean - description: Specifies the event handler is in requestor mode (send event and wait for response mode) - required: false - default: false - requestor_peer: - type: string - description: The peer event handler (output for input or input for output) of this event handler in requestor mode, this parameter is mandatory if the event handler is in requestor mode - required: false - requestor_timeout: - type: integer - description: The timeout in milliseconds for wait for responses to requests, this parameter is mandatory if the event handler is in requestor mode - required: false - onap.datatypes.native.apex.CarrierTechnology: - derived_from: tosca.datatypes.Root - properties: - label: - type: string - description: The label (name) of the carrier technology (such as REST, Kafka, WebSocket) - required: true - plugin_parameter_class_name: - type: string - description: The class name of the class that overrides default handling of event input or output for this carrier technology, defaults to the supplied input or output class - required: false - onap.datatypes.native.apex.EventProtocol: - derived_from: tosca.datatypes.Root - properties: - label: - type: string - description: The label (name) of the event protocol (such as Yaml, JSON, XML, or POJO) - required: true - event_protocol_plugin_class: - type: string - description: The class name of the class that overrides default handling of the event protocol for this carrier technology, defaults to the supplied event protocol class - required: false - onap.datatypes.native.apex.Environment: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - description: The name of the environment variable - required: true - value: - type: string - description: The value of the environment variable - required: true - onap.datatypes.native.apex.engineservice.Engine: - derived_from: tosca.datatypes.Root - properties: - context: - type: onap.datatypes.native.apex.engineservice.engine.Context - description: The properties for handling context in APEX engines, defaults to using Java maps for context - required: false - executors: - type: map - description: The plugins for policy executors used in engines such as javascript, MVEL, Jython - required: true - entry_schema: - description: The plugin class path for this policy executor - type: string - onap.datatypes.native.apex.engineservice.engine.Context: - derived_from: tosca.datatypes.Root - properties: - distributor: - type: onap.datatypes.native.apex.Plugin - description: The plugin to be used for distributing context between APEX PDPs at runtime - required: false - schemas: - type: map - description: The plugins for context schemas available in APEX PDPs such as Java and Avro - required: false - entry_schema: - type: onap.datatypes.native.apex.Plugin - locking: - type: onap.datatypes.native.apex.Plugin - description: The plugin to be used for locking context in and between APEX PDPs at runtime - required: false - persistence: - type: onap.datatypes.native.apex.Plugin - description: The plugin to be used for persisting context for APEX PDPs at runtime - required: false - onap.datatypes.native.apex.Plugin: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - description: The name of the executor such as Javascript, Jython or MVEL - required: true - plugin_class_name: - type: string - description: The class path of the plugin class for this executor - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml deleted file mode 100644 index 0ae96dbc2..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Drools.yaml +++ /dev/null @@ -1,118 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Native: - derived_from: tosca.policies.Root - description: a base policy type for all native PDP policies - version: 1.0.0 - name: onap.policies.Native - onap.policies.native.Drools: - derived_from: onap.policies.Native - description: a base policy type for all native PDP policies - version: 1.0.0 - name: onap.policies.native.Drools - onap.policies.native.drools.Controller: - derived_from: onap.policies.native.Drools - description: a policy type for a drools controller configuration - version: 1.0.0 - name: onap.policies.native.drools.Controller - properties: - controllerName: - type: string - required: true - description: the drools controller name - sourceTopics: - type: list - required: false - description: source topics and applicable events - entry_schema: - type: onap.datatypes.dmaap.topic - sinkTopics: - type: list - required: false - description: sink topics and applicable events - entry_schema: - type: onap.datatypes.dmaap.topic - customConfig: - type: map - required: false - description: any use case specific configurations relevant to the drools controller - entry_schema: - type: string - onap.policies.native.drools.Artifact: - derived_from: onap.policies.native.Drools - description: a policy type for native drools artifact policies - version: 1.0.0 - name: onap.policies.native.drools.Artifact - properties: - rulesArtifact: - type: onap.datatypes.native.rules_artifact - required: true - description: the GAV information of the maven artifact - controller: - type: onap.datatypes.drools.controller.relation - required: true - description: the drools controller to which the current native policy is assigned - -data_types: - onap.datatypes.dmaap.topic: - derived_from: tosca.datatypes.Root - properties: - topicName: - type: string - required: true - description: the dmaap topic name - events: - type: list - required: true - description: events used by this topic - entry_schema: - type: onap.datatypes.dmaap.events - onap.datatypes.dmaap.events: - derived_from: tosca.datatypes.Root - properties: - eventClass: - type: string - required: true - description: the event canonical class for serialization - eventFilter: - type: string - required: false - description: the JSONPath based condition to filter out the events to serialize - customSerialization: - type: onap.datatypes.dmaap.custom_serialization - required: false - description: overrides the default serialization/deserialization mechanisms with custom ones - onap.datatypes.dmaap.custom_serialization: - derived_from: tosca.datatypes.Root - properties: - customSerializerClass: - type: string - required: true - description: the class that contains the JSON parser serializer/deserializer. - jsonParser: - type: string - required: true - description: static field in customSerialized class with the json parser (currently only gson supported) - onap.datatypes.native.rules_artifact: - derived_from: tosca.datatypes.Root - properties: - groupId: - type: string - required: true - description: the groupId of the maven artifact - artifactId: - type: string - required: true - description: the artifactId of the maven artifact - version: - type: string - required: true - description: the version of the maven artifact - onap.datatypes.drools.controller.relation: - derived_from: tosca.datatypes.Root - properties: - name: - type: string - required: true - description: the name of drools controller policy - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml deleted file mode 100644 index eb25cdb91..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.native.Xacml.yaml +++ /dev/null @@ -1,20 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.Native: - derived_from: tosca.policies.Root - description: a base policy type for all native PDP policies - version: 1.0.0 - name: onap.policies.Native - onap.policies.native.Xacml: - derived_from: onap.policies.Native - description: a policy type for native xacml policies - version: 1.0.0 - name: onap.policies.native.Xacml - properties: - policy: - type: string - required: true - description: The XML XACML 3.0 PolicySet or Policy - metadata: - encoding: Base64 - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml deleted file mode 100644 index 6b3a2460d..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Resource.yaml +++ /dev/null @@ -1,25 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.Resource: - derived_from: onap.policies.Optimization - version: 1.0.0 - name: onap.policies.optimization.Resource - description: The base policy type for all policies that govern optimization for a Resource in a Service. - properties: - services: - description: One or more services that the policy applies to. - type: list - metadata: - matchable: true - required: true - entry_schema: - type: string - resources: - description: One or more VNF resources that the policy applies to. - type: list - metadata: - matchable: true - required: true - entry_schema: - type: string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml deleted file mode 100644 index 8b37a67e7..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.Service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.Service: - derived_from: onap.policies.Optimization - version: 1.0.0 - name: onap.policies.optimization.Service - description: The base policy type for all policies that govern optimization for a Service. - properties: - services: - description: One or more services that the policy applies to. - type: list - metadata: - matchable: true - required: true - entry_schema: - type: string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml deleted file mode 100644 index bb6adb0aa..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml +++ /dev/null @@ -1,33 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.AffinityPolicy: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.AffinityPolicy - 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 - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml deleted file mode 100644 index f41dcfd6f..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.DistancePolicy.yaml +++ /dev/null @@ -1,58 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.DistancePolicy: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.DistancePolicy - properties: - 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 - entry_schema: - type: policy.data.distance_properties - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml deleted file mode 100644 index dfe30774b..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.HpaPolicy.yaml +++ /dev/null @@ -1,105 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.HpaPolicy: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.HpaPolicy - properties: - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml deleted file mode 100644 index b0f77d67e..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml +++ /dev/null @@ -1,68 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.OptimizationPolicy: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.OptimizationPolicy - properties: - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml deleted file mode 100644 index e636582df..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.PciPolicy.yaml +++ /dev/null @@ -1,32 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.PciPolicy: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.PciPolicy - properties: - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml deleted file mode 100644 index cb387dda1..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.Vim_fit.yaml +++ /dev/null @@ -1,30 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.Vim_fit: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.Vim_fit - properties: - applicableResources: - type: list - required: true - entry_schema: - type: string - constraints: - - valid_values: - - any - - all - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml deleted file mode 100644 index 30b8b7212..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.resource.VnfPolicy.yaml +++ /dev/null @@ -1,46 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.resource.VnfPolicy: - derived_from: onap.policies.optimization.Resource - version: 1.0.0 - name: onap.policies.optimization.resource.VnfPolicy - properties: - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml deleted file mode 100644 index 2ff263b24..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.QueryPolicy.yaml +++ /dev/null @@ -1,26 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.service.QueryPolicy: - derived_from: onap.policies.optimization.Service - version: 1.0.0 - name: onap.policies.optimization.service.QueryPolicy - properties: - 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/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml deleted file mode 100644 index 81dea2c3c..000000000 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml +++ /dev/null @@ -1,36 +0,0 @@ -tosca_definitions_version: tosca_simple_yaml_1_1_0 -policy_types: - onap.policies.optimization.service.SubscriberPolicy: - derived_from: onap.policies.optimization.Service - version: 1.0.0 - name: onap.policies.optimization.service.SubscriberPolicy - properties: - subscriberProperties: - type: policy.data.subscriberProperties_properties - required: true -data_types: - policy.data.subscriberProperties_properties: - derived_from: tosca.nodes.Root - properties: - subscriberName: - type: list - required: true - metadata: - contextProvider: true - entry_schema: - type: string - subscriberRole: - type: list - required: true - metadata: - contextMatchable: scope - entry_schema: - type: string - provStatus: - type: list - required: true - metadata: - contextAttribute: true - entry_schema: - type: string - diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_automation_composition_tosca.yaml index 33b42b7bc..3d14cf572 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_control_loop_tosca.yaml +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/utils/servicetemplates/pm_automation_composition_tosca.yaml @@ -10,14 +10,14 @@ data_types: type: string required: true node_types: - org.onap.policy.clamp.controlloop.Participant: + org.onap.policy.clamp.acmParticipant: version: 1.0.1 derived_from: tosca.nodetypes.Root properties: provider: type: string requred: false - org.onap.policy.clamp.controlloop.ControlLoopElement: + org.onap.policy.clamp.acmAutomationCompositionElement: version: 1.0.1 derived_from: tosca.nodetypes.Root properties: @@ -34,11 +34,11 @@ node_types: - greater-or-equal: 0 metadata: common: true - description: A value indicating the start phase in which this control loop element will be started, the - first start phase is zero. Control Loop Elements are started in their start_phase order and stopped - in reverse start phase order. Control Loop Elements with the same start phase are started and - stopped simultaneously - org.onap.policy.clamp.controlloop.ControlLoop: + description: A value indicating the start phase in which this automation composition element will be started, + the first start phase is zero. Automation Composition Elements are started in their start_phase + order and stopped in reverse start phase order. Automation Composition Elements with the same start + phase are started and stopped simultaneously + org.onap.policy.clamp.acmAutomationComposition: version: 1.0.1 derived_from: tosca.nodetypes.Root properties: @@ -50,115 +50,115 @@ node_types: required: true entry_schema: type: onap.datatypes.ToscaConceptIdentifier - org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement: + org.onap.policy.clamp.acmDCAEMicroserviceAutomationCompositionElement: version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + derived_from: org.onap.policy.clamp.acmAutomationCompositionElement properties: dcae_blueprint_id: type: onap.datatypes.ToscaConceptIdentifier requred: true - org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement: + org.onap.policy.clamp.acmPolicyTypeAutomationCompositionElement: version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + derived_from: org.onap.policy.clamp.acmAutomationCompositionElement properties: policy_type_id: type: onap.datatypes.ToscaConceptIdentifier requred: true - org.onap.policy.clamp.controlloop.CDSControlLoopElement: + org.onap.policy.clamp.acmCDSAutomationCompositionElement: version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + derived_from: org.onap.policy.clamp.acmAutomationCompositionElement properties: cds_blueprint_id: type: onap.datatypes.ToscaConceptIdentifier requred: true topology_template: node_templates: - org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant: + org.onap.dcae.acmDCAEMicroserviceAutomationCompositionParticipant: version: 2.3.4 - type: org.onap.policy.clamp.controlloop.Participant + type: org.onap.policy.clamp.acmParticipant type_version: 1.0.1 description: Participant for DCAE microservices properties: provider: ONAP - org.onap.policy.controlloop.PolicyControlLoopParticipant: + org.onap.policy.acmPolicyAutomationCompositionParticipant: version: 2.3.1 - type: org.onap.policy.clamp.controlloop.Participant + type: org.onap.policy.clamp.acmParticipant type_version: 1.0.1 description: Participant for DCAE microservices properties: provider: ONAP - org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant: + org.onap.ccsdk.cds.acmCdsAutomationCompositionParticipant: version: 2.2.1 - type: org.onap.policy.clamp.controlloop.Participant + type: org.onap.policy.clamp.acmParticipant 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: org.onap.policy.clamp.acmDCAEMicroserviceAutomationCompositionElement type_version: 1.0.0 - description: Control loop element for the DCAE microservice for Performance Management Subscription Handling + description: Automation composition element for DCAE microservice for Performance Management Subscription Handling properties: provider: Ericsson participantType: - name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant + name: org.onap.dcae.acmDCAEMicroserviceAutomationCompositionParticipant version: 2.3.4 dcae_blueprint_id: name: org.onap.dcae.blueprints.PMSHBlueprint version: 1.0.0 - org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: + org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement: version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type: org.onap.policy.clamp.acmPolicyTypeAutomationCompositionElement type_version: 1.0.0 - description: Control loop element for the monitoring policy for Performance Management Subscription Handling + description: Automation composition element for monitoring policy for Performance Management Subscription Handling properties: provider: Ericsson participantType: - name: org.onap.policy.controlloop.PolicyControlLoopParticipant + name: org.onap.policy.acmPolicyAutomationCompositionParticipant version: 2.3.1 policy_type_id: name: onap.policies.monitoring.pm-subscription-handler version: 1.0.0 - org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement: + org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement: version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type: org.onap.policy.clamp.acmPolicyTypeAutomationCompositionElement type_version: 1.0.0 - description: Control loop element for the operational policy for Performance Management Subscription Handling + description: Automation composition element, operational policy for Performance Management Subscription Handling properties: provider: Ericsson participantType: - name: org.onap.policy.controlloop.PolicyControlLoopParticipant + name: org.onap.policy.acmPolicyAutomationCompositionParticipant version: 2.3.1 policy_type_id: name: onap.policies.operational.pm-subscription-handler version: 1.0.0 - org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement: + org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement: version: 1.2.3 - type: org.onap.policy.clamp.controlloop.ControlLoopElement + type: org.onap.policy.clamp.acmAutomationCompositionElement type_version: 1.0.0 - description: Control loop element for CDS for Performance Management Subscription Handling + description: Automation composition element for CDS for Performance Management Subscription Handling properties: provider: Ericsson participantType: - name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant + name: org.onap.ccsdk.cds.acmCdsAutomationCompositionParticipant version: 3.2.1 cds_blueprint_id: name: org.onap.ccsdk.cds.PMSHCdsBlueprint version: 1.0.0 - org.onap.domain.pmsh.PMSHControlLoopDefinition: + org.onap.domain.pmsh.PMSHAutomationCompositionDefinition: version: 1.2.3 - type: org.onap.policy.clamp.controlloop.ControlLoop + type: org.onap.policy.clamp.acmAutomationComposition type_version: 1.0.0 - description: Control loop for Performance Management Subscription Handling + description: Automation composition 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 + - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement version: 1.2.3 - - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement + - name: org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement version: 1.2.3 - - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement + - name: org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement version: 1.2.3 |