diff options
Diffstat (limited to 'tosca-controlloop/common/src/main')
11 files changed, 1497 insertions, 0 deletions
diff --git a/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/ControlLoopConstants.java b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/ControlLoopConstants.java new file mode 100644 index 000000000..aa8b720bc --- /dev/null +++ b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/ControlLoopConstants.java @@ -0,0 +1,32 @@ +/* + * ============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. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.common; + +/** + * Names of various items contained in the Registry. + */ +public class ControlLoopConstants { + + // Registry keys + public static final String REG_CLRUNTIME_ACTIVATOR = "object:activator/clruntime"; + + private ControlLoopConstants() { + super(); + } +} diff --git a/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java new file mode 100644 index 000000000..05b913b22 --- /dev/null +++ b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopException.java @@ -0,0 +1,94 @@ +/*- + * ============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.common.exception; + +import javax.ws.rs.core.Response; +import lombok.Getter; +import lombok.ToString; +import org.onap.policy.models.errors.concepts.ErrorResponse; +import org.onap.policy.models.errors.concepts.ErrorResponseInfo; +import org.onap.policy.models.errors.concepts.ErrorResponseUtils; + +/** + * This class is a base exception from which all control loop exceptions are sub classes. + */ +@Getter +@ToString +public class ControlLoopException extends Exception implements ErrorResponseInfo { + private static final long serialVersionUID = -8507246953751956974L; + + // The error response of the exception + private final ErrorResponse errorResponse = new ErrorResponse(); + + // The object on which the exception was thrown + private final transient Object object; + + /** + * Instantiates a new control loop exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + */ + public ControlLoopException(final Response.Status statusCode, final String message) { + this(statusCode, message, null); + } + + /** + * Instantiates a new control loop exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + * @param object the object that the exception was thrown on + */ + public ControlLoopException(final Response.Status statusCode, final String message, final Object object) { + super(message); + errorResponse.setResponseCode(statusCode); + ErrorResponseUtils.getExceptionMessages(errorResponse, this); + this.object = object; + } + + /** + * Instantiates a new control loop exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + * @param exception the exception that caused this exception + */ + public ControlLoopException(final Response.Status statusCode, final String message, final Exception exception) { + this(statusCode, message, exception, null); + } + + /** + * Instantiates a new exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + * @param exception the exception that caused this exception + * @param object the object that the exception was thrown on + */ + public ControlLoopException(final Response.Status statusCode, final String message, final Exception exception, + final Object object) { + super(message, exception); + errorResponse.setResponseCode(statusCode); + ErrorResponseUtils.getExceptionMessages(errorResponse, this); + this.object = object; + } +} diff --git a/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopRuntimeException.java b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopRuntimeException.java new file mode 100644 index 000000000..b110a4362 --- /dev/null +++ b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/exception/ControlLoopRuntimeException.java @@ -0,0 +1,107 @@ +/*- + * ============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.common.exception; + +import javax.ws.rs.core.Response; +import lombok.Getter; +import lombok.ToString; +import org.onap.policy.models.errors.concepts.ErrorResponse; +import org.onap.policy.models.errors.concepts.ErrorResponseInfo; +import org.onap.policy.models.errors.concepts.ErrorResponseUtils; + +/** + * This class is a base control loop run time exception from which all control loop run time exceptions are sub classes. + */ +@Getter +@ToString +public class ControlLoopRuntimeException extends RuntimeException implements ErrorResponseInfo { + private static final long serialVersionUID = -8507246953751956974L; + + // The error response of the exception + private final ErrorResponse errorResponse = new ErrorResponse(); + + // The object on which the exception was thrown + private final transient Object object; + + /** + * Instantiates a new control loop runtime exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + */ + public ControlLoopRuntimeException(final Response.Status statusCode, final String message) { + this(statusCode, message, null); + } + + /** + * Instantiates a new control loop runtime exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + * @param object the object that the exception was thrown on + */ + public ControlLoopRuntimeException(final Response.Status statusCode, final String message, final Object object) { + super(message); + this.object = object; + errorResponse.setResponseCode(statusCode); + ErrorResponseUtils.getExceptionMessages(errorResponse, this); + } + + /** + * Instantiates a new control loop runtime exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + * @param exception the exception that caused this control loop exception + */ + public ControlLoopRuntimeException(final Response.Status statusCode, final String message, + final Exception exception) { + this(statusCode, message, exception, null); + } + + /** + * Instantiates a new model runtime exception from a ControlLoopException instance. + * + * @param exception the exception that caused this control loop exception + */ + public ControlLoopRuntimeException(final ControlLoopException exception) { + super(exception.getMessage(), exception); + this.object = exception.getObject(); + errorResponse.setResponseCode(exception.getErrorResponse().getResponseCode()); + ErrorResponseUtils.getExceptionMessages(errorResponse, this); + } + + /** + * Instantiates a new control loop runtime exception. + * + * @param statusCode the return code for the exception + * @param message the message on the exception + * @param exception the exception that caused this control loop exception + * @param object the object that the exception was thrown on + */ + public ControlLoopRuntimeException(final Response.Status statusCode, final String message, + final Exception exception, final Object object) { + super(message, exception); + this.object = object; + errorResponse.setResponseCode(statusCode); + ErrorResponseUtils.getExceptionMessages(errorResponse, this); + } +} diff --git a/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/handler/ControlLoopHandler.java b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/handler/ControlLoopHandler.java new file mode 100644 index 000000000..2751f2441 --- /dev/null +++ b/tosca-controlloop/common/src/main/java/org/onap/policy/clamp/controlloop/common/handler/ControlLoopHandler.java @@ -0,0 +1,92 @@ +/*- + * ============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.common.handler; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import lombok.Getter; +import lombok.NonNull; +import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; +import org.onap.policy.common.utils.services.Registry; +import org.onap.policy.models.provider.PolicyModelsProviderParameters; + +/** + * Abstract class for handlers for sub components in the control loop system + * + * <p>Instances are effectively singletons that are started at system start. + */ +public abstract class ControlLoopHandler { + @Getter + private final PolicyModelsProviderParameters databaseProviderParameters; + + /** + * Create a handler. + * + * @param databaseProviderParameters the parameters for access to the database + */ + protected ControlLoopHandler(@NonNull PolicyModelsProviderParameters databaseProviderParameters) { + this.databaseProviderParameters = databaseProviderParameters; + + Registry.register(this.getClass().getName(), this); + } + + public void close() { + Registry.unregister(this.getClass().getName()); + } + + /** + * Get the provider classes that are used in instantiation. + * + * @return the provider classes + */ + public Set<Class<?>> getProviderClasses() { + // No REST interfaces are the default + return new HashSet<>(); + } + + /** + * Start any topic message listeners for this handler. + * + * @param msgDispatcher the message dispatcher with which to register the listener + */ + public abstract void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher); + + /** + * Start any topic message publishers for this handler. + * + * @param topicSinks the topic sinks on which the publisher can publish + */ + public abstract void startAndRegisterPublishers(List<TopicSink> topicSinks); + + /** + * Stop any topic message publishers for this handler. + */ + public abstract void stopAndUnregisterPublishers(); + + /** + * Stop any topic message listeners for this handler. + * + * @param msgDispatcher the message dispatcher from which to unregister the listener + */ + public abstract void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher); +} diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml new file mode 100644 index 000000000..2b2a4ae3e --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml @@ -0,0 +1,171 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_3 +data_types: + onap.datatypes.ToscaConceptIdentifier: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + version: + type: string + required: true +node_types: + org.onap.policy.clamp.controlloop.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + org.onap.policy.clamp.controlloop.ControlLoopElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + participant_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.ControlLoop: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + elements: + type: list + required: true + entry_schema: + type: onap.datatypes.ToscaConceptIdentifier + org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + dcae_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + policy_type_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.CDSControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + cds_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true +topology_template: + node_templates: + org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.policy.controlloop.PolicyControlLoopParticipant: + version: 2.3.1 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant: + version: 2.2.1 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.domain.pmsh.PMSH_DCAEMicroservice: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the DCAE microservice for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant + version: 2.3.4 + dcae_blueprint_id: + name: org.onap.dcae.blueprints.PMSHBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the monitoring policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.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 + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.operational.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.CDSControlLoopElement + type_version: 1.0.0 + description: Control loop element for CDS for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_Id: + name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant + version: 3.2.1 + cds_blueprint_id: + name: org.onap.ccsdk.cds.PMSHCdsBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSHControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Performance Management Subscription Handling + properties: + provider: Ericsson + elements: + - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement + version: 1.2.3
\ No newline at end of file diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling_GuilinFormat.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling_GuilinFormat.yaml new file mode 100644 index 000000000..51e369696 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling_GuilinFormat.yaml @@ -0,0 +1,455 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_3 +capability_types: + org.onap.EventProducer: + properties: + carrier_protocol_type: + type: string + required: true + constraints: + - valid_values: + - DMAAP_message_router + - SOMETHING_ELSE + - REST + data_format: + type: string + required: true + constraints: + - valid_values: + - JSON + - YAML + - JMS + event_format: + type: string + required: true + event_format_version: + type: string + required: false + config_keys: + type: list + required: false + entry_schema: + type: string + constraints: + - valid_values: + - all valid values should be added here + - if not specified, events of any config key may be generated + - 'examples for config_key: ves-measurement, ves-syslog, tca_handle_out, + etc.' + version: 0.0.1 + derived_from: tosca.capabilities.Root + org.onap.EventConsumer: + properties: + responding_capability: + type: string + required: false + carrier_protocol_type: + type: string + required: true + constraints: + - valid_values: + - DMAAP_message_router + - SOMETHING_ELSE + - REST + data_format: + type: string + required: true + constraints: + - valid_values: + - JSON + - YAML + - JMS + - all valid values should be added here + event_format: + type: string + description: 'examples for event_format: Ves_specification, LinkUp, VnfConfigured, + etc.' + required: true + event_format_version: + type: string + description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.' + required: false + config_keys: + type: list + required: false + entry_schema: + type: string + constraints: + - valid_values: + - all valid values should be added here + - if not specified, events of any config key may be generated + - 'examples for config_key: ves-measurement, ves-syslog, tca_handle_out, + etc.' + version: 0.0.1 + derived_from: tosca.capabilities.Root +node_types: + org.onap.DynamicConfig: + properties: + application_name: + type: string + description: Value used to tie the config to an application ? should we be + using a relationship here instead? + required: true + application_version: + type: string + required: true + application_provider: + type: string + required: false + data_types: + type: object + required: false + schema: + type: object + required: false + version: 0.0.1 + derived_from: tosca.nodes.Root + org.onap.APP: + properties: + application_name: + type: string + description: Human readable name for the application Product + required: false + provider: + type: string + description: Provider of the application and of the descriptor + required: true + application_version: + type: string + description: Software version of the application + required: true + blueprint_id: + type: string + description: A reference to the app blueprint + required: false + monitoring_policy: + type: string + description: A reference to the monitoring policy + required: false + requirements: + - receive: + capability: org.onap.EventProducer + relationship: org.onap.PropagateEvent + occurrences: + - 0 + - UNBOUNDED + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: + - 0 + - UNBOUNDED + version: 0.0.1 + derived_from: tosca.nodes.Root + org.onap.EventRelay: + properties: + event_format: + type: string + description: 'examples for event_format: Ves_specification, etc.' + required: true + event_format_version: + type: string + description: 'examples for event_format_version: 5.28.4, 7.30.1, etc.' + required: true + config_keys: + type: list + required: false + entry_schema: + type: string + constraints: + - valid_values: + - all valid values should be added here + - if not specified, events of any config key is relayed + - 'examples for config_key: ves-measurement, ves-syslog, tca_handle_out, + etc.' + supported_carrier_protocols: + type: map + description: 'A map describing supported carrier protocols and translations. + The tuples define what protocol combinations are supported on the producer + and consumer side: e.g. { REST: REST, DMAAP: REST, DMAAP: DMAAP}' + required: true + key_schema: + type: string + constraints: + - valid_values: + - DMAAP_message_router + - SOMETHING_ELSE + - REST + - all valid values should be added here + entry_schema: + type: string + constraints: + - valid_values: + - DMAAP_message_router + - SOMETHING_ELSE + - REST + - all valid values should be added here + supported_data_formats: + type: map + description: 'Is a map describing supported data formats and translation. + The tuples define what protocol combinations are supported on the producer + and consumer side: e.g. { JSON: JSON, JMS: JSON, YAML:YAML }' + required: true + key_schema: + type: string + constraints: + - valid_values: + - JSON + - JMS + - YAML + - etc + - all valid values should be added here + entry_schema: + type: string + constraints: + - valid_values: + - JSON + - JMS + - YAML + - etc + - all valid values should be added here + requirements: + - receive: + capability: org.onap.EventProducer + relationship: org.onap.PropagateEvent + occurrences: + - 0 + - UNBOUNDED + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: + - 0 + - UNBOUNDED + version: 0.0.1 + derived_from: tosca.nodes.Root +relationship_types: + org.onap.PropagateEvent: + properties: + config_keys: + type: list + description: The relationship type used on requirements to org.onap.EventProducer + and org.onap.EventConsumer capabilities. Filters events by specific config_keys + to be transferred by this relationship. That is, any event with a specific + config_key found in the list is transferred. If list is not defined or is + empty, events with all config_keys are transferred. + required: false + entry_schema: + type: string + version: 0.0.1 + derived_from: tosca.relationships.Root +topology_template: + inputs: + pm_subscription_topic: + type: string + pm_subscription_response_topic: + type: string + pm_subscription_handler_blueprint_id: + type: string + pm_subscription_operational_policy_id: + type: string + pm_subscription_cds_blueprint_id: + type: string + enable_tls: + type: string + node_templates: + org.onap.PM_Subscription_Handler: + type: org.onap.polcy.clamp.ControlLoopElement + properties: + application_name: PM Subscription Handler + provider: Ericsson + application_version: 1.0.0 + artifact_id: + get_input: pm_subscription_handler_blueprint_id + description: Is this a reference to the DCAE Cloudify Blueprint that is + already stored(or will be stored before CL configuration & instatiation) + in DCAE Inventory? + artifact_config: + enable_tls: + get_input: enable_tls + pmsh_publish_topic_name: + get_input: pm_subscription_topic + capabilities: + pm-subscription-event-publisher: + properties: + carrier_protocol_type: DMAAP_message_router + data_format: JSON + event_format: pm-subscription-event-format + event_format_version: 1.0.0 + attributes: + type: org.onap.EventProducer + occurrences: + - 0 + - UNBOUNDED + pm-subscription-event-receiver: + properties: + carrier_protocol_type: DMAAP_message_router + data_format: JSON + event_format: pm-subscription-event-response-format + event_format_version: 1.0.0 + relationships: + - type: tosca.relationships.DependsOn + - description: any ideas on a better realtionship ? or is it better to + just use the root realtionship ? + - target: org.onap.PM_Monitoring_Policy + attributes: + type: org.onap.EventConsumer + occurrences: + - 0 + - UNBOUNDED + org.onap.PM_Monitoring_Policy: + type: org.onap.DynamicConfig + properties: + application_name: PM Subscription Handler + application_version: 1.0.0 + provider: Ericsson + data_types: + measurementType: + type: string + DN: + type: string + nfFilter: + properties: + nfNames: + type: list + entry_schema: string + modelInvariantIDs: + type: list + entry_schema: + type: string + modelVersionIDs: + type: list + entry_schema: + type: string + measurementGroup: + properties: + masurementTypes: + type: list + entry_schema: + type: measurementType + managedObjectDNsBasic: + type: list + entry_schema: + type: DN + schema: + subscription: + subscriptionName: + type: string + required: true + administrativeState: + type: string + required: true + filebasedGP: + type: integer + required: true + fileLocation: + type: string + required: true + nfFilter: + type: nfFilter + measurementGroups: + type: list + entry_schema: + type: measurementGroup + description: Should I be showing a dependency between PM Subscription Handler + and the PM Monitoring Policy + org.onap.PM_Policy: + type: org.onap.APP + properties: + application_name: PM Subscription Operational Policy + provider: Ericsson + application_version: 1.0.0 + artifact_id: + get_input: pm_subscription_operational_policy_id + artifact_config: NOT_DEFINED + requirements: + - receive_0: + capability: pm-subscription-event-publisher + node: org.onap.PM_Subscription_Handler + relationship: NOT_DEFINED + properties: + config_keys: + - topic_name: + get_input: pm_subscription_topic + - send_0: + capability: cds-rest-receive + node: org.onap.CDS + - receive_1: + capability: cds-rest-response + node: org.onap.CDS + - send_1: + capability: pm-subscription-event-receiver + node: org.onap.PM_Subscription_Handler + relationship: NOT_DEFINED + properties: + config_keys: + - topic_name: + get_input: pm_subscription_response_topic + capabilities: + pm-subscription-response-event-publisher: + properties: + type: org.onap.EventProducer + carrier_protocol_type: DMAAP_message_router + data_format: JSON + event_format: pm-subscription-event-response-format + event_format_version: 1.0.0 + occurrences: + - 0 + - UNBOUNDED + org.onap.PM_CDS_Blueprint: + type: org.onap.APP + properties: + application_name: PM Subscription CDS Blueprint + provider: Ericsson + application_version: 1.0.0 + artifact_id: + get_input: pm_subscription_cds_blueprint_id + capabilities: + cds-rest-receive: + properties: + type: org.onap.EventConsumer + protocol_type: REST + data_format: JSON + event_format: cds_action_format + event_format_version: 1.0.0 + responding_capability: cds-rest-response + occurrences: + - 0 + - UNBOUNDED + cds-rest-response: + properties: + type: org.onap.EventProducer + protocol_type: REST + data_format: JSON + event_format: cds_action_response_format + event_format_version: 1.0.0 + occurrences: + - 0 + org.onap.controlloop0: + version: 1.2.3 + type: org.onap.policy.clamp.ControlLoop + properties: + application_name: Test Control Loop + provider: Ericsson + application_version: 1.0.0 + status: NOT_DEPLOYED + elements: + element1: org.onap.PM_Monitoring_Policy + diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml new file mode 100644 index 000000000..96ea133c2 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_DCAE_VES_TCA_substitution.yaml @@ -0,0 +1,83 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_3 + +imports: + - cloop_base_types.yaml + - cloop_dcae_types.yaml + +topology_template: + inputs: + some_property_input: + type: string + + substitution_mappings: + node_type: org.onap.DCAE_VES_TCA + properties: + some_property: { get_input: some_property_input } + capabilities: + VES-5.28.4-publisher: [ node1_VES_Collector, VES-5.28.4-publisher ] + VES-7.30.1-publisher: [ node1_VES_Collector, VES-7.30.1-publisher ] + TCA-handle-out-publisher: [ node2_TCA_GEN_2, TCA-handle-out-publisher ] + VES_specification-subscriber: [ node2_TCA_GEN_2, VES_specification-subscriber ] + + node_templates: + ################################################################################ + #alt1: without relay + + node1_VES_Collector: + type: org.onap.VESCollector + + node2_TCA_GEN_2: + type: org.onap.TCA_GEN_2 + requirements: + - receive: + capability: VES-5.28.4-publisher + node: node1_VES_Collector + relationship: + type: org.onap.PropagateEvent + properties: + config-keys: [ ves-measurement ] + + + ################################################################################ + #alt2: with relay + + node1_VES_Collector: + type: org.onap.VESCollector + + node2_TCA_GEN_2: + type: org.onap.TCA_GEN_2 + + node3_Relay: + type: org.onap.EventRelay + properties: + event_format: "VES_specification" + event_format_version: "5.28.4" + supported_carrier_protocols: [{ DMAAP_message_router: DMAAP_message_router }] + supported_data_formats: [{ JSON: JSON }] + requirements: + - receive: + node: node1_VES_Collector + properties: + config_keys: [ ves-measurement ] + - send: + node: node2_TCA_GEN_2 + properties: + config_keys: [ ves-measurement ] diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_base_types.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_base_types.yaml new file mode 100644 index 000000000..4f29e5635 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_base_types.yaml @@ -0,0 +1,210 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_2 + +capability_types: + #producer capability type + org.onap.EventProducer: + derived_from: tosca.capabilities.Root + properties: + carrier_protocol_type: + type: string + required: true + constraints: + valid_values: [ DMAAP_message_router, REST ] + #all valid values should be added here + data_format: + type: string + required: true + constraints: + valid_values: [ JSON, YAML, JMS ] + #all valid values should be added here + event_format: + type: string + required: true + #examples for event_format: Ves_specification, etc. + event_format_version: + type: string + #examples for event_format_version: 5.28.4, 7.30.1, etc. + config_keys: + type: list + required: false + entry_schema: + type: string + constraints: + #valid_values: [ ] + #all valid values should be added here + #if not specified, events of any config key may be generated + #examples for config_key: ves-measurement, ves-syslog, tca_handle_out, etc. + + + #consumer capability type + org.onap.EventConsumer: + derived_from: tosca.capabilities.Root + properties: + carrier_protocol_type: + type: string + required: true + constraints: + valid_values: [ DMAAP_message_router, REST ] + #all valid values should be added here + data_format: + type: string + required: true + constraints: + valid_values: [ JSON, YAML, JMS ] + #all valid values should be added here + event_format: + type: string + required: true + #examples for event_format: Ves_specification, LinkUp, VnfConfigured, etc. + event_format_version: + type: string + #examples for event_format_version: 5.28.4, 7.30.1, etc. + config_keys: + type: list + required: false + entry_schema: + type: string + constraints: + #valid_values: [ ] + #all valid values should be added here + #if not specified, events of any config key may be generated + #examples for config_key: ves-measurement, ves-syslog, tca_handle_out, etc. + + +relationship_types: + #the relationship type used on requirements to org.onap.EventProducer and org.onap.EventConsumer capabilities + org.onap.PropagateEvent: + derived_from: tosca.relationships.Root + properties: + config_keys: + type: list + required: false + description: > + Filters events by specific config_keys to be transferred by this relationship. + That is, any event with a specific config_key found in the list is transferred. + If list is not defined or is empty, events with all config_keys are transferred. + entry_schema: string + + + +node_types: + #base app node type + org.onap.APP: + derived_from: tosca.nodes.Root + properties: + application_name: + type: string + description: Human readable name for the application Product + required: false + provider: + type: string + description: Provider of the application and of the descriptor + required: true + application_version: + type: string + description: Software version of the application + required: true + blueprint_id: + type: string + description: A reference to the app blueprint + monitoring_policy: + type: string + required: false + description: A reference to the monitoring policy + requirements: + - receive: + capability: org.onap.EventProducer + relationship: org.onap.PropagateEvent + occurrences: [0, UNBOUNDED] + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: [0, UNBOUNDED] + + #the event relay node type + org.onap.EventRelay: + derived_from: tosca.nodes.Root + properties: + event_format: + type: string + required: true + #examples for event_format: Ves_specification, etc. + event_format_version: + type: string + required: true + #examples for event_format_version: 5.28.4, 7.30.1, etc. + config_keys: + type: list + required: false + entry_schema: + type: string + constraints: + #valid_values: [ ] + #all valid values should be added here + #if not specified, events of any config key is relayed + #examples for config_key: ves-measurement, ves-syslog, tca_handle_out, etc. + supported_carrier_protocols: + type: map + required: true + description: > + A map describing supported carrier protocols and translations. The + tuples define what protocol combinations are supported on the producer + and consumer side: e.g. { REST: REST, DMAAP: REST, DMAAP: DMAAP} + key_schema: + type: string + constraints: + valid_values: [ DMAAP_message_router, REST ] + #all valid values should be added here + entry_schema: + type: string + constraints: + valid_values: [ DMAAP_message_router, REST ] + #all valid values should be added here + supported_data_formats: + type: map + required: true + description: > + Is a map describing supported data formats and translation. The tuples + define what protocol combinations are supported on the producer and + consumer side: e.g. { JSON: JSON, JMS: JSON, YAML:YAML } + key_schema: + type: string + constraints: + valid_values: [ JSON, JMS, YAML, etc ] + #all valid values should be added here + entry_schema: + type: string + constraints: + valid_values: [ JSON, JMS, YAML, etc ] + #all valid values should be added here + requirements: + - receive: + capability: org.onap.EventProducer + relationship: org.onap.PropagateEvent + occurrences: [1, UNBOUNDED] + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: [1, UNBOUNDED] + + + + diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_dcae_example.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_dcae_example.yaml new file mode 100644 index 000000000..4629f6f75 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_dcae_example.yaml @@ -0,0 +1,50 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_3 + +imports: + - cloop_base_types.yaml + - cloop_dcae_types.yaml + - cloop_other_types.yaml + +topology_template: + node_templates: + + node1_DCAE_VES_TCA: + type: org.onap.DCAE_VES_TCA + directives: + - substitute + + node2_PolicyFramework: + type: org.onap.ApexPolicyFramework + requirements: + - receive: + capability: TCA-handle-out-publisher + node: node1_DCAE_VES_TCA + relationship: + properties: + config_keys: [ ves-measurement ] + - send: + capability: SelfService + node: org.onap.CDS + relationship: + properties: + config_keys: [ ves-measurement ] + + #if this closed loop to subscribe to other events via the VesCollector, should we not add that? diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_dcae_types.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_dcae_types.yaml new file mode 100644 index 000000000..5f96cd5df --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_dcae_types.yaml @@ -0,0 +1,140 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_3 + +imports: + - cloop_types.yaml + +node_types: + + #node type for VES_Collector + org.onap.VES_Collector: + derived_from: org.onap.APP + capabilities: + VES-5.28.4-publisher: + type: org.onap.EventProducer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "VES_specification" + event_format_version: "5.28.4" + config_keys: + - "ves-fault" + - "ves-measurement" + - "ves-syslog" + - "ves-heartbeat" + - "ves-other" + - "ves-mobileflow" + - "ves-statechange" + - "ves-thresholdCrossingAlert" + - "ves-voicequality" + - "ves-sipsignaling" + VES-7.30.1-publisher: + type: org.onap.EventProducer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "VES_specification" + event_format_version: "7.30.1" + config_keys: + - "ves-fault" + - "ves-pnfRegistration" + - "ves-notification" + - "ves-perf3gpp" + + #node type for TCA_GEN_2 + org.onap.TCA_GEN_2: + derived_from: org.onap.APP + capabilities: + TCA-handle-out-publisher: + type: org.onap.EventProducer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "DCAE_CL_Output" + event_format_version: "1.0.1" + config_keys: [ "tca_handle_out" ] + VES_specification-subscriber: + type: org.onap.EventConsumer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "VES_specification" + event_format_version: "5.28.4" + config_keys: [ "tca_handle_in" ] + + + + #node type for the composed VES_Collector and TCA_GEN_2 + org.onap.DCAE_VES_TCA: + derived_from: org.onap.APP + capabilities: + VES-5.28.4-publisher: + type: org.onap.EventProducer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "VES_specification" + event_format_version: "5.28.4" + config_keys: + - "ves-fault" + - "ves-measurement" + - "ves-syslog" + - "ves-heartbeat" + - "ves-other" + - "ves-mobileflow" + - "ves-statechange" + - "ves-thresholdCrossingAlert" + - "ves-voicequality" + - "ves-sipsignaling" + VES-7.30.1-publisher: + type: org.onap.EventProducer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "VES_specification" + event_format_version: "7.30.1" + config_keys: + - "ves-pnfRegistration" + - "ves-notification" + - "ves-perf3gpp" + TCA-handle-out-publisher: + type: org.onap.EventProducer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "DCAE_CL_Output" + event_format_version: "1.0.1" + config_keys: [ "tca_handle_out" ] + VES_specification-subscriber: + type: org.onap.EventConsumer + occurrences: [ 0, UNBOUNDED ] + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "VES_specification" + event_format_version: "5.28.4" + config_keys: [ "tca_handle_in" ] diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_other_types.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_other_types.yaml new file mode 100644 index 000000000..d743f499f --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/original/cloop_other_types.yaml @@ -0,0 +1,63 @@ +# ============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========================================================= + +tosca_definitions_version: tosca_simple_yaml_1_2 + +imports: + - cloop_base_types.yaml + +node_types: + #node type for Policy + org.onap.PolicyFramework: + derived_from: org.onap.APP + + #node type for Apex Policy + org.onap.ApexPolicyFramework: + derived_from: org.onap.PolicyFramework + + #node type for CDS + org.onap.CDS: + derived_from: org.onap.APP + capabilities: + #consumer capability for CDS for events of type ResourceAndTemplate management API + ResourceAndTemplateManagement: + type: org.onap.EventConsumer + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "ResourceAndTemplate" + event_format_version: "x.xx.x" + occurrences: [ 0, UNBOUNDED ] + #consumer capability for CDS for events of type SelfService API + SelfService: + type: org.onap.EventConsumer + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "SelfService" + event_format_version: "x.xx.x" + occurrences: [ 0, UNBOUNDED ] + #producer capability for CDS for events of type PNFControl + PNFcontrolEventsProducer: + type: org.onap.EventProducer + properties: + carrier_protocol_type: "DMAAP_message_router" + data_format: "JSON" + event_format: "PNFcontrol" + event_format_version: "x.xx.x" + occurrences: [ 0, UNBOUNDED ] |