diff options
Diffstat (limited to 'tosca-controlloop')
157 files changed, 18493 insertions, 1861 deletions
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 index dff4c6b58..1bbe5662f 100644 --- 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 @@ -69,31 +69,39 @@ public abstract class ControlLoopHandler { * * @param msgDispatcher the message dispatcher with which to register the listener */ - public abstract void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher); + public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { + // Start and register listeners + } /** * 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); - - /** - * Start any providers for this handler. - */ - public abstract void startProviders(); + public void startAndRegisterPublishers(List<TopicSink> topicSinks) { + // Start and register publishers + } /** * Stop any topic message publishers for this handler. */ - public abstract void stopAndUnregisterPublishers(); + public void stopAndUnregisterPublishers() { + // Stop and unregister publishers + } /** * 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); + public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { + // Stop and unregister listeners + } + + /** + * Start any providers for this handler. + */ + public abstract void startProviders(); /** * Stop any providers for this handler. diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/KubernetesHelm.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/KubernetesHelm.yaml new file mode 100644 index 000000000..2a5f76082 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/KubernetesHelm.yaml @@ -0,0 +1,169 @@ +# ============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.K8SMicroserviceControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + chart: + type: string + requred: true + configs: + type: list + required: false + requirements: + type: string + requred: false + templates: + type: list + required: false + entry_schema: + values: + type: string + requred: true +topology_template: + node_templates: + org.onap.k8s.controlloop.K8SControlLoopParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for K8S + properties: + provider: ONAP + org.onap.domain.database.Postgres_K8SMicroserviceControlLoopElement: + # See https://github.com/onap/oom/tree/master/kubernetes/common/postgres + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the K8S microservice for Postgres + properties: + provider: ONAP + participant_id: + name: org.onap.k8s.controlloop.K8SControlLoopParticipant + version: 2.3.4 + chart: + apiVersion: v1 + description: ONAP Postgres Server + name: postgres + version: 7.0.0 + configs: + - name: pg_hba.conf + value: <Contents of pg_hba.conf> + - name: setup.sql + value: <Contents of setup.sql> + requirements: + dependencies: + - name: common + version: ~7.x-0 + repository: 'file://../common' + - name: repositoryGenerator + version: ~7.x-0 + repository: 'file://../repositoryGenerator' + templates: + - name: first_template_file + value: <first_template_file> + - name: And so on + values: + <The Values> + org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement: + # See https://github.com/stakater-charts/helloworld/tree/master/helloworld + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.K8SMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the K8S microservice for Hello World + properties: + provider: ONAP + participant_id: + name: org.onap.k8s.controlloop.K8SControlLoopParticipant + version: 2.3.4 + chart: + apiVersion: v1 + name: helloworld + description: helloworld chart that runs on kubernetes + version: 1.0.0 + keywords: + - helloworld + - kubernetes + home: https://github.com/stakater-charts/helloworld + maintainers: + - name: Stakater + email: stakater@aurorasolutions.io + values: + kubernetes: + host: https://kubernetes.default + helloworld: + namespace: default + image: + name: tutum/hello-world + tag: latest + pullPolicy: IfNotPresent + service: + ingressClass: internal-ingress + org.onap.domain.sample.Postgres_HelloWorld_ControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Postgres and Hello World + properties: + provider: ONAP + elements: + - name: org.onap.domain.database.Postgres_K8SMicroserviceControlLoopElement + version: 1.2.3 + - name: org.onap.domain.database.HelloWorld_K8SMicroserviceControlLoopElement + version: 1.2.3 diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/consul_call_body.json b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/consul_call_body.json new file mode 100644 index 000000000..9118e9a6f --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/consul_call_body.json @@ -0,0 +1,62 @@ +{ + "subscription": { + "subscriptionName": "subscriptiona", + "administrativeState": "UNLOCKED", + "fileBasedGP": 15, + "fileLocation": "/pm/pm.xml", + "nfFilter": { + "nfNames": [ + "^pnf1.*" + ], + "modelInvariantIDs": [ + "5845y423-g654-6fju-po78-8n53154532k6", + "7129e420-d396-4efb-af02-6b83499b12f8" + ], + "modelVersionIDs": [ + "e80a6ae3-cafd-4d24-850d-e14c084a5ca9" + ] + }, + "measurementGroups": [ + { + "measurementGroup": { + "measurementTypes": [ + { + "measurementType": "countera" + }, + { + "measurementType": "counterb" + } + ], + "managedObjectDNsBasic": [ + { + "DN": "dna" + }, + { + "DN": "dnb" + } + ] + } + }, + { + "measurementGroup": { + "measurementTypes": [ + { + "measurementType": "counterc" + }, + { + "measurementType": "counterd" + } + ], + "managedObjectDNsBasic": [ + { + "DN": "dnc" + }, + { + "DN": "dnd" + } + ] + } + } + ] + } +} diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/consul_url.txt b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/consul_url.txt new file mode 100644 index 000000000..e90ded1c6 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/consul_url.txt @@ -0,0 +1 @@ +http://consul:31321/v1/kv/dcae-pmsh:policy
\ No newline at end of file diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_cloudify_blueprint.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_cloudify_blueprint.yaml new file mode 100644 index 000000000..7cdc6d5b9 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_cloudify_blueprint.yaml @@ -0,0 +1,176 @@ +# +# ============LICENSE_START======================================================= +# Copyright (C) 2020 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: cloudify_dsl_1_3 + +imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + # - plugin:k8splugin?version=>=3.4.3,<4.0.0 + - plugin:k8splugin?version=3.7.0 + - plugin:pgaas?version=1.3.0 + - plugin:clamppolicyplugin?version=1.1.0 +inputs: + tag_version: + type: string + description: Docker image to be used + default: 'nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2' + replicas: + type: integer + description: Number of instances + default: 1 + operational_policy_name: + type: string + default: 'pmsh-operational-policy' + control_loop_name: + type: string + default: 'pmsh-control-loop' + pmsh_publish_topic_name: + type: string + default: 'unauthenticated.DCAE_CL_OUTPUT' + policy_feedback_topic_name: + type: string + default: 'unauthenticated.PMSH_CL_INPUT' + aai_notification_topic_name: + type: string + default: 'AAI-EVENT' + publisher_client_role: + type: string + description: Client role to request secure access to topic + default: 'org.onap.dcae.pmPublisher' + subscriber_client_role: + type: string + description: Client role to request secure access to topic + default: 'org.onap.dcae.pmSubscriber' + dcae_location: + type: string + description: DCAE location for the subscriber, used to set up routing + default: 'san-francisco' + cpu_limit: + type: string + default: '1000m' + cpu_request: + type: string + default: '1000m' + memory_limit: + type: string + default: '1024Mi' + memory_request: + type: string + default: '1024Mi' + pgaas_cluster_name: + type: string + default: 'dcae-pg-primary.onap' + enable_tls: + type: boolean + default: true + protocol: + type: string + description: PMSH protocol. If enable_tls is false, set to http + default: 'https' + policy_model_id: + type: 'string' + default: 'onap.policies.monitoring.dcae-pm-subscription-handler' + policy_id: + type: 'string' + default: 'onap.policies.monitoring.dcae-pm-subscription-handler' +node_templates: + pgaasvm: + type: dcae.nodes.pgaas.database + properties: + writerfqdn: { get_input: pgaas_cluster_name } + name: 'pmsh' + pmsh: + type: dcae.nodes.ContainerizedServiceComponentUsingDmaap + interfaces: + cloudify.interfaces.lifecycle: + create: + inputs: + ports: + - '8443:0' + envs: + PMSH_PG_URL: + { get_attribute: [ pgaasvm, admin, host ] } + PMSH_PG_PASSWORD: + { get_attribute: [ pgaasvm, admin, password ] } + PMSH_PG_USERNAME: + { get_attribute: [ pgaasvm, admin, user ] } + PMSH_DB_NAME: + { get_attribute: [ pgaasvm, admin, database ] } + + relationships: + - target: pmsh-policy + type: cloudify.relationships.depends_on + + properties: + service_component_type: 'dcae-pmsh' + service_component_name_override: 'dcae-pmsh' + application_config: + enable_tls: { get_input: enable_tls } + aaf_identity: 'dcae@dcae.onap.org' + aaf_password: 'demo123456!' + operational_policy_name: { get_input: operational_policy_name } + control_loop_name: { get_input: control_loop_name } + cert_path: '/opt/app/pmsh/etc/certs/cert.pem' + key_path: '/opt/app/pmsh/etc/certs/key.pem' + ca_cert_path: '/opt/app/pmsh/etc/certs/cacert.pem' + streams_publishes: + policy_pm_publisher: + type: message_router + dmaap_info: + #topic_url: {concat: ["https://message-router:3905/events/", { get_input: pmsh_publish_topic_name }]} + topic_url: { concat: [ "http://message-router:3904/events/", { get_input: pmsh_publish_topic_name } ] } + streams_subscribes: + policy_pm_subscriber: + type: message_router + dmaap_info: + #topic_url: {concat: ["https://message-router:3905/events/", { get_input: policy_feedback_topic_name }]} + topic_url: {concat: ["http://message-router:3904/events/", { get_input: policy_feedback_topic_name }]} + aai_subscriber: + type: message_router + dmaap_info: + #topic_url: {concat: ["https://message-router:3905/events/", { get_input: aai_notification_topic_name }]} + topic_url: {concat: ["http://message-router:3904/events/", { get_input: aai_notification_topic_name }]} + resource_config: + limits: + cpu: { get_input: cpu_limit } + memory: { get_input: memory_limit } + requests: + cpu: { get_input: cpu_request } + memory: { get_input: memory_request } + docker_config: + healthcheck: + endpoint: /healthcheck + interval: 15s + timeout: 1s + type: { get_input: protocol } + image: { get_input: tag_version } + replicas: { get_input: replicas } + log_info: + log_directory: '/var/log/ONAP/dcaegen2/services/pmsh' + tls_info: + cert_directory: '/opt/app/pmsh/etc/certs' + use_tls: { get_input: enable_tls } + pmsh-policy: + type: clamp.nodes.policy + properties: + policy_model_id: + get_input: policy_model_id + policy_id: + get_input: policy_id diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.json b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.json new file mode 100644 index 000000000..5b64b5b6f --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.json @@ -0,0 +1,123 @@ +{ + "tosca_definitions_version": "tosca_simple_yaml_1_1_0", + "topology_template": { + "policies": [ + { + "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test": { + "type": "onap.policies.monitoring.dcae-pm-subscription-handler", + "type_version": "1.0.0", + "properties": { + "pmsh_policy": { + "measurementGroups": [ + { + "measurementGroup": { + "onap.datatypes.monitoring.measurementGroup": { + "measurementTypes": [ + { + "measurementType": { + "onap.datatypes.monitoring.measurementType": { + "measurementType": "countera" + } + } + }, + { + "measurementType": { + "onap.datatypes.monitoring.measurementType": { + "measurementType": "counterb" + } + } + } + ], + "managedObjectDNsBasic": [ + { + "managedObjectDNsBasic": { + "onap.datatypes.monitoring.managedObjectDNsBasic": { + "DN": "dna" + } + } + }, + { + "managedObjectDNsBasic": { + "onap.datatypes.monitoring.managedObjectDNsBasic": { + "DN": "dnb" + } + } + } + ] + } + } + }, + { + "measurementGroup": { + "onap.datatypes.monitoring.measurementGroup": { + "measurementTypes": [ + { + "measurementType": { + "onap.datatypes.monitoring.measurementType": { + "measurementType": "counterc" + } + } + }, + { + "measurementType": { + "onap.datatypes.monitoring.measurementType": { + "measurementType": "counterd" + } + } + } + ], + "managedObjectDNsBasic": [ + { + "managedObjectDNsBasic": { + "onap.datatypes.monitoring.managedObjectDNsBasic": { + "DN": "dnc" + } + } + }, + { + "managedObjectDNsBasic": { + "onap.datatypes.monitoring.managedObjectDNsBasic": { + "DN": "dnd" + } + } + } + ] + } + } + } + ], + "fileBasedGP": 15, + "fileLocation": "/pm/pm.xml", + "subscriptionName": "subscriptiona", + "administrativeState": "UNLOCKED", + "nfFilter": { + "onap.datatypes.monitoring.nfFilter": { + "modelVersionIDs": [ + "e80a6ae3-cafd-4d24-850d-e14c084a5ca9" + ], + "modelInvariantIDs": [ + "5845y423-g654-6fju-po78-8n53154532k6", + "7129e420-d396-4efb-af02-6b83499b12f8" + ], + "modelNames": [], + "nfNames": [ + "\"^pnf1.*\"" + ] + } + } + } + }, + "name": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test", + "version": "1.0.0", + "metadata": { + "policy-id": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test", + "policy-version": "1.0.0" + } + } + } + ] + }, + "name": "ToscaServiceTemplateSimple", + "version": "1.0.0", + "metadata": {} +} diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.yaml new file mode 100644 index 000000000..6021f36bc --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy.yaml @@ -0,0 +1,64 @@ +--- +tosca_definitions_version: tosca_simple_yaml_1_1_0 +name: ToscaServiceTemplateSimple +version: 1.0.0 +metadata: {} +topology_template: + policies: + - MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test: + type: onap.policies.monitoring.dcae-pm-subscription-handler + type_version: 1.0.0 + name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test + version: 1.0.0 + metadata: + policy-id: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test + policy-version: 1.0.0 + properties: + pmsh_policy: + fileBasedGP: 15 + fileLocation: "/pm/pm.xml" + subscriptionName: subscriptiona + administrativeState: UNLOCKED + nfFilter: + onap.datatypes.monitoring.nfFilter: + modelVersionIDs: + - e80a6ae3-cafd-4d24-850d-e14c084a5ca9 + modelInvariantIDs: + - 5845y423-g654-6fju-po78-8n53154532k6 + - 7129e420-d396-4efb-af02-6b83499b12f8 + modelNames: [] + nfNames: + - '"^pnf1.*"' + measurementGroups: + - measurementGroup: + onap.datatypes.monitoring.measurementGroup: + measurementTypes: + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: countera + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: counterb + managedObjectDNsBasic: + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dna + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dnb + - measurementGroup: + onap.datatypes.monitoring.measurementGroup: + measurementTypes: + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: counterc + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: counterd + managedObjectDNsBasic: + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dnc + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dnd diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy_type.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy_type.yaml new file mode 100644 index 000000000..e282bf5ba --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_monitoring_policy_type.yaml @@ -0,0 +1,264 @@ +tosca_definitions_version: tosca_simple_yaml_1_1_0 +name: ToscaServiceTemplateSimple +version: 1.0.0 +metadata: {} +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.dcae-pm-subscription-handler: + name: onap.policies.monitoring.dcae-pm-subscription-handler + version: 1.0.0 + derived_from: onap.policies.Monitoring + metadata: {} + properties: + pmsh_policy: + name: pmsh_policy + type: onap.datatypes.monitoring.subscription + typeVersion: 0.0.0 + description: PMSH Policy JSON + required: false + constraints: [] + metadata: {} +data_types: + onap.datatypes.monitoring.managedObjectDNsBasic: + name: onap.datatypes.monitoring.managedObjectDNsBasic + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + DN: + name: DN + type: string + typeVersion: 0.0.0 + description: Managed object distinguished name + required: true + constraints: [] + metadata: {} + onap.datatypes.monitoring.managedObjectDNsBasics: + name: onap.datatypes.monitoring.managedObjectDNsBasics + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + managedObjectDNsBasic: + name: managedObjectDNsBasic + type: map + typeVersion: 0.0.0 + description: Managed object distinguished name object + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.managedObjectDNsBasic + typeVersion: 0.0.0 + constraints: [] + metadata: {} + onap.datatypes.monitoring.measurementGroup: + name: onap.datatypes.monitoring.measurementGroup + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + measurementTypes: + name: measurementTypes + type: list + typeVersion: 0.0.0 + description: List of measurement types + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementTypes + typeVersion: 0.0.0 + constraints: [] + metadata: {} + managedObjectDNsBasic: + name: managedObjectDNsBasic + type: list + typeVersion: 0.0.0 + description: List of managed object distinguished names + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.managedObjectDNsBasics + typeVersion: 0.0.0 + constraints: [] + metadata: {} + onap.datatypes.monitoring.measurementGroups: + name: onap.datatypes.monitoring.measurementGroups + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + measurementGroup: + name: measurementGroup + type: map + typeVersion: 0.0.0 + description: Measurement Group + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementGroup + typeVersion: 0.0.0 + constraints: [] + metadata: {} + onap.datatypes.monitoring.measurementType: + name: onap.datatypes.monitoring.measurementType + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + measurementType: + name: measurementType + type: string + typeVersion: 0.0.0 + description: Measurement type + required: true + constraints: [] + metadata: {} + onap.datatypes.monitoring.measurementTypes: + name: onap.datatypes.monitoring.measurementTypes + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + measurementType: + name: measurementType + type: map + typeVersion: 0.0.0 + description: Measurement type object + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementType + typeVersion: 0.0.0 + constraints: [] + metadata: {} + onap.datatypes.monitoring.nfFilter: + name: onap.datatypes.monitoring.nfFilter + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + modelNames: + name: modelNames + type: list + typeVersion: 0.0.0 + description: List of model names + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + modelInvariantIDs: + name: modelInvariantIDs + type: list + typeVersion: 0.0.0 + description: List of model invariant IDs + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + modelVersionIDs: + name: modelVersionIDs + type: list + typeVersion: 0.0.0 + description: List of model version IDs + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + nfNames: + name: nfNames + type: list + typeVersion: 0.0.0 + description: List of network functions + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + onap.datatypes.monitoring.subscription: + name: onap.datatypes.monitoring.subscription + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + constraints: [] + properties: + measurementGroups: + name: measurementGroups + type: list + typeVersion: 0.0.0 + description: Measurement Groups + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementGroups + typeVersion: 0.0.0 + constraints: [] + metadata: {} + fileBasedGP: + name: fileBasedGP + type: integer + typeVersion: 0.0.0 + description: File based granularity period + required: true + constraints: [] + metadata: {} + fileLocation: + name: fileLocation + type: string + typeVersion: 0.0.0 + description: ROP file location + required: true + constraints: [] + metadata: {} + subscriptionName: + name: subscriptionName + type: string + typeVersion: 0.0.0 + description: Name of the subscription + required: true + constraints: [] + metadata: {} + administrativeState: + name: administrativeState + type: string + typeVersion: 0.0.0 + description: State of the subscription + required: true + constraints: + - valid_values: + - LOCKED + - UNLOCKED + metadata: {} + nfFilter: + name: nfFilter + type: map + typeVersion: 0.0.0 + description: Network function filter + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.nfFilter + typeVersion: 0.0.0 + constraints: [] + metadata: {} diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_operational_policy.json b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_operational_policy.json new file mode 100644 index 000000000..6bd681d71 --- /dev/null +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_operational_policy.json @@ -0,0 +1,2808 @@ +{ + "tosca_definitions_version":"tosca_simple_yaml_1_1_0", + "topology_template":{ + "policies":[ + { + "operational.apex.pmcontrol":{ + "type":"onap.policies.controlloop.operational.Apex", + "type_version":"1.0.0", + "version":"1.0.0", + "metadata":{ + "policy-id":"operational.apex.pmcontrol", + "policy-version":1 + }, + "properties":{ + "engineServiceParameters":{ + "name":"MyApexEngine", + "version":"0.0.1", + "id":45, + "instanceCount":2, + "deploymentPort":12561, + "policy_type_impl":{ + "apexPolicyModel":{ + "key":{ + "name":"PMControlPolicy", + "version":"0.0.1" + }, + "keyInformation":{ + "key":{ + "name":"PMControlPolicy_KeyInfo", + "version":"0.0.1" + }, + "keyInfoMap":{ + "entry":[ + { + "key":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "UUID":"6e5fa19b-14df-37e3-a4ae-8c537e861a82", + "description":"Generated description for concept referred to by key \"CDSActionIdentifiersType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSCreateResponseEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponseEvent", + "version":"0.0.1" + }, + "UUID":"14b29e38-ac75-3273-aa4e-8583c0aa7dad", + "description":"Generated description for concept referred to by key \"CDSCreateResponseEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSCreateResponsePayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponsePayloadType", + "version":"0.0.1" + }, + "UUID":"04573f8f-e772-30a5-b1d9-d7318d4a1e13", + "description":"Generated description for concept referred to by key \"CDSCreateResponsePayloadType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSCreateResponsePolicy", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponsePolicy", + "version":"0.0.1" + }, + "UUID":"e126c965-fc09-3bfe-8f55-70f380a4a49c", + "description":"Generated description for concept referred to by key \"CDSCreateResponsePolicy:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSCreateResponseTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponseTask", + "version":"0.0.1" + }, + "UUID":"6165ee82-afd2-3aab-a517-f00b3f2461d2", + "description":"Generated description for concept referred to by key \"CDSCreateResponseTask:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "UUID":"8350ac5e-c157-38b9-9614-a0f93a830e60", + "description":"Generated description for concept referred to by key \"CDSCreateSubscriptionPayloadType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSCreateSubscriptionRequestEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateSubscriptionRequestEvent", + "version":"0.0.1" + }, + "UUID":"cfa325ba-226b-3a31-9183-ec43e2b6e9a2", + "description":"Generated description for concept referred to by key \"CDSCreateSubscriptionRequestEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSDeleteResponseEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponseEvent", + "version":"0.0.1" + }, + "UUID":"8be9c0fa-7437-3841-aff2-b3cec6ae3bd8", + "description":"Generated description for concept referred to by key \"CDSDeleteResponseEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSDeleteResponsePayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponsePayloadType", + "version":"0.0.1" + }, + "UUID":"3fbfe0c9-152e-34d3-a504-09cd13c058d0", + "description":"Generated description for concept referred to by key \"CDSDeleteResponsePayloadType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSDeleteResponsePolicy", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponsePolicy", + "version":"0.0.1" + }, + "UUID":"a780251c-edd5-3132-b865-04313246b43c", + "description":"Generated description for concept referred to by key \"CDSDeleteResponsePolicy:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSDeleteResponseTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponseTask", + "version":"0.0.1" + }, + "UUID":"afce4555-3aa3-3521-a7d8-ee8cdf0d3efc", + "description":"Generated description for concept referred to by key \"CDSDeleteResponseTask:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "UUID":"12658406-9147-3c9d-a38c-5ad5e30b092b", + "description":"Generated description for concept referred to by key \"CDSDeleteSubscriptionPayloadType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSDeleteSubscriptionRequestEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteSubscriptionRequestEvent", + "version":"0.0.1" + }, + "UUID":"24380c95-9289-36e6-8cbf-0edefa15ccd9", + "description":"Generated description for concept referred to by key \"CDSDeleteSubscriptionRequestEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "UUID":"35590ac0-062c-39f1-8786-b4ff716e30b1", + "description":"Generated description for concept referred to by key \"CDSRequestCommonHeaderType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "UUID":"dd7e1805-885a-350b-aaf9-ed541321ae3c", + "description":"Generated description for concept referred to by key \"CDSResponseCommonHeaderType:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSResponseStatusEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSResponseStatusEvent", + "version":"0.0.1" + }, + "UUID":"7986e21b-32f7-302e-9554-31f21b673493", + "description":"Generated description for concept referred to by key \"CDSResponseStatusEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "UUID":"92b8a2cf-344e-3ce1-8cc0-2b7d3cb695fa", + "description":"Generated description for concept referred to by key \"CDSResponseStatusType:0.0.1\"" + } + }, + { + "key":{ + "name":"CreateSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CreateSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "UUID":"92162397-1a8e-3a3f-a469-d2af7700af4a", + "description":"Generated description for concept referred to by key \"CreateSubscriptionPayloadEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"CreateSubscriptionPayloadTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CreateSubscriptionPayloadTask", + "version":"0.0.1" + }, + "UUID":"bc0c69f0-52ed-38ea-b468-ae4a6fd1730d", + "description":"Generated description for concept referred to by key \"CreateSubscriptionPayloadTask:0.0.1\"" + } + }, + { + "key":{ + "name":"CreateSubscriptionRequestTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CreateSubscriptionRequestTask", + "version":"0.0.1" + }, + "UUID":"89cb75e9-f06c-30d3-b4ff-698d45f63869", + "description":"Generated description for concept referred to by key \"CreateSubscriptionRequestTask:0.0.1\"" + } + }, + { + "key":{ + "name":"DeleteSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"DeleteSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "UUID":"994fa441-04ab-33bb-832d-1cd12ab5d074", + "description":"Generated description for concept referred to by key \"DeleteSubscriptionPayloadEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"DeleteSubscriptionPayloadTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"DeleteSubscriptionPayloadTask", + "version":"0.0.1" + }, + "UUID":"0f519117-5fea-3e4b-941f-8f778100465f", + "description":"Generated description for concept referred to by key \"DeleteSubscriptionPayloadTask:0.0.1\"" + } + }, + { + "key":{ + "name":"DeleteSubscriptionRequestTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"DeleteSubscriptionRequestTask", + "version":"0.0.1" + }, + "UUID":"acb772fe-d442-39e3-98f9-b1080caf4150", + "description":"Generated description for concept referred to by key \"DeleteSubscriptionRequestTask:0.0.1\"" + } + }, + { + "key":{ + "name":"MRResponseEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"MRResponseEvent", + "version":"0.0.1" + }, + "UUID":"13c747a3-6bae-3bcf-9c80-b152e01dc194", + "description":"Generated description for concept referred to by key \"MRResponseEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy", + "version":"0.0.1" + }, + "UUID":"acf1e55c-7bc5-3bd5-975a-0ca54afcd8a4", + "description":"Generated description for concept referred to by key \"PMControlPolicy:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy_Albums", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy_Albums", + "version":"0.0.1" + }, + "UUID":"b38ad204-c2c8-32f4-9b5a-dda0aeb0145b", + "description":"Generated description for concept referred to by key \"PMControlPolicy_Albums:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy_Events", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy_Events", + "version":"0.0.1" + }, + "UUID":"be3871a0-c42a-3113-a066-82d192840eca", + "description":"Generated description for concept referred to by key \"PMControlPolicy_Events:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy_KeyInfo", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy_KeyInfo", + "version":"0.0.1" + }, + "UUID":"ced37634-28a4-3178-b7f6-2980794927b0", + "description":"Generated description for concept referred to by key \"PMControlPolicy_KeyInfo:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy_Policies", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy_Policies", + "version":"0.0.1" + }, + "UUID":"be3d180d-ef9c-3a75-8e9c-84271a038bed", + "description":"Generated description for concept referred to by key \"PMControlPolicy_Policies:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy_Schemas", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy_Schemas", + "version":"0.0.1" + }, + "UUID":"e61973f1-189c-39e5-82f6-0d3afe298a20", + "description":"Generated description for concept referred to by key \"PMControlPolicy_Schemas:0.0.1\"" + } + }, + { + "key":{ + "name":"PMControlPolicy_Tasks", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMControlPolicy_Tasks", + "version":"0.0.1" + }, + "UUID":"5658adb3-2962-30a3-a241-fae75bb8eb4a", + "description":"Generated description for concept referred to by key \"PMControlPolicy_Tasks:0.0.1\"" + } + }, + { + "key":{ + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + }, + "UUID":"c2bd6f0d-6854-317a-9be2-97c08338428c", + "description":"Generated description for concept referred to by key \"PMSubscriptionAlbum:0.0.1\"" + } + }, + { + "key":{ + "name":"PMSubscriptionOutputEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMSubscriptionOutputEvent", + "version":"0.0.1" + }, + "UUID":"992b7819-9f69-3aa0-bb0f-6e45ea15ce05", + "description":"Generated description for concept referred to by key \"PMSubscriptionOutputEvent:0.0.1\"" + } + }, + { + "key":{ + "name":"PMSubscriptionType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMSubscriptionType", + "version":"0.0.1" + }, + "UUID":"73c1c397-4fc3-357f-93b6-a8ad707fbaae", + "description":"Generated description for concept referred to by key \"PMSubscriptionType:0.0.1\"" + } + }, + { + "key":{ + "name":"ReceiveEventPolicy", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"ReceiveEventPolicy", + "version":"0.0.1" + }, + "UUID":"568b7345-9de1-36d3-b6a3-9b857e6809a1", + "description":"Generated description for concept referred to by key \"ReceiveEventPolicy:0.0.1\"" + } + }, + { + "key":{ + "name":"ReceiveSubscriptionTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"ReceiveSubscriptionTask", + "version":"0.0.1" + }, + "UUID":"f596afc8-100c-35eb-92c8-352355ea457d", + "description":"Generated description for concept referred to by key \"ReceiveSubscriptionTask:0.0.1\"" + } + }, + { + "key":{ + "name":"SimpleIntType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SimpleIntType", + "version":"0.0.1" + }, + "UUID":"153791fd-ae0a-36a7-88a5-309a7936415d", + "description":"Generated description for concept referred to by key \"SimpleIntType:0.0.1\"" + } + }, + { + "key":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "UUID":"8a4957cf-9493-3a76-8c22-a208e23259af", + "description":"Generated description for concept referred to by key \"SimpleStringType:0.0.1\"" + } + }, + { + "key":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "UUID":"597643b1-9db1-31ce-85d0-e1c63c43b30b", + "description":"Generated description for concept referred to by key \"SubscriptionStatusType:0.0.1\"" + } + }, + { + "key":{ + "name":"SubscriptionType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SubscriptionType", + "version":"0.0.1" + }, + "UUID":"184547bb-7d64-3cb2-a273-d7185102c5ce", + "description":"Generated description for concept referred to by key \"SubscriptionType:0.0.1\"" + } + }, + { + "key":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "UUID":"6a8cc68e-dfc8-3403-9c6d-071c886b319c", + "description":"Generated description for concept referred to by key \"UUIDType:0.0.1\"" + } + }, + { + "key":{ + "name":"pmsh-operational-policy", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"pmsh-operational-policy", + "version":"0.0.1" + }, + "UUID":"fdf2c9ff-6422-3ea6-b6b6-49b12116265d", + "description":"Generated description for concept referred to by key \"pmsh-operational-policy:0.0.1\"" + } + } + ] + } + }, + "policies":{ + "key":{ + "name":"PMControlPolicy_Policies", + "version":"0.0.1" + }, + "policyMap":{ + "entry":[ + { + "key":{ + "name":"CDSCreateResponsePolicy", + "version":"0.0.1" + }, + "value":{ + "policyKey":{ + "name":"CDSCreateResponsePolicy", + "version":"0.0.1" + }, + "template":"Freestyle", + "state":{ + "entry":[ + { + "key":"CDSCreateResponseState", + "value":{ + "stateKey":{ + "parentKeyName":"CDSCreateResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"CDSCreateResponseState" + }, + "trigger":{ + "name":"CDSCreateResponseEvent", + "version":"0.0.1" + }, + "stateOutputs":{ + "entry":[ + { + "key":"ResponseOutput", + "value":{ + "key":{ + "parentKeyName":"CDSCreateResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CDSCreateResponseState", + "localName":"ResponseOutput" + }, + "outgoingEvent":{ + "name":"CDSResponseStatusEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"NULL", + "parentKeyVersion":"0.0.0", + "parentLocalName":"NULL", + "localName":"NULL" + } + } + } + ] + }, + "contextAlbumReference":[ + + ], + "taskSelectionLogic":{ + "key":"NULL", + "logicFlavour":"UNDEFINED", + "logic":"" + }, + "stateFinalizerLogicMap":{ + "entry":[ + + ] + }, + "defaultTask":{ + "name":"CDSCreateResponseTask", + "version":"0.0.1" + }, + "taskReferences":{ + "entry":[ + { + "key":{ + "name":"CDSCreateResponseTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"CDSCreateResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CDSCreateResponseState", + "localName":"CDSCreateResponsePolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"CDSCreateResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CDSCreateResponseState", + "localName":"ResponseOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState":"CDSCreateResponseState" + } + }, + { + "key":{ + "name":"CDSDeleteResponsePolicy", + "version":"0.0.1" + }, + "value":{ + "policyKey":{ + "name":"CDSDeleteResponsePolicy", + "version":"0.0.1" + }, + "template":"Freestyle", + "state":{ + "entry":[ + { + "key":"CDSDeleteResponseState", + "value":{ + "stateKey":{ + "parentKeyName":"CDSDeleteResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"CDSDeleteResponseState" + }, + "trigger":{ + "name":"CDSDeleteResponseEvent", + "version":"0.0.1" + }, + "stateOutputs":{ + "entry":[ + { + "key":"ResponseOutput", + "value":{ + "key":{ + "parentKeyName":"CDSDeleteResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CDSDeleteResponseState", + "localName":"ResponseOutput" + }, + "outgoingEvent":{ + "name":"CDSResponseStatusEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"NULL", + "parentKeyVersion":"0.0.0", + "parentLocalName":"NULL", + "localName":"NULL" + } + } + } + ] + }, + "contextAlbumReference":[ + + ], + "taskSelectionLogic":{ + "key":"NULL", + "logicFlavour":"UNDEFINED", + "logic":"" + }, + "stateFinalizerLogicMap":{ + "entry":[ + + ] + }, + "defaultTask":{ + "name":"CDSDeleteResponseTask", + "version":"0.0.1" + }, + "taskReferences":{ + "entry":[ + { + "key":{ + "name":"CDSDeleteResponseTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"CDSDeleteResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CDSDeleteResponseState", + "localName":"CDSDeleteResponsePolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"CDSDeleteResponsePolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CDSDeleteResponseState", + "localName":"ResponseOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState":"CDSDeleteResponseState" + } + }, + { + "key":{ + "name":"ReceiveEventPolicy", + "version":"0.0.1" + }, + "value":{ + "policyKey":{ + "name":"ReceiveEventPolicy", + "version":"0.0.1" + }, + "template":"Freestyle", + "state":{ + "entry":[ + { + "key":"CreateOrDeleteState", + "value":{ + "stateKey":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"CreateOrDeleteState" + }, + "trigger":{ + "name":"PMSubscriptionOutputEvent", + "version":"0.0.1" + }, + "stateOutputs":{ + "entry":[ + { + "key":"CreateSubscriptionPayload", + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateOrDeleteState", + "localName":"CreateSubscriptionPayload" + }, + "outgoingEvent":{ + "name":"CreateSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"CreateSubscription" + } + } + }, + { + "key":"DeleteSubscriptionPayload", + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateOrDeleteState", + "localName":"DeleteSubscriptionPayload" + }, + "outgoingEvent":{ + "name":"DeleteSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"DeleteSubscription" + } + } + } + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskSelectionLogic":{ + "key":"TaskSelectionLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\nvar changeType = pmSubscriptionInfo.get(\"changeType\").toString()\n\nexecutor.logger.info(\"Change Type is \" + changeType)\n\nif (\"CREATE\".equals(changeType)) {\n executor.logger.info(\"Choosing to create a subscription\")\n executor.subject.getTaskKey(\"CreateSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n}\nelse if (\"DELETE\".equals(changeType)) {\n executor.logger.info(\"Choosing to delete a subscription\")\n executor.subject.getTaskKey(\"DeleteSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n}\n\n//var returnValue = executor.isTrue;\ntrue;" + }, + "stateFinalizerLogicMap":{ + "entry":[ + + ] + }, + "defaultTask":{ + "name":"CreateSubscriptionPayloadTask", + "version":"0.0.1" + }, + "taskReferences":{ + "entry":[ + { + "key":{ + "name":"CreateSubscriptionPayloadTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateOrDeleteState", + "localName":"ReceiveEventPolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateOrDeleteState", + "localName":"CreateSubscriptionPayload" + } + } + }, + { + "key":{ + "name":"DeleteSubscriptionPayloadTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateOrDeleteState", + "localName":"ReceiveEventPolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateOrDeleteState", + "localName":"DeleteSubscriptionPayload" + } + } + } + ] + } + } + }, + { + "key":"CreateSubscription", + "value":{ + "stateKey":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"CreateSubscription" + }, + "trigger":{ + "name":"CreateSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "stateOutputs":{ + "entry":[ + { + "key":"IssueCreateSubscriptionRequestOutput", + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateSubscription", + "localName":"IssueCreateSubscriptionRequestOutput" + }, + "outgoingEvent":{ + "name":"CDSCreateSubscriptionRequestEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"NULL", + "parentKeyVersion":"0.0.0", + "parentLocalName":"NULL", + "localName":"NULL" + } + } + } + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskSelectionLogic":{ + "key":"NULL", + "logicFlavour":"UNDEFINED", + "logic":"" + }, + "stateFinalizerLogicMap":{ + "entry":[ + + ] + }, + "defaultTask":{ + "name":"CreateSubscriptionRequestTask", + "version":"0.0.1" + }, + "taskReferences":{ + "entry":[ + { + "key":{ + "name":"CreateSubscriptionRequestTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateSubscription", + "localName":"ReceiveEventPolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"CreateSubscription", + "localName":"IssueCreateSubscriptionRequestOutput" + } + } + } + ] + } + } + }, + { + "key":"DeleteSubscription", + "value":{ + "stateKey":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"DeleteSubscription" + }, + "trigger":{ + "name":"DeleteSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "stateOutputs":{ + "entry":[ + { + "key":"IssueDeleteSubscriptionRequestOutput", + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"DeleteSubscription", + "localName":"IssueDeleteSubscriptionRequestOutput" + }, + "outgoingEvent":{ + "name":"CDSDeleteSubscriptionRequestEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"NULL", + "parentKeyVersion":"0.0.0", + "parentLocalName":"NULL", + "localName":"NULL" + } + } + } + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskSelectionLogic":{ + "key":"NULL", + "logicFlavour":"UNDEFINED", + "logic":"" + }, + "stateFinalizerLogicMap":{ + "entry":[ + + ] + }, + "defaultTask":{ + "name":"DeleteSubscriptionRequestTask", + "version":"0.0.1" + }, + "taskReferences":{ + "entry":[ + { + "key":{ + "name":"DeleteSubscriptionRequestTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"DeleteSubscription", + "localName":"ReceiveEventPolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"DeleteSubscription", + "localName":"IssueDeleteSubscriptionRequestOutput" + } + } + } + ] + } + } + }, + { + "key":"ReceiveSubscriptionState", + "value":{ + "stateKey":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"ReceiveSubscriptionState" + }, + "trigger":{ + "name":"pmsh-operational-policy", + "version":"0.0.1" + }, + "stateOutputs":{ + "entry":[ + { + "key":"ReceivePMSubscriptionOutput", + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"ReceiveSubscriptionState", + "localName":"ReceivePMSubscriptionOutput" + }, + "outgoingEvent":{ + "name":"PMSubscriptionOutputEvent", + "version":"0.0.1" + }, + "nextState":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"NULL", + "localName":"CreateOrDeleteState" + } + } + } + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskSelectionLogic":{ + "key":"NULL", + "logicFlavour":"UNDEFINED", + "logic":"" + }, + "stateFinalizerLogicMap":{ + "entry":[ + + ] + }, + "defaultTask":{ + "name":"ReceiveSubscriptionTask", + "version":"0.0.1" + }, + "taskReferences":{ + "entry":[ + { + "key":{ + "name":"ReceiveSubscriptionTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"ReceiveSubscriptionState", + "localName":"ReceiveEventPolicy" + }, + "outputType":"DIRECT", + "output":{ + "parentKeyName":"ReceiveEventPolicy", + "parentKeyVersion":"0.0.1", + "parentLocalName":"ReceiveSubscriptionState", + "localName":"ReceivePMSubscriptionOutput" + } + } + } + ] + } + } + } + ] + }, + "firstState":"ReceiveSubscriptionState" + } + } + ] + } + }, + "tasks":{ + "key":{ + "name":"PMControlPolicy_Tasks", + "version":"0.0.1" + }, + "taskMap":{ + "entry":[ + { + "key":{ + "name":"CDSCreateResponseTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponseTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateResponsePayloadType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar commonHeader = executor.inFields.get(\"commonHeader\")\nvar response = executor.inFields.get(\"payload\")\nvar albumID = commonHeader.get(\"requestId\")\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\nvar responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\nresponseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\nresponseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\nresponseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\nvar status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\nexecutor.logger.info(\"RESPONSE STATUS = \" + status)\n\nif(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n} else {\n responseStatus.put(\"message\", \"failed\")\n}\n\nexecutor.outFields.put(\"status\", responseStatus)\n\n//var returnValue = executor.isTrue;\ntrue;" + } + } + }, + { + "key":{ + "name":"CDSDeleteResponseTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponseTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteResponsePayloadType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar commonHeader = executor.inFields.get(\"commonHeader\")\nvar response = executor.inFields.get(\"payload\")\nvar albumID = commonHeader.get(\"requestId\")\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\nvar responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\nresponseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\nresponseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\nresponseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\nvar status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\nexecutor.logger.info(\"RESPONSE STATUS = \" + status)\n\nif(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n} else {\n responseStatus.put(\"message\", \"failed\")\n}\n\nexecutor.outFields.put(\"status\", responseStatus)\n\n//var returnValue = executor.isTrue;\ntrue;" + } + } + }, + { + "key":{ + "name":"CreateSubscriptionPayloadTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CreateSubscriptionPayloadTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\nvar changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\nvar payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\npayloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\npayloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\npayloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\npayloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\npayloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\npayloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\nvar payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\npayloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\nvar payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\npayload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\nexecutor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\nexecutor.outFields.put(\"payload\", payload);\n\n//var returnValue = executor.isTrue;\ntrue;" + } + } + }, + { + "key":{ + "name":"CreateSubscriptionRequestTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CreateSubscriptionRequestTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\nvar changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\nvar blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\nvar blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\nvar payload = executor.inFields.get(\"payload\")\nvar actionName = changeType + \"-subscription\"\n\nvar commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\ncommonHeader.put(\"originatorId\", \"sdnc\");\ncommonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\ncommonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\nvar actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\nactionIdentifiers.put(\"actionName\", actionName);\nactionIdentifiers.put(\"blueprintName\", blueprintName);\nactionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\nactionIdentifiers.put(\"mode\", \"sync\");\n\nexecutor.outFields.put(\"commonHeader\", commonHeader);\nexecutor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\nexecutor.outFields.put(\"payload\", payload);\n\n//var returnValue = executor.isTrue;\ntrue;" + } + } + }, + { + "key":{ + "name":"DeleteSubscriptionPayloadTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"DeleteSubscriptionPayloadTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\nvar changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\nvar payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\npayloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\npayloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\npayloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\npayloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\npayloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\npayloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\nvar payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\npayloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\nvar payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\npayload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\nexecutor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\nexecutor.outFields.put(\"payload\", payload);\n\n//var returnValue = executor.isTrue;\ntrue;" + } + } + }, + { + "key":{ + "name":"DeleteSubscriptionRequestTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"DeleteSubscriptionRequestTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\nexecutor.logger.info(executor.subject.id);\n\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\nvar changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\nvar blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\nvar blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\nvar payload = executor.inFields.get(\"payload\")\nvar actionName = changeType + \"-subscription\"\n\nvar commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\ncommonHeader.put(\"originatorId\", \"sdnc\");\ncommonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\ncommonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\nvar actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\nactionIdentifiers.put(\"actionName\", actionName);\nactionIdentifiers.put(\"blueprintName\", blueprintName);\nactionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\nactionIdentifiers.put(\"mode\", \"sync\");\n\nexecutor.outFields.put(\"commonHeader\", commonHeader);\nexecutor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\nexecutor.outFields.put(\"payload\", payload);\n\n//var returnValue = executor.isTrue;\ntrue;" + } + } + }, + { + "key":{ + "name":"ReceiveSubscriptionTask", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"ReceiveSubscriptionTask", + "version":"0.0.1" + }, + "inputFields":{ + "entry":[ + { + "key":"blueprintName", + "value":{ + "key":"blueprintName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"blueprintVersion", + "value":{ + "key":"blueprintVersion", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"changeType", + "value":{ + "key":"changeType", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"closedLoopControlName", + "value":{ + "key":"closedLoopControlName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"nfName", + "value":{ + "key":"nfName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"policyName", + "value":{ + "key":"policyName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"subscription", + "value":{ + "key":"subscription", + "fieldSchemaKey":{ + "name":"SubscriptionType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "outputFields":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + }, + "taskParameters":{ + "entry":[ + + ] + }, + "contextAlbumReference":[ + { + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + } + ], + "taskLogic":{ + "key":"TaskLogic", + "logicFlavour":"JAVASCRIPT", + "logic":"/*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\nvar uuidType = java.util.UUID;\n\nexecutor.logger.info(executor.subject.id);\n\n//albumID will be used to fetch info from our album later\nvar albumID = uuidType.randomUUID();\nvar pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").getSchemaHelper().createNewInstance();\nvar returnValue = true;\n\nif(executor.inFields.get(\"policyName\") != null) {\n executor.logger.info(\"nfName in receive sub event \" + executor.inFields.get(\"nfName\"));\n\n var changeType = executor.inFields.get(\"changeType\")\n var nfName = executor.inFields.get(\"nfName\")\n var policyName = executor.inFields.get(\"policyName\")\n var closedLoopControlName = executor.inFields.get(\"closedLoopControlName\")\n var subscription = executor.inFields.get(\"subscription\")\n var blueprintName = executor.inFields.get(\"blueprintName\")\n var blueprintVersion = executor.inFields.get(\"blueprintVersion\")\n\n pmSubscriptionInfo.put(\"nfName\", executor.inFields.get(\"nfName\"));\n pmSubscriptionInfo.put(\"changeType\", executor.inFields.get(\"changeType\"))\n pmSubscriptionInfo.put(\"policyName\", executor.inFields.get(\"policyName\"))\n pmSubscriptionInfo.put(\"closedLoopControlName\", executor.inFields.get(\"closedLoopControlName\"))\n pmSubscriptionInfo.put(\"subscription\", subscription)\n pmSubscriptionInfo.put(\"blueprintName\", blueprintName)\n pmSubscriptionInfo.put(\"blueprintVersion\", blueprintVersion)\n\n\n executor.getContextAlbum(\"PMSubscriptionAlbum\").put(albumID.toString(), pmSubscriptionInfo);\n\n executor.outFields.put(\"albumID\", albumID)\n} else {\n executor.message = \"Received invalid event\"\n returnValue = false;\n}\n\nreturnValue;" + } + } + } + ] + } + }, + "events":{ + "key":{ + "name":"PMControlPolicy_Events", + "version":"0.0.1" + }, + "eventMap":{ + "entry":[ + { + "key":{ + "name":"CDSCreateResponseEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponseEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"CDS", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateResponsePayloadType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"CDSCreateSubscriptionRequestEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateSubscriptionRequestEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"CDSDeleteResponseEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponseEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"CDS", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteResponsePayloadType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"CDSDeleteSubscriptionRequestEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteSubscriptionRequestEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"actionIdentifiers", + "value":{ + "key":"actionIdentifiers", + "fieldSchemaKey":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"commonHeader", + "value":{ + "key":"commonHeader", + "fieldSchemaKey":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"CDSResponseStatusEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSResponseStatusEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"DCAE", + "parameter":{ + "entry":[ + { + "key":"status", + "value":{ + "key":"status", + "fieldSchemaKey":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"CreateSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CreateSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"DeleteSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"DeleteSubscriptionPayloadEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"payload", + "value":{ + "key":"payload", + "fieldSchemaKey":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"MRResponseEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"MRResponseEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"DCAE", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"count", + "value":{ + "key":"count", + "fieldSchemaKey":{ + "name":"SimpleIntType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"serverTimeMs", + "value":{ + "key":"serverTimeMs", + "fieldSchemaKey":{ + "name":"SimpleIntType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"PMSubscriptionOutputEvent", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMSubscriptionOutputEvent", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"APEX", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"albumID", + "value":{ + "key":"albumID", + "fieldSchemaKey":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + }, + { + "key":{ + "name":"pmsh-operational-policy", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"pmsh-operational-policy", + "version":"0.0.1" + }, + "nameSpace":"org.onap.policy.apex.onap.pmcontrol", + "source":"DCAE", + "target":"APEX", + "parameter":{ + "entry":[ + { + "key":"blueprintName", + "value":{ + "key":"blueprintName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"blueprintVersion", + "value":{ + "key":"blueprintVersion", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"changeType", + "value":{ + "key":"changeType", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"closedLoopControlName", + "value":{ + "key":"closedLoopControlName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"nfName", + "value":{ + "key":"nfName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"policyName", + "value":{ + "key":"policyName", + "fieldSchemaKey":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "optional":false + } + }, + { + "key":"subscription", + "value":{ + "key":"subscription", + "fieldSchemaKey":{ + "name":"SubscriptionType", + "version":"0.0.1" + }, + "optional":false + } + } + ] + } + } + } + ] + } + }, + "albums":{ + "key":{ + "name":"PMControlPolicy_Albums", + "version":"0.0.1" + }, + "albums":{ + "entry":[ + { + "key":{ + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMSubscriptionAlbum", + "version":"0.0.1" + }, + "scope":"policy", + "isWritable":true, + "itemSchema":{ + "name":"PMSubscriptionType", + "version":"0.0.1" + } + } + } + ] + } + }, + "schemas":{ + "key":{ + "name":"PMControlPolicy_Schemas", + "version":"0.0.1" + }, + "schemas":{ + "entry":[ + { + "key":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSActionIdentifiersType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"ActionIdentifiers_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"actionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"mode\",\n \"type\": \"string\"\n }\n ]\n}" + } + }, + { + "key":{ + "name":"CDSCreateResponsePayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateResponsePayloadType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"name\": \"CreateResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n}" + } + }, + { + "key":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSCreateSubscriptionPayloadType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n}" + } + }, + { + "key":{ + "name":"CDSDeleteResponsePayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteResponsePayloadType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"name\": \"DeleteResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"com.acme.avro\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n}" + } + }, + { + "key":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSDeleteSubscriptionPayloadType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n}" + } + }, + { + "key":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSRequestCommonHeaderType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"RequestCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n }\n ]\n}" + } + }, + { + "key":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSResponseCommonHeaderType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"ResponseCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"flags\",\n \"type\": [\"null\", \"string\"]\n }\n ]\n}" + } + }, + { + "key":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"CDSResponseStatusType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"ResponseStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"code\",\n \"type\": \"int\"\n },\n {\n \"name\": \"eventType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n}" + } + }, + { + "key":{ + "name":"PMSubscriptionType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"PMSubscriptionType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n\t\"name\": \"PMSubscription\",\n\t\"type\": \"record\",\n\t\"namespace\": \"org.onap.policy.apex.onap.pmcontrol\",\n\t\"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n\t {\n\t\t\t\"name\": \"changeType\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"closedLoopControlName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"policyName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t \"name\": \"blueprintName\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t \"name\": \"blueprintVersion\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"subscription\",\n\t\t\t\"type\": {\n\t\t\t\t\"name\": \"subscription\",\n\t\t\t\t\"type\": \"record\",\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\"name\": \"subscriptionName\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"administrativeState\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\t\t\t\"type\": \"int\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"fileLocation\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\"name\": \"Measurement_Groups_Type\",\n\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\": \"measurementGroup\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"name\": \"Measurement_Group_Type\",\n\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementType\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"managedObjectDNsBasic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"DN\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t]\n}" + } + }, + { + "key":{ + "name":"SimpleIntType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SimpleIntType", + "version":"0.0.1" + }, + "schemaFlavour":"Java", + "schemaDefinition":"java.lang.Integer" + } + }, + { + "key":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SimpleStringType", + "version":"0.0.1" + }, + "schemaFlavour":"Java", + "schemaDefinition":"java.lang.String" + } + }, + { + "key":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SubscriptionStatusType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n \"type\": \"record\",\n \"name\": \"ActivateSubscriptionStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"changeType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n}" + } + }, + { + "key":{ + "name":"SubscriptionType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"SubscriptionType", + "version":"0.0.1" + }, + "schemaFlavour":"Avro", + "schemaDefinition":"{\n\t\"name\": \"subscription\",\n\t\"type\": \"record\",\n\t\"fields\": [{\n\t\t\t\"name\": \"subscriptionName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"administrativeState\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\"type\": \"int\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileLocation\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\"type\": {\n\t\t\t\t\"type\": \"array\",\n\t\t\t\t\"items\": {\n\t\t\t\t\t\"name\": \"Measurement_Groups_Type\",\n\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\"name\": \"measurementGroup\",\n\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\"name\": \"Measurement_Group_Type\",\n\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\": \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementType\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"name\": \"managedObjectDNsBasic\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"DN\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t]\n}" + } + }, + { + "key":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "value":{ + "key":{ + "name":"UUIDType", + "version":"0.0.1" + }, + "schemaFlavour":"Java", + "schemaDefinition":"java.util.UUID" + } + } + ] + } + } + } + }, + "engineParameters":{ + "executorParameters":{ + "JAVASCRIPT":{ + "parameterClassName":"org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters":{ + "parameterClassName":"org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters":{ + "Avro":{ + "parameterClassName":"org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + }, + "Java":{ + "parameterClassName":"org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters", + "jsonAdapters":{ + "Instant":{ + "adaptedClass":"java.time.Instant", + "adaptorClass":"org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" + } + } + } + } + } + } + }, + "eventInputParameters":{ + "DCAEConsumer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTCLIENT", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters", + "parameters":{ + "consumerPollTime":"50", + "url":"https://message-router:3905/events/unauthenticated.DCAE_CL_OUTPUT/cg1/sg1" + } + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON", + "parameters":{ + "nameAlias":"policyName" + } + }, + "eventName":"pmsh-operational-policy", + "eventNameFilter":"pmsh-operational-policy" + }, + "CDSRequestConsumer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTREQUESTOR", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters", + "parameters":{ + "url":"http://10.10.10.184:30254/api/v1/execution-service/process", + "httpMethod":"POST", + "restRequestTimeout":2000, + "httpHeaders":[ + [ + "Authorization", + "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" + ] + ] + } + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + }, + "eventName":"CDSCreateResponseEvent", + "eventNameFilter":"CDSCreateResponseEvent", + "requestorMode":true, + "requestorPeer":"CDSRequestProducer", + "requestorTimeout":500 + }, + "CDSDeleteRequestConsumer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTREQUESTOR", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters", + "parameters":{ + "url":"http://10.10.10.184:30254/api/v1/execution-service/process", + "httpMethod":"POST", + "restRequestTimeout":2000, + "httpHeaders":[ + [ + "Authorization", + "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==" + ] + ] + } + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + }, + "eventName":"CDSDeleteResponseEvent", + "eventNameFilter":"CDSDeleteResponseEvent", + "requestorMode":true, + "requestorPeer":"CDSDeleteRequestProducer", + "requestorTimeout":500 + }, + "CDSReplyConsumer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTREQUESTOR", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters", + "parameters":{ + "url":"https://message-router:3905/events/unauthenticated.PMSH_CL_INPUT", + "httpMethod":"POST", + "restRequestTimeout":2000 + } + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + }, + "eventName":"MRResponseEvent", + "eventNameFilter":"MRResponseEvent", + "requestorMode":true, + "requestorPeer":"CDSReplyProducer", + "requestorTimeout":500 + } + }, + "eventOutputParameters":{ + "logOutputter":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"FILE", + "parameters":{ + "fileName":"/tmp/outputevents.log" + } + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + } + }, + "StdOutOutputter":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"FILE", + "parameters":{ + "standardIo":true + } + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + } + }, + "CDSRequestProducer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTREQUESTOR", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + }, + "eventNameFilter":"CDSCreateSubscriptionRequestEvent", + "requestorMode":true, + "requestorPeer":"CDSRequestConsumer", + "requestorTimeout":500 + }, + "CDSDeleteRequestProducer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTREQUESTOR", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + }, + "eventNameFilter":"CDSDeleteSubscriptionRequestEvent", + "requestorMode":true, + "requestorPeer":"CDSDeleteRequestConsumer", + "requestorTimeout":500 + }, + "CDSReplyProducer":{ + "carrierTechnologyParameters":{ + "carrierTechnology":"RESTREQUESTOR", + "parameterClassName":"org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters" + }, + "eventProtocolParameters":{ + "eventProtocol":"JSON" + }, + "eventNameFilter":"CDSResponseStatusEvent", + "requestorMode":true, + "requestorPeer":"CDSReplyConsumer", + "requestorTimeout":500 + } + } + } + } + } + ] + } +}
\ No newline at end of file diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/pmsh/PMSubscriptionHandling.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_operational_policy.yaml index c15d11643..faf579012 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/pmsh/PMSubscriptionHandling.yaml +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSH/pmsh_operational_policy.yaml @@ -1,771 +1,9 @@ -# ============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 - org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo: - name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo - version: 0.0.0 - derived_from: tosca.datatypes.Root - properties: - consulUrl: - name: consulUrl - type: string - typeVersion: 0.0.0 - description: Consul url for this entry - required: true - consul_body: - name: consulBody - type: string - typeVersion: 0.0.0 - description: Body of Consul entry - required: true - onap.datatypes.monitoring.managedObjectDNsBasic: - constraints: [] - properties: - DN: - name: DN - type: string - typeVersion: 0.0.0 - description: Managed object distinguished name - required: true - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.managedObjectDNsBasic - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.managedObjectDNsBasics: - constraints: [] - properties: - managedObjectDNsBasic: - name: managedObjectDNsBasic - type: map - typeVersion: 0.0.0 - description: Managed object distinguished name object - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.managedObjectDNsBasic - typeVersion: 0.0.0 - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.managedObjectDNsBasics - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.measurementGroup: - constraints: [] - properties: - measurementTypes: - name: measurementTypes - type: list - typeVersion: 0.0.0 - description: List of measurement types - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.measurementTypes - typeVersion: 0.0.0 - constraints: [] - metadata: {} - managedObjectDNsBasic: - name: managedObjectDNsBasic - type: list - typeVersion: 0.0.0 - description: List of managed object distinguished names - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.managedObjectDNsBasics - typeVersion: 0.0.0 - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.measurementGroup - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.measurementGroups: - constraints: [] - properties: - measurementGroup: - name: measurementGroup - type: map - typeVersion: 0.0.0 - description: Measurement Group - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.measurementGroup - typeVersion: 0.0.0 - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.measurementGroups - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.measurementType: - constraints: [] - properties: - measurementType: - name: measurementType - type: string - typeVersion: 0.0.0 - description: Measurement type - required: true - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.measurementType - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.measurementTypes: - constraints: [] - properties: - measurementType: - name: measurementType - type: map - typeVersion: 0.0.0 - description: Measurement type object - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.measurementType - typeVersion: 0.0.0 - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.measurementTypes - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.nfFilter: - constraints: [] - properties: - modelNames: - name: modelNames - type: list - typeVersion: 0.0.0 - description: List of model names - required: true - constraints: [] - entry_schema: - type: string - typeVersion: 0.0.0 - constraints: [] - metadata: {} - modelInvariantIDs: - name: modelInvariantIDs - type: list - typeVersion: 0.0.0 - description: List of model invariant IDs - required: true - constraints: [] - entry_schema: - type: string - typeVersion: 0.0.0 - constraints: [] - metadata: {} - modelVersionIDs: - name: modelVersionIDs - type: list - typeVersion: 0.0.0 - description: List of model version IDs - required: true - constraints: [] - entry_schema: - type: string - typeVersion: 0.0.0 - constraints: [] - metadata: {} - nfNames: - name: nfNames - type: list - typeVersion: 0.0.0 - description: List of network functions - required: true - constraints: [] - entry_schema: - type: string - typeVersion: 0.0.0 - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.nfFilter - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} - onap.datatypes.monitoring.subscription: - constraints: [] - properties: - measurementGroups: - name: measurementGroups - type: list - typeVersion: 0.0.0 - description: Measurement Groups - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.measurementGroups - typeVersion: 0.0.0 - constraints: [] - metadata: {} - fileBasedGP: - name: fileBasedGP - type: integer - typeVersion: 0.0.0 - description: File based granularity period - required: true - constraints: [] - metadata: {} - fileLocation: - name: fileLocation - type: string - typeVersion: 0.0.0 - description: ROP file location - required: true - constraints: [] - metadata: {} - subscriptionName: - name: subscriptionName - type: string - typeVersion: 0.0.0 - description: Name of the subscription - required: true - constraints: [] - metadata: {} - administrativeState: - name: administrativeState - type: string - typeVersion: 0.0.0 - description: State of the subscription - required: true - constraints: - - valid_values: - - LOCKED - - UNLOCKED - metadata: {} - nfFilter: - name: nfFilter - type: map - typeVersion: 0.0.0 - description: Network function filter - required: true - constraints: [] - entry_schema: - type: onap.datatypes.monitoring.nfFilter - typeVersion: 0.0.0 - constraints: [] - metadata: {} - name: onap.datatypes.monitoring.subscription - version: 0.0.0 - derived_from: tosca.datatypes.Root - metadata: {} -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.dcae-pm-subscription-handler: - properties: - pmsh_policy: - name: pmsh_policy - type: onap.datatypes.monitoring.subscription - typeVersion: 0.0.0 - description: PMSH Policy JSON - required: false - constraints: [] - metadata: {} - name: onap.policies.monitoring.dcae-pm-subscription-handler - version: 1.0.0 - derived_from: onap.policies.Monitoring - metadata: {} - onap.policies.controlloop.operational.common.Apex: - derived_from: onap.policies.controlloop.operational.Common - type_version: 1.0.0 - version: 1.0.0 - name: onap.policies.controlloop.operational.common.Apex - description: Operational policies for Apex PDP - properties: - engineServiceParameters: - type: string - description: The engine parameters like name, instanceCount, policy implementation, parameters etc. - required: true - eventInputParameters: - type: string - description: The event input parameters. - required: true - eventOutputParameters: - type: string - description: The event output parameters. - required: true - javaProperties: - type: string - description: Name/value pairs of properties to be set for APEX if needed. - required: false -node_types: - org.onap.policy.clamp.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: false - dcae_blueprint: - type: onap.dcae.cloudify_blueprint - requred: false - consul_info: - type: list - required: false - entry_schema: - type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo - org.onap.policy.clamp.controlloop.PolicyControlLoopElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement - properties: - policy_type_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - policy_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: false - 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 +--- +tosca_definitions_version: tosca_simple_yaml_1_1_0 topology_template: - inputs: - pmsh_monitoring_policy: - type: onap.datatypes.ToscaConceptIdentifier - description: The ID of the PMSH monitoring policy to use - default: - name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test - version: 1.0.0 - pmsh_operational_policy: - type: onap.datatypes.ToscaConceptIdentifier - description: The ID of the PMSH operational policy to use - default: - name: operational.apex.pmcontrol - version: 1.0.0 - node_templates: - org.onap.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: - tosca_definitions_version: cloudify_dsl_1_3 - imports: - - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml - - plugin:k8splugin?version=3.7.0 - - plugin:pgaas?version=1.3.0 - - plugin:clamppolicyplugin?version=1.1.0 - inputs: - tag_version: - type: string - description: Docker image to be used - default: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2 - replicas: - type: integer - description: Number of instances - default: 1 - operational_policy_name: - type: string - default: operational.apex.pmcontrol - control_loop_name: - type: string - default: pmsh-control-loop - pmsh_publish_topic_name: - type: string - default: unauthenticated.DCAE_CL_OUTPUT - policy_feedback_topic_name: - type: string - default: unauthenticated.PMSH_CL_INPUT - aai_notification_topic_name: - type: string - default: AAI-EVENT - publisher_client_role: - type: string - description: Client role to request secure access to topic - default: org.onap.dcae.pmPublisher - subscriber_client_role: - type: string - description: Client role to request secure access to topic - default: org.onap.dcae.pmSubscriber - dcae_location: - type: string - description: DCAE location for the subscriber, used to set up routing - default: san-francisco - cpu_limit: - type: string - default: 1000m - cpu_request: - type: string - default: 1000m - memory_limit: - type: string - default: 1024Mi - memory_request: - type: string - default: 1024Mi - pgaas_cluster_name: - type: string - default: dcae-pg-primary.onap - enable_tls: - type: boolean - default: true - protocol: - type: string - description: PMSH protocol. If enable_tls is false, set to http - default: https - policy_model_id: - type: string - default: onap.policies.monitoring.dcae-pm-subscription-handler - policy_id: - type: string - default: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test - node_templates: - pgaasvm: - type: dcae.nodes.pgaas.database - properties: - writerfqdn: - get_input: pgaas_cluster_name - name: pmsh - pmsh: - type: dcae.nodes.ContainerizedServiceComponentUsingDmaap - interfaces: - cloudify.interfaces.lifecycle: - create: - inputs: - ports: - - '8443:0' - envs: - PMSH_PG_URL: - get_attribute: - - pgaasvm - - admin - - host - PMSH_PG_PASSWORD: - get_attribute: - - pgaasvm - - admin - - password - PMSH_PG_USERNAME: - get_attribute: - - pgaasvm - - admin - - user - PMSH_DB_NAME: - get_attribute: - - pgaasvm - - admin - - database - relationships: - - target: pmsh-policy - type: cloudify.relationships.depends_on - properties: - service_component_type: dcae-pmsh - service_component_name_override: dcae-pmsh - application_config: - enable_tls: - get_input: enable_tls - aaf_identity: dcae@dcae.onap.org - aaf_password: demo123456! - operational_policy_name: - get_input: operational_policy_name - control_loop_name: - get_input: control_loop_name - cert_path: /opt/app/pmsh/etc/certs/cert.pem - key_path: /opt/app/pmsh/etc/certs/key.pem - ca_cert_path: /opt/app/pmsh/etc/certs/cacert.pem - streams_publishes: - policy_pm_publisher: - type: message_router - dmaap_info: - topic_url: - concat: - - http://message-router:3904/events/ - - get_input: pmsh_publish_topic_name - streams_subscribes: - policy_pm_subscriber: - type: message_router - dmaap_info: - topic_url: - concat: - - http://message-router:3904/events/ - - get_input: policy_feedback_topic_name - aai_subscriber: - type: message_router - dmaap_info: - topic_url: - concat: - - http://message-router:3904/events/ - - get_input: aai_notification_topic_name - resource_config: - limits: - cpu: - get_input: cpu_limit - memory: - get_input: memory_limit - requests: - cpu: - get_input: cpu_request - memory: - get_input: memory_request - docker_config: - healthcheck: - endpoint: /healthcheck - interval: 15s - timeout: 1s - type: - get_input: protocol - image: - get_input: tag_version - replicas: - get_input: replicas - log_info: - log_directory: /var/log/ONAP/dcaegen2/services/pmsh - tls_info: - cert_directory: /opt/app/pmsh/etc/certs - use_tls: - get_input: enable_tls - pmsh-policy: - type: clamp.nodes.policy - properties: - policy_model_id: - get_input: policy_model_id - policy_id: - get_input: policy_id - consul_info: - - consulUrl: http://consul:31321/v1/kv/dcae-pmsh:policy - consulBody: - subscription: - subscriptionName: subscriptiona - administrativeState: UNLOCKED - fileBasedGP: 15 - fileLocation: /pm/pm.xml - nfFilter: - nfNames: - - ^pnf1.* - modelInvariantIDs: - - 5845y423-g654-6fju-po78-8n53154532k6 - - 7129e420-d396-4efb-af02-6b83499b12f8 - modelVersionIDs: - - e80a6ae3-cafd-4d24-850d-e14c084a5ca9 - measurementGroups: - - measurementGroup: - measurementTypes: - - measurementType: countera - - measurementType: counterb - managedObjectDNsBasic: - - DN: dna - - DN: dnb - - measurementGroup: - measurementTypes: - - measurementType: counterc - - measurementType: counterd - managedObjectDNsBasic: - - DN: dnc - - DN: dnd - org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement - 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 - policy_id: - get_input: pmsh_monitoring_policy - org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement: - version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement - 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 - policy_id: - get_input: pmsh_operational_policy - 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 policies: - - MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test: - type: onap.policies.monitoring.dcae-pm-subscription-handler - type_version: 1.0.0 - name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test - version: 1.0.0 - metadata: - policy-id: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test - policy-version: 1.0.0 - properties: - pmsh_policy: - fileBasedGP: 15 - fileLocation: /pm/pm.xml - subscriptionName: subscriptiona - administrativeState: UNLOCKED - nfFilter: - onap.datatypes.monitoring.nfFilter: - modelVersionIDs: - - e80a6ae3-cafd-4d24-850d-e14c084a5ca9 - modelInvariantIDs: - - 5845y423-g654-6fju-po78-8n53154532k6 - - 7129e420-d396-4efb-af02-6b83499b12f8 - modelNames: [] - nfNames: - - '"^pnf1.*"' - measurementGroups: - - measurementGroup: - onap.datatypes.monitoring.measurementGroup: - measurementTypes: - - measurementType: - onap.datatypes.monitoring.measurementType: - measurementType: countera - - measurementType: - onap.datatypes.monitoring.measurementType: - measurementType: counterb - managedObjectDNsBasic: - - managedObjectDNsBasic: - onap.datatypes.monitoring.managedObjectDNsBasic: - DN: dna - - managedObjectDNsBasic: - onap.datatypes.monitoring.managedObjectDNsBasic: - DN: dnb - - measurementGroup: - onap.datatypes.monitoring.measurementGroup: - measurementTypes: - - measurementType: - onap.datatypes.monitoring.measurementType: - measurementType: counterc - - measurementType: - onap.datatypes.monitoring.measurementType: - measurementType: counterd - managedObjectDNsBasic: - - managedObjectDNsBasic: - onap.datatypes.monitoring.managedObjectDNsBasic: - DN: dnc - - managedObjectDNsBasic: - onap.datatypes.monitoring.managedObjectDNsBasic: - DN: dnd - operational.apex.pmcontrol: - type: onap.policies.controlloop.operational.Common.Apex + type: onap.policies.controlloop.operational.Apex type_version: 1.0.0 version: 1.0.0 metadata: @@ -797,7 +35,8 @@ topology_template: name: CDSActionIdentifiersType version: 0.0.1 UUID: 6e5fa19b-14df-37e3-a4ae-8c537e861a82 - description: Generated description for concept referred to by key "CDSActionIdentifiersType:0.0.1" + description: Generated description for concept referred to by + key "CDSActionIdentifiersType:0.0.1" - key: name: CDSCreateResponseEvent version: 0.0.1 @@ -806,7 +45,8 @@ topology_template: name: CDSCreateResponseEvent version: 0.0.1 UUID: 14b29e38-ac75-3273-aa4e-8583c0aa7dad - description: Generated description for concept referred to by key "CDSCreateResponseEvent:0.0.1" + description: Generated description for concept referred to by + key "CDSCreateResponseEvent:0.0.1" - key: name: CDSCreateResponsePayloadType version: 0.0.1 @@ -815,7 +55,8 @@ topology_template: name: CDSCreateResponsePayloadType version: 0.0.1 UUID: 04573f8f-e772-30a5-b1d9-d7318d4a1e13 - description: Generated description for concept referred to by key "CDSCreateResponsePayloadType:0.0.1" + description: Generated description for concept referred to by + key "CDSCreateResponsePayloadType:0.0.1" - key: name: CDSCreateResponsePolicy version: 0.0.1 @@ -824,7 +65,8 @@ topology_template: name: CDSCreateResponsePolicy version: 0.0.1 UUID: e126c965-fc09-3bfe-8f55-70f380a4a49c - description: Generated description for concept referred to by key "CDSCreateResponsePolicy:0.0.1" + description: Generated description for concept referred to by + key "CDSCreateResponsePolicy:0.0.1" - key: name: CDSCreateResponseTask version: 0.0.1 @@ -833,7 +75,8 @@ topology_template: name: CDSCreateResponseTask version: 0.0.1 UUID: 6165ee82-afd2-3aab-a517-f00b3f2461d2 - description: Generated description for concept referred to by key "CDSCreateResponseTask:0.0.1" + description: Generated description for concept referred to by + key "CDSCreateResponseTask:0.0.1" - key: name: CDSCreateSubscriptionPayloadType version: 0.0.1 @@ -842,7 +85,8 @@ topology_template: name: CDSCreateSubscriptionPayloadType version: 0.0.1 UUID: 8350ac5e-c157-38b9-9614-a0f93a830e60 - description: Generated description for concept referred to by key "CDSCreateSubscriptionPayloadType:0.0.1" + description: Generated description for concept referred to by + key "CDSCreateSubscriptionPayloadType:0.0.1" - key: name: CDSCreateSubscriptionRequestEvent version: 0.0.1 @@ -851,7 +95,8 @@ topology_template: name: CDSCreateSubscriptionRequestEvent version: 0.0.1 UUID: cfa325ba-226b-3a31-9183-ec43e2b6e9a2 - description: Generated description for concept referred to by key "CDSCreateSubscriptionRequestEvent:0.0.1" + description: Generated description for concept referred to by + key "CDSCreateSubscriptionRequestEvent:0.0.1" - key: name: CDSDeleteResponseEvent version: 0.0.1 @@ -860,7 +105,8 @@ topology_template: name: CDSDeleteResponseEvent version: 0.0.1 UUID: 8be9c0fa-7437-3841-aff2-b3cec6ae3bd8 - description: Generated description for concept referred to by key "CDSDeleteResponseEvent:0.0.1" + description: Generated description for concept referred to by + key "CDSDeleteResponseEvent:0.0.1" - key: name: CDSDeleteResponsePayloadType version: 0.0.1 @@ -869,7 +115,8 @@ topology_template: name: CDSDeleteResponsePayloadType version: 0.0.1 UUID: 3fbfe0c9-152e-34d3-a504-09cd13c058d0 - description: Generated description for concept referred to by key "CDSDeleteResponsePayloadType:0.0.1" + description: Generated description for concept referred to by + key "CDSDeleteResponsePayloadType:0.0.1" - key: name: CDSDeleteResponsePolicy version: 0.0.1 @@ -878,7 +125,8 @@ topology_template: name: CDSDeleteResponsePolicy version: 0.0.1 UUID: a780251c-edd5-3132-b865-04313246b43c - description: Generated description for concept referred to by key "CDSDeleteResponsePolicy:0.0.1" + description: Generated description for concept referred to by + key "CDSDeleteResponsePolicy:0.0.1" - key: name: CDSDeleteResponseTask version: 0.0.1 @@ -887,7 +135,8 @@ topology_template: name: CDSDeleteResponseTask version: 0.0.1 UUID: afce4555-3aa3-3521-a7d8-ee8cdf0d3efc - description: Generated description for concept referred to by key "CDSDeleteResponseTask:0.0.1" + description: Generated description for concept referred to by + key "CDSDeleteResponseTask:0.0.1" - key: name: CDSDeleteSubscriptionPayloadType version: 0.0.1 @@ -896,7 +145,8 @@ topology_template: name: CDSDeleteSubscriptionPayloadType version: 0.0.1 UUID: 12658406-9147-3c9d-a38c-5ad5e30b092b - description: Generated description for concept referred to by key "CDSDeleteSubscriptionPayloadType:0.0.1" + description: Generated description for concept referred to by + key "CDSDeleteSubscriptionPayloadType:0.0.1" - key: name: CDSDeleteSubscriptionRequestEvent version: 0.0.1 @@ -905,7 +155,8 @@ topology_template: name: CDSDeleteSubscriptionRequestEvent version: 0.0.1 UUID: 24380c95-9289-36e6-8cbf-0edefa15ccd9 - description: Generated description for concept referred to by key "CDSDeleteSubscriptionRequestEvent:0.0.1" + description: Generated description for concept referred to by + key "CDSDeleteSubscriptionRequestEvent:0.0.1" - key: name: CDSRequestCommonHeaderType version: 0.0.1 @@ -914,7 +165,8 @@ topology_template: name: CDSRequestCommonHeaderType version: 0.0.1 UUID: 35590ac0-062c-39f1-8786-b4ff716e30b1 - description: Generated description for concept referred to by key "CDSRequestCommonHeaderType:0.0.1" + description: Generated description for concept referred to by + key "CDSRequestCommonHeaderType:0.0.1" - key: name: CDSResponseCommonHeaderType version: 0.0.1 @@ -923,7 +175,8 @@ topology_template: name: CDSResponseCommonHeaderType version: 0.0.1 UUID: dd7e1805-885a-350b-aaf9-ed541321ae3c - description: Generated description for concept referred to by key "CDSResponseCommonHeaderType:0.0.1" + description: Generated description for concept referred to by + key "CDSResponseCommonHeaderType:0.0.1" - key: name: CDSResponseStatusEvent version: 0.0.1 @@ -932,7 +185,8 @@ topology_template: name: CDSResponseStatusEvent version: 0.0.1 UUID: 7986e21b-32f7-302e-9554-31f21b673493 - description: Generated description for concept referred to by key "CDSResponseStatusEvent:0.0.1" + description: Generated description for concept referred to by + key "CDSResponseStatusEvent:0.0.1" - key: name: CDSResponseStatusType version: 0.0.1 @@ -941,7 +195,8 @@ topology_template: name: CDSResponseStatusType version: 0.0.1 UUID: 92b8a2cf-344e-3ce1-8cc0-2b7d3cb695fa - description: Generated description for concept referred to by key "CDSResponseStatusType:0.0.1" + description: Generated description for concept referred to by + key "CDSResponseStatusType:0.0.1" - key: name: CreateSubscriptionPayloadEvent version: 0.0.1 @@ -950,7 +205,8 @@ topology_template: name: CreateSubscriptionPayloadEvent version: 0.0.1 UUID: 92162397-1a8e-3a3f-a469-d2af7700af4a - description: Generated description for concept referred to by key "CreateSubscriptionPayloadEvent:0.0.1" + description: Generated description for concept referred to by + key "CreateSubscriptionPayloadEvent:0.0.1" - key: name: CreateSubscriptionPayloadTask version: 0.0.1 @@ -959,7 +215,8 @@ topology_template: name: CreateSubscriptionPayloadTask version: 0.0.1 UUID: bc0c69f0-52ed-38ea-b468-ae4a6fd1730d - description: Generated description for concept referred to by key "CreateSubscriptionPayloadTask:0.0.1" + description: Generated description for concept referred to by + key "CreateSubscriptionPayloadTask:0.0.1" - key: name: CreateSubscriptionRequestTask version: 0.0.1 @@ -968,7 +225,8 @@ topology_template: name: CreateSubscriptionRequestTask version: 0.0.1 UUID: 89cb75e9-f06c-30d3-b4ff-698d45f63869 - description: Generated description for concept referred to by key "CreateSubscriptionRequestTask:0.0.1" + description: Generated description for concept referred to by + key "CreateSubscriptionRequestTask:0.0.1" - key: name: DeleteSubscriptionPayloadEvent version: 0.0.1 @@ -977,7 +235,8 @@ topology_template: name: DeleteSubscriptionPayloadEvent version: 0.0.1 UUID: 994fa441-04ab-33bb-832d-1cd12ab5d074 - description: Generated description for concept referred to by key "DeleteSubscriptionPayloadEvent:0.0.1" + description: Generated description for concept referred to by + key "DeleteSubscriptionPayloadEvent:0.0.1" - key: name: DeleteSubscriptionPayloadTask version: 0.0.1 @@ -986,7 +245,8 @@ topology_template: name: DeleteSubscriptionPayloadTask version: 0.0.1 UUID: 0f519117-5fea-3e4b-941f-8f778100465f - description: Generated description for concept referred to by key "DeleteSubscriptionPayloadTask:0.0.1" + description: Generated description for concept referred to by + key "DeleteSubscriptionPayloadTask:0.0.1" - key: name: DeleteSubscriptionRequestTask version: 0.0.1 @@ -995,7 +255,8 @@ topology_template: name: DeleteSubscriptionRequestTask version: 0.0.1 UUID: acb772fe-d442-39e3-98f9-b1080caf4150 - description: Generated description for concept referred to by key "DeleteSubscriptionRequestTask:0.0.1" + description: Generated description for concept referred to by + key "DeleteSubscriptionRequestTask:0.0.1" - key: name: MRResponseEvent version: 0.0.1 @@ -1004,7 +265,8 @@ topology_template: name: MRResponseEvent version: 0.0.1 UUID: 13c747a3-6bae-3bcf-9c80-b152e01dc194 - description: Generated description for concept referred to by key "MRResponseEvent:0.0.1" + description: Generated description for concept referred to by + key "MRResponseEvent:0.0.1" - key: name: PMControlPolicy version: 0.0.1 @@ -1013,7 +275,8 @@ topology_template: name: PMControlPolicy version: 0.0.1 UUID: acf1e55c-7bc5-3bd5-975a-0ca54afcd8a4 - description: Generated description for concept referred to by key "PMControlPolicy:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy:0.0.1" - key: name: PMControlPolicy_Albums version: 0.0.1 @@ -1022,7 +285,8 @@ topology_template: name: PMControlPolicy_Albums version: 0.0.1 UUID: b38ad204-c2c8-32f4-9b5a-dda0aeb0145b - description: Generated description for concept referred to by key "PMControlPolicy_Albums:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy_Albums:0.0.1" - key: name: PMControlPolicy_Events version: 0.0.1 @@ -1031,7 +295,8 @@ topology_template: name: PMControlPolicy_Events version: 0.0.1 UUID: be3871a0-c42a-3113-a066-82d192840eca - description: Generated description for concept referred to by key "PMControlPolicy_Events:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy_Events:0.0.1" - key: name: PMControlPolicy_KeyInfo version: 0.0.1 @@ -1040,7 +305,8 @@ topology_template: name: PMControlPolicy_KeyInfo version: 0.0.1 UUID: ced37634-28a4-3178-b7f6-2980794927b0 - description: Generated description for concept referred to by key "PMControlPolicy_KeyInfo:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy_KeyInfo:0.0.1" - key: name: PMControlPolicy_Policies version: 0.0.1 @@ -1049,7 +315,8 @@ topology_template: name: PMControlPolicy_Policies version: 0.0.1 UUID: be3d180d-ef9c-3a75-8e9c-84271a038bed - description: Generated description for concept referred to by key "PMControlPolicy_Policies:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy_Policies:0.0.1" - key: name: PMControlPolicy_Schemas version: 0.0.1 @@ -1058,7 +325,8 @@ topology_template: name: PMControlPolicy_Schemas version: 0.0.1 UUID: e61973f1-189c-39e5-82f6-0d3afe298a20 - description: Generated description for concept referred to by key "PMControlPolicy_Schemas:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy_Schemas:0.0.1" - key: name: PMControlPolicy_Tasks version: 0.0.1 @@ -1067,7 +335,8 @@ topology_template: name: PMControlPolicy_Tasks version: 0.0.1 UUID: 5658adb3-2962-30a3-a241-fae75bb8eb4a - description: Generated description for concept referred to by key "PMControlPolicy_Tasks:0.0.1" + description: Generated description for concept referred to by + key "PMControlPolicy_Tasks:0.0.1" - key: name: PMSubscriptionAlbum version: 0.0.1 @@ -1076,7 +345,8 @@ topology_template: name: PMSubscriptionAlbum version: 0.0.1 UUID: c2bd6f0d-6854-317a-9be2-97c08338428c - description: Generated description for concept referred to by key "PMSubscriptionAlbum:0.0.1" + description: Generated description for concept referred to by + key "PMSubscriptionAlbum:0.0.1" - key: name: PMSubscriptionOutputEvent version: 0.0.1 @@ -1085,7 +355,8 @@ topology_template: name: PMSubscriptionOutputEvent version: 0.0.1 UUID: 992b7819-9f69-3aa0-bb0f-6e45ea15ce05 - description: Generated description for concept referred to by key "PMSubscriptionOutputEvent:0.0.1" + description: Generated description for concept referred to by + key "PMSubscriptionOutputEvent:0.0.1" - key: name: PMSubscriptionType version: 0.0.1 @@ -1094,7 +365,8 @@ topology_template: name: PMSubscriptionType version: 0.0.1 UUID: 73c1c397-4fc3-357f-93b6-a8ad707fbaae - description: Generated description for concept referred to by key "PMSubscriptionType:0.0.1" + description: Generated description for concept referred to by + key "PMSubscriptionType:0.0.1" - key: name: ReceiveEventPolicy version: 0.0.1 @@ -1103,7 +375,8 @@ topology_template: name: ReceiveEventPolicy version: 0.0.1 UUID: 568b7345-9de1-36d3-b6a3-9b857e6809a1 - description: Generated description for concept referred to by key "ReceiveEventPolicy:0.0.1" + description: Generated description for concept referred to by + key "ReceiveEventPolicy:0.0.1" - key: name: ReceiveSubscriptionTask version: 0.0.1 @@ -1112,7 +385,8 @@ topology_template: name: ReceiveSubscriptionTask version: 0.0.1 UUID: f596afc8-100c-35eb-92c8-352355ea457d - description: Generated description for concept referred to by key "ReceiveSubscriptionTask:0.0.1" + description: Generated description for concept referred to by + key "ReceiveSubscriptionTask:0.0.1" - key: name: SimpleIntType version: 0.0.1 @@ -1121,7 +395,8 @@ topology_template: name: SimpleIntType version: 0.0.1 UUID: 153791fd-ae0a-36a7-88a5-309a7936415d - description: Generated description for concept referred to by key "SimpleIntType:0.0.1" + description: Generated description for concept referred to by + key "SimpleIntType:0.0.1" - key: name: SimpleStringType version: 0.0.1 @@ -1130,7 +405,8 @@ topology_template: name: SimpleStringType version: 0.0.1 UUID: 8a4957cf-9493-3a76-8c22-a208e23259af - description: Generated description for concept referred to by key "SimpleStringType:0.0.1" + description: Generated description for concept referred to by + key "SimpleStringType:0.0.1" - key: name: SubscriptionStatusType version: 0.0.1 @@ -1139,7 +415,8 @@ topology_template: name: SubscriptionStatusType version: 0.0.1 UUID: 597643b1-9db1-31ce-85d0-e1c63c43b30b - description: Generated description for concept referred to by key "SubscriptionStatusType:0.0.1" + description: Generated description for concept referred to by + key "SubscriptionStatusType:0.0.1" - key: name: SubscriptionType version: 0.0.1 @@ -1148,7 +425,8 @@ topology_template: name: SubscriptionType version: 0.0.1 UUID: 184547bb-7d64-3cb2-a273-d7185102c5ce - description: Generated description for concept referred to by key "SubscriptionType:0.0.1" + description: Generated description for concept referred to by + key "SubscriptionType:0.0.1" - key: name: UUIDType version: 0.0.1 @@ -1157,7 +435,8 @@ topology_template: name: UUIDType version: 0.0.1 UUID: 6a8cc68e-dfc8-3403-9c6d-071c886b319c - description: Generated description for concept referred to by key "UUIDType:0.0.1" + description: Generated description for concept referred to by + key "UUIDType:0.0.1" - key: name: pmsh-operational-policy version: 0.0.1 @@ -1166,7 +445,8 @@ topology_template: name: pmsh-operational-policy version: 0.0.1 UUID: fdf2c9ff-6422-3ea6-b6b6-49b12116265d - description: Generated description for concept referred to by key "pmsh-operational-policy:0.0.1" + description: Generated description for concept referred to by + key "pmsh-operational-policy:0.0.1" policies: key: name: PMControlPolicy_Policies @@ -1381,10 +661,14 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) var changeType = pmSubscriptionInfo.get("changeType").toString() + executor.logger.info("Change Type is " + changeType) + if ("CREATE".equals(changeType)) { executor.logger.info("Choosing to create a subscription") executor.subject.getTaskKey("CreateSubscriptionPayloadTask").copyTo(executor.selectedTask); @@ -1393,6 +677,7 @@ topology_template: executor.logger.info("Choosing to delete a subscription") executor.subject.getTaskKey("DeleteSubscriptionPayloadTask").copyTo(executor.selectedTask); } + //var returnValue = executor.isTrue; true; stateFinalizerLogicMap: @@ -1681,23 +966,32 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var commonHeader = executor.inFields.get("commonHeader") var response = executor.inFields.get("payload") var albumID = commonHeader.get("requestId") + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(albumID.toString()); var responseStatus = executor.subject.getOutFieldSchemaHelper("status").createNewInstance(); + responseStatus.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) responseStatus.put("nfName", pmSubscriptionInfo.get("nfName")) responseStatus.put("changeType", pmSubscriptionInfo.get("changeType")) + var status = response.get(pmSubscriptionInfo.get("changeType").toLowerCase() + "_DasH_subscription_DasH_response").get("odl_DasH_response").get("status") + executor.logger.info("RESPONSE STATUS = " + status) + if(status == "success") { responseStatus.put("message", "success") } else { responseStatus.put("message", "failed") } + executor.outFields.put("status", responseStatus) + //var returnValue = executor.isTrue; true; - key: @@ -1774,23 +1068,32 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var commonHeader = executor.inFields.get("commonHeader") var response = executor.inFields.get("payload") var albumID = commonHeader.get("requestId") + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(albumID.toString()); var responseStatus = executor.subject.getOutFieldSchemaHelper("status").createNewInstance(); + responseStatus.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) responseStatus.put("nfName", pmSubscriptionInfo.get("nfName")) responseStatus.put("changeType", pmSubscriptionInfo.get("changeType")) + var status = response.get(pmSubscriptionInfo.get("changeType").toLowerCase() + "_DasH_subscription_DasH_response").get("odl_DasH_response").get("status") + executor.logger.info("RESPONSE STATUS = " + status) + if(status == "success") { responseStatus.put("message", "success") } else { responseStatus.put("message", "failed") } + executor.outFields.put("status", responseStatus) + //var returnValue = executor.isTrue; true; - key: @@ -1853,22 +1156,31 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() + var payloadProperties = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance(changeType + "_DasH_subscription_DasH_properties_record"); + payloadProperties.put("nfName", pmSubscriptionInfo.get("nfName")) payloadProperties.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) payloadProperties.put("administrativeState", pmSubscriptionInfo.get("subscription").get("administrativeState")) payloadProperties.put("fileBasedGP", pmSubscriptionInfo.get("subscription").get("fileBasedGP").toString()) payloadProperties.put("fileLocation", pmSubscriptionInfo.get("subscription").get("fileLocation")) payloadProperties.put("measurementGroups", pmSubscriptionInfo.get("subscription").get("measurementGroups")) + var payloadEntry = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("CDSRequestPayloadEntry"); payloadEntry.put(changeType + "_DasH_subscription_DasH_properties", payloadProperties) + var payload = executor.subject.getOutFieldSchemaHelper("payload").createNewInstance(); payload.put(changeType + "_DasH_subscription_DasH_request", payloadEntry); + executor.outFields.put("albumID", executor.inFields.get("albumID")) executor.outFields.put("payload", payload); + //var returnValue = executor.isTrue; true; - key: @@ -1945,25 +1257,32 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() var blueprintName = pmSubscriptionInfo.get("blueprintName").toLowerCase() var blueprintVersion = pmSubscriptionInfo.get("blueprintVersion").toLowerCase() var payload = executor.inFields.get("payload") var actionName = changeType + "-subscription" + var commonHeader = executor.subject.getOutFieldSchemaHelper("commonHeader").createNewInstance(); commonHeader.put("originatorId", "sdnc"); commonHeader.put("requestId", executor.inFields.get("albumID").toString()); commonHeader.put("subRequestId", "sub-123456-1000"); + var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("actionIdentifiers").createNewInstance(); actionIdentifiers.put("actionName", actionName); actionIdentifiers.put("blueprintName", blueprintName); actionIdentifiers.put("blueprintVersion", blueprintVersion); actionIdentifiers.put("mode", "sync"); + executor.outFields.put("commonHeader", commonHeader); executor.outFields.put("actionIdentifiers", actionIdentifiers); executor.outFields.put("payload", payload); + //var returnValue = executor.isTrue; true; - key: @@ -2026,22 +1345,31 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() + var payloadProperties = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance(changeType + "_DasH_subscription_DasH_properties_record"); + payloadProperties.put("nfName", pmSubscriptionInfo.get("nfName")) payloadProperties.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) payloadProperties.put("administrativeState", pmSubscriptionInfo.get("subscription").get("administrativeState")) payloadProperties.put("fileBasedGP", pmSubscriptionInfo.get("subscription").get("fileBasedGP").toString()) payloadProperties.put("fileLocation", pmSubscriptionInfo.get("subscription").get("fileLocation")) payloadProperties.put("measurementGroups", pmSubscriptionInfo.get("subscription").get("measurementGroups")) + var payloadEntry = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("CDSRequestPayloadEntry"); payloadEntry.put(changeType + "_DasH_subscription_DasH_properties", payloadProperties) + var payload = executor.subject.getOutFieldSchemaHelper("payload").createNewInstance(); payload.put(changeType + "_DasH_subscription_DasH_request", payloadEntry); + executor.outFields.put("albumID", executor.inFields.get("albumID")) executor.outFields.put("payload", payload); + //var returnValue = executor.isTrue; true; - key: @@ -2118,25 +1446,32 @@ topology_template: * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + executor.logger.info(executor.subject.id); + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() var blueprintName = pmSubscriptionInfo.get("blueprintName").toLowerCase() var blueprintVersion = pmSubscriptionInfo.get("blueprintVersion").toLowerCase() var payload = executor.inFields.get("payload") var actionName = changeType + "-subscription" + var commonHeader = executor.subject.getOutFieldSchemaHelper("commonHeader").createNewInstance(); commonHeader.put("originatorId", "sdnc"); commonHeader.put("requestId", executor.inFields.get("albumID").toString()); commonHeader.put("subRequestId", "sub-123456-1000"); + var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("actionIdentifiers").createNewInstance(); actionIdentifiers.put("actionName", actionName); actionIdentifiers.put("blueprintName", blueprintName); actionIdentifiers.put("blueprintVersion", blueprintVersion); actionIdentifiers.put("mode", "sync"); + executor.outFields.put("commonHeader", commonHeader); executor.outFields.put("actionIdentifiers", actionIdentifiers); executor.outFields.put("payload", payload); + //var returnValue = executor.isTrue; true; - key: @@ -2235,13 +1570,17 @@ topology_template: * ============LICENSE_END========================================================= */ var uuidType = java.util.UUID; + executor.logger.info(executor.subject.id); + //albumID will be used to fetch info from our album later var albumID = uuidType.randomUUID(); var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").getSchemaHelper().createNewInstance(); var returnValue = true; + if(executor.inFields.get("policyName") != null) { executor.logger.info("nfName in receive sub event " + executor.inFields.get("nfName")); + var changeType = executor.inFields.get("changeType") var nfName = executor.inFields.get("nfName") var policyName = executor.inFields.get("policyName") @@ -2249,6 +1588,7 @@ topology_template: var subscription = executor.inFields.get("subscription") var blueprintName = executor.inFields.get("blueprintName") var blueprintVersion = executor.inFields.get("blueprintVersion") + pmSubscriptionInfo.put("nfName", executor.inFields.get("nfName")); pmSubscriptionInfo.put("changeType", executor.inFields.get("changeType")) pmSubscriptionInfo.put("policyName", executor.inFields.get("policyName")) @@ -2256,12 +1596,16 @@ topology_template: pmSubscriptionInfo.put("subscription", subscription) pmSubscriptionInfo.put("blueprintName", blueprintName) pmSubscriptionInfo.put("blueprintVersion", blueprintVersion) + + executor.getContextAlbum("PMSubscriptionAlbum").put(albumID.toString(), pmSubscriptionInfo); + executor.outFields.put("albumID", albumID) } else { executor.message = "Received invalid event" returnValue = false; } + returnValue; events: key: @@ -3028,37 +2372,38 @@ topology_template: name: PMSubscriptionType version: 0.0.1 schemaFlavour: Avro - schemaDefinition: "{\n\t\"name\": \"PMSubscription\",\n\t\"type\": \"record\",\n\t\"namespace\": \"\ - org.onap.policy.apex.onap.pmcontrol\",\n\t\"fields\": [\n {\n \"name\": \"nfName\"\ - ,\n \"type\": \"string\"\n },\n\t {\n\t\t\t\"name\": \"changeType\",\n\t\t\t\"\ - type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"closedLoopControlName\",\n\t\t\t\"type\": \"\ - string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"policyName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\ - {\n\t\t \"name\": \"blueprintName\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t \"name\"\ - : \"blueprintVersion\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"subscription\"\ - ,\n\t\t\t\"type\": {\n\t\t\t\t\"name\": \"subscription\",\n\t\t\t\t\"type\": \"record\",\n\t\t\t\t\ - \"fields\": [{\n\t\t\t\t\t\t\"name\": \"subscriptionName\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\ - \t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"administrativeState\",\n\t\t\t\t\t\t\"type\": \"string\"\ - \n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\t\t\t\"type\": \"int\"\ - \n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"fileLocation\",\n\t\t\t\t\t\t\"type\": \"string\"\ - \n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\t\t\t\"type\": {\n\ - \t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\"name\": \"Measurement_Groups_Type\"\ - ,\n\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\"\ - : \"measurementGroup\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"name\": \"Measurement_Group_Type\"\ - ,\n\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\ - \t\t\t\t\"name\": \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\ - \t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"\ - name\": \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\ - \t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementType\",\n\t\ - \t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\ - \t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\ - \t\t\t\t\t\t\t\t\"name\": \"managedObjectDNsBasic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\ - \t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\ - \t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\"\ - ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"DN\",\n\t\ - \t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\ - \t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\ - \t\t\t\t}\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\ - \t}\n\t]\n}" + schemaDefinition: "{\n\t\"name\": \"PMSubscription\",\n\t\"type\": + \"record\",\n\t\"namespace\": \"org.onap.policy.apex.onap.pmcontrol\",\n\t\"fields\": + [\n {\n \"name\": \"nfName\",\n \"type\": + \"string\"\n },\n\t {\n\t\t\t\"name\": \"changeType\",\n\t\t\t\"type\": + \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"closedLoopControlName\",\n\t\t\t\"type\": + \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"policyName\",\n\t\t\t\"type\": + \"string\"\n\t\t},\n\t\t{\n\t\t \"name\": \"blueprintName\",\n\t\t + \ \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t \"name\": + \"blueprintVersion\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": + \"subscription\",\n\t\t\t\"type\": {\n\t\t\t\t\"name\": \"subscription\",\n\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\"name\": + \"subscriptionName\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": + \"administrativeState\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": + \"fileBasedGP\",\n\t\t\t\t\t\t\"type\": \"int\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": + \"fileLocation\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": + \"measurementGroups\",\n\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\"type\": + \"array\",\n\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\"name\": + \"Measurement_Groups_Type\",\n\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\"fields\": + [{\n\t\t\t\t\t\t\t\t\t\"name\": \"measurementGroup\",\n\t\t\t\t\t\t\t\t\t\"type\": + {\n\t\t\t\t\t\t\t\t\t\t\"name\": \"Measurement_Group_Type\",\n\t\t\t\t\t\t\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": + \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"measurementType\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": + \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"managedObjectDNsBasic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": + {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": + {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"DN\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t]\n}" - key: name: SimpleIntType version: 0.0.1 @@ -3117,26 +2462,27 @@ topology_template: name: SubscriptionType version: 0.0.1 schemaFlavour: Avro - schemaDefinition: "{\n\t\"name\": \"subscription\",\n\t\"type\": \"record\",\n\t\"fields\": [{\n\t\t\ - \t\"name\": \"subscriptionName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"administrativeState\"\ - ,\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\"type\": \"\ - int\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileLocation\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\ - {\n\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\"type\": {\n\t\t\t\t\"type\": \"array\",\n\t\t\t\ - \t\"items\": {\n\t\t\t\t\t\"name\": \"Measurement_Groups_Type\",\n\t\t\t\t\t\"type\": \"record\",\n\ - \t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\"name\": \"measurementGroup\",\n\t\t\t\t\t\t\"type\": {\n\t\ - \t\t\t\t\t\t\"name\": \"Measurement_Group_Type\",\n\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\ - \t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\": \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\"type\"\ - : {\n\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\ - \t\t\"name\": \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\ - \t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementType\",\n\t\t\t\t\t\t\t\ - \t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ - }\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"name\": \"managedObjectDNsBasic\",\n\ - \t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\"\ - : {\n\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"\ - type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"DN\"\ - ,\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\ - \t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\ - \t\t}\n\t\t}\n\t]\n}" + schemaDefinition: "{\n\t\"name\": \"subscription\",\n\t\"type\": + \"record\",\n\t\"fields\": [{\n\t\t\t\"name\": \"subscriptionName\",\n\t\t\t\"type\": + \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"administrativeState\",\n\t\t\t\"type\": + \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\"type\": + \"int\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileLocation\",\n\t\t\t\"type\": + \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\"type\": + {\n\t\t\t\t\"type\": \"array\",\n\t\t\t\t\"items\": {\n\t\t\t\t\t\"name\": + \"Measurement_Groups_Type\",\n\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\"fields\": + [{\n\t\t\t\t\t\t\"name\": \"measurementGroup\",\n\t\t\t\t\t\t\"type\": + {\n\t\t\t\t\t\t\t\"name\": \"Measurement_Group_Type\",\n\t\t\t\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\": + \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"type\": + \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"measurementType\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"name\": + \"managedObjectDNsBasic\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"type\": + \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\": + \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": + \"DN\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t]\n}" - key: name: UUIDType version: 0.0.1 @@ -3231,7 +2577,7 @@ topology_template: carrierTechnologyParameters: carrierTechnology: FILE parameters: - fileName: /tmp/outputevents.log + fileName: "/tmp/outputevents.log" eventProtocolParameters: eventProtocol: JSON StdOutOutputter: @@ -3271,4 +2617,3 @@ topology_template: requestorMode: true requestorPeer: CDSReplyConsumer requestorTimeout: 500 - diff --git a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml index 2b2a4ae3e..f9f97420a 100644 --- a/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml +++ b/tosca-controlloop/common/src/main/resources/examples/controlloop/PMSubscriptionHandling.yaml @@ -15,7 +15,6 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= - tosca_definitions_version: tosca_simple_yaml_1_3 data_types: onap.datatypes.ToscaConceptIdentifier: @@ -27,6 +26,282 @@ data_types: version: type: string required: true + org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo: + name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo + version: 0.0.0 + derived_from: tosca.datatypes.Root + properties: + consulUrl: + name: consulUrl + type: string + typeVersion: 0.0.0 + description: Consul url for this entry + required: true + consul_body: + name: consulBody + type: string + typeVersion: 0.0.0 + description: Body of Consul entry + required: true + onap.datatypes.monitoring.managedObjectDNsBasic: + constraints: [] + properties: + DN: + name: DN + type: string + typeVersion: 0.0.0 + description: Managed object distinguished name + required: true + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.managedObjectDNsBasic + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.managedObjectDNsBasics: + constraints: [] + properties: + managedObjectDNsBasic: + name: managedObjectDNsBasic + type: map + typeVersion: 0.0.0 + description: Managed object distinguished name object + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.managedObjectDNsBasic + typeVersion: 0.0.0 + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.managedObjectDNsBasics + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.measurementGroup: + constraints: [] + properties: + measurementTypes: + name: measurementTypes + type: list + typeVersion: 0.0.0 + description: List of measurement types + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementTypes + typeVersion: 0.0.0 + constraints: [] + metadata: {} + managedObjectDNsBasic: + name: managedObjectDNsBasic + type: list + typeVersion: 0.0.0 + description: List of managed object distinguished names + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.managedObjectDNsBasics + typeVersion: 0.0.0 + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.measurementGroup + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.measurementGroups: + constraints: [] + properties: + measurementGroup: + name: measurementGroup + type: map + typeVersion: 0.0.0 + description: Measurement Group + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementGroup + typeVersion: 0.0.0 + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.measurementGroups + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.measurementType: + constraints: [] + properties: + measurementType: + name: measurementType + type: string + typeVersion: 0.0.0 + description: Measurement type + required: true + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.measurementType + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.measurementTypes: + constraints: [] + properties: + measurementType: + name: measurementType + type: map + typeVersion: 0.0.0 + description: Measurement type object + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementType + typeVersion: 0.0.0 + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.measurementTypes + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.nfFilter: + constraints: [] + properties: + modelNames: + name: modelNames + type: list + typeVersion: 0.0.0 + description: List of model names + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + modelInvariantIDs: + name: modelInvariantIDs + type: list + typeVersion: 0.0.0 + description: List of model invariant IDs + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + modelVersionIDs: + name: modelVersionIDs + type: list + typeVersion: 0.0.0 + description: List of model version IDs + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + nfNames: + name: nfNames + type: list + typeVersion: 0.0.0 + description: List of network functions + required: true + constraints: [] + entry_schema: + type: string + typeVersion: 0.0.0 + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.nfFilter + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} + onap.datatypes.monitoring.subscription: + constraints: [] + properties: + measurementGroups: + name: measurementGroups + type: list + typeVersion: 0.0.0 + description: Measurement Groups + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.measurementGroups + typeVersion: 0.0.0 + constraints: [] + metadata: {} + fileBasedGP: + name: fileBasedGP + type: integer + typeVersion: 0.0.0 + description: File based granularity period + required: true + constraints: [] + metadata: {} + fileLocation: + name: fileLocation + type: string + typeVersion: 0.0.0 + description: ROP file location + required: true + constraints: [] + metadata: {} + subscriptionName: + name: subscriptionName + type: string + typeVersion: 0.0.0 + description: Name of the subscription + required: true + constraints: [] + metadata: {} + administrativeState: + name: administrativeState + type: string + typeVersion: 0.0.0 + description: State of the subscription + required: true + constraints: + - valid_values: + - LOCKED + - UNLOCKED + metadata: {} + nfFilter: + name: nfFilter + type: map + typeVersion: 0.0.0 + description: Network function filter + required: true + constraints: [] + entry_schema: + type: onap.datatypes.monitoring.nfFilter + typeVersion: 0.0.0 + constraints: [] + metadata: {} + name: onap.datatypes.monitoring.subscription + version: 0.0.0 + derived_from: tosca.datatypes.Root + metadata: {} +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.dcae-pm-subscription-handler: + properties: + pmsh_policy: + name: pmsh_policy + type: onap.datatypes.monitoring.subscription + typeVersion: 0.0.0 + description: PMSH Policy JSON + required: false + constraints: [] + metadata: {} + name: onap.policies.monitoring.dcae-pm-subscription-handler + version: 1.0.0 + derived_from: onap.policies.Monitoring + metadata: {} node_types: org.onap.policy.clamp.controlloop.Participant: version: 1.0.1 @@ -63,14 +338,25 @@ node_types: properties: dcae_blueprint_id: type: onap.datatypes.ToscaConceptIdentifier - requred: true - org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement: + requred: false + dcae_blueprint: + type: onap.dcae.cloudify_blueprint + requred: false + consul_info: + type: list + required: false + entry_schema: + type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo + org.onap.policy.clamp.controlloop.PolicyControlLoopElement: version: 1.0.1 derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement properties: policy_type_id: type: onap.datatypes.ToscaConceptIdentifier requred: true + policy_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: false org.onap.policy.clamp.controlloop.CDSControlLoopElement: version: 1.0.1 derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement @@ -79,6 +365,19 @@ node_types: type: onap.datatypes.ToscaConceptIdentifier requred: true topology_template: + inputs: + pmsh_monitoring_policy: + type: onap.datatypes.ToscaConceptIdentifier + description: The ID of the PMSH monitoring policy to use + default: + name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test + version: 1.0.0 + pmsh_operational_policy: + type: onap.datatypes.ToscaConceptIdentifier + description: The ID of the PMSH operational policy to use + default: + name: operational.apex.pmcontrol + version: 1.0.0 node_templates: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant: version: 2.3.4 @@ -111,12 +410,223 @@ topology_template: 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 + dcae_blueprint: + tosca_definitions_version: cloudify_dsl_1_3 + imports: + - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml + - plugin:k8splugin?version=3.7.0 + - plugin:pgaas?version=1.3.0 + - plugin:clamppolicyplugin?version=1.1.0 + inputs: + tag_version: + type: string + description: Docker image to be used + default: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2 + replicas: + type: integer + description: Number of instances + default: 1 + operational_policy_name: + type: string + default: operational.apex.pmcontrol + control_loop_name: + type: string + default: pmsh-control-loop + pmsh_publish_topic_name: + type: string + default: unauthenticated.DCAE_CL_OUTPUT + policy_feedback_topic_name: + type: string + default: unauthenticated.PMSH_CL_INPUT + aai_notification_topic_name: + type: string + default: AAI-EVENT + publisher_client_role: + type: string + description: Client role to request secure access to topic + default: org.onap.dcae.pmPublisher + subscriber_client_role: + type: string + description: Client role to request secure access to topic + default: org.onap.dcae.pmSubscriber + dcae_location: + type: string + description: DCAE location for the subscriber, used to set up routing + default: san-francisco + cpu_limit: + type: string + default: 1000m + cpu_request: + type: string + default: 1000m + memory_limit: + type: string + default: 1024Mi + memory_request: + type: string + default: 1024Mi + pgaas_cluster_name: + type: string + default: dcae-pg-primary.onap + enable_tls: + type: boolean + default: true + protocol: + type: string + description: PMSH protocol. If enable_tls is false, set to http + default: https + policy_model_id: + type: string + default: onap.policies.monitoring.dcae-pm-subscription-handler + policy_id: + type: string + default: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test + node_templates: + pgaasvm: + type: dcae.nodes.pgaas.database + properties: + writerfqdn: + get_input: pgaas_cluster_name + name: pmsh + pmsh: + type: dcae.nodes.ContainerizedServiceComponentUsingDmaap + interfaces: + cloudify.interfaces.lifecycle: + create: + inputs: + ports: + - '8443:0' + envs: + PMSH_PG_URL: + get_attribute: + - pgaasvm + - admin + - host + PMSH_PG_PASSWORD: + get_attribute: + - pgaasvm + - admin + - password + PMSH_PG_USERNAME: + get_attribute: + - pgaasvm + - admin + - user + PMSH_DB_NAME: + get_attribute: + - pgaasvm + - admin + - database + relationships: + - target: pmsh-policy + type: cloudify.relationships.depends_on + properties: + service_component_type: dcae-pmsh + service_component_name_override: dcae-pmsh + application_config: + enable_tls: + get_input: enable_tls + aaf_identity: dcae@dcae.onap.org + aaf_password: demo123456! + operational_policy_name: + get_input: operational_policy_name + control_loop_name: + get_input: control_loop_name + cert_path: /opt/app/pmsh/etc/certs/cert.pem + key_path: /opt/app/pmsh/etc/certs/key.pem + ca_cert_path: /opt/app/pmsh/etc/certs/cacert.pem + streams_publishes: + policy_pm_publisher: + type: message_router + dmaap_info: + topic_url: + concat: + - http://message-router:3904/events/ + - get_input: pmsh_publish_topic_name + streams_subscribes: + policy_pm_subscriber: + type: message_router + dmaap_info: + topic_url: + concat: + - http://message-router:3904/events/ + - get_input: policy_feedback_topic_name + aai_subscriber: + type: message_router + dmaap_info: + topic_url: + concat: + - http://message-router:3904/events/ + - get_input: aai_notification_topic_name + resource_config: + limits: + cpu: + get_input: cpu_limit + memory: + get_input: memory_limit + requests: + cpu: + get_input: cpu_request + memory: + get_input: memory_request + docker_config: + healthcheck: + endpoint: /healthcheck + interval: 15s + timeout: 1s + type: + get_input: protocol + image: + get_input: tag_version + replicas: + get_input: replicas + log_info: + log_directory: /var/log/ONAP/dcaegen2/services/pmsh + tls_info: + cert_directory: /opt/app/pmsh/etc/certs + use_tls: + get_input: enable_tls + pmsh-policy: + type: clamp.nodes.policy + properties: + policy_model_id: + get_input: policy_model_id + policy_id: + get_input: policy_id + consul_info: + - consulUrl: http://consul:31321/v1/kv/dcae-pmsh:policy + consulBody: + subscription: + subscriptionName: subscriptiona + administrativeState: UNLOCKED + fileBasedGP: 15 + fileLocation: /pm/pm.xml + nfFilter: + nfNames: + - ^pnf1.* + modelInvariantIDs: + - 5845y423-g654-6fju-po78-8n53154532k6 + - 7129e420-d396-4efb-af02-6b83499b12f8 + modelVersionIDs: + - e80a6ae3-cafd-4d24-850d-e14c084a5ca9 + measurementGroups: + - measurementGroup: + measurementTypes: + - measurementType: countera + - measurementType: counterb + managedObjectDNsBasic: + - DN: dna + - DN: dnb + - measurementGroup: + measurementTypes: + - measurementType: counterc + - measurementType: counterd + managedObjectDNsBasic: + - DN: dnc + - DN: dnd org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement type_version: 1.0.0 description: Control loop element for the monitoring policy for Performance Management Subscription Handling properties: @@ -127,9 +637,11 @@ topology_template: policy_type_id: name: onap.policies.monitoring.pm-subscription-handler version: 1.0.0 + policy_id: + get_input: pmsh_monitoring_policy org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement: version: 1.2.3 - type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement type_version: 1.0.0 description: Control loop element for the operational policy for Performance Management Subscription Handling properties: @@ -140,6 +652,8 @@ topology_template: policy_type_id: name: onap.policies.operational.pm-subscription-handler version: 1.0.0 + policy_id: + get_input: pmsh_operational_policy org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement: version: 1.2.3 type: org.onap.policy.clamp.controlloop.CDSControlLoopElement @@ -168,4 +682,2633 @@ topology_template: - 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 + version: 1.2.3 + policies: + - MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test: + type: onap.policies.monitoring.dcae-pm-subscription-handler + type_version: 1.0.0 + name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test + version: 1.0.0 + metadata: + policy-id: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test + policy-version: 1.0.0 + properties: + pmsh_policy: + fileBasedGP: 15 + fileLocation: /pm/pm.xml + subscriptionName: subscriptiona + administrativeState: UNLOCKED + nfFilter: + onap.datatypes.monitoring.nfFilter: + modelVersionIDs: + - e80a6ae3-cafd-4d24-850d-e14c084a5ca9 + modelInvariantIDs: + - 5845y423-g654-6fju-po78-8n53154532k6 + - 7129e420-d396-4efb-af02-6b83499b12f8 + modelNames: [] + nfNames: + - '"^pnf1.*"' + measurementGroups: + - measurementGroup: + onap.datatypes.monitoring.measurementGroup: + measurementTypes: + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: countera + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: counterb + managedObjectDNsBasic: + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dna + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dnb + - measurementGroup: + onap.datatypes.monitoring.measurementGroup: + measurementTypes: + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: counterc + - measurementType: + onap.datatypes.monitoring.measurementType: + measurementType: counterd + managedObjectDNsBasic: + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dnc + - managedObjectDNsBasic: + onap.datatypes.monitoring.managedObjectDNsBasic: + DN: dnd + - operational.apex.pmcontrol: + type: onap.policies.controlloop.operational.common.Apex + type_version: 1.0.0 + version: 1.0.0 + metadata: + policy-id: operational.apex.pmcontrol + policy-version: 1 + properties: + engineServiceParameters: + name: MyApexEngine + version: 0.0.1 + id: 45 + instanceCount: 2 + deploymentPort: 12561 + policy_type_impl: + apexPolicyModel: + key: + name: PMControlPolicy + version: 0.0.1 + keyInformation: + key: + name: PMControlPolicy_KeyInfo + version: 0.0.1 + keyInfoMap: + entry: + - key: + name: CDSActionIdentifiersType + version: 0.0.1 + value: + key: + name: CDSActionIdentifiersType + version: 0.0.1 + UUID: 6e5fa19b-14df-37e3-a4ae-8c537e861a82 + description: Generated description for concept referred to by key "CDSActionIdentifiersType:0.0.1" + - key: + name: CDSCreateResponseEvent + version: 0.0.1 + value: + key: + name: CDSCreateResponseEvent + version: 0.0.1 + UUID: 14b29e38-ac75-3273-aa4e-8583c0aa7dad + description: Generated description for concept referred to by key "CDSCreateResponseEvent:0.0.1" + - key: + name: CDSCreateResponsePayloadType + version: 0.0.1 + value: + key: + name: CDSCreateResponsePayloadType + version: 0.0.1 + UUID: 04573f8f-e772-30a5-b1d9-d7318d4a1e13 + description: Generated description for concept referred to by key "CDSCreateResponsePayloadType:0.0.1" + - key: + name: CDSCreateResponsePolicy + version: 0.0.1 + value: + key: + name: CDSCreateResponsePolicy + version: 0.0.1 + UUID: e126c965-fc09-3bfe-8f55-70f380a4a49c + description: Generated description for concept referred to by key "CDSCreateResponsePolicy:0.0.1" + - key: + name: CDSCreateResponseTask + version: 0.0.1 + value: + key: + name: CDSCreateResponseTask + version: 0.0.1 + UUID: 6165ee82-afd2-3aab-a517-f00b3f2461d2 + description: Generated description for concept referred to by key "CDSCreateResponseTask:0.0.1" + - key: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + value: + key: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + UUID: 8350ac5e-c157-38b9-9614-a0f93a830e60 + description: Generated description for concept referred to by key "CDSCreateSubscriptionPayloadType:0.0.1" + - key: + name: CDSCreateSubscriptionRequestEvent + version: 0.0.1 + value: + key: + name: CDSCreateSubscriptionRequestEvent + version: 0.0.1 + UUID: cfa325ba-226b-3a31-9183-ec43e2b6e9a2 + description: Generated description for concept referred to by key "CDSCreateSubscriptionRequestEvent:0.0.1" + - key: + name: CDSDeleteResponseEvent + version: 0.0.1 + value: + key: + name: CDSDeleteResponseEvent + version: 0.0.1 + UUID: 8be9c0fa-7437-3841-aff2-b3cec6ae3bd8 + description: Generated description for concept referred to by key "CDSDeleteResponseEvent:0.0.1" + - key: + name: CDSDeleteResponsePayloadType + version: 0.0.1 + value: + key: + name: CDSDeleteResponsePayloadType + version: 0.0.1 + UUID: 3fbfe0c9-152e-34d3-a504-09cd13c058d0 + description: Generated description for concept referred to by key "CDSDeleteResponsePayloadType:0.0.1" + - key: + name: CDSDeleteResponsePolicy + version: 0.0.1 + value: + key: + name: CDSDeleteResponsePolicy + version: 0.0.1 + UUID: a780251c-edd5-3132-b865-04313246b43c + description: Generated description for concept referred to by key "CDSDeleteResponsePolicy:0.0.1" + - key: + name: CDSDeleteResponseTask + version: 0.0.1 + value: + key: + name: CDSDeleteResponseTask + version: 0.0.1 + UUID: afce4555-3aa3-3521-a7d8-ee8cdf0d3efc + description: Generated description for concept referred to by key "CDSDeleteResponseTask:0.0.1" + - key: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + value: + key: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + UUID: 12658406-9147-3c9d-a38c-5ad5e30b092b + description: Generated description for concept referred to by key "CDSDeleteSubscriptionPayloadType:0.0.1" + - key: + name: CDSDeleteSubscriptionRequestEvent + version: 0.0.1 + value: + key: + name: CDSDeleteSubscriptionRequestEvent + version: 0.0.1 + UUID: 24380c95-9289-36e6-8cbf-0edefa15ccd9 + description: Generated description for concept referred to by key "CDSDeleteSubscriptionRequestEvent:0.0.1" + - key: + name: CDSRequestCommonHeaderType + version: 0.0.1 + value: + key: + name: CDSRequestCommonHeaderType + version: 0.0.1 + UUID: 35590ac0-062c-39f1-8786-b4ff716e30b1 + description: Generated description for concept referred to by key "CDSRequestCommonHeaderType:0.0.1" + - key: + name: CDSResponseCommonHeaderType + version: 0.0.1 + value: + key: + name: CDSResponseCommonHeaderType + version: 0.0.1 + UUID: dd7e1805-885a-350b-aaf9-ed541321ae3c + description: Generated description for concept referred to by key "CDSResponseCommonHeaderType:0.0.1" + - key: + name: CDSResponseStatusEvent + version: 0.0.1 + value: + key: + name: CDSResponseStatusEvent + version: 0.0.1 + UUID: 7986e21b-32f7-302e-9554-31f21b673493 + description: Generated description for concept referred to by key "CDSResponseStatusEvent:0.0.1" + - key: + name: CDSResponseStatusType + version: 0.0.1 + value: + key: + name: CDSResponseStatusType + version: 0.0.1 + UUID: 92b8a2cf-344e-3ce1-8cc0-2b7d3cb695fa + description: Generated description for concept referred to by key "CDSResponseStatusType:0.0.1" + - key: + name: CreateSubscriptionPayloadEvent + version: 0.0.1 + value: + key: + name: CreateSubscriptionPayloadEvent + version: 0.0.1 + UUID: 92162397-1a8e-3a3f-a469-d2af7700af4a + description: Generated description for concept referred to by key "CreateSubscriptionPayloadEvent:0.0.1" + - key: + name: CreateSubscriptionPayloadTask + version: 0.0.1 + value: + key: + name: CreateSubscriptionPayloadTask + version: 0.0.1 + UUID: bc0c69f0-52ed-38ea-b468-ae4a6fd1730d + description: Generated description for concept referred to by key "CreateSubscriptionPayloadTask:0.0.1" + - key: + name: CreateSubscriptionRequestTask + version: 0.0.1 + value: + key: + name: CreateSubscriptionRequestTask + version: 0.0.1 + UUID: 89cb75e9-f06c-30d3-b4ff-698d45f63869 + description: Generated description for concept referred to by key "CreateSubscriptionRequestTask:0.0.1" + - key: + name: DeleteSubscriptionPayloadEvent + version: 0.0.1 + value: + key: + name: DeleteSubscriptionPayloadEvent + version: 0.0.1 + UUID: 994fa441-04ab-33bb-832d-1cd12ab5d074 + description: Generated description for concept referred to by key "DeleteSubscriptionPayloadEvent:0.0.1" + - key: + name: DeleteSubscriptionPayloadTask + version: 0.0.1 + value: + key: + name: DeleteSubscriptionPayloadTask + version: 0.0.1 + UUID: 0f519117-5fea-3e4b-941f-8f778100465f + description: Generated description for concept referred to by key "DeleteSubscriptionPayloadTask:0.0.1" + - key: + name: DeleteSubscriptionRequestTask + version: 0.0.1 + value: + key: + name: DeleteSubscriptionRequestTask + version: 0.0.1 + UUID: acb772fe-d442-39e3-98f9-b1080caf4150 + description: Generated description for concept referred to by key "DeleteSubscriptionRequestTask:0.0.1" + - key: + name: MRResponseEvent + version: 0.0.1 + value: + key: + name: MRResponseEvent + version: 0.0.1 + UUID: 13c747a3-6bae-3bcf-9c80-b152e01dc194 + description: Generated description for concept referred to by key "MRResponseEvent:0.0.1" + - key: + name: PMControlPolicy + version: 0.0.1 + value: + key: + name: PMControlPolicy + version: 0.0.1 + UUID: acf1e55c-7bc5-3bd5-975a-0ca54afcd8a4 + description: Generated description for concept referred to by key "PMControlPolicy:0.0.1" + - key: + name: PMControlPolicy_Albums + version: 0.0.1 + value: + key: + name: PMControlPolicy_Albums + version: 0.0.1 + UUID: b38ad204-c2c8-32f4-9b5a-dda0aeb0145b + description: Generated description for concept referred to by key "PMControlPolicy_Albums:0.0.1" + - key: + name: PMControlPolicy_Events + version: 0.0.1 + value: + key: + name: PMControlPolicy_Events + version: 0.0.1 + UUID: be3871a0-c42a-3113-a066-82d192840eca + description: Generated description for concept referred to by key "PMControlPolicy_Events:0.0.1" + - key: + name: PMControlPolicy_KeyInfo + version: 0.0.1 + value: + key: + name: PMControlPolicy_KeyInfo + version: 0.0.1 + UUID: ced37634-28a4-3178-b7f6-2980794927b0 + description: Generated description for concept referred to by key "PMControlPolicy_KeyInfo:0.0.1" + - key: + name: PMControlPolicy_Policies + version: 0.0.1 + value: + key: + name: PMControlPolicy_Policies + version: 0.0.1 + UUID: be3d180d-ef9c-3a75-8e9c-84271a038bed + description: Generated description for concept referred to by key "PMControlPolicy_Policies:0.0.1" + - key: + name: PMControlPolicy_Schemas + version: 0.0.1 + value: + key: + name: PMControlPolicy_Schemas + version: 0.0.1 + UUID: e61973f1-189c-39e5-82f6-0d3afe298a20 + description: Generated description for concept referred to by key "PMControlPolicy_Schemas:0.0.1" + - key: + name: PMControlPolicy_Tasks + version: 0.0.1 + value: + key: + name: PMControlPolicy_Tasks + version: 0.0.1 + UUID: 5658adb3-2962-30a3-a241-fae75bb8eb4a + description: Generated description for concept referred to by key "PMControlPolicy_Tasks:0.0.1" + - key: + name: PMSubscriptionAlbum + version: 0.0.1 + value: + key: + name: PMSubscriptionAlbum + version: 0.0.1 + UUID: c2bd6f0d-6854-317a-9be2-97c08338428c + description: Generated description for concept referred to by key "PMSubscriptionAlbum:0.0.1" + - key: + name: PMSubscriptionOutputEvent + version: 0.0.1 + value: + key: + name: PMSubscriptionOutputEvent + version: 0.0.1 + UUID: 992b7819-9f69-3aa0-bb0f-6e45ea15ce05 + description: Generated description for concept referred to by key "PMSubscriptionOutputEvent:0.0.1" + - key: + name: PMSubscriptionType + version: 0.0.1 + value: + key: + name: PMSubscriptionType + version: 0.0.1 + UUID: 73c1c397-4fc3-357f-93b6-a8ad707fbaae + description: Generated description for concept referred to by key "PMSubscriptionType:0.0.1" + - key: + name: ReceiveEventPolicy + version: 0.0.1 + value: + key: + name: ReceiveEventPolicy + version: 0.0.1 + UUID: 568b7345-9de1-36d3-b6a3-9b857e6809a1 + description: Generated description for concept referred to by key "ReceiveEventPolicy:0.0.1" + - key: + name: ReceiveSubscriptionTask + version: 0.0.1 + value: + key: + name: ReceiveSubscriptionTask + version: 0.0.1 + UUID: f596afc8-100c-35eb-92c8-352355ea457d + description: Generated description for concept referred to by key "ReceiveSubscriptionTask:0.0.1" + - key: + name: SimpleIntType + version: 0.0.1 + value: + key: + name: SimpleIntType + version: 0.0.1 + UUID: 153791fd-ae0a-36a7-88a5-309a7936415d + description: Generated description for concept referred to by key "SimpleIntType:0.0.1" + - key: + name: SimpleStringType + version: 0.0.1 + value: + key: + name: SimpleStringType + version: 0.0.1 + UUID: 8a4957cf-9493-3a76-8c22-a208e23259af + description: Generated description for concept referred to by key "SimpleStringType:0.0.1" + - key: + name: SubscriptionStatusType + version: 0.0.1 + value: + key: + name: SubscriptionStatusType + version: 0.0.1 + UUID: 597643b1-9db1-31ce-85d0-e1c63c43b30b + description: Generated description for concept referred to by key "SubscriptionStatusType:0.0.1" + - key: + name: SubscriptionType + version: 0.0.1 + value: + key: + name: SubscriptionType + version: 0.0.1 + UUID: 184547bb-7d64-3cb2-a273-d7185102c5ce + description: Generated description for concept referred to by key "SubscriptionType:0.0.1" + - key: + name: UUIDType + version: 0.0.1 + value: + key: + name: UUIDType + version: 0.0.1 + UUID: 6a8cc68e-dfc8-3403-9c6d-071c886b319c + description: Generated description for concept referred to by key "UUIDType:0.0.1" + - key: + name: pmsh-operational-policy + version: 0.0.1 + value: + key: + name: pmsh-operational-policy + version: 0.0.1 + UUID: fdf2c9ff-6422-3ea6-b6b6-49b12116265d + description: Generated description for concept referred to by key "pmsh-operational-policy:0.0.1" + policies: + key: + name: PMControlPolicy_Policies + version: 0.0.1 + policyMap: + entry: + - key: + name: CDSCreateResponsePolicy + version: 0.0.1 + value: + policyKey: + name: CDSCreateResponsePolicy + version: 0.0.1 + template: Freestyle + state: + entry: + - key: CDSCreateResponseState + value: + stateKey: + parentKeyName: CDSCreateResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: CDSCreateResponseState + trigger: + name: CDSCreateResponseEvent + version: 0.0.1 + stateOutputs: + entry: + - key: ResponseOutput + value: + key: + parentKeyName: CDSCreateResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: CDSCreateResponseState + localName: ResponseOutput + outgoingEvent: + name: CDSResponseStatusEvent + version: 0.0.1 + nextState: + parentKeyName: 'NULL' + parentKeyVersion: 0.0.0 + parentLocalName: 'NULL' + localName: 'NULL' + contextAlbumReference: [] + taskSelectionLogic: + key: 'NULL' + logicFlavour: UNDEFINED + logic: '' + stateFinalizerLogicMap: + entry: [] + defaultTask: + name: CDSCreateResponseTask + version: 0.0.1 + taskReferences: + entry: + - key: + name: CDSCreateResponseTask + version: 0.0.1 + value: + key: + parentKeyName: CDSCreateResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: CDSCreateResponseState + localName: CDSCreateResponsePolicy + outputType: DIRECT + output: + parentKeyName: CDSCreateResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: CDSCreateResponseState + localName: ResponseOutput + firstState: CDSCreateResponseState + - key: + name: CDSDeleteResponsePolicy + version: 0.0.1 + value: + policyKey: + name: CDSDeleteResponsePolicy + version: 0.0.1 + template: Freestyle + state: + entry: + - key: CDSDeleteResponseState + value: + stateKey: + parentKeyName: CDSDeleteResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: CDSDeleteResponseState + trigger: + name: CDSDeleteResponseEvent + version: 0.0.1 + stateOutputs: + entry: + - key: ResponseOutput + value: + key: + parentKeyName: CDSDeleteResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: CDSDeleteResponseState + localName: ResponseOutput + outgoingEvent: + name: CDSResponseStatusEvent + version: 0.0.1 + nextState: + parentKeyName: 'NULL' + parentKeyVersion: 0.0.0 + parentLocalName: 'NULL' + localName: 'NULL' + contextAlbumReference: [] + taskSelectionLogic: + key: 'NULL' + logicFlavour: UNDEFINED + logic: '' + stateFinalizerLogicMap: + entry: [] + defaultTask: + name: CDSDeleteResponseTask + version: 0.0.1 + taskReferences: + entry: + - key: + name: CDSDeleteResponseTask + version: 0.0.1 + value: + key: + parentKeyName: CDSDeleteResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: CDSDeleteResponseState + localName: CDSDeleteResponsePolicy + outputType: DIRECT + output: + parentKeyName: CDSDeleteResponsePolicy + parentKeyVersion: 0.0.1 + parentLocalName: CDSDeleteResponseState + localName: ResponseOutput + firstState: CDSDeleteResponseState + - key: + name: ReceiveEventPolicy + version: 0.0.1 + value: + policyKey: + name: ReceiveEventPolicy + version: 0.0.1 + template: Freestyle + state: + entry: + - key: CreateOrDeleteState + value: + stateKey: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: CreateOrDeleteState + trigger: + name: PMSubscriptionOutputEvent + version: 0.0.1 + stateOutputs: + entry: + - key: CreateSubscriptionPayload + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateOrDeleteState + localName: CreateSubscriptionPayload + outgoingEvent: + name: CreateSubscriptionPayloadEvent + version: 0.0.1 + nextState: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: CreateSubscription + - key: DeleteSubscriptionPayload + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateOrDeleteState + localName: DeleteSubscriptionPayload + outgoingEvent: + name: DeleteSubscriptionPayloadEvent + version: 0.0.1 + nextState: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: DeleteSubscription + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskSelectionLogic: + key: TaskSelectionLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + var changeType = pmSubscriptionInfo.get("changeType").toString() + + executor.logger.info("Change Type is " + changeType) + + if ("CREATE".equals(changeType)) { + executor.logger.info("Choosing to create a subscription") + executor.subject.getTaskKey("CreateSubscriptionPayloadTask").copyTo(executor.selectedTask); + } + else if ("DELETE".equals(changeType)) { + executor.logger.info("Choosing to delete a subscription") + executor.subject.getTaskKey("DeleteSubscriptionPayloadTask").copyTo(executor.selectedTask); + } + + //var returnValue = executor.isTrue; + true; + stateFinalizerLogicMap: + entry: [] + defaultTask: + name: CreateSubscriptionPayloadTask + version: 0.0.1 + taskReferences: + entry: + - key: + name: CreateSubscriptionPayloadTask + version: 0.0.1 + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateOrDeleteState + localName: ReceiveEventPolicy + outputType: DIRECT + output: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateOrDeleteState + localName: CreateSubscriptionPayload + - key: + name: DeleteSubscriptionPayloadTask + version: 0.0.1 + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateOrDeleteState + localName: ReceiveEventPolicy + outputType: DIRECT + output: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateOrDeleteState + localName: DeleteSubscriptionPayload + - key: CreateSubscription + value: + stateKey: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: CreateSubscription + trigger: + name: CreateSubscriptionPayloadEvent + version: 0.0.1 + stateOutputs: + entry: + - key: IssueCreateSubscriptionRequestOutput + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateSubscription + localName: IssueCreateSubscriptionRequestOutput + outgoingEvent: + name: CDSCreateSubscriptionRequestEvent + version: 0.0.1 + nextState: + parentKeyName: 'NULL' + parentKeyVersion: 0.0.0 + parentLocalName: 'NULL' + localName: 'NULL' + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskSelectionLogic: + key: 'NULL' + logicFlavour: UNDEFINED + logic: '' + stateFinalizerLogicMap: + entry: [] + defaultTask: + name: CreateSubscriptionRequestTask + version: 0.0.1 + taskReferences: + entry: + - key: + name: CreateSubscriptionRequestTask + version: 0.0.1 + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateSubscription + localName: ReceiveEventPolicy + outputType: DIRECT + output: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: CreateSubscription + localName: IssueCreateSubscriptionRequestOutput + - key: DeleteSubscription + value: + stateKey: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: DeleteSubscription + trigger: + name: DeleteSubscriptionPayloadEvent + version: 0.0.1 + stateOutputs: + entry: + - key: IssueDeleteSubscriptionRequestOutput + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: DeleteSubscription + localName: IssueDeleteSubscriptionRequestOutput + outgoingEvent: + name: CDSDeleteSubscriptionRequestEvent + version: 0.0.1 + nextState: + parentKeyName: 'NULL' + parentKeyVersion: 0.0.0 + parentLocalName: 'NULL' + localName: 'NULL' + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskSelectionLogic: + key: 'NULL' + logicFlavour: UNDEFINED + logic: '' + stateFinalizerLogicMap: + entry: [] + defaultTask: + name: DeleteSubscriptionRequestTask + version: 0.0.1 + taskReferences: + entry: + - key: + name: DeleteSubscriptionRequestTask + version: 0.0.1 + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: DeleteSubscription + localName: ReceiveEventPolicy + outputType: DIRECT + output: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: DeleteSubscription + localName: IssueDeleteSubscriptionRequestOutput + - key: ReceiveSubscriptionState + value: + stateKey: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: ReceiveSubscriptionState + trigger: + name: pmsh-operational-policy + version: 0.0.1 + stateOutputs: + entry: + - key: ReceivePMSubscriptionOutput + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: ReceiveSubscriptionState + localName: ReceivePMSubscriptionOutput + outgoingEvent: + name: PMSubscriptionOutputEvent + version: 0.0.1 + nextState: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: 'NULL' + localName: CreateOrDeleteState + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskSelectionLogic: + key: 'NULL' + logicFlavour: UNDEFINED + logic: '' + stateFinalizerLogicMap: + entry: [] + defaultTask: + name: ReceiveSubscriptionTask + version: 0.0.1 + taskReferences: + entry: + - key: + name: ReceiveSubscriptionTask + version: 0.0.1 + value: + key: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: ReceiveSubscriptionState + localName: ReceiveEventPolicy + outputType: DIRECT + output: + parentKeyName: ReceiveEventPolicy + parentKeyVersion: 0.0.1 + parentLocalName: ReceiveSubscriptionState + localName: ReceivePMSubscriptionOutput + firstState: ReceiveSubscriptionState + tasks: + key: + name: PMControlPolicy_Tasks + version: 0.0.1 + taskMap: + entry: + - key: + name: CDSCreateResponseTask + version: 0.0.1 + value: + key: + name: CDSCreateResponseTask + version: 0.0.1 + inputFields: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSResponseCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateResponsePayloadType + version: 0.0.1 + optional: false + - key: status + value: + key: status + fieldSchemaKey: + name: CDSResponseStatusType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: status + value: + key: status + fieldSchemaKey: + name: SubscriptionStatusType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var commonHeader = executor.inFields.get("commonHeader") + var response = executor.inFields.get("payload") + var albumID = commonHeader.get("requestId") + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(albumID.toString()); + var responseStatus = executor.subject.getOutFieldSchemaHelper("status").createNewInstance(); + + responseStatus.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) + responseStatus.put("nfName", pmSubscriptionInfo.get("nfName")) + responseStatus.put("changeType", pmSubscriptionInfo.get("changeType")) + + var status = response.get(pmSubscriptionInfo.get("changeType").toLowerCase() + "_DasH_subscription_DasH_response").get("odl_DasH_response").get("status") + + executor.logger.info("RESPONSE STATUS = " + status) + + if(status == "success") { + responseStatus.put("message", "success") + } else { + responseStatus.put("message", "failed") + } + + executor.outFields.put("status", responseStatus) + + //var returnValue = executor.isTrue; + true; + - key: + name: CDSDeleteResponseTask + version: 0.0.1 + value: + key: + name: CDSDeleteResponseTask + version: 0.0.1 + inputFields: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSResponseCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteResponsePayloadType + version: 0.0.1 + optional: false + - key: status + value: + key: status + fieldSchemaKey: + name: CDSResponseStatusType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: status + value: + key: status + fieldSchemaKey: + name: SubscriptionStatusType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var commonHeader = executor.inFields.get("commonHeader") + var response = executor.inFields.get("payload") + var albumID = commonHeader.get("requestId") + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(albumID.toString()); + var responseStatus = executor.subject.getOutFieldSchemaHelper("status").createNewInstance(); + + responseStatus.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) + responseStatus.put("nfName", pmSubscriptionInfo.get("nfName")) + responseStatus.put("changeType", pmSubscriptionInfo.get("changeType")) + + var status = response.get(pmSubscriptionInfo.get("changeType").toLowerCase() + "_DasH_subscription_DasH_response").get("odl_DasH_response").get("status") + + executor.logger.info("RESPONSE STATUS = " + status) + + if(status == "success") { + responseStatus.put("message", "success") + } else { + responseStatus.put("message", "failed") + } + + executor.outFields.put("status", responseStatus) + + //var returnValue = executor.isTrue; + true; + - key: + name: CreateSubscriptionPayloadTask + version: 0.0.1 + value: + key: + name: CreateSubscriptionPayloadTask + version: 0.0.1 + inputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() + + var payloadProperties = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance(changeType + "_DasH_subscription_DasH_properties_record"); + + payloadProperties.put("nfName", pmSubscriptionInfo.get("nfName")) + payloadProperties.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) + payloadProperties.put("administrativeState", pmSubscriptionInfo.get("subscription").get("administrativeState")) + payloadProperties.put("fileBasedGP", pmSubscriptionInfo.get("subscription").get("fileBasedGP").toString()) + payloadProperties.put("fileLocation", pmSubscriptionInfo.get("subscription").get("fileLocation")) + payloadProperties.put("measurementGroups", pmSubscriptionInfo.get("subscription").get("measurementGroups")) + + var payloadEntry = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("CDSRequestPayloadEntry"); + payloadEntry.put(changeType + "_DasH_subscription_DasH_properties", payloadProperties) + + var payload = executor.subject.getOutFieldSchemaHelper("payload").createNewInstance(); + payload.put(changeType + "_DasH_subscription_DasH_request", payloadEntry); + + executor.outFields.put("albumID", executor.inFields.get("albumID")) + executor.outFields.put("payload", payload); + + //var returnValue = executor.isTrue; + true; + - key: + name: CreateSubscriptionRequestTask + version: 0.0.1 + value: + key: + name: CreateSubscriptionRequestTask + version: 0.0.1 + inputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSRequestCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() + var blueprintName = pmSubscriptionInfo.get("blueprintName").toLowerCase() + var blueprintVersion = pmSubscriptionInfo.get("blueprintVersion").toLowerCase() + var payload = executor.inFields.get("payload") + var actionName = changeType + "-subscription" + + var commonHeader = executor.subject.getOutFieldSchemaHelper("commonHeader").createNewInstance(); + commonHeader.put("originatorId", "sdnc"); + commonHeader.put("requestId", executor.inFields.get("albumID").toString()); + commonHeader.put("subRequestId", "sub-123456-1000"); + + var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("actionIdentifiers").createNewInstance(); + actionIdentifiers.put("actionName", actionName); + actionIdentifiers.put("blueprintName", blueprintName); + actionIdentifiers.put("blueprintVersion", blueprintVersion); + actionIdentifiers.put("mode", "sync"); + + executor.outFields.put("commonHeader", commonHeader); + executor.outFields.put("actionIdentifiers", actionIdentifiers); + executor.outFields.put("payload", payload); + + //var returnValue = executor.isTrue; + true; + - key: + name: DeleteSubscriptionPayloadTask + version: 0.0.1 + value: + key: + name: DeleteSubscriptionPayloadTask + version: 0.0.1 + inputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() + + var payloadProperties = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance(changeType + "_DasH_subscription_DasH_properties_record"); + + payloadProperties.put("nfName", pmSubscriptionInfo.get("nfName")) + payloadProperties.put("subscriptionName", pmSubscriptionInfo.get("subscription").get("subscriptionName")) + payloadProperties.put("administrativeState", pmSubscriptionInfo.get("subscription").get("administrativeState")) + payloadProperties.put("fileBasedGP", pmSubscriptionInfo.get("subscription").get("fileBasedGP").toString()) + payloadProperties.put("fileLocation", pmSubscriptionInfo.get("subscription").get("fileLocation")) + payloadProperties.put("measurementGroups", pmSubscriptionInfo.get("subscription").get("measurementGroups")) + + var payloadEntry = executor.subject.getOutFieldSchemaHelper("payload").createNewSubInstance("CDSRequestPayloadEntry"); + payloadEntry.put(changeType + "_DasH_subscription_DasH_properties", payloadProperties) + + var payload = executor.subject.getOutFieldSchemaHelper("payload").createNewInstance(); + payload.put(changeType + "_DasH_subscription_DasH_request", payloadEntry); + + executor.outFields.put("albumID", executor.inFields.get("albumID")) + executor.outFields.put("payload", payload); + + //var returnValue = executor.isTrue; + true; + - key: + name: DeleteSubscriptionRequestTask + version: 0.0.1 + value: + key: + name: DeleteSubscriptionRequestTask + version: 0.0.1 + inputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSRequestCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + + executor.logger.info(executor.subject.id); + + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").get(executor.inFields.get("albumID").toString()) + + var changeType = pmSubscriptionInfo.get("changeType").toLowerCase() + var blueprintName = pmSubscriptionInfo.get("blueprintName").toLowerCase() + var blueprintVersion = pmSubscriptionInfo.get("blueprintVersion").toLowerCase() + var payload = executor.inFields.get("payload") + var actionName = changeType + "-subscription" + + var commonHeader = executor.subject.getOutFieldSchemaHelper("commonHeader").createNewInstance(); + commonHeader.put("originatorId", "sdnc"); + commonHeader.put("requestId", executor.inFields.get("albumID").toString()); + commonHeader.put("subRequestId", "sub-123456-1000"); + + var actionIdentifiers = executor.subject.getOutFieldSchemaHelper("actionIdentifiers").createNewInstance(); + actionIdentifiers.put("actionName", actionName); + actionIdentifiers.put("blueprintName", blueprintName); + actionIdentifiers.put("blueprintVersion", blueprintVersion); + actionIdentifiers.put("mode", "sync"); + + executor.outFields.put("commonHeader", commonHeader); + executor.outFields.put("actionIdentifiers", actionIdentifiers); + executor.outFields.put("payload", payload); + + //var returnValue = executor.isTrue; + true; + - key: + name: ReceiveSubscriptionTask + version: 0.0.1 + value: + key: + name: ReceiveSubscriptionTask + version: 0.0.1 + inputFields: + entry: + - key: blueprintName + value: + key: blueprintName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: blueprintVersion + value: + key: blueprintVersion + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: changeType + value: + key: changeType + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: closedLoopControlName + value: + key: closedLoopControlName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: nfName + value: + key: nfName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: policyName + value: + key: policyName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: subscription + value: + key: subscription + fieldSchemaKey: + name: SubscriptionType + version: 0.0.1 + optional: false + outputFields: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + taskParameters: + entry: [] + contextAlbumReference: + - name: PMSubscriptionAlbum + version: 0.0.1 + taskLogic: + key: TaskLogic + logicFlavour: JAVASCRIPT + logic: |- + /* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix. 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========================================================= + */ + var uuidType = java.util.UUID; + + executor.logger.info(executor.subject.id); + + //albumID will be used to fetch info from our album later + var albumID = uuidType.randomUUID(); + var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").getSchemaHelper().createNewInstance(); + var returnValue = true; + + if(executor.inFields.get("policyName") != null) { + executor.logger.info("nfName in receive sub event " + executor.inFields.get("nfName")); + + var changeType = executor.inFields.get("changeType") + var nfName = executor.inFields.get("nfName") + var policyName = executor.inFields.get("policyName") + var closedLoopControlName = executor.inFields.get("closedLoopControlName") + var subscription = executor.inFields.get("subscription") + var blueprintName = executor.inFields.get("blueprintName") + var blueprintVersion = executor.inFields.get("blueprintVersion") + + pmSubscriptionInfo.put("nfName", executor.inFields.get("nfName")); + pmSubscriptionInfo.put("changeType", executor.inFields.get("changeType")) + pmSubscriptionInfo.put("policyName", executor.inFields.get("policyName")) + pmSubscriptionInfo.put("closedLoopControlName", executor.inFields.get("closedLoopControlName")) + pmSubscriptionInfo.put("subscription", subscription) + pmSubscriptionInfo.put("blueprintName", blueprintName) + pmSubscriptionInfo.put("blueprintVersion", blueprintVersion) + + + executor.getContextAlbum("PMSubscriptionAlbum").put(albumID.toString(), pmSubscriptionInfo); + + executor.outFields.put("albumID", albumID) + } else { + executor.message = "Received invalid event" + returnValue = false; + } + + returnValue; + events: + key: + name: PMControlPolicy_Events + version: 0.0.1 + eventMap: + entry: + - key: + name: CDSCreateResponseEvent + version: 0.0.1 + value: + key: + name: CDSCreateResponseEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: CDS + target: APEX + parameter: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSResponseCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateResponsePayloadType + version: 0.0.1 + optional: false + - key: status + value: + key: status + fieldSchemaKey: + name: CDSResponseStatusType + version: 0.0.1 + optional: false + - key: + name: CDSCreateSubscriptionRequestEvent + version: 0.0.1 + value: + key: + name: CDSCreateSubscriptionRequestEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: APEX + target: APEX + parameter: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSRequestCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + optional: false + - key: + name: CDSDeleteResponseEvent + version: 0.0.1 + value: + key: + name: CDSDeleteResponseEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: CDS + target: APEX + parameter: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSResponseCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteResponsePayloadType + version: 0.0.1 + optional: false + - key: status + value: + key: status + fieldSchemaKey: + name: CDSResponseStatusType + version: 0.0.1 + optional: false + - key: + name: CDSDeleteSubscriptionRequestEvent + version: 0.0.1 + value: + key: + name: CDSDeleteSubscriptionRequestEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: APEX + target: APEX + parameter: + entry: + - key: actionIdentifiers + value: + key: actionIdentifiers + fieldSchemaKey: + name: CDSActionIdentifiersType + version: 0.0.1 + optional: false + - key: commonHeader + value: + key: commonHeader + fieldSchemaKey: + name: CDSRequestCommonHeaderType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + optional: false + - key: + name: CDSResponseStatusEvent + version: 0.0.1 + value: + key: + name: CDSResponseStatusEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: APEX + target: DCAE + parameter: + entry: + - key: status + value: + key: status + fieldSchemaKey: + name: SubscriptionStatusType + version: 0.0.1 + optional: false + - key: + name: CreateSubscriptionPayloadEvent + version: 0.0.1 + value: + key: + name: CreateSubscriptionPayloadEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: APEX + target: APEX + parameter: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + optional: false + - key: + name: DeleteSubscriptionPayloadEvent + version: 0.0.1 + value: + key: + name: DeleteSubscriptionPayloadEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: APEX + target: APEX + parameter: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: payload + value: + key: payload + fieldSchemaKey: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + optional: false + - key: + name: MRResponseEvent + version: 0.0.1 + value: + key: + name: MRResponseEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: DCAE + target: APEX + parameter: + entry: + - key: count + value: + key: count + fieldSchemaKey: + name: SimpleIntType + version: 0.0.1 + optional: false + - key: serverTimeMs + value: + key: serverTimeMs + fieldSchemaKey: + name: SimpleIntType + version: 0.0.1 + optional: false + - key: + name: PMSubscriptionOutputEvent + version: 0.0.1 + value: + key: + name: PMSubscriptionOutputEvent + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: APEX + target: APEX + parameter: + entry: + - key: albumID + value: + key: albumID + fieldSchemaKey: + name: UUIDType + version: 0.0.1 + optional: false + - key: + name: pmsh-operational-policy + version: 0.0.1 + value: + key: + name: pmsh-operational-policy + version: 0.0.1 + nameSpace: org.onap.policy.apex.onap.pmcontrol + source: DCAE + target: APEX + parameter: + entry: + - key: blueprintName + value: + key: blueprintName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: blueprintVersion + value: + key: blueprintVersion + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: changeType + value: + key: changeType + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: closedLoopControlName + value: + key: closedLoopControlName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: nfName + value: + key: nfName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: policyName + value: + key: policyName + fieldSchemaKey: + name: SimpleStringType + version: 0.0.1 + optional: false + - key: subscription + value: + key: subscription + fieldSchemaKey: + name: SubscriptionType + version: 0.0.1 + optional: false + albums: + key: + name: PMControlPolicy_Albums + version: 0.0.1 + albums: + entry: + - key: + name: PMSubscriptionAlbum + version: 0.0.1 + value: + key: + name: PMSubscriptionAlbum + version: 0.0.1 + scope: policy + isWritable: true + itemSchema: + name: PMSubscriptionType + version: 0.0.1 + schemas: + key: + name: PMControlPolicy_Schemas + version: 0.0.1 + schemas: + entry: + - key: + name: CDSActionIdentifiersType + version: 0.0.1 + value: + key: + name: CDSActionIdentifiersType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "record", + "name": "ActionIdentifiers_Type", + "namespace": "org.onap.policy.apex.onap.helloworld", + "fields": [ + { + "name": "actionName", + "type": "string" + }, + { + "name": "blueprintName", + "type": "string" + }, + { + "name": "blueprintVersion", + "type": "string" + }, + { + "name": "mode", + "type": "string" + } + ] + } + - key: + name: CDSCreateResponsePayloadType + version: 0.0.1 + value: + key: + name: CDSCreateResponsePayloadType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "name": "CreateResponsePayloadEntry", + "type": "record", + "namespace": "org.onap.policy.apex.onap.helloworld", + "fields": [ + { + "name": "create_DasH_subscription_DasH_response", + "type": { + "name": "create_DasH_subscription_DasH_response", + "type": "record", + "fields": [ + { + "name": "odl_DasH_response", + "type": { + "name": "odl_DasH_response", + "type": "record", + "fields": [ + { + "name": "status", + "type": "string" + } + ] + } + } + ] + } + } + ] + } + - key: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + value: + key: + name: CDSCreateSubscriptionPayloadType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "map", + "values": { + "type": "record", + "name": "CDSRequestPayloadEntry", + "fields": [ + { + "name": "create_DasH_subscription_DasH_properties", + "type": { + "name": "create_DasH_subscription_DasH_properties_record", + "type": "record", + "fields": [ + { + "name": "nfName", + "type": "string" + }, + { + "name": "subscriptionName", + "type": "string" + }, + { + "name": "administrativeState", + "type": "string" + }, + { + "name": "fileBasedGP", + "type": "string" + }, + { + "name": "fileLocation", + "type": "string" + }, + { + "name": "measurementGroups", + "type": { + "type": "array", + "items": { + "name": "measurementGroups_record", + "type": "record", + "fields": [ + { + "name": "measurementGroup", + "type": { + "name": "measurementGroup", + "type": "record", + "fields": [ + { + "name": "measurementTypes", + "type": { + "type": "array", + "items": { + "name": "measurementTypes_record", + "type": "record", + "fields": [ + { + "name": "measurementType", + "type": "string" + } + ] + } + } + }, + { + "name": "managedObjectDNsBasic", + "type": { + "type": "array", + "items": { + "name": "managedObjectDNsBasic_record", + "type": "record", + "fields": [ + { + "name": "DN", + "type": "string" + } + ] + } + } + } + ] + } + } + ] + } + } + } + ] + } + } + ] + } + } + - key: + name: CDSDeleteResponsePayloadType + version: 0.0.1 + value: + key: + name: CDSDeleteResponsePayloadType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "name": "DeleteResponsePayloadEntry", + "type": "record", + "namespace": "com.acme.avro", + "fields": [ + { + "name": "delete_DasH_subscription_DasH_response", + "type": { + "name": "delete_DasH_subscription_DasH_response", + "type": "record", + "fields": [ + { + "name": "odl_DasH_response", + "type": { + "name": "odl_DasH_response", + "type": "record", + "fields": [ + { + "name": "status", + "type": "string" + } + ] + } + } + ] + } + } + ] + } + - key: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + value: + key: + name: CDSDeleteSubscriptionPayloadType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "map", + "values": { + "type": "record", + "name": "CDSRequestPayloadEntry", + "fields": [ + { + "name": "delete_DasH_subscription_DasH_properties", + "type": { + "name": "delete_DasH_subscription_DasH_properties_record", + "type": "record", + "fields": [ + { + "name": "nfName", + "type": "string" + }, + { + "name": "subscriptionName", + "type": "string" + }, + { + "name": "administrativeState", + "type": "string" + }, + { + "name": "fileBasedGP", + "type": "string" + }, + { + "name": "fileLocation", + "type": "string" + }, + { + "name": "measurementGroups", + "type": { + "type": "array", + "items": { + "name": "measurementGroups_record", + "type": "record", + "fields": [ + { + "name": "measurementGroup", + "type": { + "name": "measurementGroup", + "type": "record", + "fields": [ + { + "name": "measurementTypes", + "type": { + "type": "array", + "items": { + "name": "measurementTypes_record", + "type": "record", + "fields": [ + { + "name": "measurementType", + "type": "string" + } + ] + } + } + }, + { + "name": "managedObjectDNsBasic", + "type": { + "type": "array", + "items": { + "name": "managedObjectDNsBasic_record", + "type": "record", + "fields": [ + { + "name": "DN", + "type": "string" + } + ] + } + } + } + ] + } + } + ] + } + } + } + ] + } + } + ] + } + } + - key: + name: CDSRequestCommonHeaderType + version: 0.0.1 + value: + key: + name: CDSRequestCommonHeaderType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "record", + "name": "RequestCommonHeader_Type", + "namespace": "org.onap.policy.apex.onap.helloworld", + "fields": [ + { + "name": "originatorId", + "type": "string" + }, + { + "name": "requestId", + "type": "string" + }, + { + "name": "subRequestId", + "type": "string" + } + ] + } + - key: + name: CDSResponseCommonHeaderType + version: 0.0.1 + value: + key: + name: CDSResponseCommonHeaderType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "record", + "name": "ResponseCommonHeader_Type", + "namespace": "org.onap.policy.apex.onap.helloworld", + "fields": [ + { + "name": "originatorId", + "type": "string" + }, + { + "name": "requestId", + "type": "string" + }, + { + "name": "subRequestId", + "type": "string" + }, + { + "name": "timestamp", + "type": "string" + }, + { + "name": "flags", + "type": ["null", "string"] + } + ] + } + - key: + name: CDSResponseStatusType + version: 0.0.1 + value: + key: + name: CDSResponseStatusType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "record", + "name": "ResponseStatus_Type", + "namespace": "org.onap.policy.apex.onap.helloworld", + "fields": [ + { + "name": "code", + "type": "int" + }, + { + "name": "eventType", + "type": "string" + }, + { + "name": "timestamp", + "type": "string" + }, + { + "name": "message", + "type": "string" + } + ] + } + - key: + name: PMSubscriptionType + version: 0.0.1 + value: + key: + name: PMSubscriptionType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: "{\n\t\"name\": \"PMSubscription\",\n\t\"type\": \"record\",\n\t\"namespace\": \"\ + org.onap.policy.apex.onap.pmcontrol\",\n\t\"fields\": [\n {\n \"name\": \"nfName\"\ + ,\n \"type\": \"string\"\n },\n\t {\n\t\t\t\"name\": \"changeType\",\n\t\t\t\"\ + type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"closedLoopControlName\",\n\t\t\t\"type\": \"\ + string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"policyName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\ + {\n\t\t \"name\": \"blueprintName\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t \"name\"\ + : \"blueprintVersion\",\n\t\t \"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"subscription\"\ + ,\n\t\t\t\"type\": {\n\t\t\t\t\"name\": \"subscription\",\n\t\t\t\t\"type\": \"record\",\n\t\t\t\t\ + \"fields\": [{\n\t\t\t\t\t\t\"name\": \"subscriptionName\",\n\t\t\t\t\t\t\"type\": \"string\"\n\t\t\ + \t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"administrativeState\",\n\t\t\t\t\t\t\"type\": \"string\"\ + \n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\t\t\t\"type\": \"int\"\ + \n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"fileLocation\",\n\t\t\t\t\t\t\"type\": \"string\"\ + \n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\t\t\t\"type\": {\n\ + \t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\"name\": \"Measurement_Groups_Type\"\ + ,\n\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\"\ + : \"measurementGroup\",\n\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"name\": \"Measurement_Group_Type\"\ + ,\n\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\ + \t\t\t\t\"name\": \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\ + \t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"\ + name\": \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\ + \t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementType\",\n\t\ + \t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\ + \t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\ + \t\t\t\t\t\t\t\t\"name\": \"managedObjectDNsBasic\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\ + \t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\ + \t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\"\ + ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"DN\",\n\t\ + \t\t\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\ + \t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\ + \t\t\t\t}\n\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\ + \t}\n\t]\n}" + - key: + name: SimpleIntType + version: 0.0.1 + value: + key: + name: SimpleIntType + version: 0.0.1 + schemaFlavour: Java + schemaDefinition: java.lang.Integer + - key: + name: SimpleStringType + version: 0.0.1 + value: + key: + name: SimpleStringType + version: 0.0.1 + schemaFlavour: Java + schemaDefinition: java.lang.String + - key: + name: SubscriptionStatusType + version: 0.0.1 + value: + key: + name: SubscriptionStatusType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: |- + { + "type": "record", + "name": "ActivateSubscriptionStatus_Type", + "namespace": "org.onap.policy.apex.onap.helloworld", + "fields": [ + { + "name": "subscriptionName", + "type": "string" + }, + { + "name": "nfName", + "type": "string" + }, + { + "name": "changeType", + "type": "string" + }, + { + "name": "message", + "type": "string" + } + ] + } + - key: + name: SubscriptionType + version: 0.0.1 + value: + key: + name: SubscriptionType + version: 0.0.1 + schemaFlavour: Avro + schemaDefinition: "{\n\t\"name\": \"subscription\",\n\t\"type\": \"record\",\n\t\"fields\": [{\n\t\t\ + \t\"name\": \"subscriptionName\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"administrativeState\"\ + ,\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileBasedGP\",\n\t\t\t\"type\": \"\ + int\"\n\t\t},\n\t\t{\n\t\t\t\"name\": \"fileLocation\",\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\ + {\n\t\t\t\"name\": \"measurementGroups\",\n\t\t\t\"type\": {\n\t\t\t\t\"type\": \"array\",\n\t\t\t\ + \t\"items\": {\n\t\t\t\t\t\"name\": \"Measurement_Groups_Type\",\n\t\t\t\t\t\"type\": \"record\",\n\ + \t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\"name\": \"measurementGroup\",\n\t\t\t\t\t\t\"type\": {\n\t\ + \t\t\t\t\t\t\"name\": \"Measurement_Group_Type\",\n\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\ + \t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\"name\": \"measurementTypes\",\n\t\t\t\t\t\t\t\t\t\"type\"\ + : {\n\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\": {\n\t\t\t\t\t\t\t\t\t\ + \t\t\"name\": \"Measurement_Types_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"type\": \"record\",\n\t\t\t\t\t\ + \t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"measurementType\",\n\t\t\t\t\t\t\t\ + \t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ + }\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\"name\": \"managedObjectDNsBasic\",\n\ + \t\t\t\t\t\t\t\t\t\"type\": {\n\t\t\t\t\t\t\t\t\t\t\"type\": \"array\",\n\t\t\t\t\t\t\t\t\t\t\"items\"\ + : {\n\t\t\t\t\t\t\t\t\t\t\t\"name\": \"Managed_Object_Dns_Basic_Type\",\n\t\t\t\t\t\t\t\t\t\t\t\"\ + type\": \"record\",\n\t\t\t\t\t\t\t\t\t\t\t\"fields\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": \"DN\"\ + ,\n\t\t\t\t\t\t\t\t\t\t\t\t\"type\": \"string\"\n\t\t\t\t\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t\t\t\t\t}\n\ + \t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\ + \t\t}\n\t\t}\n\t]\n}" + - key: + name: UUIDType + version: 0.0.1 + value: + key: + name: UUIDType + version: 0.0.1 + schemaFlavour: Java + schemaDefinition: java.util.UUID + engineParameters: + executorParameters: + JAVASCRIPT: + parameterClassName: org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters + contextParameters: + parameterClassName: org.onap.policy.apex.context.parameters.ContextParameters + schemaParameters: + Avro: + parameterClassName: org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters + Java: + parameterClassName: org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters + jsonAdapters: + Instant: + adaptedClass: java.time.Instant + adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter + eventInputParameters: + DCAEConsumer: + carrierTechnologyParameters: + carrierTechnology: RESTCLIENT + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters + parameters: + consumerPollTime: '50' + url: https://message-router:3905/events/unauthenticated.DCAE_CL_OUTPUT/cg1/sg1 + eventProtocolParameters: + eventProtocol: JSON + parameters: + nameAlias: policyName + eventName: pmsh-operational-policy + eventNameFilter: pmsh-operational-policy + CDSRequestConsumer: + carrierTechnologyParameters: + carrierTechnology: RESTREQUESTOR + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters + parameters: + url: http://10.10.10.184:30254/api/v1/execution-service/process + httpMethod: POST + restRequestTimeout: 2000 + httpHeaders: + - - Authorization + - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== + eventProtocolParameters: + eventProtocol: JSON + eventName: CDSCreateResponseEvent + eventNameFilter: CDSCreateResponseEvent + requestorMode: true + requestorPeer: CDSRequestProducer + requestorTimeout: 500 + CDSDeleteRequestConsumer: + carrierTechnologyParameters: + carrierTechnology: RESTREQUESTOR + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters + parameters: + url: http://10.10.10.184:30254/api/v1/execution-service/process + httpMethod: POST + restRequestTimeout: 2000 + httpHeaders: + - - Authorization + - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== + eventProtocolParameters: + eventProtocol: JSON + eventName: CDSDeleteResponseEvent + eventNameFilter: CDSDeleteResponseEvent + requestorMode: true + requestorPeer: CDSDeleteRequestProducer + requestorTimeout: 500 + CDSReplyConsumer: + carrierTechnologyParameters: + carrierTechnology: RESTREQUESTOR + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters + parameters: + url: https://message-router:3905/events/unauthenticated.PMSH_CL_INPUT + httpMethod: POST + restRequestTimeout: 2000 + eventProtocolParameters: + eventProtocol: JSON + eventName: MRResponseEvent + eventNameFilter: MRResponseEvent + requestorMode: true + requestorPeer: CDSReplyProducer + requestorTimeout: 500 + eventOutputParameters: + logOutputter: + carrierTechnologyParameters: + carrierTechnology: FILE + parameters: + fileName: /tmp/outputevents.log + eventProtocolParameters: + eventProtocol: JSON + StdOutOutputter: + carrierTechnologyParameters: + carrierTechnology: FILE + parameters: + standardIo: true + eventProtocolParameters: + eventProtocol: JSON + CDSRequestProducer: + carrierTechnologyParameters: + carrierTechnology: RESTREQUESTOR + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters + eventProtocolParameters: + eventProtocol: JSON + eventNameFilter: CDSCreateSubscriptionRequestEvent + requestorMode: true + requestorPeer: CDSRequestConsumer + requestorTimeout: 500 + CDSDeleteRequestProducer: + carrierTechnologyParameters: + carrierTechnology: RESTREQUESTOR + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters + eventProtocolParameters: + eventProtocol: JSON + eventNameFilter: CDSDeleteSubscriptionRequestEvent + requestorMode: true + requestorPeer: CDSDeleteRequestConsumer + requestorTimeout: 500 + CDSReplyProducer: + carrierTechnologyParameters: + carrierTechnology: RESTREQUESTOR + parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters + eventProtocolParameters: + eventProtocol: JSON + eventNameFilter: CDSResponseStatusEvent + requestorMode: true + requestorPeer: CDSReplyConsumer + requestorTimeout: 500 diff --git a/tosca-controlloop/common/src/test/resources/demo/Notes.txt b/tosca-controlloop/common/src/test/resources/demo/Notes.txt new file mode 100644 index 000000000..21be91449 --- /dev/null +++ b/tosca-controlloop/common/src/test/resources/demo/Notes.txt @@ -0,0 +1,39 @@ +Run DMaaP simulator using Docker +c/Users/${USER}/Github/simulator/distribution +${USER}@S031PC03 MINGW64 ~/Github/simulator/distribution (master) +$ docker run -p 3904:3904 --volume //c/Users/${USER}/Github/simulator/distribution:/opt/app/policy/simulators/etc/mounted:ro --name=dmaap-simulator nexus3.onap.org:10001/onap/policy-models-simulator:latest + + +Run DMaaP simulator using Maven +Check out policy models +Go to policy/models/models-sim/models-sim-dmaap +mvn exec:java -Dexec.mainClass=org.onap.policy.models.sim.dmaap.startstop.Main -Dexec.args="-c src/main/resources/etc/DefaultConfig.json" + + +Run CL from command line +Go to clamp/tosca-controlloop/runtime +mvn exec:java -Dexec.mainClass=org.onap.policy.clamp.controlloop.runtime.main.startstop.Main -Dexec.args="-c src/test/resources/parameters/TestParametersMariaDB.json" + +Run Participant from command line +mvn exec:java -Dexec.mainClass=org.onap.policy.clamp.controlloop.participants.ParticipantMain -Dexec.args=" -c src/main/resources/config/CDSParticipantConfig.json" +mvn exec:java -Dexec.mainClass=org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.Main -Dexec.args=" -c src/main/resources/config/DCAEParticipantConfig.json" +mvn exec:java -Dexec.mainClass=org.onap.policy.clamp.controlloop.participants.ParticipantMain -Dexec.args=" -c src/main/resources/config/PolicyParticipantConfig.json" + +Config of DB + +Prompt > mysql +MariaDB [(none)]> create database controlloop; +MariaDB [(none)]> CREATE USER 'policy'@localhost IDENTIFIED BY 'P01icY'; +MariaDB [(none)]> GRANT ALL PRIVILEGES ON controlloop.* TO 'policy'@'localhost';\ +MariaDB [(none)]> SHOW GRANTS for 'policy'@localhost; ++---------------------------------------------------------------------------------------------------------------+ +| Grants for policy@localhost | ++---------------------------------------------------------------------------------------------------------------+ +| GRANT USAGE ON *.* TO `policy`@`localhost` IDENTIFIED BY PASSWORD '*D0574A541C5DEDF11838FB41CA04E256FD5A04CC' | +| GRANT ALL PRIVILEGES ON `controlloop`.* TO `policy`@`localhost` | ++---------------------------------------------------------------------------------------------------------------+ +2 rows in set (0.000 sec) + + +Run Policy API: +mvn exec:java -Dexec.mainClass=org.onap.policy.api.main.startstop.Main -Dexec.args="-c ../../clamp-tpn/tosca-controlloop/common/src/test/resources/demo/policy-api/PolicyAPIConfig.json" diff --git a/tosca-controlloop/common/src/test/resources/demo/config/DEMO.postman_collection.json b/tosca-controlloop/common/src/test/resources/demo/config/DEMO.postman_collection.json new file mode 100644 index 000000000..0b4c1f2ce --- /dev/null +++ b/tosca-controlloop/common/src/test/resources/demo/config/DEMO.postman_collection.json @@ -0,0 +1,302 @@ +{ + "info": { + "_postman_id": "44176e3a-cd0d-457f-9ea9-b414bc368f33", + "name": "DEMO", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Demo: Comission control loop definition Multiple Copy", + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "zb!XztG34", + "type": "string" + }, + { + "key": "username", + "value": "healthcheck", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "X-ONAP-RequestID", + "type": "text", + "value": "709c62b3-8918-41b9-a747-d21eb79c6c20" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/yaml" + } + ], + "body": { + "mode": "raw", + "raw": "tosca_definitions_version: tosca_simple_yaml_1_1_0\ndata_types:\n onap.datatypes.ToscaConceptIdentifier:\n derived_from: tosca.datatypes.Root\n properties:\n name:\n type: string\n required: true\n version:\n type: string\n required: true\n org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo:\n name: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n properties:\n consulUrl:\n name: consulUrl\n type: string\n typeVersion: 0.0.0\n description: Consul url for this entry\n required: true\n consul_body:\n name: consulBody\n type: string\n typeVersion: 0.0.0\n description: Body of Consul entry\n required: true\n onap.datatype.controlloop.Target:\n derived_from: tosca.datatypes.Root\n description: Definition for a entity in A&AI to perform a control loop operation on\n properties:\n targetType:\n type: string\n description: Category for the target type\n required: true\n constraints:\n - valid_values:\n - VNF\n - VM\n - VFMODULE\n - PNF\n entityIds:\n type: map\n description: |\n Map of values that identify the resource. If none are provided, it is assumed that the\n entity that generated the ONSET event will be the target.\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CSAR_RESOURCES\n entry_schema:\n type: string\n onap.datatype.controlloop.Actor:\n derived_from: tosca.datatypes.Root\n description: An actor/operation/target definition\n properties:\n actor:\n type: string\n description: The actor performing the operation.\n required: true\n metadata:\n clamp_possible_values: Dictionary:DefaultActors,ClampExecution:CDS/actor\n operation:\n type: string\n description: The operation the actor is performing.\n metadata:\n clamp_possible_values: Dictionary:DefaultOperations,ClampExecution:CDS/operation\n required: true\n target:\n type: onap.datatype.controlloop.Target\n description: The resource the operation should be performed on.\n required: true\n payload:\n type: map\n description: Name/value pairs of payload information passed by Policy to the actor\n required: false\n metadata:\n clamp_possible_values: ClampExecution:CDS/payload\n entry_schema:\n type: string\n onap.datatype.controlloop.Operation:\n derived_from: tosca.datatypes.Root\n description: An operation supported by an actor\n properties:\n id:\n type: string\n description: Unique identifier for the operation\n required: true\n description:\n type: string\n description: A user-friendly description of the intent for the operation\n required: false\n operation:\n type: onap.datatype.controlloop.Actor\n description: The definition of the operation to be performed.\n required: true\n timeout:\n type: integer\n description: The amount of time for the actor to perform the operation.\n required: true\n retries:\n type: integer\n description: The number of retries the actor should attempt to perform the operation.\n required: true\n default: 0\n success:\n type: string\n description: Points to the operation to invoke on success. A value of \"final_success\" indicates and end to the operation.\n required: false\n default: final_success\n failure:\n type: string\n description: Points to the operation to invoke on Actor operation failure.\n required: false\n default: final_failure\n failure_timeout:\n type: string\n description: Points to the operation to invoke when the time out for the operation occurs.\n required: false\n default: final_failure_timeout\n failure_retries:\n type: string\n description: Points to the operation to invoke when the current operation has exceeded its max retries.\n required: false\n default: final_failure_retries\n failure_exception:\n type: string\n description: Points to the operation to invoke when the current operation causes an exception.\n required: false\n default: final_failure_exception\n failure_guard:\n type: string\n description: Points to the operation to invoke when the current operation is blocked due to guard policy enforcement.\n required: false\n default: final_failure_guard\n onap.datatypes.monitoring.managedObjectDNsBasic:\n constraints: []\n properties:\n DN:\n name: DN\n type: string\n typeVersion: 0.0.0\n description: Managed object distinguished name\n required: true\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.managedObjectDNsBasic\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.managedObjectDNsBasics:\n constraints: []\n properties:\n managedObjectDNsBasic:\n name: managedObjectDNsBasic\n type: map\n typeVersion: 0.0.0\n description: Managed object distinguished name object\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.managedObjectDNsBasic\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.managedObjectDNsBasics\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementGroup:\n constraints: []\n properties:\n measurementTypes:\n name: measurementTypes\n type: list\n typeVersion: 0.0.0\n description: List of measurement types\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementTypes\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n managedObjectDNsBasic:\n name: managedObjectDNsBasic\n type: list\n typeVersion: 0.0.0\n description: List of managed object distinguished names\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.managedObjectDNsBasics\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementGroup\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementGroups:\n constraints: []\n properties:\n measurementGroup:\n name: measurementGroup\n type: map\n typeVersion: 0.0.0\n description: Measurement Group\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementGroup\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementGroups\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementType:\n constraints: []\n properties:\n measurementType:\n name: measurementType\n type: string\n typeVersion: 0.0.0\n description: Measurement type\n required: true\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementType\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.measurementTypes:\n constraints: []\n properties:\n measurementType:\n name: measurementType\n type: map\n typeVersion: 0.0.0\n description: Measurement type object\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementType\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.measurementTypes\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.nfFilter:\n constraints: []\n properties:\n modelNames:\n name: modelNames\n type: list\n typeVersion: 0.0.0\n description: List of model names\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n modelInvariantIDs:\n name: modelInvariantIDs\n type: list\n typeVersion: 0.0.0\n description: List of model invariant IDs\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n modelVersionIDs:\n name: modelVersionIDs\n type: list\n typeVersion: 0.0.0\n description: List of model version IDs\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n nfNames:\n name: nfNames\n type: list\n typeVersion: 0.0.0\n description: List of network functions\n required: true\n constraints: []\n entry_schema:\n type: string\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.nfFilter\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\n onap.datatypes.monitoring.subscription:\n constraints: []\n properties:\n measurementGroups:\n name: measurementGroups\n type: list\n typeVersion: 0.0.0\n description: Measurement Groups\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.measurementGroups\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n fileBasedGP:\n name: fileBasedGP\n type: integer\n typeVersion: 0.0.0\n description: File based granularity period\n required: true\n constraints: []\n metadata: {}\n fileLocation:\n name: fileLocation\n type: string\n typeVersion: 0.0.0\n description: ROP file location\n required: true\n constraints: []\n metadata: {}\n subscriptionName:\n name: subscriptionName\n type: string\n typeVersion: 0.0.0\n description: Name of the subscription\n required: true\n constraints: []\n metadata: {}\n administrativeState:\n name: administrativeState\n type: string\n typeVersion: 0.0.0\n description: State of the subscription\n required: true\n constraints:\n - valid_values:\n - LOCKED\n - UNLOCKED\n metadata: {}\n nfFilter:\n name: nfFilter\n type: map\n typeVersion: 0.0.0\n description: Network function filter\n required: true\n constraints: []\n entry_schema:\n type: onap.datatypes.monitoring.nfFilter\n typeVersion: 0.0.0\n constraints: []\n metadata: {}\n name: onap.datatypes.monitoring.subscription\n version: 0.0.0\n derived_from: tosca.datatypes.Root\n metadata: {}\npolicy_types:\n onap.policies.Monitoring:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that govern monitoring provisioning\n version: 1.0.0\n name: onap.policies.Monitoring\n onap.policies.Sirisha:\n derived_from: tosca.policies.Root\n description: a base policy type for all policies that govern monitoring provisioning\n version: 1.0.0\n name: onap.policies.Sirisha\n onap.policies.monitoring.dcae-pm-subscription-handler:\n properties:\n pmsh_policy:\n name: pmsh_policy\n type: onap.datatypes.monitoring.subscription\n typeVersion: 0.0.0\n description: PMSH Policy JSON\n required: false\n constraints: []\n metadata: {}\n name: onap.policies.monitoring.dcae-pm-subscription-handler\n version: 1.0.0\n derived_from: onap.policies.Monitoring\n metadata: {}\n onap.policies.controlloop.operational.Common:\n derived_from: tosca.policies.Root\n version: 1.0.0\n name: onap.policies.controlloop.operational.Common\n description: |\n Operational Policy for Control Loop execution. Originated in Frankfurt to support TOSCA Compliant\n Policy Types. This does NOT support the legacy Policy YAML policy type.\n properties:\n id:\n type: string\n description: The unique control loop id.\n required: true\n timeout:\n type: integer\n description: |\n Overall timeout for executing all the operations. This timeout should equal or exceed the total\n timeout for each operation listed.\n required: true\n abatement:\n type: boolean\n description: Whether an abatement event message will be expected for the control loop from DCAE.\n required: true\n default: false\n trigger:\n type: string\n description: Initial operation to execute upon receiving an Onset event message for the Control Loop.\n required: true\n operations:\n type: list\n description: List of operations to be performed when Control Loop is triggered.\n required: true\n entry_schema:\n type: onap.datatype.controlloop.Operation\n onap.policies.controlloop.operational.common.Apex:\n derived_from: onap.policies.controlloop.operational.Common\n type_version: 1.0.0\n version: 1.0.0\n name: onap.policies.controlloop.operational.common.Apex\n description: Operational policies for Apex PDP\n properties:\n engineServiceParameters:\n type: string\n description: The engine parameters like name, instanceCount, policy implementation, parameters etc.\n required: true\n eventInputParameters:\n type: string\n description: The event input parameters.\n required: true\n eventOutputParameters:\n type: string\n description: The event output parameters.\n required: true\n javaProperties:\n type: string\n description: Name/value pairs of properties to be set for APEX if needed.\n required: false\nnode_types:\n org.onap.policy.clamp.controlloop.Participant:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n org.onap.policy.clamp.controlloop.ControlLoopElement:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n participant_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\n org.onap.policy.clamp.controlloop.ControlLoop:\n version: 1.0.1\n derived_from: tosca.nodetypes.Root\n properties:\n provider:\n type: string\n requred: false\n elements:\n type: list\n required: true\n entry_schema:\n type: onap.datatypes.ToscaConceptIdentifier\n org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement\n properties:\n dcae_blueprint_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: false\n dcae_blueprint:\n type: onap.dcae.cloudify_blueprint\n requred: false\n consul_info:\n type: list\n required: false\n entry_schema:\n type: org.onap.datatypes.policy.clamp.controlloop.DCAEMicroserviceControlLoopElementConsulInfo\n org.onap.policy.clamp.controlloop.PolicyControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement\n properties:\n policy_type_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\n policy_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: false\n org.onap.policy.clamp.controlloop.CDSControlLoopElement:\n version: 1.0.1\n derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement\n properties:\n cds_blueprint_id:\n type: onap.datatypes.ToscaConceptIdentifier\n requred: true\ntopology_template:\n inputs:\n pmsh_monitoring_policy:\n type: onap.datatypes.ToscaConceptIdentifier\n description: The ID of the PMSH monitoring policy to use\n default:\n name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n version: 1.0.0\n pmsh_operational_policy:\n type: onap.datatypes.ToscaConceptIdentifier\n description: The ID of the PMSH operational policy to use\n default:\n name: operational.apex.pmcontrol\n version: 1.0.0\n node_templates:\n org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant:\n version: 2.3.4\n type: org.onap.policy.clamp.controlloop.Participant\n type_version: 1.0.1\n description: Participant for DCAE microservices\n properties:\n provider: ONAP\n org.onap.policy.controlloop.PolicyControlLoopParticipant:\n version: 2.3.1\n type: org.onap.policy.clamp.controlloop.Participant\n type_version: 1.0.1\n description: Participant for DCAE microservices\n properties:\n provider: ONAP\n org.onap.domain.pmsh.PMSH_DCAEMicroservice:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the DCAE microservice for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participant_id:\n name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant\n version: 2.3.4\n dcae_blueprint:\n tosca_definitions_version: cloudify_dsl_1_3\n imports:\n - https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml\n - plugin:k8splugin?version=3.7.0\n - plugin:pgaas?version=1.3.0\n - plugin:clamppolicyplugin?version=1.1.0\n inputs:\n tag_version:\n type: string\n description: Docker image to be used\n default: nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2\n replicas:\n type: integer\n description: Number of instances\n default: 1\n operational_policy_name:\n type: string\n default: operational.apex.pmcontrol\n control_loop_name:\n type: string\n default: pmsh-control-loop\n pmsh_publish_topic_name:\n type: string\n default: unauthenticated.DCAE_CL_OUTPUT\n policy_feedback_topic_name:\n type: string\n default: unauthenticated.PMSH_CL_INPUT\n aai_notification_topic_name:\n type: string\n default: AAI-EVENT\n publisher_client_role:\n type: string\n description: Client role to request secure access to topic\n default: org.onap.dcae.pmPublisher\n subscriber_client_role:\n type: string\n description: Client role to request secure access to topic\n default: org.onap.dcae.pmSubscriber\n dcae_location:\n type: string\n description: DCAE location for the subscriber, used to set up routing\n default: san-francisco\n cpu_limit:\n type: string\n default: 1000m\n cpu_request:\n type: string\n default: 1000m\n memory_limit:\n type: string\n default: 1024Mi\n memory_request:\n type: string\n default: 1024Mi\n pgaas_cluster_name:\n type: string\n default: dcae-pg-primary.onap\n enable_tls:\n type: boolean\n default: true\n protocol:\n type: string\n description: PMSH protocol. If enable_tls is false, set to http\n default: https\n policy_model_id:\n type: string\n default: onap.policies.monitoring.dcae-pm-subscription-handler\n policy_id:\n type: string\n default: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n node_templates:\n pgaasvm:\n type: dcae.nodes.pgaas.database\n properties:\n writerfqdn:\n get_input: pgaas_cluster_name\n name: pmsh\n pmsh:\n type: dcae.nodes.ContainerizedServiceComponentUsingDmaap\n interfaces:\n cloudify.interfaces.lifecycle:\n create:\n inputs:\n ports:\n - '8443:0'\n envs:\n PMSH_PG_URL:\n get_attribute:\n - pgaasvm\n - admin\n - host\n PMSH_PG_PASSWORD:\n get_attribute:\n - pgaasvm\n - admin\n - password\n PMSH_PG_USERNAME:\n get_attribute:\n - pgaasvm\n - admin\n - user\n PMSH_DB_NAME:\n get_attribute:\n - pgaasvm\n - admin\n - database\n relationships:\n - target: pmsh-policy\n type: cloudify.relationships.depends_on\n properties:\n service_component_type: dcae-pmsh\n service_component_name_override: dcae-pmsh\n application_config:\n enable_tls:\n get_input: enable_tls\n aaf_identity: dcae@dcae.onap.org\n aaf_password: demo123456!\n operational_policy_name:\n get_input: operational_policy_name\n control_loop_name:\n get_input: control_loop_name\n cert_path: /opt/app/pmsh/etc/certs/cert.pem\n key_path: /opt/app/pmsh/etc/certs/key.pem\n ca_cert_path: /opt/app/pmsh/etc/certs/cacert.pem\n streams_publishes:\n policy_pm_publisher:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: pmsh_publish_topic_name\n streams_subscribes:\n policy_pm_subscriber:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: policy_feedback_topic_name\n aai_subscriber:\n type: message_router\n dmaap_info:\n topic_url:\n concat:\n - http://message-router:3904/events/\n - get_input: aai_notification_topic_name\n resource_config:\n limits:\n cpu:\n get_input: cpu_limit\n memory:\n get_input: memory_limit\n requests:\n cpu:\n get_input: cpu_request\n memory:\n get_input: memory_request\n docker_config:\n healthcheck:\n endpoint: /healthcheck\n interval: 15s\n timeout: 1s\n type:\n get_input: protocol\n image:\n get_input: tag_version\n replicas:\n get_input: replicas\n log_info:\n log_directory: /var/log/ONAP/dcaegen2/services/pmsh\n tls_info:\n cert_directory: /opt/app/pmsh/etc/certs\n use_tls:\n get_input: enable_tls\n pmsh-policy:\n type: clamp.nodes.policy\n properties:\n policy_model_id:\n get_input: policy_model_id\n policy_id:\n get_input: policy_id\n consul_info:\n - consulUrl: http://consul:31321/v1/kv/dcae-pmsh:policy\n consulBody:\n subscription:\n subscriptionName: subscriptiona\n administrativeState: UNLOCKED\n fileBasedGP: 15\n fileLocation: /pm/pm.xml\n nfFilter:\n nfNames:\n - ^pnf1.*\n modelInvariantIDs:\n - 5845y423-g654-6fju-po78-8n53154532k6\n - 7129e420-d396-4efb-af02-6b83499b12f8\n modelVersionIDs:\n - e80a6ae3-cafd-4d24-850d-e14c084a5ca9\n measurementGroups:\n - measurementGroup:\n measurementTypes:\n - measurementType: countera\n - measurementType: counterb\n managedObjectDNsBasic:\n - DN: dna\n - DN: dnb\n - measurementGroup:\n measurementTypes:\n - measurementType: counterc\n - measurementType: counterd\n managedObjectDNsBasic:\n - DN: dnc\n - DN: dnd\n org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the monitoring policy for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participant_id:\n name: org.onap.policy.controlloop.PolicyControlLoopParticipant\n version: 2.3.1\n policy_type_id:\n name: onap.policies.monitoring.pm-subscription-handler\n version: 1.0.0\n policy_id:\n get_input: pmsh_monitoring_policy\n org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.PolicyControlLoopElement\n type_version: 1.0.0\n description: Control loop element for the operational policy for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n participant_id:\n name: org.onap.policy.controlloop.PolicyControlLoopParticipant\n version: 2.3.1\n policy_type_id:\n name: onap.policies.operational.pm-subscription-handler\n version: 1.0.0\n policy_id:\n get_input: pmsh_operational_policy\n org.onap.domain.pmsh.PMSHControlLoopDefinition:\n version: 1.2.3\n type: org.onap.policy.clamp.controlloop.ControlLoop\n type_version: 1.0.0\n description: Control loop for Performance Management Subscription Handling\n properties:\n provider: Ericsson\n elements:\n - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice\n version: 1.2.3\n - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement\n version: 1.2.3\n - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement\n version: 1.2.3\n policies:\n - MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test:\n type: onap.policies.monitoring.dcae-pm-subscription-handler\n type_version: 1.0.0\n name: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n version: 1.0.0\n metadata:\n policy-id: MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0test\n policy-version: 1.0.0\n properties:\n pmsh_policy:\n fileBasedGP: 15\n fileLocation: /pm/pm.xml\n subscriptionName: subscriptiona\n administrativeState: UNLOCKED\n nfFilter:\n onap.datatypes.monitoring.nfFilter:\n modelVersionIDs:\n - e80a6ae3-cafd-4d24-850d-e14c084a5ca9\n modelInvariantIDs:\n - 5845y423-g654-6fju-po78-8n53154532k6\n - 7129e420-d396-4efb-af02-6b83499b12f8\n modelNames: []\n nfNames:\n - '\"^pnf1.*\"'\n measurementGroups:\n - measurementGroup:\n onap.datatypes.monitoring.measurementGroup:\n measurementTypes:\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: countera\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterb\n managedObjectDNsBasic:\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dna\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnb\n - measurementGroup:\n onap.datatypes.monitoring.measurementGroup:\n measurementTypes:\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterc\n - measurementType:\n onap.datatypes.monitoring.measurementType:\n measurementType: counterd\n managedObjectDNsBasic:\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnc\n - managedObjectDNsBasic:\n onap.datatypes.monitoring.managedObjectDNsBasic:\n DN: dnd\n - operational.apex.pmcontrol:\n type: onap.policies.controlloop.operational.common.Apex\n type_version: 1.0.0\n version: 1.0.0\n metadata:\n policy-id: operational.apex.pmcontrol\n policy-version: 1\n properties:\n engineServiceParameters:\n name: MyApexEngine\n version: 0.0.1\n id: 45\n instanceCount: 2\n deploymentPort: 12561\n policy_type_impl:\n apexPolicyModel:\n key:\n name: PMControlPolicy\n version: 0.0.1\n keyInformation:\n key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n keyInfoMap:\n entry:\n - key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n value:\n key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n UUID: 6e5fa19b-14df-37e3-a4ae-8c537e861a82\n description: Generated description for concept referred to by key \"CDSActionIdentifiersType:0.0.1\"\n - key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n UUID: 14b29e38-ac75-3273-aa4e-8583c0aa7dad\n description: Generated description for concept referred to by key \"CDSCreateResponseEvent:0.0.1\"\n - key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n UUID: 04573f8f-e772-30a5-b1d9-d7318d4a1e13\n description: Generated description for concept referred to by key \"CDSCreateResponsePayloadType:0.0.1\"\n - key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n UUID: e126c965-fc09-3bfe-8f55-70f380a4a49c\n description: Generated description for concept referred to by key \"CDSCreateResponsePolicy:0.0.1\"\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseTask\n version: 0.0.1\n UUID: 6165ee82-afd2-3aab-a517-f00b3f2461d2\n description: Generated description for concept referred to by key \"CDSCreateResponseTask:0.0.1\"\n - key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n UUID: 8350ac5e-c157-38b9-9614-a0f93a830e60\n description: Generated description for concept referred to by key \"CDSCreateSubscriptionPayloadType:0.0.1\"\n - key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n UUID: cfa325ba-226b-3a31-9183-ec43e2b6e9a2\n description: Generated description for concept referred to by key \"CDSCreateSubscriptionRequestEvent:0.0.1\"\n - key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n UUID: 8be9c0fa-7437-3841-aff2-b3cec6ae3bd8\n description: Generated description for concept referred to by key \"CDSDeleteResponseEvent:0.0.1\"\n - key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n UUID: 3fbfe0c9-152e-34d3-a504-09cd13c058d0\n description: Generated description for concept referred to by key \"CDSDeleteResponsePayloadType:0.0.1\"\n - key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n UUID: a780251c-edd5-3132-b865-04313246b43c\n description: Generated description for concept referred to by key \"CDSDeleteResponsePolicy:0.0.1\"\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n UUID: afce4555-3aa3-3521-a7d8-ee8cdf0d3efc\n description: Generated description for concept referred to by key \"CDSDeleteResponseTask:0.0.1\"\n - key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n UUID: 12658406-9147-3c9d-a38c-5ad5e30b092b\n description: Generated description for concept referred to by key \"CDSDeleteSubscriptionPayloadType:0.0.1\"\n - key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n UUID: 24380c95-9289-36e6-8cbf-0edefa15ccd9\n description: Generated description for concept referred to by key \"CDSDeleteSubscriptionRequestEvent:0.0.1\"\n - key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n UUID: 35590ac0-062c-39f1-8786-b4ff716e30b1\n description: Generated description for concept referred to by key \"CDSRequestCommonHeaderType:0.0.1\"\n - key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n UUID: dd7e1805-885a-350b-aaf9-ed541321ae3c\n description: Generated description for concept referred to by key \"CDSResponseCommonHeaderType:0.0.1\"\n - key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n UUID: 7986e21b-32f7-302e-9554-31f21b673493\n description: Generated description for concept referred to by key \"CDSResponseStatusEvent:0.0.1\"\n - key:\n name: CDSResponseStatusType\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusType\n version: 0.0.1\n UUID: 92b8a2cf-344e-3ce1-8cc0-2b7d3cb695fa\n description: Generated description for concept referred to by key \"CDSResponseStatusType:0.0.1\"\n - key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n UUID: 92162397-1a8e-3a3f-a469-d2af7700af4a\n description: Generated description for concept referred to by key \"CreateSubscriptionPayloadEvent:0.0.1\"\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n UUID: bc0c69f0-52ed-38ea-b468-ae4a6fd1730d\n description: Generated description for concept referred to by key \"CreateSubscriptionPayloadTask:0.0.1\"\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n UUID: 89cb75e9-f06c-30d3-b4ff-698d45f63869\n description: Generated description for concept referred to by key \"CreateSubscriptionRequestTask:0.0.1\"\n - key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n UUID: 994fa441-04ab-33bb-832d-1cd12ab5d074\n description: Generated description for concept referred to by key \"DeleteSubscriptionPayloadEvent:0.0.1\"\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n UUID: 0f519117-5fea-3e4b-941f-8f778100465f\n description: Generated description for concept referred to by key \"DeleteSubscriptionPayloadTask:0.0.1\"\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n UUID: acb772fe-d442-39e3-98f9-b1080caf4150\n description: Generated description for concept referred to by key \"DeleteSubscriptionRequestTask:0.0.1\"\n - key:\n name: MRResponseEvent\n version: 0.0.1\n value:\n key:\n name: MRResponseEvent\n version: 0.0.1\n UUID: 13c747a3-6bae-3bcf-9c80-b152e01dc194\n description: Generated description for concept referred to by key \"MRResponseEvent:0.0.1\"\n - key:\n name: PMControlPolicy\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy\n version: 0.0.1\n UUID: acf1e55c-7bc5-3bd5-975a-0ca54afcd8a4\n description: Generated description for concept referred to by key \"PMControlPolicy:0.0.1\"\n - key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n UUID: b38ad204-c2c8-32f4-9b5a-dda0aeb0145b\n description: Generated description for concept referred to by key \"PMControlPolicy_Albums:0.0.1\"\n - key:\n name: PMControlPolicy_Events\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Events\n version: 0.0.1\n UUID: be3871a0-c42a-3113-a066-82d192840eca\n description: Generated description for concept referred to by key \"PMControlPolicy_Events:0.0.1\"\n - key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_KeyInfo\n version: 0.0.1\n UUID: ced37634-28a4-3178-b7f6-2980794927b0\n description: Generated description for concept referred to by key \"PMControlPolicy_KeyInfo:0.0.1\"\n - key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n UUID: be3d180d-ef9c-3a75-8e9c-84271a038bed\n description: Generated description for concept referred to by key \"PMControlPolicy_Policies:0.0.1\"\n - key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n UUID: e61973f1-189c-39e5-82f6-0d3afe298a20\n description: Generated description for concept referred to by key \"PMControlPolicy_Schemas:0.0.1\"\n - key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n value:\n key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n UUID: 5658adb3-2962-30a3-a241-fae75bb8eb4a\n description: Generated description for concept referred to by key \"PMControlPolicy_Tasks:0.0.1\"\n - key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n UUID: c2bd6f0d-6854-317a-9be2-97c08338428c\n description: Generated description for concept referred to by key \"PMSubscriptionAlbum:0.0.1\"\n - key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n UUID: 992b7819-9f69-3aa0-bb0f-6e45ea15ce05\n description: Generated description for concept referred to by key \"PMSubscriptionOutputEvent:0.0.1\"\n - key:\n name: PMSubscriptionType\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionType\n version: 0.0.1\n UUID: 73c1c397-4fc3-357f-93b6-a8ad707fbaae\n description: Generated description for concept referred to by key \"PMSubscriptionType:0.0.1\"\n - key:\n name: ReceiveEventPolicy\n version: 0.0.1\n value:\n key:\n name: ReceiveEventPolicy\n version: 0.0.1\n UUID: 568b7345-9de1-36d3-b6a3-9b857e6809a1\n description: Generated description for concept referred to by key \"ReceiveEventPolicy:0.0.1\"\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n UUID: f596afc8-100c-35eb-92c8-352355ea457d\n description: Generated description for concept referred to by key \"ReceiveSubscriptionTask:0.0.1\"\n - key:\n name: SimpleIntType\n version: 0.0.1\n value:\n key:\n name: SimpleIntType\n version: 0.0.1\n UUID: 153791fd-ae0a-36a7-88a5-309a7936415d\n description: Generated description for concept referred to by key \"SimpleIntType:0.0.1\"\n - key:\n name: SimpleStringType\n version: 0.0.1\n value:\n key:\n name: SimpleStringType\n version: 0.0.1\n UUID: 8a4957cf-9493-3a76-8c22-a208e23259af\n description: Generated description for concept referred to by key \"SimpleStringType:0.0.1\"\n - key:\n name: SubscriptionStatusType\n version: 0.0.1\n value:\n key:\n name: SubscriptionStatusType\n version: 0.0.1\n UUID: 597643b1-9db1-31ce-85d0-e1c63c43b30b\n description: Generated description for concept referred to by key \"SubscriptionStatusType:0.0.1\"\n - key:\n name: SubscriptionType\n version: 0.0.1\n value:\n key:\n name: SubscriptionType\n version: 0.0.1\n UUID: 184547bb-7d64-3cb2-a273-d7185102c5ce\n description: Generated description for concept referred to by key \"SubscriptionType:0.0.1\"\n - key:\n name: UUIDType\n version: 0.0.1\n value:\n key:\n name: UUIDType\n version: 0.0.1\n UUID: 6a8cc68e-dfc8-3403-9c6d-071c886b319c\n description: Generated description for concept referred to by key \"UUIDType:0.0.1\"\n - key:\n name: pmsh-operational-policy\n version: 0.0.1\n value:\n key:\n name: pmsh-operational-policy\n version: 0.0.1\n UUID: fdf2c9ff-6422-3ea6-b6b6-49b12116265d\n description: Generated description for concept referred to by key \"pmsh-operational-policy:0.0.1\"\n policies:\n key:\n name: PMControlPolicy_Policies\n version: 0.0.1\n policyMap:\n entry:\n - key:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n value:\n policyKey:\n name: CDSCreateResponsePolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CDSCreateResponseState\n value:\n stateKey:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CDSCreateResponseState\n trigger:\n name: CDSCreateResponseEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ResponseOutput\n value:\n key:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: ResponseOutput\n outgoingEvent:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference: []\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CDSCreateResponseTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: CDSCreateResponsePolicy\n outputType: DIRECT\n output:\n parentKeyName: CDSCreateResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSCreateResponseState\n localName: ResponseOutput\n firstState: CDSCreateResponseState\n - key:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n value:\n policyKey:\n name: CDSDeleteResponsePolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CDSDeleteResponseState\n value:\n stateKey:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CDSDeleteResponseState\n trigger:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ResponseOutput\n value:\n key:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: ResponseOutput\n outgoingEvent:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference: []\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CDSDeleteResponseTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: CDSDeleteResponsePolicy\n outputType: DIRECT\n output:\n parentKeyName: CDSDeleteResponsePolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CDSDeleteResponseState\n localName: ResponseOutput\n firstState: CDSDeleteResponseState\n - key:\n name: ReceiveEventPolicy\n version: 0.0.1\n value:\n policyKey:\n name: ReceiveEventPolicy\n version: 0.0.1\n template: Freestyle\n state:\n entry:\n - key: CreateOrDeleteState\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateOrDeleteState\n trigger:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: CreateSubscriptionPayload\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: CreateSubscriptionPayload\n outgoingEvent:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateSubscription\n - key: DeleteSubscriptionPayload\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: DeleteSubscriptionPayload\n outgoingEvent:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: DeleteSubscription\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: TaskSelectionLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n var changeType = pmSubscriptionInfo.get(\"changeType\").toString()\n\n executor.logger.info(\"Change Type is \" + changeType)\n\n if (\"CREATE\".equals(changeType)) {\n executor.logger.info(\"Choosing to create a subscription\")\n executor.subject.getTaskKey(\"CreateSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n }\n else if (\"DELETE\".equals(changeType)) {\n executor.logger.info(\"Choosing to delete a subscription\")\n executor.subject.getTaskKey(\"DeleteSubscriptionPayloadTask\").copyTo(executor.selectedTask);\n }\n\n //var returnValue = executor.isTrue;\n true;\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: CreateSubscriptionPayload\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateOrDeleteState\n localName: DeleteSubscriptionPayload\n - key: CreateSubscription\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateSubscription\n trigger:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: IssueCreateSubscriptionRequestOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: IssueCreateSubscriptionRequestOutput\n outgoingEvent:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: CreateSubscription\n localName: IssueCreateSubscriptionRequestOutput\n - key: DeleteSubscription\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: DeleteSubscription\n trigger:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n stateOutputs:\n entry:\n - key: IssueDeleteSubscriptionRequestOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: IssueDeleteSubscriptionRequestOutput\n outgoingEvent:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n nextState:\n parentKeyName: 'NULL'\n parentKeyVersion: 0.0.0\n parentLocalName: 'NULL'\n localName: 'NULL'\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: DeleteSubscription\n localName: IssueDeleteSubscriptionRequestOutput\n - key: ReceiveSubscriptionState\n value:\n stateKey:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: ReceiveSubscriptionState\n trigger:\n name: pmsh-operational-policy\n version: 0.0.1\n stateOutputs:\n entry:\n - key: ReceivePMSubscriptionOutput\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceivePMSubscriptionOutput\n outgoingEvent:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n nextState:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: 'NULL'\n localName: CreateOrDeleteState\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskSelectionLogic:\n key: 'NULL'\n logicFlavour: UNDEFINED\n logic: ''\n stateFinalizerLogicMap:\n entry: []\n defaultTask:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n taskReferences:\n entry:\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceiveEventPolicy\n outputType: DIRECT\n output:\n parentKeyName: ReceiveEventPolicy\n parentKeyVersion: 0.0.1\n parentLocalName: ReceiveSubscriptionState\n localName: ReceivePMSubscriptionOutput\n firstState: ReceiveSubscriptionState\n tasks:\n key:\n name: PMControlPolicy_Tasks\n version: 0.0.1\n taskMap:\n entry:\n - key:\n name: CDSCreateResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseTask\n version: 0.0.1\n inputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var commonHeader = executor.inFields.get(\"commonHeader\")\n var response = executor.inFields.get(\"payload\")\n var albumID = commonHeader.get(\"requestId\")\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\n var responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\n responseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n responseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n responseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\n var status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\n executor.logger.info(\"RESPONSE STATUS = \" + status)\n\n if(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n } else {\n responseStatus.put(\"message\", \"failed\")\n }\n\n executor.outFields.put(\"status\", responseStatus)\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseTask\n version: 0.0.1\n inputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var commonHeader = executor.inFields.get(\"commonHeader\")\n var response = executor.inFields.get(\"payload\")\n var albumID = commonHeader.get(\"requestId\")\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(albumID.toString());\n var responseStatus = executor.subject.getOutFieldSchemaHelper(\"status\").createNewInstance();\n\n responseStatus.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n responseStatus.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n responseStatus.put(\"changeType\", pmSubscriptionInfo.get(\"changeType\"))\n\n var status = response.get(pmSubscriptionInfo.get(\"changeType\").toLowerCase() + \"_DasH_subscription_DasH_response\").get(\"odl_DasH_response\").get(\"status\")\n\n executor.logger.info(\"RESPONSE STATUS = \" + status)\n\n if(status == \"success\") {\n responseStatus.put(\"message\", \"success\")\n } else {\n responseStatus.put(\"message\", \"failed\")\n }\n\n executor.outFields.put(\"status\", responseStatus)\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\n var payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\n payloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n payloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n payloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\n payloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\n payloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\n payloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\n var payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\n payloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\n var payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\n payload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\n executor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionRequestTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n var blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\n var blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\n var payload = executor.inFields.get(\"payload\")\n var actionName = changeType + \"-subscription\"\n\n var commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\n commonHeader.put(\"originatorId\", \"sdnc\");\n commonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\n commonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\n var actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\n actionIdentifiers.put(\"actionName\", actionName);\n actionIdentifiers.put(\"blueprintName\", blueprintName);\n actionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\n actionIdentifiers.put(\"mode\", \"sync\");\n\n executor.outFields.put(\"commonHeader\", commonHeader);\n executor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n\n var payloadProperties = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(changeType + \"_DasH_subscription_DasH_properties_record\");\n\n payloadProperties.put(\"nfName\", pmSubscriptionInfo.get(\"nfName\"))\n payloadProperties.put(\"subscriptionName\", pmSubscriptionInfo.get(\"subscription\").get(\"subscriptionName\"))\n payloadProperties.put(\"administrativeState\", pmSubscriptionInfo.get(\"subscription\").get(\"administrativeState\"))\n payloadProperties.put(\"fileBasedGP\", pmSubscriptionInfo.get(\"subscription\").get(\"fileBasedGP\").toString())\n payloadProperties.put(\"fileLocation\", pmSubscriptionInfo.get(\"subscription\").get(\"fileLocation\"))\n payloadProperties.put(\"measurementGroups\", pmSubscriptionInfo.get(\"subscription\").get(\"measurementGroups\"))\n\n var payloadEntry = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewSubInstance(\"CDSRequestPayloadEntry\");\n payloadEntry.put(changeType + \"_DasH_subscription_DasH_properties\", payloadProperties)\n\n var payload = executor.subject.getOutFieldSchemaHelper(\"payload\").createNewInstance();\n payload.put(changeType + \"_DasH_subscription_DasH_request\", payloadEntry);\n\n executor.outFields.put(\"albumID\", executor.inFields.get(\"albumID\"))\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionRequestTask\n version: 0.0.1\n inputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n\n executor.logger.info(executor.subject.id);\n\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").get(executor.inFields.get(\"albumID\").toString())\n\n var changeType = pmSubscriptionInfo.get(\"changeType\").toLowerCase()\n var blueprintName = pmSubscriptionInfo.get(\"blueprintName\").toLowerCase()\n var blueprintVersion = pmSubscriptionInfo.get(\"blueprintVersion\").toLowerCase()\n var payload = executor.inFields.get(\"payload\")\n var actionName = changeType + \"-subscription\"\n\n var commonHeader = executor.subject.getOutFieldSchemaHelper(\"commonHeader\").createNewInstance();\n commonHeader.put(\"originatorId\", \"sdnc\");\n commonHeader.put(\"requestId\", executor.inFields.get(\"albumID\").toString());\n commonHeader.put(\"subRequestId\", \"sub-123456-1000\");\n\n var actionIdentifiers = executor.subject.getOutFieldSchemaHelper(\"actionIdentifiers\").createNewInstance();\n actionIdentifiers.put(\"actionName\", actionName);\n actionIdentifiers.put(\"blueprintName\", blueprintName);\n actionIdentifiers.put(\"blueprintVersion\", blueprintVersion);\n actionIdentifiers.put(\"mode\", \"sync\");\n\n executor.outFields.put(\"commonHeader\", commonHeader);\n executor.outFields.put(\"actionIdentifiers\", actionIdentifiers);\n executor.outFields.put(\"payload\", payload);\n\n //var returnValue = executor.isTrue;\n true;\n - key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n value:\n key:\n name: ReceiveSubscriptionTask\n version: 0.0.1\n inputFields:\n entry:\n - key: blueprintName\n value:\n key: blueprintName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: blueprintVersion\n value:\n key: blueprintVersion\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: changeType\n value:\n key: changeType\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: closedLoopControlName\n value:\n key: closedLoopControlName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: nfName\n value:\n key: nfName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: policyName\n value:\n key: policyName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: subscription\n value:\n key: subscription\n fieldSchemaKey:\n name: SubscriptionType\n version: 0.0.1\n optional: false\n outputFields:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n taskParameters:\n entry: []\n contextAlbumReference:\n - name: PMSubscriptionAlbum\n version: 0.0.1\n taskLogic:\n key: TaskLogic\n logicFlavour: JAVASCRIPT\n logic: |-\n /*\n * ============LICENSE_START=======================================================\n * Copyright (C) 2020 Nordix. All rights reserved.\n * ================================================================================\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * SPDX-License-Identifier: Apache-2.0\n * ============LICENSE_END=========================================================\n */\n var uuidType = java.util.UUID;\n\n executor.logger.info(executor.subject.id);\n\n //albumID will be used to fetch info from our album later\n var albumID = uuidType.randomUUID();\n var pmSubscriptionInfo = executor.getContextAlbum(\"PMSubscriptionAlbum\").getSchemaHelper().createNewInstance();\n var returnValue = true;\n\n if(executor.inFields.get(\"policyName\") != null) {\n executor.logger.info(\"nfName in receive sub event \" + executor.inFields.get(\"nfName\"));\n\n var changeType = executor.inFields.get(\"changeType\")\n var nfName = executor.inFields.get(\"nfName\")\n var policyName = executor.inFields.get(\"policyName\")\n var closedLoopControlName = executor.inFields.get(\"closedLoopControlName\")\n var subscription = executor.inFields.get(\"subscription\")\n var blueprintName = executor.inFields.get(\"blueprintName\")\n var blueprintVersion = executor.inFields.get(\"blueprintVersion\")\n\n pmSubscriptionInfo.put(\"nfName\", executor.inFields.get(\"nfName\"));\n pmSubscriptionInfo.put(\"changeType\", executor.inFields.get(\"changeType\"))\n pmSubscriptionInfo.put(\"policyName\", executor.inFields.get(\"policyName\"))\n pmSubscriptionInfo.put(\"closedLoopControlName\", executor.inFields.get(\"closedLoopControlName\"))\n pmSubscriptionInfo.put(\"subscription\", subscription)\n pmSubscriptionInfo.put(\"blueprintName\", blueprintName)\n pmSubscriptionInfo.put(\"blueprintVersion\", blueprintVersion)\n\n\n executor.getContextAlbum(\"PMSubscriptionAlbum\").put(albumID.toString(), pmSubscriptionInfo);\n\n executor.outFields.put(\"albumID\", albumID)\n } else {\n executor.message = \"Received invalid event\"\n returnValue = false;\n }\n\n returnValue;\n events:\n key:\n name: PMControlPolicy_Events\n version: 0.0.1\n eventMap:\n entry:\n - key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: CDS\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionRequestEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: CDS\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n optional: false\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: CDSResponseStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionRequestEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: actionIdentifiers\n value:\n key: actionIdentifiers\n fieldSchemaKey:\n name: CDSActionIdentifiersType\n version: 0.0.1\n optional: false\n - key: commonHeader\n value:\n key: commonHeader\n fieldSchemaKey:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: DCAE\n parameter:\n entry:\n - key: status\n value:\n key: status\n fieldSchemaKey:\n name: SubscriptionStatusType\n version: 0.0.1\n optional: false\n - key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: CreateSubscriptionPayloadEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n value:\n key:\n name: DeleteSubscriptionPayloadEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key: payload\n value:\n key: payload\n fieldSchemaKey:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n optional: false\n - key:\n name: MRResponseEvent\n version: 0.0.1\n value:\n key:\n name: MRResponseEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: DCAE\n target: APEX\n parameter:\n entry:\n - key: count\n value:\n key: count\n fieldSchemaKey:\n name: SimpleIntType\n version: 0.0.1\n optional: false\n - key: serverTimeMs\n value:\n key: serverTimeMs\n fieldSchemaKey:\n name: SimpleIntType\n version: 0.0.1\n optional: false\n - key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionOutputEvent\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: APEX\n target: APEX\n parameter:\n entry:\n - key: albumID\n value:\n key: albumID\n fieldSchemaKey:\n name: UUIDType\n version: 0.0.1\n optional: false\n - key:\n name: pmsh-operational-policy\n version: 0.0.1\n value:\n key:\n name: pmsh-operational-policy\n version: 0.0.1\n nameSpace: org.onap.policy.apex.onap.pmcontrol\n source: DCAE\n target: APEX\n parameter:\n entry:\n - key: blueprintName\n value:\n key: blueprintName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: blueprintVersion\n value:\n key: blueprintVersion\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: changeType\n value:\n key: changeType\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: closedLoopControlName\n value:\n key: closedLoopControlName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: nfName\n value:\n key: nfName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: policyName\n value:\n key: policyName\n fieldSchemaKey:\n name: SimpleStringType\n version: 0.0.1\n optional: false\n - key: subscription\n value:\n key: subscription\n fieldSchemaKey:\n name: SubscriptionType\n version: 0.0.1\n optional: false\n albums:\n key:\n name: PMControlPolicy_Albums\n version: 0.0.1\n albums:\n entry:\n - key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionAlbum\n version: 0.0.1\n scope: policy\n isWritable: true\n itemSchema:\n name: PMSubscriptionType\n version: 0.0.1\n schemas:\n key:\n name: PMControlPolicy_Schemas\n version: 0.0.1\n schemas:\n entry:\n - key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n value:\n key:\n name: CDSActionIdentifiersType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ActionIdentifiers_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"actionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"blueprintVersion\",\n \"type\": \"string\"\n },\n {\n \"name\": \"mode\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateResponsePayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"name\": \"CreateResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n - key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSCreateSubscriptionPayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"create_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"create_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n - key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteResponsePayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"name\": \"DeleteResponsePayloadEntry\",\n \"type\": \"record\",\n \"namespace\": \"com.acme.avro\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"odl_DasH_response\",\n \"type\": {\n \"name\": \"odl_DasH_response\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"status\",\n \"type\": \"string\"\n }\n ]\n }\n }\n ]\n }\n }\n ]\n }\n - key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n value:\n key:\n name: CDSDeleteSubscriptionPayloadType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"map\",\n \"values\": {\n \"type\": \"record\",\n \"name\": \"CDSRequestPayloadEntry\",\n \"fields\": [\n {\n \"name\": \"delete_DasH_subscription_DasH_properties\",\n \"type\": {\n \"name\": \"delete_DasH_subscription_DasH_properties_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"administrativeState\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileBasedGP\",\n \"type\": \"string\"\n },\n {\n \"name\": \"fileLocation\",\n \"type\": \"string\"\n },\n {\n \"name\": \"measurementGroups\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementGroups_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementGroup\",\n \"type\": {\n \"name\": \"measurementGroup\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementTypes\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"measurementTypes_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"measurementType\",\n \"type\": \"string\"\n }\n ]\n }\n }\n },\n {\n \"name\": \"managedObjectDNsBasic\",\n \"type\": {\n \"type\": \"array\",\n \"items\": {\n \"name\": \"managedObjectDNsBasic_record\",\n \"type\": \"record\",\n \"fields\": [\n {\n \"name\": \"DN\",\n \"type\": \"string\"\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n }\n ]\n }\n }\n ]\n }\n }\n - key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSRequestCommonHeaderType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"RequestCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n value:\n key:\n name: CDSResponseCommonHeaderType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ResponseCommonHeader_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"originatorId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"requestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"subRequestId\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"flags\",\n \"type\": [\"null\", \"string\"]\n }\n ]\n }\n - key:\n name: CDSResponseStatusType\n version: 0.0.1\n value:\n key:\n name: CDSResponseStatusType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ResponseStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"code\",\n \"type\": \"int\"\n },\n {\n \"name\": \"eventType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"timestamp\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: PMSubscriptionType\n version: 0.0.1\n value:\n key:\n name: PMSubscriptionType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: \"{\\n\\t\\\"name\\\": \\\"PMSubscription\\\",\\n\\t\\\"type\\\": \\\"record\\\",\\n\\t\\\"namespace\\\": \\\"\\\n org.onap.policy.apex.onap.pmcontrol\\\",\\n\\t\\\"fields\\\": [\\n {\\n \\\"name\\\": \\\"nfName\\\"\\\n ,\\n \\\"type\\\": \\\"string\\\"\\n },\\n\\t {\\n\\t\\t\\t\\\"name\\\": \\\"changeType\\\",\\n\\t\\t\\t\\\"\\\n type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"closedLoopControlName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"\\\n string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"policyName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t\\\n {\\n\\t\\t \\\"name\\\": \\\"blueprintName\\\",\\n\\t\\t \\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t \\\"name\\\"\\\n : \\\"blueprintVersion\\\",\\n\\t\\t \\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"subscription\\\"\\\n ,\\n\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\"name\\\": \\\"subscription\\\",\\n\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\\n \\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"subscriptionName\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\\n \\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"administrativeState\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"fileBasedGP\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"int\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"fileLocation\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\\n \\n\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementGroups\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Groups_Type\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\"\\\n : \\\"measurementGroup\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Group_Type\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\\"name\\\": \\\"measurementTypes\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"\\\n name\\\": \\\"Measurement_Types_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementType\\\",\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"managedObjectDNsBasic\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\\"name\\\": \\\"Managed_Object_Dns_Basic_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"DN\\\",\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t]\\n\\t\\t\\t}\\n\\t\\\n \\t}\\n\\t]\\n}\"\n - key:\n name: SimpleIntType\n version: 0.0.1\n value:\n key:\n name: SimpleIntType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.lang.Integer\n - key:\n name: SimpleStringType\n version: 0.0.1\n value:\n key:\n name: SimpleStringType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.lang.String\n - key:\n name: SubscriptionStatusType\n version: 0.0.1\n value:\n key:\n name: SubscriptionStatusType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: |-\n {\n \"type\": \"record\",\n \"name\": \"ActivateSubscriptionStatus_Type\",\n \"namespace\": \"org.onap.policy.apex.onap.helloworld\",\n \"fields\": [\n {\n \"name\": \"subscriptionName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"nfName\",\n \"type\": \"string\"\n },\n {\n \"name\": \"changeType\",\n \"type\": \"string\"\n },\n {\n \"name\": \"message\",\n \"type\": \"string\"\n }\n ]\n }\n - key:\n name: SubscriptionType\n version: 0.0.1\n value:\n key:\n name: SubscriptionType\n version: 0.0.1\n schemaFlavour: Avro\n schemaDefinition: \"{\\n\\t\\\"name\\\": \\\"subscription\\\",\\n\\t\\\"type\\\": \\\"record\\\",\\n\\t\\\"fields\\\": [{\\n\\t\\t\\\n \\t\\\"name\\\": \\\"subscriptionName\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"administrativeState\\\"\\\n ,\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"fileBasedGP\\\",\\n\\t\\t\\t\\\"type\\\": \\\"\\\n int\\\"\\n\\t\\t},\\n\\t\\t{\\n\\t\\t\\t\\\"name\\\": \\\"fileLocation\\\",\\n\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t},\\n\\t\\t\\\n {\\n\\t\\t\\t\\\"name\\\": \\\"measurementGroups\\\",\\n\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\\n \\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Groups_Type\\\",\\n\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\\n \\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementGroup\\\",\\n\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\\n \\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Measurement_Group_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementTypes\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\"\\\n : {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\\"name\\\": \\\"Measurement_Types_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"measurementType\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\\n \\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\n }\\n\\t\\t\\t\\t\\t\\t\\t\\t},\\n\\t\\t\\t\\t\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"managedObjectDNsBasic\\\",\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"array\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"items\\\"\\\n : {\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"Managed_Object_Dns_Basic_Type\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"\\\n type\\\": \\\"record\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"fields\\\": [{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"name\\\": \\\"DN\\\"\\\n ,\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\\"type\\\": \\\"string\\\"\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\\n \\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t]\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}]\\n\\t\\t\\t\\t}\\n\\t\\\n \\t\\t}\\n\\t\\t}\\n\\t]\\n}\"\n - key:\n name: UUIDType\n version: 0.0.1\n value:\n key:\n name: UUIDType\n version: 0.0.1\n schemaFlavour: Java\n schemaDefinition: java.util.UUID\n engineParameters:\n executorParameters:\n JAVASCRIPT:\n parameterClassName: org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters\n contextParameters:\n parameterClassName: org.onap.policy.apex.context.parameters.ContextParameters\n schemaParameters:\n Avro:\n parameterClassName: org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters\n Java:\n parameterClassName: org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters\n jsonAdapters:\n Instant:\n adaptedClass: java.time.Instant\n adaptorClass: org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter\n eventInputParameters:\n DCAEConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTCLIENT\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restclient.RestClientCarrierTechnologyParameters\n parameters:\n consumerPollTime: '50'\n url: https://message-router:3905/events/unauthenticated.DCAE_CL_OUTPUT/cg1/sg1\n eventProtocolParameters:\n eventProtocol: JSON\n parameters:\n nameAlias: policyName\n eventName: pmsh-operational-policy\n eventNameFilter: pmsh-operational-policy\n CDSRequestConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: http://10.10.10.184:30254/api/v1/execution-service/process\n httpMethod: POST\n restRequestTimeout: 2000\n httpHeaders:\n - - Authorization\n - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: CDSCreateResponseEvent\n eventNameFilter: CDSCreateResponseEvent\n requestorMode: true\n requestorPeer: CDSRequestProducer\n requestorTimeout: 500\n CDSDeleteRequestConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: http://10.10.10.184:30254/api/v1/execution-service/process\n httpMethod: POST\n restRequestTimeout: 2000\n httpHeaders:\n - - Authorization\n - Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: CDSDeleteResponseEvent\n eventNameFilter: CDSDeleteResponseEvent\n requestorMode: true\n requestorPeer: CDSDeleteRequestProducer\n requestorTimeout: 500\n CDSReplyConsumer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n parameters:\n url: https://message-router:3905/events/unauthenticated.PMSH_CL_INPUT\n httpMethod: POST\n restRequestTimeout: 2000\n eventProtocolParameters:\n eventProtocol: JSON\n eventName: MRResponseEvent\n eventNameFilter: MRResponseEvent\n requestorMode: true\n requestorPeer: CDSReplyProducer\n requestorTimeout: 500\n eventOutputParameters:\n logOutputter:\n carrierTechnologyParameters:\n carrierTechnology: FILE\n parameters:\n fileName: /tmp/outputevents.log\n eventProtocolParameters:\n eventProtocol: JSON\n StdOutOutputter:\n carrierTechnologyParameters:\n carrierTechnology: FILE\n parameters:\n standardIo: true\n eventProtocolParameters:\n eventProtocol: JSON\n CDSRequestProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSCreateSubscriptionRequestEvent\n requestorMode: true\n requestorPeer: CDSRequestConsumer\n requestorTimeout: 500\n CDSDeleteRequestProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSDeleteSubscriptionRequestEvent\n requestorMode: true\n requestorPeer: CDSDeleteRequestConsumer\n requestorTimeout: 500\n CDSReplyProducer:\n carrierTechnologyParameters:\n carrierTechnology: RESTREQUESTOR\n parameterClassName: org.onap.policy.apex.plugins.event.carrier.restrequestor.RestRequestorCarrierTechnologyParameters\n eventProtocolParameters:\n eventProtocol: JSON\n eventNameFilter: CDSResponseStatusEvent\n requestorMode: true\n requestorPeer: CDSReplyConsumer\n requestorTimeout: 500", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "localhost:6969/onap/controlloop/v2/commission", + "host": [ + "localhost" + ], + "port": "6969", + "path": [ + "onap", + "controlloop", + "v2", + "commission" + ] + } + }, + "response": [] + }, + { + "name": "Demo: Instantiation control loop definition (Full tosca try)", + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "zb!XztG34", + "type": "string" + }, + { + "key": "username", + "value": "healthcheck", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "X-ONAP-RequestID", + "value": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "type": "text" + }, + { + "key": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"controlLoopList\": [\n {\n \"name\": \"PMSHInstance0\",\n \"version\": \"1.0.1\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSHControlLoopDefinition\",\n \"version\": \"1.2.3\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"PMSH control loop instance 0\",\n \"elements\": {\n \"709c62b3-8918-41b9-a747-d21eb79c6c20\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c20\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_DCAEMicroservice\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant\",\n \"version\": \"2.3.4\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"DCAE Control Loop Element for the PMSH instance 0 control loop\"\n },\n \"709c62b3-8918-41b9-a747-d21eb79c6c21\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c21\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.policy.controlloop.PolicyControlLoopParticipant\",\n \"version\": \"2.3.1\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"Monitoring Policy Control Loop Element for the PMSH instance 0 control loop\"\n },\n \"709c62b3-8918-41b9-a747-d21eb79c6c22\": {\n \"id\": \"709c62b3-8918-41b9-a747-d21eb79c6c22\",\n \"definition\": {\n \"name\": \"org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement\",\n \"version\": \"1.2.3\"\n },\n \"participantType\": {\n \"name\": \"org.onap.policy.controlloop.PolicyControlLoopParticipant\",\n \"version\": \"2.3.1\"\n },\n \"state\": \"UNINITIALISED\",\n \"orderedState\": \"UNINITIALISED\",\n \"description\": \"Operational Policy Control Loop Element for the PMSH instance 0 control loop\"\n }\n }\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:6969/onap/controlloop/v2/instantiation", + "host": [ + "localhost" + ], + "port": "6969", + "path": [ + "onap", + "controlloop", + "v2", + "instantiation" + ] + } + }, + "response": [] + }, + { + "name": "Demo: Instantiation control loop definition Command", + "protocolProfileBehavior": { + "disabledSystemHeaders": { + "content-type": true + } + }, + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "zb!XztG34", + "type": "string" + }, + { + "key": "username", + "value": "healthcheck", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [ + { + "key": "X-ONAP-RequestID", + "type": "text", + "value": "709c62b3-8918-41b9-a747-d21eb79c6c20" + }, + { + "key": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"orderedState\": \"PASSIVE\",\n \"controlLoopIdentifierList\": [\n {\n \"name\": \"PMSHInstance0\",\n \"version\": \"1.0.1\"\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "localhost:6969/onap/controlloop/v2/instantiation/command", + "host": [ + "localhost" + ], + "port": "6969", + "path": [ + "onap", + "controlloop", + "v2", + "instantiation", + "command" + ] + } + }, + "response": [] + }, + { + "name": "Demo: Get PolicyTypes Policy API", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "zb!XztG34", + "type": "string" + }, + { + "key": "username", + "value": "healthcheck", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "localhost:6968/policy/api/v1/policytypes/onap.policies.Sirisha", + "host": [ + "localhost" + ], + "port": "6968", + "path": [ + "policy", + "api", + "v1", + "policytypes", + "onap.policies.Sirisha" + ] + } + }, + "response": [] + }, + { + "name": "Demo: Get Policies Policy API", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "zb!XztG34", + "type": "string" + }, + { + "key": "username", + "value": "healthcheck", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "localhost:6968/policy/api/v1/policies", + "host": [ + "localhost" + ], + "port": "6968", + "path": [ + "policy", + "api", + "v1", + "policies" + ] + } + }, + "response": [] + }, + { + "name": "Demo: Get instantiated control loops", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "zb!XztG34", + "type": "string" + }, + { + "key": "username", + "value": "healthcheck", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "localhost:6969/onap/controlloop/v2/instantiation", + "host": [ + "localhost" + ], + "port": "6969", + "path": [ + "onap", + "controlloop", + "v2", + "instantiation" + ] + } + }, + "response": [] + } + ] +}
\ No newline at end of file diff --git a/tosca-controlloop/common/src/test/resources/demo/config/PolicyAPIConfig.json b/tosca-controlloop/common/src/test/resources/demo/config/PolicyAPIConfig.json new file mode 100644 index 000000000..48e89c5dc --- /dev/null +++ b/tosca-controlloop/common/src/test/resources/demo/config/PolicyAPIConfig.json @@ -0,0 +1,53 @@ +{ + "name": "ApiGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6968, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://localhost:3306/policyadmin", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "PolicyMariaDb" + }, + "preloadPolicyTypes": [ + "policytypes/onap.policies.monitoring.tcagen2.yaml", + "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml", + "policytypes/onap.policies.monitoring.dcae-restconfcollector.yaml", + "policytypes/onap.policies.Optimization.yaml", + "policytypes/onap.policies.optimization.Resource.yaml", + "policytypes/onap.policies.optimization.Service.yaml", + "policytypes/onap.policies.optimization.resource.AffinityPolicy.yaml", + "policytypes/onap.policies.optimization.resource.DistancePolicy.yaml", + "policytypes/onap.policies.optimization.resource.HpaPolicy.yaml", + "policytypes/onap.policies.optimization.resource.OptimizationPolicy.yaml", + "policytypes/onap.policies.optimization.resource.PciPolicy.yaml", + "policytypes/onap.policies.optimization.service.QueryPolicy.yaml", + "policytypes/onap.policies.optimization.service.SubscriberPolicy.yaml", + "policytypes/onap.policies.optimization.resource.Vim_fit.yaml", + "policytypes/onap.policies.optimization.resource.VnfPolicy.yaml", + "policytypes/onap.policies.controlloop.guard.Common.yaml", + "policytypes/onap.policies.controlloop.guard.common.Blacklist.yaml", + "policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml", + "policytypes/onap.policies.controlloop.guard.common.MinMax.yaml", + "policytypes/onap.policies.controlloop.guard.common.Filter.yaml", + "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml", + "policytypes/onap.policies.Naming.yaml", + "policytypes/onap.policies.Match.yaml", + "policytypes/onap.policies.native.Drools.yaml", + "policytypes/onap.policies.native.Xacml.yaml", + "policytypes/onap.policies.native.Apex.yaml", + "policytypes/onap.policies.controlloop.operational.Common.yaml", + "policytypes/onap.policies.controlloop.operational.common.Drools.yaml" + ], + "preloadPolicies" : [ + "policies/sdnc.policy.naming.input.tosca.yaml" + ] +} diff --git a/tosca-controlloop/common/src/test/resources/demo/config/PolicyParticipantConfig.json b/tosca-controlloop/common/src/test/resources/demo/config/PolicyParticipantConfig.json new file mode 100644 index 000000000..f02fbdd23 --- /dev/null +++ b/tosca-controlloop/common/src/test/resources/demo/config/PolicyParticipantConfig.json @@ -0,0 +1,53 @@ +{ + "name": "ControlLoopParticipantGroup", + "intermediaryParameters": { + "name": "Participant parameters", + "reportingTimeInterval": 120000, + "description": "Participant Description", + "participantType":{ + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version":"2.3.1" + }, + "participantId": { + "name": "org.onap.PM_Policy", + "version": "1.0.0" + }, + "clampControlLoopTopics": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://localhost:3306/policyadmin", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "ToscaConceptTest" + } +} diff --git a/tosca-controlloop/common/src/test/resources/demo/config/RuntimeConfig.json b/tosca-controlloop/common/src/test/resources/demo/config/RuntimeConfig.json new file mode 100644 index 000000000..2c0127b16 --- /dev/null +++ b/tosca-controlloop/common/src/test/resources/demo/config/RuntimeConfig.json @@ -0,0 +1,79 @@ +{ + "name": "ControlLoopRuntimeGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false + }, + "participantParameters": { + "heartBeatMs": 120000, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://localhost:3306/controlloop", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "CommissioningMariaDb" + }, + "topicParameterGroup": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + }, + "healthCheckRestClientParameters": [ + { + "clientName": "api", + "hostname": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "policy/api/v1/healthcheck" + }, + { + "clientName": "distribution", + "hostname": "policy-distribution", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "healthcheck" + } + ] +} diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java index 014323090..4ef9bdcd9 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ClElementStatistics.java @@ -26,10 +26,12 @@ import java.util.UUID; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; +import lombok.ToString; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @NoArgsConstructor @Data +@ToString public class ClElementStatistics implements Serializable { private static final long serialVersionUID = 3284285693112271055L; diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java index 417e02a5a..d0d79274c 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoop.java @@ -20,14 +20,17 @@ package org.onap.policy.clamp.controlloop.models.controlloop.concepts; +import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.apache.commons.collections4.CollectionUtils; -import org.onap.policy.models.base.PfKey; +import org.apache.commons.collections4.MapUtils; +import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; @@ -40,7 +43,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; @EqualsAndHashCode(callSuper = true) public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop> { @NonNull - private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_NAME); + private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); @NonNull private ControlLoopState state = ControlLoopState.UNINITIALISED; @@ -48,7 +51,7 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop> @NonNull private ControlLoopOrderedState orderedState = ControlLoopOrderedState.UNINITIALISED; - private List<ControlLoopElement> elements; + private Map<UUID, ControlLoopElement> elements; @Override public String getType() { @@ -70,7 +73,7 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop> this.definition = new ToscaConceptIdentifier(otherControlLoop.definition); this.state = otherControlLoop.state; this.orderedState = otherControlLoop.orderedState; - this.elements = PfUtils.mapList(otherControlLoop.elements, ControlLoopElement::new); + this.elements = PfUtils.mapMap(otherControlLoop.elements, ControlLoopElement::new); } @Override @@ -86,25 +89,25 @@ public class ControlLoop extends ToscaEntity implements Comparable<ControlLoop> public void setCascadedOrderedState(final ControlLoopOrderedState orderedState) { this.orderedState = orderedState; - if (CollectionUtils.isEmpty(elements)) { + if (MapUtils.isEmpty(elements)) { return; } - elements.forEach(element -> element.setOrderedState(orderedState)); + elements.values().forEach(element -> element.setOrderedState(orderedState)); } /** - * Find the element with a given UUID for the control loop. + * Get a list of control loop element statistics. * - * @param id the UUID to search for - * @return the element or null if its not found + * @param controlLoop the control loop + * @return List of ClElementStatistics */ - - public ControlLoopElement getElement(final UUID id) { - if (CollectionUtils.isEmpty(elements)) { + public List<ClElementStatistics> getControlLoopElementStatisticsList(final ControlLoop controlLoop) { + if (MapUtils.isEmpty(controlLoop.elements)) { return null; } - return elements.stream().filter(element -> id.equals(element.getId())).findAny().orElse(null); + return controlLoop.elements.values().stream().map(ControlLoopElement::getClElementStatistics) + .collect(Collectors.toList()); } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java index a8d317c2b..83f062c74 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopElement.java @@ -25,7 +25,7 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.ToString; -import org.onap.policy.models.base.PfKey; +import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** @@ -39,10 +39,13 @@ public class ControlLoopElement { private UUID id = UUID.randomUUID(); @NonNull - private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_NAME); + private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); @NonNull - private ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_NAME); + private ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); + + @NonNull + private ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); @NonNull private ControlLoopState state = ControlLoopState.UNINITIALISED; @@ -52,6 +55,8 @@ public class ControlLoopElement { private String description; + private ClElementStatistics clElementStatistics; + /** * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy. * @@ -60,9 +65,11 @@ public class ControlLoopElement { public ControlLoopElement(final ControlLoopElement otherElement) { this.id = otherElement.id; this.definition = new ToscaConceptIdentifier(otherElement.definition); + this.participantType = new ToscaConceptIdentifier(otherElement.participantType); this.participantId = new ToscaConceptIdentifier(otherElement.participantId); this.state = otherElement.state; this.orderedState = otherElement.orderedState; this.description = otherElement.description; + this.clElementStatistics = otherElement.clElementStatistics; } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java index 43ad49b7c..3130b6c2f 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/Participant.java @@ -24,7 +24,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.NonNull; -import org.onap.policy.models.base.PfKey; +import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; @@ -36,7 +36,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; @EqualsAndHashCode(callSuper = true) public class Participant extends ToscaEntity implements Comparable<Participant> { @NonNull - private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_NAME); + private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); @NonNull private ParticipantState participantState = ParticipantState.UNKNOWN; diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java index ec5dbb32c..c5ce99677 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatistics.java @@ -24,7 +24,6 @@ import java.io.Serializable; import java.util.List; import java.util.UUID; import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; @@ -190,6 +189,6 @@ public class JpaClElementStatistics extends PfConcept implements PfAuthorative<C final JpaClElementStatistics other = (JpaClElementStatistics) otherConcept; return new CompareToBuilder().append(this.key, other.key).append(this.state, other.state) - .append(this.clElementUptime, other.clElementUptime).toComparison(); + .append(this.clElementUptime, other.clElementUptime).toComparison(); } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java index 3f54ac2bb..cac405abd 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoop.java @@ -20,21 +20,21 @@ package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts; -import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; -import java.util.stream.Collectors; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.CascadeType; -import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; +import javax.persistence.ManyToMany; import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; @@ -96,16 +96,9 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo private String description; // @formatter:off - @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @CollectionTable(joinColumns = { - @JoinColumn(name = "controlLoopParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "controlLoopParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "controlLoopParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "controlLoopLocalUUID", referencedColumnName = "localUUID") - }) - // @formatter:on + @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @NotNull - private List<@NotNull @Valid JpaControlLoopElement> elements; + private Map<@NotNull UUID, @NotNull @Valid JpaControlLoopElement> elements; /** * The Default Constructor creates a {@link JpaControlLoop} object with a null key. @@ -120,7 +113,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo * @param key the key */ public JpaControlLoop(@NonNull final PfConceptKey key) { - this(key, new PfConceptKey(), ControlLoopState.UNINITIALISED, new ArrayList<>()); + this(key, new PfConceptKey(), ControlLoopState.UNINITIALISED, new LinkedHashMap<>()); } /** @@ -132,7 +125,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo * @param elements the elements of the control looop in participants */ public JpaControlLoop(@NonNull final PfConceptKey key, @NonNull final PfConceptKey definition, - @NonNull final ControlLoopState state, @NonNull final List<JpaControlLoopElement> elements) { + @NonNull final ControlLoopState state, @NonNull final Map<UUID, JpaControlLoopElement> elements) { this.key = key; this.definition = definition; this.state = state; @@ -151,7 +144,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo this.state = copyConcept.state; this.orderedState = copyConcept.orderedState; this.description = copyConcept.description; - this.elements = PfUtils.mapList(copyConcept.elements, JpaControlLoopElement::new, new ArrayList<>(0)); + this.elements = PfUtils.mapMap(copyConcept.elements, JpaControlLoopElement::new, new LinkedHashMap<>(0)); } /** @@ -173,9 +166,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo controlLoop.setState(state); controlLoop.setOrderedState(orderedState != null ? orderedState : state.asOrderedState()); controlLoop.setDescription(description); - - controlLoop - .setElements(elements.stream().map(JpaControlLoopElement::toAuthorative).collect(Collectors.toList())); + controlLoop.setElements(PfUtils.mapMap(elements, JpaControlLoopElement::toAuthorative, new LinkedHashMap<>(0))); return controlLoop; } @@ -191,12 +182,12 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo this.orderedState = controlLoop.getOrderedState(); this.description = controlLoop.getDescription(); - this.elements = new ArrayList<>(controlLoop.getElements().size()); - for (ControlLoopElement element : controlLoop.getElements()) { + this.elements = new LinkedHashMap<>(controlLoop.getElements().size()); + for (Entry<UUID, ControlLoopElement> elementEntry : controlLoop.getElements().entrySet()) { JpaControlLoopElement jpaControlLoopElement = new JpaControlLoopElement(); - jpaControlLoopElement.setKey(new PfReferenceKey(getKey(), element.getId().toString())); - jpaControlLoopElement.fromAuthorative(element); - this.elements.add(jpaControlLoopElement); + jpaControlLoopElement.setKey(new PfReferenceKey(getKey(), elementEntry.getValue().getId().toString())); + jpaControlLoopElement.fromAuthorative(elementEntry.getValue()); + this.elements.put(elementEntry.getKey(), jpaControlLoopElement); } } @@ -206,7 +197,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo keyList.add(definition); - for (JpaControlLoopElement element : elements) { + for (JpaControlLoopElement element : elements.values()) { keyList.addAll(element.getKeys()); } @@ -219,7 +210,7 @@ public class JpaControlLoop extends PfConcept implements PfAuthorative<ControlLo definition.clean(); description = (description == null ? null : description.trim()); - for (JpaControlLoopElement element : elements) { + for (JpaControlLoopElement element : elements.values()) { element.clean(); } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java index 042cb16e1..911a52089 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElement.java @@ -23,7 +23,6 @@ package org.onap.policy.clamp.controlloop.models.controlloop.persistence.concept import java.util.List; import java.util.UUID; import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; @@ -67,20 +66,19 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co // @formatter:off @VerifyKey @NotNull - @AttributeOverrides({ - @AttributeOverride(name = "name", column = @Column(name = "definition_name")), - @AttributeOverride(name = "version", column = @Column(name = "definition_version")) - } - ) + @AttributeOverride(name = "name", column = @Column(name = "definition_name")) + @AttributeOverride(name = "version", column = @Column(name = "definition_version")) private PfConceptKey definition; @VerifyKey @NotNull - @AttributeOverrides({ - @AttributeOverride(name = "name", column = @Column(name = "participant_name")), - @AttributeOverride(name = "version", column = @Column(name = "participant_version")) - } - ) + @AttributeOverride(name = "name", column = @Column(name = "participant_type_name")) + @AttributeOverride(name = "version", column = @Column(name = "participant_type_version")) + private PfConceptKey participantType; + + @NotNull + @AttributeOverride(name = "name", column = @Column(name = "participant_name")) + @AttributeOverride(name = "version", column = @Column(name = "participant_version")) private PfConceptKey participantId; // @formatter:on @@ -116,14 +114,14 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co * * @param key the key * @param definition the TOSCA definition of the control loop element - * @param participantId the TOSCA definition of the participant running the control loop element + * @param participantType the TOSCA definition of the participant running the control loop element * @param state the state of the control loop */ public JpaControlLoopElement(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey definition, - @NonNull final PfConceptKey participantId, @NonNull final ControlLoopState state) { + @NonNull final PfConceptKey participantType, @NonNull final ControlLoopState state) { this.key = key; this.definition = definition; - this.participantId = participantId; + this.participantType = participantType; this.state = state; } @@ -136,6 +134,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co super(copyConcept); this.key = new PfReferenceKey(copyConcept.key); this.definition = new PfConceptKey(copyConcept.definition); + this.participantType = new PfConceptKey(copyConcept.participantType); this.participantId = new PfConceptKey(copyConcept.participantId); this.state = copyConcept.state; this.orderedState = copyConcept.orderedState; @@ -157,6 +156,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co element.setId(UUID.fromString(getKey().getLocalName())); element.setDefinition(new ToscaConceptIdentifier(definition)); + element.setParticipantType(new ToscaConceptIdentifier(participantType)); element.setParticipantId(new ToscaConceptIdentifier(participantId)); element.setState(state); element.setOrderedState(orderedState != null ? orderedState : state.asOrderedState()); @@ -173,6 +173,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co } this.definition = element.getDefinition().asConceptKey(); + this.participantType = element.getParticipantType().asConceptKey(); this.participantId = element.getParticipantId().asConceptKey(); this.state = element.getState(); this.orderedState = element.getOrderedState(); @@ -184,6 +185,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co List<PfKey> keyList = getKey().getKeys(); keyList.add(definition); + keyList.add(participantType); keyList.add(participantId); return keyList; @@ -193,6 +195,7 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co public void clean() { key.clean(); definition.clean(); + participantType.clean(); participantId.clean(); if (description != null) { @@ -223,6 +226,11 @@ public class JpaControlLoopElement extends PfConcept implements PfAuthorative<Co return result; } + result = participantType.compareTo(other.participantType); + if (result != 0) { + return result; + } + result = participantId.compareTo(other.participantId); if (result != 0) { return result; diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java index c09658f80..8a06cbf1e 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ClElementStatisticsProvider.java @@ -62,10 +62,10 @@ public class ClElementStatisticsProvider extends AbstractModelsProvider { * @throws PfModelException on errors creating clElement statistics */ public List<ClElementStatistics> createClElementStatistics( - @NonNull final List<ClElementStatistics> clElementStatisticsList) throws PfModelException { + @NonNull final List<ClElementStatistics> clElementStatisticsList) throws PfModelException { BeanValidationResult validationResult = - new BeanValidationResult("control loop element statistics list", clElementStatisticsList); + new BeanValidationResult("control loop element statistics list", clElementStatisticsList); for (ClElementStatistics clElementStatistics : clElementStatisticsList) { JpaClElementStatistics jpaClElementStatistics = new JpaClElementStatistics(); jpaClElementStatistics.fromAuthorative(clElementStatistics); @@ -118,7 +118,7 @@ public class ClElementStatisticsProvider extends AbstractModelsProvider { * @throws PfModelException on errors getting clElement statistics */ public List<ClElementStatistics> getClElementStatistics(final String name, final String version, final String id, - final Instant timestamp) throws PfModelException { + final Instant timestamp) throws PfModelException { List<ClElementStatistics> clElementStatistics = new ArrayList<>(1); if (name != null && version != null && timestamp != null && id != null) { clElementStatistics.add(getPfDao() @@ -146,11 +146,9 @@ public class ClElementStatisticsProvider extends AbstractModelsProvider { * @throws PfModelException on errors getting policies */ public List<ClElementStatistics> getFilteredClElementStatistics(final String name, final String version, - final Instant startTimeStamp, - final Instant endTimeStamp, - Map<String, Object> filterMap, - final String sortOrder, final int getRecordNum) { + final Instant startTimeStamp, final Instant endTimeStamp, Map<String, Object> filterMap, + final String sortOrder, final int getRecordNum) { return asClElementStatisticsList(getPfDao().getFiltered(JpaClElementStatistics.class, name, version, - startTimeStamp, endTimeStamp, filterMap, sortOrder, getRecordNum)); + startTimeStamp, endTimeStamp, filterMap, sortOrder, getRecordNum)); } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java index ebb81942b..6b075278c 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ParticipantStatisticsProvider.java @@ -62,12 +62,12 @@ public class ParticipantStatisticsProvider extends AbstractModelsProvider { * @throws PfModelException on errors getting participant statistics */ public List<ParticipantStatistics> getParticipantStatistics(final String name, final String version, - final Instant timestamp) throws PfModelException { + final Instant timestamp) throws PfModelException { if (name != null && version != null && timestamp != null) { List<ParticipantStatistics> participantStatistics = new ArrayList<>(1); participantStatistics.add(getPfDao() - .get(JpaParticipantStatistics.class, new PfTimestampKey(name, version, timestamp)).toAuthorative()); + .get(JpaParticipantStatistics.class, new PfTimestampKey(name, version, timestamp)).toAuthorative()); return participantStatistics; } else if (name != null) { return getFilteredParticipantStatistics(name, version, timestamp, null, null, @@ -90,14 +90,11 @@ public class ParticipantStatisticsProvider extends AbstractModelsProvider { * @throws PfModelException on errors getting policies */ public List<ParticipantStatistics> getFilteredParticipantStatistics(final String name, final String version, - final Instant startTimeStamp, - final Instant endTimeStamp, - Map<String, Object> filterMap, - final String sortOrder, - final int getRecordNum) { + final Instant startTimeStamp, final Instant endTimeStamp, Map<String, Object> filterMap, + final String sortOrder, final int getRecordNum) { return asParticipantStatisticsList(getPfDao().getFiltered(JpaParticipantStatistics.class, name, version, - startTimeStamp, endTimeStamp, filterMap, sortOrder, getRecordNum)); + startTimeStamp, endTimeStamp, filterMap, sortOrder, getRecordNum)); } @@ -109,10 +106,10 @@ public class ParticipantStatisticsProvider extends AbstractModelsProvider { * @throws PfModelException on errors creating participant statistics */ public List<ParticipantStatistics> createParticipantStatistics( - @NonNull final List<ParticipantStatistics> participantStatisticsList) throws PfModelException { + @NonNull final List<ParticipantStatistics> participantStatisticsList) throws PfModelException { BeanValidationResult validationResult = - new BeanValidationResult("participant statistics List", participantStatisticsList); + new BeanValidationResult("participant statistics List", participantStatisticsList); for (ParticipantStatistics participantStatistics : participantStatisticsList) { JpaParticipantStatistics jpaParticipantStatistics = new JpaParticipantStatistics(); @@ -137,9 +134,9 @@ public class ParticipantStatisticsProvider extends AbstractModelsProvider { for (ParticipantStatistics participantStatisticsItem : participantStatisticsList) { JpaParticipantStatistics jpaParticipantStatistics = getPfDao().get(JpaParticipantStatistics.class, - new PfTimestampKey(participantStatisticsItem.getParticipantId().getName(), - participantStatisticsItem.getParticipantId().getVersion(), - participantStatisticsItem.getTimeStamp())); + new PfTimestampKey(participantStatisticsItem.getParticipantId().getName(), + participantStatisticsItem.getParticipantId().getVersion(), + participantStatisticsItem.getTimeStamp())); participantStatistics.add(jpaParticipantStatistics.toAuthorative()); } @@ -154,9 +151,9 @@ public class ParticipantStatisticsProvider extends AbstractModelsProvider { * @return the participant statistics list */ private List<ParticipantStatistics> asParticipantStatisticsList( - List<JpaParticipantStatistics> jpaParticipantStatisticsList) { + List<JpaParticipantStatistics> jpaParticipantStatisticsList) { return jpaParticipantStatisticsList.stream().map(JpaParticipantStatistics::toAuthorative) - .collect(Collectors.toList()); + .collect(Collectors.toList()); } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java index 4b27e0df3..3ca4d3d34 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessage.java @@ -30,8 +30,8 @@ import lombok.ToString; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** - * Class to represent the base class for various messages that will be exchanged between - * the control loop runtime and participants. + * Class to represent the base class for various messages that will be exchanged between the control loop runtime and + * participants. */ @Getter @Setter @@ -43,18 +43,22 @@ public class ParticipantMessage { private UUID messageId = UUID.randomUUID(); /** - * Time-stamp, in milliseconds, when the message was created. Defaults to the current - * time. + * Time-stamp, in milliseconds, when the message was created. Defaults to the current time. */ private Instant timestamp = Instant.now(); /** - * Participant ID, or {@code null} for state-change broadcast messages. + * Participant Type, or {@code null} for messages from participants. + */ + private ToscaConceptIdentifier participantType; + + /** + * Participant ID, or {@code null} for messages from participants. */ private ToscaConceptIdentifier participantId; /** - * Control loop ID. For state-change messages, this may be {@code null}. + * Control loop ID, or {@code null} for messages to participants. */ private ToscaConceptIdentifier controlLoopId; @@ -68,30 +72,42 @@ public class ParticipantMessage { } /** - * Constructs the object, making a deep copy. Does <i>not</i> copy the request id or - * the time stamp. + * Constructs the object, making a deep copy. Does <i>not</i> copy the request id or the time stamp. * * @param source source from which to copy */ public ParticipantMessage(final ParticipantMessage source) { this.messageType = source.messageType; + this.participantType = source.participantType; this.participantId = source.participantId; this.controlLoopId = source.controlLoopId; } /** - * Determines if this message applies to this participant. + * Determines if this message applies to this participant type. * + * @param participantType type of the participant to match against * @param participantId id of the participant to match against * @return {@code true} if this message applies to this participant, {@code false} otherwise */ - public boolean appliesTo(@NonNull final ToscaConceptIdentifier participantId) { - if (participantId.equals(this.participantId)) { + public boolean appliesTo(@NonNull final ToscaConceptIdentifier participantType, + @NonNull final ToscaConceptIdentifier participantId) { + // Broadcast message to all participants + if (this.participantType == null) { + return true; + } + + // Broadcast message to all control loop elements on this participant + if (participantType.equals(this.participantType) && this.participantId == null) { + return true; + } + + // Targeted message at this specific participant + if (participantType.equals(this.participantType) && participantId.equals(this.participantId)) { return true; } - // false: message included a participant ID, but it does not match - // true: its a broadcast message - return this.participantId == null; + // Message is not for this participant + return false; } } diff --git a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java index b7140d4b8..5b9284243 100644 --- a/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java +++ b/tosca-controlloop/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java @@ -26,6 +26,7 @@ import lombok.ToString; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics; /** * Class to represent the PARTICIPANT_STATUS message that all the participants send to the control loop runtime. @@ -44,6 +45,9 @@ public class ParticipantStatus extends ParticipantMessage { // Control Loops on the participant private ControlLoops controlLoops; + // Participant statistics + private ParticipantStatistics participantStatistics; + // Description. May be left {@code null}. private String message; diff --git a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java index 2c0a45541..c865b76ab 100644 --- a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java +++ b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/concepts/ControlLoopTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.UUID; import org.junit.Test; import org.onap.policy.models.base.PfKey; @@ -51,6 +51,7 @@ public class ControlLoopTest { public void testControlLoopLombok() { assertNotNull(new ControlLoop()); ControlLoop cl0 = new ControlLoop(); + cl0.setElements(new LinkedHashMap<>()); assertThat(cl0.toString()).contains("ControlLoop("); assertThat(cl0.hashCode()).isNotZero(); @@ -61,7 +62,7 @@ public class ControlLoopTest { cl1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1")); cl1.setDescription("Description"); - cl1.setElements(new ArrayList<>()); + cl1.setElements(new LinkedHashMap<>()); cl1.setName("Name"); cl1.setOrderedState(ControlLoopOrderedState.UNINITIALISED); cl1.setState(ControlLoopState.UNINITIALISED); @@ -75,6 +76,7 @@ public class ControlLoopTest { assertNotEquals(cl1, cl0); ControlLoop cl2 = new ControlLoop(); + cl2.setElements(new LinkedHashMap<>()); // @formatter:off assertThatThrownBy(() -> cl2.setDefinition(null)). isInstanceOf(NullPointerException.class); @@ -87,14 +89,13 @@ public class ControlLoopTest { cl1.setCascadedOrderedState(ControlLoopOrderedState.PASSIVE); assertEquals(ControlLoopOrderedState.PASSIVE, cl1.getOrderedState()); - cl1.getElements().add(new ControlLoopElement()); + cl1.getElements().put(UUID.randomUUID(), new ControlLoopElement()); cl1.setCascadedOrderedState(ControlLoopOrderedState.RUNNING); assertEquals(ControlLoopOrderedState.RUNNING, cl1.getOrderedState()); - assertEquals(ControlLoopOrderedState.RUNNING, cl1.getElements().get(0).getOrderedState()); + assertEquals(ControlLoopOrderedState.RUNNING, cl1.getElements().values().iterator().next().getOrderedState()); - assertNull(cl0.getElement(UUID.randomUUID())); - assertNull(cl1.getElement(UUID.randomUUID())); - assertEquals(cl1.getElements().get(0), cl1.getElement(cl1.getElements().get(0).getId())); + assertNull(cl0.getElements().get(UUID.randomUUID())); + assertNull(cl1.getElements().get(UUID.randomUUID())); assertEquals(PfKey.NULL_KEY_NAME, cl0.getDefinition().getName()); } diff --git a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java index c82dcf060..16c302f94 100644 --- a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java +++ b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaClElementStatisticsTest.java @@ -83,7 +83,7 @@ public class JpaClElementStatisticsTest { }).hasMessageMatching("clElementStatistics is marked .*ull but is null"); assertThatThrownBy(() -> new JpaClElementStatistics((JpaClElementStatistics) null)) - .isInstanceOf(NullPointerException.class); + .isInstanceOf(NullPointerException.class); JpaClElementStatistics testJpaClElementStatisticsFa = new JpaClElementStatistics(); testJpaClElementStatisticsFa.setKey(null); diff --git a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java index cd105a671..032d655e3 100644 --- a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java +++ b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopElementTest.java @@ -112,11 +112,11 @@ public class JpaControlLoopElementTest { assertThatThrownBy(() -> { new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), null, null); - }).hasMessageMatching("participantId is marked .*ull but is null"); + }).hasMessageMatching("participantType is marked .*ull but is null"); assertThatThrownBy(() -> { new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), null, ControlLoopState.UNINITIALISED); - }).hasMessageMatching("participantId is marked .*ull but is null"); + }).hasMessageMatching("participantType is marked .*ull but is null"); assertThatThrownBy(() -> { new JpaControlLoopElement(new PfReferenceKey(), new PfConceptKey(), @@ -240,9 +240,9 @@ public class JpaControlLoopElementTest { testJpaControlLoopElement.setState(ControlLoopState.UNINITIALISED); assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement)); - testJpaControlLoopElement.setParticipantId(new PfConceptKey("dummy", "0.0.1")); + testJpaControlLoopElement.setParticipantType(new PfConceptKey("dummy", "0.0.1")); assertNotEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement)); - testJpaControlLoopElement.setParticipantId(new PfConceptKey("participant", "0.0.1")); + testJpaControlLoopElement.setParticipantType(new PfConceptKey("participantType", "0.0.1")); assertEquals(0, testJpaControlLoopElement.compareTo(otherJpaControlLoopElement)); assertEquals(testJpaControlLoopElement, new JpaControlLoopElement(testJpaControlLoopElement)); @@ -293,7 +293,7 @@ public class JpaControlLoopElementTest { ControlLoopElement controlLoopElement = new ControlLoopElement(); controlLoopElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e")); controlLoopElement.setDefinition(new ToscaConceptIdentifier("cleDef", "0.0.1")); - controlLoopElement.setParticipantId(new ToscaConceptIdentifier("participant", "0.0.1")); + controlLoopElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1")); return controlLoopElement; } diff --git a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java index 7ef7e3276..01062b046 100644 --- a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java +++ b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/concepts/JpaControlLoopTest.java @@ -30,7 +30,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.File; -import java.util.ArrayList; +import java.util.LinkedHashMap; import org.junit.Test; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; @@ -63,7 +63,7 @@ public class JpaControlLoopTest { }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { - new JpaControlLoop(null, null, null, new ArrayList<>()); + new JpaControlLoop(null, null, null, new LinkedHashMap<>()); }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { @@ -71,7 +71,7 @@ public class JpaControlLoopTest { }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { - new JpaControlLoop(null, null, ControlLoopState.UNINITIALISED, new ArrayList<>()); + new JpaControlLoop(null, null, ControlLoopState.UNINITIALISED, new LinkedHashMap<>()); }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { @@ -79,7 +79,7 @@ public class JpaControlLoopTest { }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { - new JpaControlLoop(null, new PfConceptKey(), null, new ArrayList<>()); + new JpaControlLoop(null, new PfConceptKey(), null, new LinkedHashMap<>()); }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { @@ -87,7 +87,7 @@ public class JpaControlLoopTest { }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { - new JpaControlLoop(null, new PfConceptKey(), ControlLoopState.UNINITIALISED, new ArrayList<>()); + new JpaControlLoop(null, new PfConceptKey(), ControlLoopState.UNINITIALISED, new LinkedHashMap<>()); }).hasMessageMatching(NULL_KEY_ERROR); assertThatThrownBy(() -> { @@ -95,7 +95,7 @@ public class JpaControlLoopTest { }).hasMessageMatching("definition is marked .*ull but is null"); assertThatThrownBy(() -> { - new JpaControlLoop(new PfConceptKey(), null, null, new ArrayList<>()); + new JpaControlLoop(new PfConceptKey(), null, null, new LinkedHashMap<>()); }).hasMessageMatching("definition is marked .*ull but is null"); assertThatThrownBy(() -> { @@ -103,7 +103,7 @@ public class JpaControlLoopTest { }).hasMessageMatching("definition is marked .*ull but is null"); assertThatThrownBy(() -> { - new JpaControlLoop(new PfConceptKey(), null, ControlLoopState.UNINITIALISED, new ArrayList<>()); + new JpaControlLoop(new PfConceptKey(), null, ControlLoopState.UNINITIALISED, new LinkedHashMap<>()); }).hasMessageMatching("definition is marked .*ull but is null"); assertThatThrownBy(() -> { @@ -111,7 +111,7 @@ public class JpaControlLoopTest { }).hasMessageMatching("state is marked .*ull but is null"); assertThatThrownBy(() -> { - new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), null, new ArrayList<>()); + new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), null, new LinkedHashMap<>()); }).hasMessageMatching("state is marked .*ull but is null"); assertThatThrownBy(() -> { @@ -121,7 +121,7 @@ public class JpaControlLoopTest { assertNotNull(new JpaControlLoop()); assertNotNull(new JpaControlLoop((new PfConceptKey()))); assertNotNull(new JpaControlLoop(new PfConceptKey(), new PfConceptKey(), ControlLoopState.UNINITIALISED, - new ArrayList<>())); + new LinkedHashMap<>())); } @Test @@ -188,7 +188,7 @@ public class JpaControlLoopTest { JpaControlLoop jpaControlLoopWithElements = new JpaControlLoop(controlLoopsWithElements.getControlLoopList().get(0)); assertEquals(4, jpaControlLoopWithElements.getElements().size()); - assertEquals(14, jpaControlLoopWithElements.getKeys().size()); + assertEquals(18, jpaControlLoopWithElements.getKeys().size()); assertThatCode(() -> jpaControlLoopWithElements.clean()).doesNotThrowAnyException(); assertEquals(controlLoopsWithElements.getControlLoopList().get(0), jpaControlLoopWithElements.toAuthorative()); @@ -258,7 +258,7 @@ public class JpaControlLoopTest { cl1.setDefinition(new PfConceptKey("defName", "0.0.1")); cl1.setDescription("Description"); - cl1.setElements(new ArrayList<>()); + cl1.setElements(new LinkedHashMap<>()); cl1.setKey(new PfConceptKey("participant", "0.0.1")); cl1.setState(ControlLoopState.UNINITIALISED); @@ -289,7 +289,7 @@ public class JpaControlLoopTest { testControlLoop.setName("control-loop"); testControlLoop.setVersion("0.0.1"); testControlLoop.setDefinition(new ToscaConceptIdentifier("controlLoopDefinitionName", "0.0.1")); - testControlLoop.setElements(new ArrayList<>()); + testControlLoop.setElements(new LinkedHashMap<>()); return testControlLoop; } diff --git a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java index fb443c82e..96b63a23d 100644 --- a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java +++ b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/controlloop/persistence/provider/ControlLoopProviderTest.java @@ -91,11 +91,8 @@ public class ControlLoopProviderTest { ControlLoops createdControlLoops = new ControlLoops(); createdControlLoops .setControlLoopList(controlLoopProvider.createControlLoops(inputControlLoops.getControlLoopList())); - String createdJson = CODER.encode(createdControlLoops, true); - System.err.println(originalJson); - System.out.println(createdJson); - assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); + assertEquals(inputControlLoops, createdControlLoops); } @Test diff --git a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java index f66c99262..d27d3a22c 100644 --- a/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java +++ b/tosca-controlloop/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java @@ -57,9 +57,11 @@ public class ParticipantMessageTest { public void testAppliesTo_NullParticipantId() { message = makeMessage(); - assertThatThrownBy(() -> message.appliesTo(null)) - .isInstanceOf(NullPointerException.class); - + assertThatThrownBy(() -> message.appliesTo(null, null)).isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> message.appliesTo(new ToscaConceptIdentifier("PType", "4.5.6"), null)) + .isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> message.appliesTo(null, new ToscaConceptIdentifier("id", "1.2.3"))) + .isInstanceOf(NullPointerException.class); } @Test @@ -67,33 +69,32 @@ public class ParticipantMessageTest { message = makeMessage(); // ParticipantId matches - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - assertTrue(message.appliesTo(id)); + assertTrue(message.appliesTo(new ToscaConceptIdentifier("PType", "4.5.6"), + new ToscaConceptIdentifier("id", "1.2.3"))); + assertFalse(message.appliesTo(new ToscaConceptIdentifier("PType", "4.5.6"), + new ToscaConceptIdentifier("id", "1.2.4"))); + assertFalse(message.appliesTo(new ToscaConceptIdentifier("PType", "4.5.7"), + new ToscaConceptIdentifier("id", "1.2.3"))); } @Test public void testAppliesTo_ParticipantIdNoMatch() { message = makeMessage(); - // ParticipantId doesnot match + // ParticipantId does not match ToscaConceptIdentifier id = new ToscaConceptIdentifier(); id.setName("id1111"); id.setVersion("3.2.1"); - assertFalse(message.appliesTo(id)); - message.setParticipantId(null); - assertTrue(message.appliesTo(id)); + assertFalse(message.appliesTo(id, id)); + message.setParticipantType(null); + assertTrue(message.appliesTo(id, id)); } private ParticipantMessage makeMessage() { ParticipantMessage msg = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - msg.setControlLoopId(id); - msg.setParticipantId(id); + msg.setParticipantType(new ToscaConceptIdentifier("PType", "4.5.6")); + msg.setParticipantId(new ToscaConceptIdentifier("id", "1.2.3")); msg.setMessageId(UUID.randomUUID()); msg.setTimestamp(Instant.ofEpochMilli(3000)); diff --git a/tosca-controlloop/models/src/test/resources/META-INF/persistence.xml b/tosca-controlloop/models/src/test/resources/META-INF/persistence.xml index 8f0e0648b..078d534be 100644 --- a/tosca-controlloop/models/src/test/resources/META-INF/persistence.xml +++ b/tosca-controlloop/models/src/test/resources/META-INF/persistence.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- ============LICENSE_START======================================================= - Copyright (C) 2019-2020 Nordix Foundation. + 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. diff --git a/tosca-controlloop/models/src/test/resources/json/ControlLoopElementNoOrderedState.json b/tosca-controlloop/models/src/test/resources/json/ControlLoopElementNoOrderedState.json index e9da16aad..33a63e604 100644 --- a/tosca-controlloop/models/src/test/resources/json/ControlLoopElementNoOrderedState.json +++ b/tosca-controlloop/models/src/test/resources/json/ControlLoopElementNoOrderedState.json @@ -4,8 +4,8 @@ "name": "cleDef", "version": "0.0.1" }, - "participantId": { - "name": "participant", + "participantType": { + "name": "participantType", "version": "0.0.1" }, "state": "UNINITIALISED", diff --git a/tosca-controlloop/models/src/test/resources/providers/TestControlLoops.json b/tosca-controlloop/models/src/test/resources/providers/TestControlLoops.json index 25e36458c..fedda9600 100644 --- a/tosca-controlloop/models/src/test/resources/providers/TestControlLoops.json +++ b/tosca-controlloop/models/src/test/resources/providers/TestControlLoops.json @@ -7,64 +7,64 @@ }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-e21eb79c6c20": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-e21eb79c6c21": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-e21eb79c6c22": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-e21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 0 control loop" } - ], + }, "name": "PMSHInstance0", "version": "1.0.1", "description": "PMSH control loop instance 0" @@ -76,64 +76,64 @@ }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-e21eb79c6c24": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-e21eb79c6c25": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-e21eb79c6c26": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-e21eb79c6c27": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 1 control loop" } - ], + }, "name": "PMSHInstance1", "version": "1.0.1", "description": "PMSH control loop instance 1" diff --git a/tosca-controlloop/models/src/test/resources/providers/UpdateControlLoops.json b/tosca-controlloop/models/src/test/resources/providers/UpdateControlLoops.json index 0ae402629..2d6bd0753 100644 --- a/tosca-controlloop/models/src/test/resources/providers/UpdateControlLoops.json +++ b/tosca-controlloop/models/src/test/resources/providers/UpdateControlLoops.json @@ -10,64 +10,64 @@ "state": "RUNNING", "orderedState": "RUNNING", "description": "PMSH control loop instance 0", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "RUNNING", "orderedState": "RUNNING", "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "RUNNING", "orderedState": "RUNNING", "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c22": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", - "version": "1.2.3" + "version": "2.3.1" }, - "participantId": { - "name": "PolicyParticipant0", + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", "version": "1.0.0" }, "state": "RUNNING", "orderedState": "RUNNING", "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "RUNNING", "orderedState": "RUNNING", "description": "CDS Control Loop Element for the PMSH instance 0 control loop" } - ] + } } ] } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/pom.xml b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/pom.xml index 49d74aefc..7b0e531ce 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/pom.xml +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/pom.xml @@ -32,11 +32,27 @@ <name>${project.artifactId}</name> <description>DCAE participant, that allows DCAE to partake in control loops</description> + <properties> + <mockserver.version>5.11.2</mockserver.version> + </properties> + <dependencies> <dependency> <groupId>org.onap.policy.clamp.controlloop</groupId> <artifactId>participant-intermediary</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.mock-server</groupId> + <artifactId>mockserver-netty</artifactId> + <version>${mockserver.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mock-server</groupId> + <artifactId>mockserver-client-java</artifactId> + <version>${mockserver.version}</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java new file mode 100644 index 000000000..b2d0b61d0 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java @@ -0,0 +1,154 @@ +/*- + * ============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.dcae.httpclient; + +import java.io.Closeable; +import java.io.IOException; +import javax.ws.rs.core.Response.Status; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpRequest; +import org.apache.http.ParseException; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.AuthCache; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.conn.ssl.TrustSelfSignedStrategy; +import org.apache.http.impl.auth.BasicScheme; +import org.apache.http.impl.client.BasicAuthCache; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContextBuilder; +import org.apache.http.util.EntityUtils; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; +import org.onap.policy.common.endpoints.parameters.RestServerParameters; +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.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class AbstractHttpClient implements Closeable { + + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractHttpClient.class); + private final HttpClientContext localContext; + private final CloseableHttpClient httpclient; + private final HttpHost target; + public static final Coder CODER = new StandardCoder(); + + /** + * Constructor. + */ + protected AbstractHttpClient(RestServerParameters restServerParameters) { + try { + final String scheme = restServerParameters.isHttps() ? "https" : "http"; + target = new HttpHost(restServerParameters.getHost(), restServerParameters.getPort(), scheme); + + CredentialsProvider credsProvider = new BasicCredentialsProvider(); + credsProvider.setCredentials(new AuthScope(target.getHostName(), target.getPort()), + new UsernamePasswordCredentials(restServerParameters.getUserName(), + restServerParameters.getPassword())); + + AuthCache authCache = new BasicAuthCache(); + BasicScheme basicAuth = new BasicScheme(); + authCache.put(target, basicAuth); + localContext = HttpClientContext.create(); + localContext.setAuthCache(authCache); + + HttpClientBuilder builder = HttpClients.custom().setDefaultCredentialsProvider(credsProvider); + if (restServerParameters.isHttps()) { + final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(new SSLContextBuilder() + .loadTrustMaterial(null, new TrustSelfSignedStrategy()).setProtocol("TLSv1.2").build(), + new NoopHostnameVerifier()); + builder.setSSLSocketFactory(sslsf); + } + httpclient = builder.build(); + + } catch (final Exception e) { + throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, + restServerParameters.getName() + " Client failed to start", e); + } + } + + CloseableHttpResponse execute(HttpRequest request) throws IOException { + return httpclient.execute(target, request, localContext); + } + + protected boolean executePut(String path, int statusCode) { + try (CloseableHttpResponse response = execute(new HttpPut(path))) { + return response.getStatusLine().getStatusCode() == statusCode; + } catch (Exception e) { + return false; + } + } + + protected Loop executePost(String path, int statusCode) { + try (CloseableHttpResponse response = execute(new HttpPost(path))) { + if (response.getStatusLine().getStatusCode() != statusCode) { + return null; + } + return entityToMap(response.getEntity()); + } catch (Exception e) { + return null; + } + } + + protected Loop executeGet(String path, int statusCode) { + try (CloseableHttpResponse response = execute(new HttpGet(path))) { + if (response.getStatusLine().getStatusCode() != statusCode) { + return null; + } + return entityToMap(response.getEntity()); + } catch (Exception e) { + return null; + } + } + + private Loop entityToMap(HttpEntity httpEntity) { + if (httpEntity == null) { + return new Loop(); + } + try { + return CODER.convert(EntityUtils.toString(httpEntity), Loop.class); + } catch (ParseException | IOException e) { + LOGGER.error("error reading Entity", e); + return new Loop(); + } catch (CoderException e) { + LOGGER.error("cannot convert to Loop Object", e); + return new Loop(); + } + } + + @Override + public void close() throws IOException { + httpclient.close(); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java new file mode 100644 index 000000000..eb805054d --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java @@ -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========================================================= + */ + +package org.onap.policy.clamp.controlloop.participant.dcae.httpclient; + +import org.apache.http.HttpStatus; +import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent; +import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; +import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ClampHttpClient extends AbstractHttpClient { + + private static final Logger LOGGER = LoggerFactory.getLogger(ClampHttpClient.class); + + private static final String STATUS = "/restservices/clds/v2/loop/getstatus/"; + private static final String CREATE = "/restservices/clds/v2/loop/create/%s?templateName=%s"; + private static final String UPDATE = "/restservices/clds/v2/loop/updateMicroservicePolicy/"; + private static final String DEPLOY = "/restservices/clds/v2/loop/deploy/"; + private static final String STOP = "/restservices/clds/v2/loop/stop/"; + private static final String DELETE = "/restservices/clds/v2/loop/delete/"; + private static final String UNDEPLOY = "/restservices/clds/v2/loop/undeploy/"; + public static final String STATUS_NOT_FOUND = "STATUS_NOT_FOUND"; + public static final String POLICY_NOT_FOUND = "POLICY_NOT_FOUND"; + + /** + * Constructor. + */ + public ClampHttpClient(RestServerParameters restServerParameters) { + super(restServerParameters); + } + + /** + * Create. + * + * @param loopName the loopName + * @param templateName the templateName + * @return the Loop object or null if error occurred + */ + public Loop create(String loopName, String templateName) { + return executePost(String.format(CREATE, loopName, templateName), HttpStatus.SC_OK); + } + + /** + * Update. + * + * @param loopName the loopName + * @param jsonEntity the Json entity + * @return true + */ + public boolean update(String loopName, String jsonEntity) { + return executePost(UPDATE + loopName, HttpStatus.SC_OK) != null; + } + + /** + * Deploy. + * + * @param loopName the loopName + * @return true + */ + public boolean deploy(String loopName) { // DCAE + return executePut(DEPLOY + loopName, HttpStatus.SC_ACCEPTED); + } + + /** + * Get Status. + * + * @param loopName the loopName + * @return the Loop object or null if error occurred + */ + public Loop getstatus(String loopName) { + return executeGet(STATUS + loopName, HttpStatus.SC_OK); + } + + /** + * Undeploy. + * + * @param loopName the loopName + * @return true + */ + public boolean undeploy(String loopName) { + return executePut(UNDEPLOY + loopName, HttpStatus.SC_ACCEPTED); + } + + /** + * Stop. + * + * @param loopName the loopName + * @return true + */ + public boolean stop(String loopName) { + return executePut(STOP + loopName, HttpStatus.SC_OK); + } + + /** + * Delete. + * + * @param loopName the loopName + * @return true + */ + public boolean delete(String loopName) { + return executePut(DELETE + loopName, HttpStatus.SC_OK); + } + + /** + * return status from Loop object. + * + * @param loop Loop + * @return status + */ + public static String getStatusCode(Loop loop) { + if (loop == null || loop.getComponents() == null || loop.getComponents().isEmpty()) { + return STATUS_NOT_FOUND; + } + ExternalComponent externalComponent = loop.getComponents().get("DCAE"); + if (externalComponent == null || externalComponent.getComponentState() == null) { + return STATUS_NOT_FOUND; + } + + return externalComponent.getComponentState().getStateName(); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java new file mode 100644 index 000000000..cd84a2feb --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java @@ -0,0 +1,46 @@ +/*- + * ============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.dcae.httpclient; + +import org.apache.http.HttpStatus; +import org.onap.policy.common.endpoints.parameters.RestServerParameters; + +public class ConsulDcaeHttpClient extends AbstractHttpClient { + + private static final String DEPLOY = "/v1/kv/dcae-pmsh:policy"; + + /** + * constructor. + */ + public ConsulDcaeHttpClient(RestServerParameters restServerParameters) { + super(restServerParameters); + } + + /** + * call consult. + * + * @param jsonEntity the Entity + * @return true + */ + public boolean deploy(String jsonEntity) { + return executePut(DEPLOY + jsonEntity, HttpStatus.SC_ACCEPTED); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java new file mode 100644 index 000000000..96677f320 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java @@ -0,0 +1,197 @@ +/*- + * ============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.dcae.main.handler; + +import java.io.Closeable; +import java.io.IOException; +import java.time.Instant; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +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.participant.dcae.httpclient.ClampHttpClient; +import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ConsulDcaeHttpClient; +import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; +import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class handles implementation of controlLoopElement updates. + */ +public class ControlLoopElementHandler implements ControlLoopElementListener, Closeable { + + private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class); + private final ClampHttpClient clampClient; + private final ConsulDcaeHttpClient consulClient; + + private static final String LOOP = "pmsh_loop"; + private static final String TEMPLATE = "LOOP_TEMPLATE_k8s_pmsh"; + + private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED"; + private static final String MICROSERVICE_INSTALLED_SUCCESSFULLY = "MICROSERVICE_INSTALLED_SUCCESSFULLY"; + private static final int CHECK_COUNT = 10; + + private static final String BODY_CONSUL = + "{ \"subscription\": { \"subscriptionName\": \"subscriptiona\", \"administrativeState\": \"UNLOCKED\", " + + "\"fileBasedGP\": 15, \"fileLocation\": \"/pm/pm.xml\", \"nfFilter\": " + + "{ \"nfNames\": [ \"^pnf1.*\" ], \"modelInvariantIDs\": " + + "[ \"5845y423-g654-6fju-po78-8n53154532k6\", \"7129e420-d396-4efb-af02-6b83499b12f8\" ], " + + "\"modelVersionIDs\": [ \"e80a6ae3-cafd-4d24-850d-e14c084a5ca9\" ] }, \"measurementGroups\": " + + "[ { \"measurementGroup\": { \"measurementTypes\": [ { \"measurementType\": \"countera\" }, " + + "{ \"measurementType\": \"counterb\" } ], \"managedObjectDNsBasic\": [ { \"DN\": \"dna\" }, " + + "{ \"DN\": \"dnb\" } ] } }, { \"measurementGroup\": { \"measurementTypes\": " + + "[ { \"measurementType\": \"counterc\" }, { \"measurementType\": \"counterd\" } ], " + + "\"managedObjectDNsBasic\": " + "[ { \"DN\": \"dnc\" }, { \"DN\": \"dnd\" } ] } } ] } }"; + + /** + * Constructor. + */ + public ControlLoopElementHandler(RestServerParameters clampParameters, RestServerParameters consulParameters) { + clampClient = new ClampHttpClient(clampParameters); + consulClient = new ConsulDcaeHttpClient(consulParameters); + } + + /** + * Callback method to handle a control loop element state change. + * + * @param controlLoopElementId the ID of the control loop element + * @param currentState the current state of the control loop element + * @param newState the state to which the control loop element is changing to + */ + @Override + public void controlLoopElementStateChange(UUID controlLoopElementId, ControlLoopState currentState, + ControlLoopOrderedState newState) { + switch (newState) { + case UNINITIALISED: + Loop loop = clampClient.getstatus(LOOP); + if (loop != null) { + clampClient.undeploy(LOOP); + DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi() + .updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.UNINITIALISED); + } + break; + case PASSIVE: + DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi() + .updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.PASSIVE); + break; + case RUNNING: + DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi() + .updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.RUNNING); + break; + default: + LOGGER.debug("Unknown orderedstate {}", newState); + break; + } + } + + private Loop getStatus() throws PfModelException { + Loop loop = clampClient.getstatus(LOOP); + if (loop == null) { + loop = clampClient.create(LOOP, TEMPLATE); + } + if (loop == null) { + throw new PfModelException(null, ""); + } + return loop; + } + + private void deploy() throws PfModelException { + if (!consulClient.deploy(BODY_CONSUL)) { + throw new PfModelException(null, "deploy to consul failed"); + } + if (!clampClient.deploy(LOOP)) { + throw new PfModelException(null, "deploy failed"); + } + } + + /** + * Callback method to handle an update on a control loop element. + * + * @param element the information on the control loop element + * @param controlLoopDefinition toscaServiceTemplate + * @throws PfModelException in case of an exception + */ + @Override + public void controlLoopElementUpdate(ControlLoopElement element, ToscaServiceTemplate controlLoopDefinition) + throws PfModelException { + try { + Loop loop = getStatus(); + + if (BLUEPRINT_DEPLOYED.equals(ClampHttpClient.getStatusCode(loop))) { + deploy(); + boolean deployedFlag = false; + for (int i = 0; i < CHECK_COUNT; i++) { + //sleep 10 seconds + TimeUnit.SECONDS.sleep(CHECK_COUNT); + loop = getStatus(); + String status = ClampHttpClient.getStatusCode(loop); + if (MICROSERVICE_INSTALLED_SUCCESSFULLY.equals(status)) { + DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi() + .updateControlLoopElementState(element.getId(), element.getOrderedState(), + ControlLoopState.PASSIVE); + deployedFlag = true; + break; + } + } + if (!deployedFlag) { + LOGGER.warn("DCAE is not deployed properly, ClElement state will be UNINITIALISED2PASSIVE"); + DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi() + .updateControlLoopElementState(element.getId(), element.getOrderedState(), + ControlLoopState.UNINITIALISED2PASSIVE); + } + } + } catch (PfModelException e) { + throw e; + } catch (Exception e) { + throw new PfModelException(null, e.getMessage(), e); + } + } + + /** + * Handle controlLoopElement statistics. + * + * @param controlLoopElementId controlloop element id + */ + @Override + public void handleStatistics(UUID controlLoopElementId) { + ControlLoopElement clElement = DcaeHandler.getInstance().getDcaeProvider() + .getIntermediaryApi().getControlLoopElement(controlLoopElementId); + if (clElement != null) { + ClElementStatistics clElementStatistics = new ClElementStatistics(); + clElementStatistics.setControlLoopState(clElement.getState()); + clElementStatistics.setTimeStamp(Instant.now()); + DcaeHandler.getInstance().getDcaeProvider().getIntermediaryApi() + .updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics); + } + } + + @Override + public void close() throws IOException { + clampClient.close(); + consulClient.close(); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java new file mode 100644 index 000000000..1963e38b1 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeHandler.java @@ -0,0 +1,82 @@ +/*- + * ============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.dcae.main.handler; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import javax.ws.rs.core.Response; +import lombok.Getter; +import org.onap.policy.clamp.controlloop.common.handler.ControlLoopHandler; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +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.base.PfModelRuntimeException; + +/** + * This class handles dcae of participants and control loop elements. + * + * </p> + * It is effectively a singleton that is started at system start. + */ +public class DcaeHandler extends ControlLoopHandler { + + private final ParticipantDcaeParameters parameters; + @Getter + private DcaeProvider dcaeProvider; + + /** + * Create a handler. + * + * @param parameters the parameters for access to the database + */ + public DcaeHandler(ParticipantDcaeParameters parameters) { + super(parameters.getDatabaseProviderParameters()); + this.parameters = parameters; + } + + public static DcaeHandler getInstance() { + return Registry.get(DcaeHandler.class.getName()); + } + + @Override + public Set<Class<?>> getProviderClasses() { + return Collections.emptySet(); + } + + @Override + public void startProviders() { + dcaeProvider = new DcaeProvider(parameters); + } + + @Override + public void stopProviders() { + try { + dcaeProvider.close(); + } catch (IOException e) { + throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()); + } finally { + dcaeProvider = null; + } + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java new file mode 100644 index 000000000..afaf1c754 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/DcaeProvider.java @@ -0,0 +1,133 @@ +/*- + * ============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.dcae.main.handler; + +import java.io.Closeable; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import lombok.Getter; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; +import org.onap.policy.clamp.controlloop.models.messages.rest.TypedSimpleResponse; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory; + +/** + * This provider class dcae of participants and control loop elements. + */ +public class DcaeProvider implements Closeable { + @Getter + private final ParticipantIntermediaryApi intermediaryApi; + + private final ControlLoopElementHandler clElementHandler; + + /** + * Create a participant dcae provider. + * + * @throws ControlLoopRuntimeException on errors creating the provider + */ + public DcaeProvider(ParticipantDcaeParameters parameters) throws ControlLoopRuntimeException { + intermediaryApi = new ParticipantIntermediaryFactory().createApiImplementation(); + intermediaryApi.init(parameters.getIntermediaryParameters()); + clElementHandler = new ControlLoopElementHandler(parameters.getClampClientParameters(), + parameters.getConsulClientParameters()); + intermediaryApi.registerControlLoopElementListener(clElementHandler); + } + + @Override + public void close() throws IOException { + intermediaryApi.close(); + clElementHandler.close(); + } + + /** + * Get the control loops. + * + * @param name the controlLoop, null to get all + * @param version the controlLoop, null to get all + * @return the control loops + * @throws ControlLoopException on errors getting the control loops + */ + public ControlLoops getControlLoops(String name, String version) throws ControlLoopException { + return intermediaryApi.getControlLoops(name, version); + } + + /** + * Get the dcae control loop elements. + * + * @param name the controlLoopElement, null to get all + * @param version the controlLoopElement, null to get all + * @return the control loop elements + * @throws ControlLoopException on errors getting the control loop elements + */ + public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) + throws ControlLoopException { + return intermediaryApi.getControlLoopElements(name, version); + } + + /** + * Update the given control loop element in the dcae. + * + * @param element the control loop element to update + * @return response simple response returned + * @throws ControlLoopException on errors updating the control loop element + */ + public TypedSimpleResponse<ControlLoopElement> updateControlLoopElement(ControlLoopElement element) + throws ControlLoopException { + TypedSimpleResponse<ControlLoopElement> response = new TypedSimpleResponse<>(); + response.setResponse(intermediaryApi.updateControlLoopElementState(element.getId(), + element.getOrderedState(), element.getState())); + return response; + } + + /** + * Get the current dcae participants. + * + * @param name the participant, null to get all + * @param version the participant, null to get all + * @return the list of participants + * @throws ControlLoopException on errors getting the participants + */ + public List<Participant> getParticipants(String name, String version) throws ControlLoopException { + return intermediaryApi.getParticipants(name, version); + } + + /** + * Update a dcae participant. + * + * @param participant the participant to update + * @return TypedSimpleResponse simple response + * @throws ControlLoopException on errors updating the participant + */ + + public TypedSimpleResponse<Participant> updateParticipant(Participant participant) throws ControlLoopException { + TypedSimpleResponse<Participant> response = new TypedSimpleResponse<>(); + response.setResponse( + intermediaryApi.updateParticipantState(participant.getDefinition(), participant.getParticipantState())); + return response; + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java new file mode 100644 index 000000000..8d9bef98c --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java @@ -0,0 +1,78 @@ +/*- + * ============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.dcae.main.parameters; + +import java.io.File; +import javax.ws.rs.core.Response; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeCommandLineArguments; +import org.onap.policy.common.parameters.ValidationResult; +import org.onap.policy.common.utils.coder.Coder; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; + +/** + * This class handles reading, parsing and validating of control loop runtime parameters from JSON files. + */ +public class ParticipantDcaeParameterHandler { + + private static final Coder CODER = new StandardCoder(); + + /** + * Read the parameters from the parameter file. + * + * @param arguments the arguments passed to dcae + * @return the parameters read from the configuration file + * @throws ControlLoopException on parameter exceptions + */ + public ParticipantDcaeParameters getParameters(final ParticipantDcaeCommandLineArguments arguments) + throws ControlLoopException { + ParticipantDcaeParameters parameters = null; + + // Read the parameters + try { + // Read the parameters from JSON + File file = new File(arguments.getFullConfigurationFilePath()); + parameters = CODER.decode(file, ParticipantDcaeParameters.class); + } catch (final CoderException e) { + final String errorMessage = "error reading parameters from \"" + arguments.getConfigurationFilePath() + + "\"\n" + "(" + e.getClass().getSimpleName() + ")"; + throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage, e); + } + + // The JSON processing returns null if there is an empty file + if (parameters == null) { + final String errorMessage = "no parameters found in \"" + arguments.getConfigurationFilePath() + "\""; + throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage); + } + + // validate the parameters + final ValidationResult validationResult = parameters.validate(); + if (!validationResult.isValid()) { + String returnMessage = + "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n"; + returnMessage += validationResult.getResult(); + throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, returnMessage); + } + + return parameters; + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java new file mode 100644 index 000000000..beb273086 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java @@ -0,0 +1,93 @@ +/*- + * ============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.dcae.main.parameters; + +import javax.validation.constraints.NotBlank; +import lombok.Getter; +import org.apache.commons.lang3.StringUtils; +import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; +import org.onap.policy.common.endpoints.parameters.RestServerParameters; +import org.onap.policy.common.parameters.BeanValidationResult; +import org.onap.policy.common.parameters.ParameterGroupImpl; +import org.onap.policy.common.parameters.ValidationStatus; +import org.onap.policy.common.parameters.annotations.NotNull; +import org.onap.policy.common.parameters.annotations.Valid; +import org.onap.policy.models.provider.PolicyModelsProviderParameters; + +/** + * Class to hold all parameters needed for the participant dcae. + * + */ +@NotNull +@NotBlank +@Getter +public class ParticipantDcaeParameters extends ParameterGroupImpl { + @Valid + private RestServerParameters clampClientParameters; + + @Valid + private RestServerParameters consulClientParameters; + + private ParticipantIntermediaryParameters intermediaryParameters; + private PolicyModelsProviderParameters databaseProviderParameters; + + /** + * Create the participant dcae parameter group. + * + * @param name the parameter group name + */ + public ParticipantDcaeParameters(final String name) { + super(name); + } + + /** + * {@inheritDoc}. + */ + @Override + public BeanValidationResult validate() { + BeanValidationResult result = super.validate(); + if (result.isValid()) { + result.addResult(checkMissingMandatoryParams(clampClientParameters)); + result.addResult(checkMissingMandatoryParams(consulClientParameters)); + } + return result; + } + + private BeanValidationResult checkMissingMandatoryParams(RestServerParameters clientParameters) { + BeanValidationResult result = new BeanValidationResult(clientParameters.getName(), clientParameters); + if (StringUtils.isBlank(clientParameters.getHost())) { + result.addResult("Host", clientParameters.getHost(), ValidationStatus.INVALID, "is blank"); + } + if (StringUtils.isBlank(clientParameters.getName())) { + result.addResult("Name", clientParameters.getName(), ValidationStatus.INVALID, "is blank"); + } + if (StringUtils.isBlank(clientParameters.getPassword())) { + result.addResult("Password", clientParameters.getPassword(), ValidationStatus.INVALID, "is blank"); + } + if (StringUtils.isBlank(clientParameters.getUserName())) { + result.addResult("UserName", clientParameters.getUserName(), ValidationStatus.INVALID, "is blank"); + } + if (clientParameters.getPort() <= 0 || clientParameters.getPort() >= 65535) { + result.addResult("Port", clientParameters.getPort(), ValidationStatus.INVALID, "is not valid"); + } + return result; + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java new file mode 100644 index 000000000..2b47a2c13 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/Main.java @@ -0,0 +1,151 @@ +/*- + * ============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.dcae.main.startstop; + +import java.util.Arrays; +import javax.ws.rs.core.Response; +import lombok.Getter; +import org.onap.policy.clamp.controlloop.common.ControlLoopConstants; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.common.utils.resources.MessageConstants; +import org.onap.policy.common.utils.services.Registry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class initiates ONAP Policy Framework Control Loop participant component. + */ +public class Main { + + private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); + + private ParticipantDcaeActivator activator; + + @Getter + private ParticipantDcaeParameters parameterGroup; + + /** + * Instantiates the control loop participant service. + * + * @param args the command line arguments + */ + public Main(final String[] args) { + final String argumentString = Arrays.toString(args); + LOGGER.info("Starting the control loop participant service with arguments - {}", argumentString); + + // Check the arguments + final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments(); + try { + // The arguments return a string if there is a message to print and we should exit + final String argumentMessage = arguments.parse(args); + if (argumentMessage != null) { + LOGGER.info(argumentMessage); + return; + } + // Validate that the arguments are sane + arguments.validate(); + + // Read the parameters + parameterGroup = new ParticipantDcaeParameterHandler().getParameters(arguments); + + // Now, create the activator for the service + activator = new ParticipantDcaeActivator(parameterGroup); + Registry.register(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR, activator); + + // Start the activator + activator.start(); + } catch (Exception exp) { + if (null != activator) { + Registry.unregister(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR); + } + throw new ControlLoopRuntimeException(Response.Status.BAD_REQUEST, + String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP), exp); + } + + // Add a shutdown hook to shut everything down in an orderly manner + Runtime.getRuntime().addShutdownHook(new ClRuntimeShutdownHookClass()); + String successMsg = String.format(MessageConstants.START_SUCCESS_MSG, MessageConstants.POLICY_CLAMP); + LOGGER.info(successMsg); + } + + /** + * Check if main is running. + */ + public boolean isRunning() { + return activator != null && activator.isAlive(); + } + + /** + * Shut down Execution. + * + * @throws ControlLoopException on shutdown errors + */ + public void shutdown() throws ControlLoopException { + // clear the parameterGroup variable + parameterGroup = null; + + // clear the cl participant activator + if (activator != null) { + activator.stop(); + } + } + + /** + * The Class ClRuntimeShutdownHookClass terminates the control loop participant service + * when its run method is called. + */ + private class ClRuntimeShutdownHookClass extends Thread { + /* + * (non-Javadoc) + * + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + if (!activator.isAlive()) { + return; + } + + try { + // Shutdown the control loop participant service and wait for everything to stop + activator.stop(); + } catch (final RuntimeException e) { + LOGGER.warn("error occured during shut down of the control loop participant service", e); + } + } + } + + /** + * The main method. + * + * @param args the arguments + */ + public static void main(final String[] args) { // NOSONAR + /* + * NOTE: arguments are validated by the constructor, thus sonar is disabled. + */ + + new Main(args); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java new file mode 100644 index 000000000..d485895cf --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeActivator.java @@ -0,0 +1,58 @@ +/*- + * ============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.dcae.main.startstop; + +import java.util.concurrent.atomic.AtomicReference; +import lombok.Getter; +import org.onap.policy.clamp.controlloop.participant.dcae.main.handler.DcaeHandler; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.common.utils.services.ServiceManagerContainer; + +/** + * This class activates the control loop runtime component as a complete service together with all its controllers, + * listeners & handlers. + */ +public class ParticipantDcaeActivator extends ServiceManagerContainer { + @Getter + private final ParticipantDcaeParameters parameters; + + /** + * Instantiate the activator for the dcae as a complete service. + * + * @param parameters the parameters for the control loop runtime service + */ + public ParticipantDcaeActivator(final ParticipantDcaeParameters parameters) { + this.parameters = parameters; + + final AtomicReference<DcaeHandler> dcaeHandler = new AtomicReference<>(); + + // @formatter:off + addAction("Dcae Handler", + () -> dcaeHandler.set(new DcaeHandler(parameters)), + () -> dcaeHandler.get().close()); + + addAction("Dcae Providers", + () -> dcaeHandler.get().startProviders(), + () -> dcaeHandler.get().stopProviders()); + + // @formatter:on + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java new file mode 100644 index 000000000..0bf382ab1 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/ParticipantDcaeCommandLineArguments.java @@ -0,0 +1,151 @@ +/*- + * ============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.dcae.main.startstop; + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.URL; +import java.util.Arrays; +import javax.ws.rs.core.Response; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.apache.commons.lang3.StringUtils; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments; +import org.onap.policy.common.utils.resources.ResourceUtils; + +/** + * This class reads and handles command line parameters for the control loop runtime service. + * + */ +public class ParticipantDcaeCommandLineArguments { + private static final String FILE_MESSAGE_PREAMBLE = " file \""; + private static final int HELP_LINE_LENGTH = 120; + + private final Options options; + private final CommonCommandLineArguments commonCommandLineArguments; + + @Getter() + @Setter() + private String configurationFilePath = null; + + /** + * Construct the options for the dcae participant. + */ + public ParticipantDcaeCommandLineArguments() { + options = new Options(); + commonCommandLineArguments = new CommonCommandLineArguments(options); + } + + /** + * Construct the options for the CLI editor and parse in the given arguments. + * + * @param args The command line arguments + */ + public ParticipantDcaeCommandLineArguments(final String[] args) { + // Set up the options with the default constructor + this(); + + // Parse the arguments + try { + parse(args); + } catch (final ControlLoopException e) { + throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, + "parse error on dcae participant parameters", e); + } + } + + /** + * Parse the command line options. + * + * @param args The command line arguments + * @return a string with a message for help and version, or null if there is no message + * @throws ControlLoopException on command argument errors + */ + public String parse(final String[] args) throws ControlLoopException { + // Clear all our arguments + setConfigurationFilePath(null); + CommandLine commandLine = null; + try { + commandLine = new DefaultParser().parse(options, args); + } catch (final ParseException e) { + throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, + "invalid command line arguments specified : " + e.getMessage()); + } + + // Arguments left over after Commons CLI does its stuff + final String[] remainingArgs = commandLine.getArgs(); + + if (remainingArgs.length > 0) { + throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, + "too many command line arguments specified : " + Arrays.toString(args)); + } + + if (commandLine.hasOption('h')) { + return commonCommandLineArguments.help(Main.class.getName(), options); + } + + if (commandLine.hasOption('v')) { + return commonCommandLineArguments.version(); + } + + if (commandLine.hasOption('c')) { + setConfigurationFilePath(commandLine.getOptionValue('c')); + } + + return null; + } + + /** + * Validate the command line options. + * + * @throws ControlLoopException on command argument validation errors + */ + public void validate() throws ControlLoopException { + commonCommandLineArguments.validate(configurationFilePath); + } + + /** + * Gets the full expanded configuration file path. + * + * @return the configuration file path + */ + public String getFullConfigurationFilePath() { + return ResourceUtils.getFilePath4Resource(getConfigurationFilePath()); + } + + /** + * Check set configuration file path. + * + * @return true, if check set configuration file path + */ + public boolean checkSetConfigurationFilePath() { + return !StringUtils.isEmpty(configurationFilePath); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java new file mode 100644 index 000000000..01a514f43 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java @@ -0,0 +1,35 @@ +/*- + * ============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.dcae.model; + +import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExternalComponent implements Serializable { + + private static final long serialVersionUID = -10; + + private ExternalComponentState componentState; + +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java new file mode 100644 index 000000000..da7360a9b --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java @@ -0,0 +1,34 @@ +/*- + * ============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.dcae.model; + +import java.io.Serializable; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class ExternalComponentState implements Serializable { + + private static final long serialVersionUID = -10; + + private String stateName; +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java new file mode 100644 index 000000000..d84270500 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java @@ -0,0 +1,36 @@ +/*- + * ============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.dcae.model; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class Loop implements Serializable { + + private static final long serialVersionUID = -10; + + private Map<String, ExternalComponent> components = new HashMap<>(); +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json new file mode 100644 index 000000000..863c135d5 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json @@ -0,0 +1,71 @@ +{ + "name": "ControlLoopParticipantDcae", + "clampClientParameters": { + "name": "Clamp", + "host": "0.0.0.0", + "port": 8443, + "userName": "admin", + "password": "password", + "https": true, + "aaf": false + }, + "consulClientParameters": { + "name": "Consul", + "host": "consul", + "port": 31321, + "userName": "admin", + "password": "password", + "https": false, + "aaf": false + }, + "intermediaryParameters": { + "name": "Participant parameters", + "reportingTimeInterval": 120000, + "description": "Participant Description", + "participantId": { + "name": "DCAEParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "clampControlLoopTopics": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "ToscaConceptTest" + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt new file mode 100644 index 000000000..dbd67585f --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt @@ -0,0 +1,4 @@ +ONAP Tosca defined control loop Participant +Version: ${project.version} +Built (UTC): ${maven.build.timestamp} +ONAP https://wiki.onap.org diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java new file mode 100644 index 000000000..040b33f5e --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClientTest.java @@ -0,0 +1,128 @@ +/*- + * ============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.dcae.httpclient; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.junit.Assert.assertTrue; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockserver.integration.ClientAndServer; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; +import org.onap.policy.common.utils.coder.Coder; +import org.onap.policy.common.utils.coder.StandardCoder; + +/** + * Class to perform unit test of {@link ClampHttpClient}. + * + */ +public class ClampHttpClientTest { + + private static final String LOOP = "pmsh_loop"; + private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED"; + + private static ClientAndServer mockServer; + private static ParticipantDcaeParameters parameters; + public static final Coder CODER = new StandardCoder(); + + /** + * Set up. + */ + @BeforeClass + public static void setUp() { + CommonTestData commonTestData = new CommonTestData(); + + parameters = commonTestData.toObject( + commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME), + ParticipantDcaeParameters.class); + + mockServer = ClientAndServer.startClientAndServer(parameters.getClampClientParameters().getPort()); + + mockServer.when(request().withMethod("GET").withPath("/restservices/clds/v2/loop/getstatus/" + LOOP)) + .respond(response().withBody(CommonTestData.createJsonStatus(BLUEPRINT_DEPLOYED)).withStatusCode(200)); + + mockServer.when(request().withMethod("PUT").withPath("/restservices/clds/v2/loop/deploy/" + LOOP)) + .respond(response().withStatusCode(202)); + + mockServer.when(request().withMethod("PUT").withPath("/restservices/clds/v2/loop/undeploy/" + LOOP)) + .respond(response().withStatusCode(202)); + } + + @AfterClass + public static void stopServer() { + mockServer.stop(); + mockServer = null; + } + + @Test + public void test_getstatus() throws Exception { + try (ClampHttpClient client = new ClampHttpClient(parameters.getClampClientParameters())) { + + Loop status = client.getstatus(LOOP); + + String json = CommonTestData.createJsonStatus(BLUEPRINT_DEPLOYED); + Loop loop = CODER.convert(json, Loop.class); + + assertThat(ClampHttpClient.getStatusCode(status)).isEqualTo(ClampHttpClient.getStatusCode(loop)); + + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void test_deploy() throws Exception { + try (ClampHttpClient client = new ClampHttpClient(parameters.getClampClientParameters())) { + + assertTrue(client.deploy(LOOP)); + + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void test_undeploy() throws Exception { + try (ClampHttpClient client = new ClampHttpClient(parameters.getClampClientParameters())) { + + assertTrue(client.undeploy(LOOP)); + + } catch (Exception e) { + fail(e.getMessage()); + } + } + + @Test + public void test_getStatusCodeNull() { + assertThat(ClampHttpClient.getStatusCode(null)).isEqualTo(ClampHttpClient.STATUS_NOT_FOUND); + } + + @Test + public void test_getStatusEmptyMap() { + assertThat(ClampHttpClient.getStatusCode(new Loop())).isEqualTo(ClampHttpClient.STATUS_NOT_FOUND); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java new file mode 100644 index 000000000..bcfaf8bb9 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java @@ -0,0 +1,294 @@ +/*- + * ============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.dcae.main.parameters; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import javax.ws.rs.core.Response; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.common.endpoints.parameters.TopicParameters; +import org.onap.policy.common.parameters.ParameterGroup; +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.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 DESCRIPTION = "Participant description"; + public static final long TIME_INTERVAL = 2000; + public static final List<TopicParameters> TOPIC_PARAMS = Arrays.asList(getTopicParams()); + private static final String REST_CLIENT_PASSWORD = "password"; + private static final String REST_CLIENT_USER = "admin"; + private static final int REST_CLAMP_PORT = 8443; + private static final int REST_CONSUL_PORT = 31321; + private static final String REST_CLAMP_HOST = "localhost"; + private static final String REST_CONSUL_HOST = "consul"; + private static final boolean REST_CLAMP_HTTPS = false; + private static final boolean REST_CONSUL_HTTPS = false; + private static final boolean REST_CLIENT_AAF = false; + + public static final Coder coder = new StandardCoder(); + + /** + * Converts the contents of a map to a parameter class. + * + * @param source property map + * @param clazz class of object to be created from the map + * @return a new object represented by the map + */ + public <T extends ParameterGroup> T toObject(final Map<String, Object> source, final Class<T> clazz) { + try { + return coder.convert(source, clazz); + + } catch (final CoderException e) { + throw new RuntimeException("cannot create " + clazz.getName() + " from map", e); + } + } + + /** + * Returns a property map for a ApexStarterParameterGroup map for test cases. + * + * @param name name of the parameters + * + * @return a property map suitable for constructing an object + */ + public Map<String, Object> getParticipantParameterGroupMap(final String name) { + final Map<String, Object> map = new TreeMap<>(); + + map.put("name", name); + map.put("clampClientParameters", getClampClientParametersMap(false)); + map.put("consulClientParameters", getConsulClientParametersMap(false)); + map.put("intermediaryParameters", getIntermediaryParametersMap(false)); + map.put("databaseProviderParameters", getDatabaseProviderParametersMap(false)); + return map; + } + + /** + * Returns a property map for a RestServerParameters map for test cases. + * + * @param isEmpty boolean value to represent that object created should be empty or not + * @return a property map suitable for constructing an object + */ + public Map<String, Object> getClampClientParametersMap(final boolean isEmpty) { + final Map<String, Object> map = new TreeMap<>(); + map.put("https", REST_CLAMP_HTTPS); + map.put("aaf", REST_CLIENT_AAF); + + if (!isEmpty) { + map.put("host", REST_CLAMP_HOST); + map.put("port", REST_CLAMP_PORT); + map.put("userName", REST_CLIENT_USER); + map.put("password", REST_CLIENT_PASSWORD); + } + + return map; + } + + /** + * Returns a property map for a RestServerParameters map for test cases. + * + * @param isEmpty boolean value to represent that object created should be empty or not + * @return a property map suitable for constructing an object + */ + public Map<String, Object> getConsulClientParametersMap(final boolean isEmpty) { + final Map<String, Object> map = new TreeMap<>(); + map.put("https", REST_CONSUL_HTTPS); + map.put("aaf", REST_CLIENT_AAF); + + if (!isEmpty) { + map.put("host", REST_CONSUL_HOST); + map.put("port", REST_CONSUL_PORT); + map.put("userName", REST_CLIENT_USER); + map.put("password", REST_CLIENT_PASSWORD); + } + + return map; + } + + /** + * Returns a property map for a databaseProviderParameters map for test cases. + * + * @param isEmpty boolean value to represent that object created should be empty or not + * @return a property map suitable for constructing an object + */ + public Map<String, Object> getDatabaseProviderParametersMap(final boolean isEmpty) { + final Map<String, Object> map = new TreeMap<>(); + if (!isEmpty) { + map.put("name", "PolicyProviderParameterGroup"); + map.put("implementation", "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl"); + map.put("databaseDriver", "org.h2.Driver"); + map.put("databaseUrl", "jdbc:h2:mem:testdb"); + map.put("databaseUser", "policy"); + map.put("databasePassword", "P01icY"); + map.put("persistenceUnit", "ToscaConceptTest"); + } + + return map; + } + + /** + * Returns a property map for a intermediaryParameters map for test cases. + * + * @param isEmpty boolean value to represent that object created should be empty or not + * @return a property map suitable for constructing an object + */ + public Map<String, Object> getIntermediaryParametersMap(final boolean isEmpty) { + final Map<String, Object> map = new TreeMap<>(); + if (!isEmpty) { + map.put("name", "Participant parameters"); + map.put("reportingTimeInterval", TIME_INTERVAL); + map.put("description", DESCRIPTION); + map.put("participantId", getParticipantId()); + map.put("participantType", getParticipantId()); + map.put("clampControlLoopTopics", getTopicParametersMap(false)); + } + + return map; + } + + /** + * Returns a property map for a TopicParameters map for test cases. + * + * @param isEmpty boolean value to represent that object created should be empty or not + * @return a property map suitable for constructing an object + */ + public Map<String, Object> getTopicParametersMap(final boolean isEmpty) { + final Map<String, Object> map = new TreeMap<>(); + if (!isEmpty) { + map.put("topicSources", TOPIC_PARAMS); + map.put("topicSinks", TOPIC_PARAMS); + } + return map; + } + + /** + * Returns topic parameters for test cases. + * + * @return topic parameters + */ + public static TopicParameters getTopicParams() { + final TopicParameters topicParams = new TopicParameters(); + topicParams.setTopic("POLICY-CLRUNTIME-PARTICIPANT"); + topicParams.setTopicCommInfrastructure("dmaap"); + topicParams.setServers(Arrays.asList("localhost")); + return topicParams; + } + + /** + * Returns participantId for test cases. + * + * @return participant Id + */ + public static ToscaConceptIdentifier getParticipantId() { + final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); + participantId.setName("CDSParticipant0"); + participantId.setVersion("1.0.0"); + return participantId; + } + + /** + * Gets the standard participant parameters. + * + * @param port port to be inserted into the parameters + * @return the standard participant parameters + */ + public ParticipantDcaeParameters getParticipantParameterGroup(int port) { + try { + return coder.decode(getParticipantParameterGroupAsString(port), ParticipantDcaeParameters.class); + + } catch (CoderException e) { + throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters", + e); + } + } + + /** + * Gets the standard participant parameters, as a String. + * + * @param port port to be inserted into the parameters + * @return the standard participant parameters + */ + public static String getParticipantParameterGroupAsString(int port) { + + try { + File file = new File(getParamFile()); + String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); + + json = json.replace("${port}", String.valueOf(port)); + json = json.replace("${dbName}", "jdbc:h2:mem:testdb"); + + return json; + + } catch (IOException e) { + throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read participant parameters", + e); + + } + } + + /** + * Gets the full path to the parameter file, which may vary depending on whether or + * not this is an end-to-end test. + * + * @return the parameter file name + */ + private static String getParamFile() { + return "src/test/resources/parameters/TestParametersStd.json"; + } + + /** + * Nulls out a field within a JSON string. + * + * @param json JSON string + * @param field field to be nulled out + * @return a new JSON string with the field nulled out + */ + public String nullifyField(String json, String field) { + return json.replace(field + "\"", field + "\":null, \"" + field + "Xxx\""); + } + + /** + * create Json response from getstatus call. + * + * @param status the status of Partecipant + * @return the JSON + */ + public static String createJsonStatus(String status) { + try { + File file = new File("src/test/resources/rest/status.json"); + String json = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); + return json.replace("${status}", status); + + } catch (IOException e) { + throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, "cannot read json file", e); + } + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.java new file mode 100644 index 000000000..058a3dae4 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameterHandler.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.controlloop.participant.dcae.main.parameters; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.FileNotFoundException; +import org.junit.Test; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeCommandLineArguments; +import org.onap.policy.common.utils.coder.CoderException; + +/** + * Class to perform unit test of {@link ParticipantParameterHandler}. + * + */ +public class TestParticipantDcaeParameterHandler { + + @Test + public void testParameterHandlerNoParameterFile() throws ControlLoopException { + final String[] emptyArgumentString = { "-c", "src/test/resources/parameters/NoParametersFile.json" }; + + final ParticipantDcaeCommandLineArguments emptyArguments = new ParticipantDcaeCommandLineArguments(); + emptyArguments.parse(emptyArgumentString); + + assertThatThrownBy(() -> new ParticipantDcaeParameterHandler().getParameters(emptyArguments)) + .hasCauseInstanceOf(CoderException.class) + .hasRootCauseInstanceOf(FileNotFoundException.class); + } + + @Test + public void testParameterHandlerInvalidParameters() throws ControlLoopException { + final String[] invalidArgumentString = { "-c", "src/test/resources/parameters/InvalidParameters.json" }; + + final ParticipantDcaeCommandLineArguments invalidArguments = + new ParticipantDcaeCommandLineArguments(); + invalidArguments.parse(invalidArgumentString); + + assertThatThrownBy(() -> new ParticipantDcaeParameterHandler().getParameters(invalidArguments)) + .hasMessageStartingWith("error reading parameters from") + .hasCauseInstanceOf(CoderException.class); + } + + @Test + public void testParticipantParameterGroup() throws ControlLoopException { + final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json" }; + + final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments(); + arguments.parse(participantConfigParameters); + + final ParticipantDcaeParameters parGroup = new ParticipantDcaeParameterHandler() + .getParameters(arguments); + assertTrue(arguments.checkSetConfigurationFilePath()); + assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, parGroup.getName()); + } + + @Test + public void testParticipantVersion() throws ControlLoopException { + final String[] participantConfigParameters = { "-v" }; + final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments(); + assertThat(arguments.parse(participantConfigParameters)).startsWith( + "ONAP Tosca defined control loop Participant"); + } + + @Test + public void testParticipantHelp() throws ControlLoopException { + final String[] participantConfigParameters = { "-h" }; + final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments(); + assertThat(arguments.parse(participantConfigParameters)).startsWith("usage:"); + } + + @Test + public void testParticipantInvalidOption() throws ControlLoopException { + final String[] participantConfigParameters = { "-d" }; + final ParticipantDcaeCommandLineArguments arguments = new ParticipantDcaeCommandLineArguments(); + assertThatThrownBy(() -> arguments.parse(participantConfigParameters)) + .hasMessageStartingWith("invalid command line arguments specified"); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java new file mode 100644 index 000000000..edb429322 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/TestParticipantDcaeParameters.java @@ -0,0 +1,90 @@ +/*- + * ============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.dcae.main.parameters; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Map; +import org.junit.Test; +import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; +import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; +import org.onap.policy.common.parameters.ValidationResult; + +/** + * Class to perform unit test of {@link ParticipantParameterGroup}. + * + */ +public class TestParticipantDcaeParameters { + CommonTestData commonTestData = new CommonTestData(); + + @Test + public void testParticipantParameterGroup_Named() { + final ParticipantDcaeParameters participantParameters = new ParticipantDcaeParameters("my-name"); + assertEquals("my-name", participantParameters.getName()); + } + + @Test + public void testParticipantParameterGroup() { + final ParticipantDcaeParameters participantParameters = commonTestData.toObject( + commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME), + ParticipantDcaeParameters.class); + final ParticipantIntermediaryParameters participantIntermediaryParameters = participantParameters + .getIntermediaryParameters(); + final TopicParameterGroup topicParameterGroup = participantParameters.getIntermediaryParameters() + .getClampControlLoopTopics(); + final ValidationResult validationResult = participantParameters.validate(); + assertTrue(validationResult.isValid()); + assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, participantParameters.getName()); + assertEquals(CommonTestData.TIME_INTERVAL, participantIntermediaryParameters.getReportingTimeInterval()); + assertEquals(CommonTestData.DESCRIPTION, participantIntermediaryParameters.getDescription()); + assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSinks()); + assertEquals(CommonTestData.TOPIC_PARAMS, topicParameterGroup.getTopicSources()); + } + + @Test + public void testParticipantParameterGroup_EmptyParticipantIntermediaryParameters() { + final Map<String, Object> map = + commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME); + map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true)); + final ParticipantDcaeParameters participantParameters = + commonTestData.toObject(map, ParticipantDcaeParameters.class); + final ValidationResult validationResult = participantParameters.validate(); + assertNull(validationResult.getResult()); + } + + @Test + public void testParticipantParameterGroup_EmptyTopicParameters() { + final Map<String, Object> map = + commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME); + final Map<String, Object> intermediaryParametersMap = commonTestData.getIntermediaryParametersMap(false); + intermediaryParametersMap.put("clampControlLoopTopics", commonTestData.getTopicParametersMap(true)); + map.replace("intermediaryParameters", intermediaryParametersMap); + + final ParticipantDcaeParameters participantParameters = + commonTestData.toObject(map, ParticipantDcaeParameters.class); + final ValidationResult validationResult = participantParameters.validate(); + assertNull(validationResult.getResult()); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java new file mode 100644 index 000000000..c3cc8b755 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java @@ -0,0 +1,255 @@ +/*- + * ============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.dcae.main.rest; + +import java.io.File; +import java.time.Instant; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.UUID; +import lombok.Getter; +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.ParticipantState; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; +import org.onap.policy.clamp.controlloop.participant.dcae.main.handler.DcaeProvider; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; +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; + +public class TestListenerUtils { + + private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator(); + private static final Coder CODER = new StandardCoder(); + private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml"; + static CommonTestData commonTestData = new CommonTestData(); + + @Getter + private static ParticipantHandler participantHandler; + + /** + * Method to initialize participantHandler. + */ + public static void initParticipantHandler() { + + final ParticipantDcaeParameters parameters = commonTestData.toObject( + commonTestData.getParticipantParameterGroupMap(CommonTestData.PARTICIPANT_GROUP_NAME), + ParticipantDcaeParameters.class); + + DcaeProvider dcaeProvider = new DcaeProvider(parameters); + + participantHandler = dcaeProvider.getIntermediaryApi().getParticipantHandler(); + } + + /** + * 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 ParticipantStateChange message from the arguments passed. + * + * @param participantState participant State + * + * @return ParticipantStateChange message + */ + public static ParticipantStateChange createParticipantStateChangeMsg(final ParticipantState participantState) { + final ParticipantStateChange participantStateChangeMsg = new ParticipantStateChange(); + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); + participantId.setName("CDSParticipant0"); + participantId.setVersion("1.0.0"); + + participantStateChangeMsg.setParticipantId(participantId); + participantStateChangeMsg.setTimestamp(Instant.now()); + participantStateChangeMsg.setState(participantState); + + return participantStateChangeMsg; + } + + /** + * Method to create ControlLoopStateChange message from the arguments passed. + * + * @param controlLoopOrderedState controlLoopOrderedState + * + * @return ParticipantControlLoopStateChange message + */ + public static ParticipantControlLoopStateChange createControlLoopStateChangeMsg( + final ControlLoopOrderedState controlLoopOrderedState) { + final ParticipantControlLoopStateChange participantClStateChangeMsg = new ParticipantControlLoopStateChange(); + + ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(); + controlLoopId.setName("PMSHInstance0"); + controlLoopId.setVersion("1.0.0"); + + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); + participantId.setName("CDSParticipant0"); + participantId.setVersion("1.0.0"); + + participantClStateChangeMsg.setControlLoopId(controlLoopId); + participantClStateChangeMsg.setParticipantId(participantId); + participantClStateChangeMsg.setTimestamp(Instant.now()); + participantClStateChangeMsg.setOrderedState(controlLoopOrderedState); + + return participantClStateChangeMsg; + } + + /** + * Method to create ControlLoopUpdateMsg. + * + * @return ParticipantControlLoopUpdate message + */ + public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() { + final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate(); + ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(); + controlLoopId.setName("PMSHInstance0"); + controlLoopId.setVersion("1.0.0"); + + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); + participantId.setName("CDSParticipant0"); + participantId.setVersion("1.0.0"); + + clUpdateMsg.setControlLoopId(controlLoopId); + clUpdateMsg.setParticipantId(participantId); + + 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"); + controlLoop.setDefinition(controlLoopId); + clUpdateMsg.setControlLoop(controlLoop); + clUpdateMsg.setControlLoopDefinition(toscaServiceTemplate); + + return clUpdateMsg; + } + + /** + * Method to create ParticipantHealthCheck message. + * + * @return ParticipantHealthCheck message + */ + public static ParticipantHealthCheck createParticipantHealthCheckMsg() { + ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(); + participantId.setName("CDSParticipant0"); + participantId.setVersion("1.0.0"); + + ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(); + controlLoopId.setName("PMSHInstance0"); + controlLoopId.setVersion("1.0.0"); + + final ParticipantHealthCheck participantHealthCheckMsg = new ParticipantHealthCheck(); + participantHealthCheckMsg.setParticipantId(participantId); + participantHealthCheckMsg.setControlLoopId(controlLoopId); + participantHealthCheckMsg.setTimestamp(Instant.now()); + participantHealthCheckMsg.setState(ParticipantState.PASSIVE); + + return participantHealthCheckMsg; + } + + /** + * Method to create ParticipantControlLoopUpdate using the arguments passed. + * + * @param jsonFilePath the path of the controlloop content + * + * @return ParticipantControlLoopUpdate message + * @throws CoderException exception while reading the file to object + */ + public static ParticipantControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) + throws CoderException { + ParticipantControlLoopUpdate participantControlLoopUpdateMsg = + CODER.decode(new File(jsonFilePath), ParticipantControlLoopUpdate.class); + return participantControlLoopUpdateMsg; + } + + private static ToscaServiceTemplate testControlLoopRead() { + return testControlLoopYamlSerialization(TOSCA_TEMPLATE_YAML); + } + + private static ToscaServiceTemplate testControlLoopYamlSerialization(String controlLoopFilePath) { + String controlLoopString = ResourceUtils.getResourceAsString(controlLoopFilePath); + ToscaServiceTemplate serviceTemplate = yamlTranslator.fromYaml(controlLoopString, ToscaServiceTemplate.class); + return serviceTemplate; + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java new file mode 100644 index 000000000..f779f3a57 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestMain.java @@ -0,0 +1,151 @@ +/*- + * ============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.dcae.main.startstop; + +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.clamp.controlloop.common.ControlLoopConstants; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.Main; +import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeActivator; +import org.onap.policy.common.utils.resources.MessageConstants; +import org.onap.policy.common.utils.services.Registry; + +/** + * Class to perform unit test of {@link Main}}. + */ +public class TestMain { + + /** + * Set up. + */ + @BeforeClass + public static void setUp() { + Registry.newRegistry(); + } + + /** + * Shuts "main" down. + * + * @throws Exception if an error occurs + */ + @AfterClass + public static void tearDown() throws Exception { + // shut down activator + final ParticipantDcaeActivator activator = + Registry.getOrDefault(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR, + ParticipantDcaeActivator.class, null); + if (activator != null && activator.isAlive()) { + activator.shutdown(); + } + } + + @Test + public void testMain_Help() { + final String[] configParameters = {"-h"}; + Main main = new Main(configParameters); + assertFalse(main.isRunning()); + } + + @Test + public void testMain_Version() { + final String[] configParameters = {"-v"}; + Main main = new Main(configParameters); + assertFalse(main.isRunning()); + } + + @Test + public void testMain_Valid() { + final String[] configParameters = {"-c", "src/test/resources/parameters/TestParameters.json"}; + Main main = new Main(configParameters); + assertTrue(main.isRunning()); + + // ensure items were added to the registry + assertNotNull(Registry.get(ControlLoopConstants.REG_CLRUNTIME_ACTIVATOR, ParticipantDcaeActivator.class)); + + assertThatCode(() -> main.shutdown()).doesNotThrowAnyException(); + + assertFalse(main.isRunning()); + } + + @Test + public void testMain_NoParameter() { + assertThatConfigParameterThrownException(new String[] {}); + } + + @Test + public void testMain_FilePathNotDefined() { + assertThatConfigParameterThrownException(new String[] {"-c"}); + } + + @Test + public void testMain_TooManyCommand() { + assertThatConfigParameterThrownException(new String[] {"-h", "d"}); + } + + @Test + public void testMain_WrongParameter() { + assertThatConfigParameterThrownException(new String[] {"-d"}); + } + + private void assertThatConfigParameterThrownException(final String[] configParameters) { + assertThatThrownBy(() -> Main.main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class) + .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP)); + } + + @Test + public void testParticipant_NoFileWithThisName() { + assertThatConfigFileThrownException("src/test/resources/parameters/NoFileWithThisName.json"); + } + + @Test + public void testParticipant_NotValidFile() { + assertThatConfigFileThrownException("src/test/resources/parameters"); + } + + @Test + public void testParticipant_NoParameters() { + assertThatConfigFileThrownException("src/test/resources/parameters/NoParameters.json"); + } + + @Test + public void testParticipant_InvalidParameters() { + assertThatConfigFileThrownException("src/test/resources/parameters/InvalidParameters.json"); + } + + @Test + public void testParticipant_WrongJsonFormat() { + assertThatConfigFileThrownException("src/test/resources/parameters/Unreadable.json"); + } + + private void assertThatConfigFileThrownException(final String configFilePath) { + final String[] configParameters = new String[] {"-c", configFilePath}; + assertThatThrownBy(() -> new Main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class) + .hasMessage(String.format(MessageConstants.START_FAILURE_MSG, MessageConstants.POLICY_CLAMP)); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.java b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.java new file mode 100644 index 000000000..1903868e2 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/startstop/TestParticipantDcaeActivator.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.participant.dcae.main.startstop; + +import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameterHandler; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; +import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeActivator; +import org.onap.policy.clamp.controlloop.participant.dcae.main.startstop.ParticipantDcaeCommandLineArguments; +import org.onap.policy.common.utils.services.Registry; + +/** + * Class to perform unit test of {@link ParticipantDcaeActivator}}. + * + */ +public class TestParticipantDcaeActivator { + + private static ParticipantDcaeActivator activator; + + /** + * Initializes an activator. + * + * @throws Exception if an error occurs + */ + @BeforeClass + public static void setUp() throws Exception { + Registry.newRegistry(); + final String[] participantConfigParameters = { "-c", "src/test/resources/parameters/TestParameters.json"}; + final ParticipantDcaeCommandLineArguments arguments = + new ParticipantDcaeCommandLineArguments(participantConfigParameters); + final ParticipantDcaeParameters parGroup = + new ParticipantDcaeParameterHandler().getParameters(arguments); + activator = new ParticipantDcaeActivator(parGroup); + } + + /** + * Method for cleanup after each test. + * + * @throws Exception if an error occurs + */ + @AfterClass + public static void teardown() throws Exception { + // shut down activator + if (activator != null && activator.isAlive()) { + activator.shutdown(); + } + } + + @Test + public void testParticipantActivator() { + activator.start(); + assertTrue(activator.isAlive()); + assertTrue(activator.getParameters().isValid()); + assertEquals(CommonTestData.PARTICIPANT_GROUP_NAME, activator.getParameters().getName()); + + // repeat - should throw an exception + assertThatIllegalStateException().isThrownBy(() -> activator.start()); + assertTrue(activator.isAlive()); + assertTrue(activator.getParameters().isValid()); + + activator.shutdown(); + assertFalse(activator.isAlive()); + + // repeat - should throw an exception + assertThatIllegalStateException().isThrownBy(() -> activator.shutdown()); + assertFalse(activator.isAlive()); + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json new file mode 100644 index 000000000..1035ccb67 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/InvalidParameters.json @@ -0,0 +1,3 @@ +{ + "name": " +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json new file mode 100644 index 000000000..1ee2955b9 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/MinimumParametersH2.json @@ -0,0 +1,61 @@ +{ + "name": "ControlLoopParticipantGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false + }, + "intermediaryParameters": { + "name": "Participant parameters", + "reportingTimeInterval": 120000, + "description": "Participant Description", + "participantId": { + "name": "DCAEParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "clampControlLoopTopics": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "ToscaConceptTest" + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json new file mode 100644 index 000000000..7a73a41bf --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/NoParameters.json @@ -0,0 +1,2 @@ +{ +}
\ No newline at end of file diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json index a890af709..a4258622d 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestCLParams.json @@ -158,4 +158,3 @@ topology_template: version: 1.2.3 - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement version: 1.2.3 - diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json new file mode 100644 index 000000000..789fc7bbd --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParameters.json @@ -0,0 +1,71 @@ +{ + "name": "ControlLoopParticipantGroup", + "clampClientParameters": { + "name": "Clamp", + "host": "0.0.0.0", + "port": 8443, + "userName": "admin", + "password": "password", + "https": true, + "aaf": false + }, + "consulClientParameters": { + "name": "Clamp", + "host": "consul", + "port": 31321, + "userName": "admin", + "password": "password", + "https": false, + "aaf": false + }, + "intermediaryParameters": { + "name": "Participant parameters", + "reportingTimeInterval": 120000, + "description": "Participant Description", + "participantId": { + "name": "DCAEParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "clampControlLoopTopics": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "ToscaConceptTest" + } +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json new file mode 100644 index 000000000..789fc7bbd --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/TestParametersStd.json @@ -0,0 +1,71 @@ +{ + "name": "ControlLoopParticipantGroup", + "clampClientParameters": { + "name": "Clamp", + "host": "0.0.0.0", + "port": 8443, + "userName": "admin", + "password": "password", + "https": true, + "aaf": false + }, + "consulClientParameters": { + "name": "Clamp", + "host": "consul", + "port": 31321, + "userName": "admin", + "password": "password", + "https": false, + "aaf": false + }, + "intermediaryParameters": { + "name": "Participant parameters", + "reportingTimeInterval": 120000, + "description": "Participant Description", + "participantId": { + "name": "DCAEParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "clampControlLoopTopics": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "ToscaConceptTest" + } +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/ConfigParametersStd.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json index 19346a059..581ce8f4f 100644 --- a/tosca-controlloop/runtime/src/test/resources/parameters/ConfigParametersStd.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json @@ -77,3 +77,5 @@ } ] } + + diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml new file mode 100644 index 000000000..cf6b89eb9 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/logback-test.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============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========================================================= +--> + +<configuration> + + <contextName>Participant</contextName> + <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> + <property name="LOG_DIR" value="${java.io.tmpdir}/clamp_logging/" /> + + <!-- USE FOR STD OUT ONLY --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> + </encoder> + </appender> + + <root level="info"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="org.onap.policy.clamp.controlloop.participant" level="trace" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> +</configuration> diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml new file mode 100644 index 000000000..01f825fc9 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml @@ -0,0 +1,452 @@ +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.0 + - UNBOUNDED + version: 0.0.0 + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: + - 0.0 + - UNBOUNDED + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: + - 0.0 + - UNBOUNDED + version: 0.0.0 + 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.APP + 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.0 + - UNBOUNDED + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + version: 0.0.0 + 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 + version: 0.0.0 + 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 + version: 0.0.0 + - send_0: + capability: cds-rest-receive + node: org.onap.CDS + version: 0.0.0 + - receive_1: + capability: cds-rest-response + node: org.onap.CDS + version: 0.0.0 + - 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 + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + 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.0 + version: 0.0.0 + version: 0.0.0 + org.onap.controlloop0: + type: org.onap.APP + properties: + application_name: Test Control Loop + provider: Ericsson + application_version: 1.0.0 + status: NOT_DEPLOYED + version: 0.0.0 +version: 0.0.0 diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json new file mode 100644 index 000000000..143ef635d --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/rest/status.json @@ -0,0 +1,3918 @@ +{ + "name": "pmsh_loop", + "globalPropertiesJson": { + "dcaeDeployParameters": { + "uniqueBlueprintParameters": { + "tag_version": "nexus3.onap.org:10001/onap/org.onap.dcaegen2.services.pmsh:1.1.2", + "replicas": 1, + "operational_policy_name": "pmsh-operational-policy", + "control_loop_name": "pmsh-control-loop", + "pmsh_publish_topic_name": "unauthenticated.DCAE_CL_OUTPUT", + "policy_feedback_topic_name": "unauthenticated.PMSH_CL_INPUT", + "aai_notification_topic_name": "AAI-EVENT", + "publisher_client_role": "org.onap.dcae.pmPublisher", + "subscriber_client_role": "org.onap.dcae.pmSubscriber", + "dcae_location": "san-francisco", + "cpu_limit": "1000m", + "cpu_request": "1000m", + "memory_limit": "1024Mi", + "memory_request": "1024Mi", + "pgaas_cluster_name": "dcae-pg-primary.onap", + "enable_tls": true, + "protocol": "https", + "policy_model_id": "onap.policies.monitoring.dcae-pm-subscription-handler", + "policy_id": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh" + } + } + }, + "modelService": { + "serviceDetails": { + "serviceType": "", + "serviceRole": "", + "description": "vLBMS", + "type": "Service", + "instantiationType": "A-la-carte", + "namingPolicy": "", + "serviceEcompNaming": "true", + "environmentContext": "General_Revenue-Bearing", + "name": "vLoadBalancerMS", + "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f", + "ecompGeneratedNaming": "true", + "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0", + "category": "Network L4+" + }, + "resourceDetails": { + "CP": {}, + "VL": {}, + "VF": { + "vLoadBalancerMS 0": { + "resourceVendor": "Test", + "name": "vLoadBalancerMS", + "resourceVendorModelNumber": "", + "description": "vLBMS", + "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506", + "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6", + "type": "VF", + "category": "Application L4+", + "subcategory": "Load Balancer", + "version": "1.0", + "customizationUUID": "465246dc-7748-45f4-a013-308d92922552", + "resourceVendorRelease": "1.0", + "controllerProperties": { + "sdnc_model_name": "baseconfiguration", + "sdnc_model_version": "1.0.0", + "workflows": { + "resource-assignment": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "activate": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "activate-restconf": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "activate-cli": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "assign-activate": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "imperative-test-wf": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + } + } + } + } + }, + "CR": {}, + "VFC": {}, + "PNF": {}, + "Service": {}, + "CVFC": {}, + "Service Proxy": {}, + "Configuration": {}, + "AllottedResource": {}, + "VFModule": { + "Vloadbalancerms..vpkg..module-1": { + "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vpkg..module-1", + "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc", + "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52", + "min_vf_module_instances": 0, + "vf_module_label": "vpkg", + "max_vf_module_instances": 1, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + }, + "Vloadbalancerms..vdns..module-3": { + "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vdns..module-3", + "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720", + "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1", + "min_vf_module_instances": 0, + "vf_module_label": "vdns", + "max_vf_module_instances": 50, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + }, + "Vloadbalancerms..base_template..module-0": { + "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..base_template..module-0", + "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce", + "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27", + "min_vf_module_instances": 1, + "vf_module_label": "base_template", + "max_vf_module_instances": 1, + "vf_module_type": "Base", + "isBase": true, + "initial_count": 1, + "volume_group": false + }, + "Vloadbalancerms..vlb..module-2": { + "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vlb..module-2", + "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a", + "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806", + "min_vf_module_instances": 0, + "vf_module_label": "vlb", + "max_vf_module_instances": 1, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + } + } + } + }, + "lastComputedState": "DESIGN", + "components": { + "POLICY": { + "componentState": { + "stateName": "NOT_SENT", + "description": "The policies defined have NOT yet been created on the policy engine" + } + }, + "DCAE": { + "componentState": { + "stateName": "${status}", + "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop" + } + } + }, + "operationalPolicies": [], + "microServicePolicies": [ + { + "name": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh", + "shared": false, + "jsonRepresentation": { + "title": "onap.policies.monitoring.dcae-pm-subscription-handler", + "type": "object", + "required": [], + "properties": { + "pmsh_policy": { + "title": "onap.datatypes.monitoring.subscription", + "type": "object", + "required": [ + "measurementGroups", + "fileBasedGP", + "fileLocation", + "subscriptionName", + "administrativeState", + "nfFilter" + ], + "properties": { + "measurementGroups": { + "type": "array", + "description": "Measurement Groups", + "items": { + "title": "onap.datatypes.monitoring.measurementGroups", + "type": "object", + "required": [ + "measurementGroup" + ], + "properties": { + "measurementGroup": { + "type": "object", + "description": "Measurement Group", + "properties": { + "onap.datatypes.monitoring.measurementGroup": { + "title": "onap.datatypes.monitoring.measurementGroup", + "type": "object", + "required": [ + "measurementTypes", + "managedObjectDNsBasic" + ], + "properties": { + "measurementTypes": { + "type": "array", + "description": "List of measurement types", + "items": { + "title": "onap.datatypes.monitoring.measurementTypes", + "type": "object", + "required": [ + "measurementType" + ], + "properties": { + "measurementType": { + "type": "object", + "description": "Measurement type object", + "properties": { + "onap.datatypes.monitoring.measurementType": { + "title": "onap.datatypes.monitoring.measurementType", + "type": "object", + "required": [ + "measurementType" + ], + "properties": { + "measurementType": { + "type": "string", + "description": "Measurement type" + } + } + } + } + } + } + }, + "format": "tabs-top" + }, + "managedObjectDNsBasic": { + "type": "array", + "description": "List of managed object distinguished names", + "items": { + "title": "onap.datatypes.monitoring.managedObjectDNsBasics", + "type": "object", + "required": [ + "managedObjectDNsBasic" + ], + "properties": { + "managedObjectDNsBasic": { + "type": "object", + "description": "Managed object distinguished name object", + "properties": { + "onap.datatypes.monitoring.managedObjectDNsBasic": { + "title": "onap.datatypes.monitoring.managedObjectDNsBasic", + "type": "object", + "required": [ + "DN" + ], + "properties": { + "DN": { + "type": "string", + "description": "Managed object distinguished name" + } + } + } + } + } + } + }, + "format": "tabs-top" + } + } + } + } + } + } + }, + "format": "tabs-top" + }, + "fileBasedGP": { + "type": "integer", + "description": "File based granularity period" + }, + "fileLocation": { + "type": "string", + "description": "ROP file location" + }, + "subscriptionName": { + "type": "string", + "description": "Name of the subscription" + }, + "administrativeState": { + "type": "string", + "description": "State of the subscription", + "enum": [ + "LOCKED", + "UNLOCKED" + ] + }, + "nfFilter": { + "type": "object", + "description": "Network function filter", + "properties": { + "onap.datatypes.monitoring.nfFilter": { + "title": "onap.datatypes.monitoring.nfFilter", + "type": "object", + "required": [ + "modelVersionIDs", + "modelInvariantIDs", + "modelNames", + "nfNames" + ], + "properties": { + "modelVersionIDs": { + "type": "array", + "description": "List of model version IDs", + "items": { + "type": "string" + }, + "format": "tabs-top" + }, + "modelInvariantIDs": { + "type": "array", + "description": "List of model invariant IDs", + "items": { + "type": "string" + }, + "format": "tabs-top" + }, + "modelNames": { + "type": "array", + "description": "List of model names", + "items": { + "type": "string" + }, + "format": "tabs-top" + }, + "nfNames": { + "type": "array", + "description": "List of network functions", + "items": { + "type": "string" + }, + "format": "tabs-top" + } + } + } + } + } + } + } + } + }, + "loopElementModel": { + "name": "onap.policies.monitoring.dcae-pm-subscription-handler", + "loopElementType": "MICRO_SERVICE_TYPE", + "policyModels": [ + { + "policyModelType": "onap.policies.monitoring.dcae-pm-subscription-handler", + "version": "1.0.0", + "policyAcronym": "dcae-pm-subscription-handler", + "policyPdpGroup": { + "supportedPdpGroups": [ + { + "ControlLoopGroup": [ + "apex", + "xacml" + ] + }, + { + "defaultGroup": [ + "xacml" + ] + } + ] + }, + "createdDate": "2021-03-30T09:55:52.261232Z", + "updatedDate": "2021-03-30T09:56:17.502284Z", + "updatedBy": "Not found", + "createdBy": "Not found" + } + ], + "createdDate": "2021-03-30T08:48:21Z", + "updatedDate": "2021-03-30T08:48:21Z", + "updatedBy": "Not found", + "createdBy": "Not found" + }, + "policyModel": { + "policyModelType": "onap.policies.monitoring.dcae-pm-subscription-handler", + "version": "1.0.0", + "policyAcronym": "dcae-pm-subscription-handler", + "policyPdpGroup": { + "supportedPdpGroups": [ + { + "ControlLoopGroup": [ + "apex", + "xacml" + ] + }, + { + "defaultGroup": [ + "xacml" + ] + } + ] + }, + "createdDate": "2021-03-30T09:55:52.261232Z", + "updatedDate": "2021-03-30T09:56:17.502284Z", + "updatedBy": "Not found", + "createdBy": "Not found" + }, + "createdDate": "2021-03-30T13:07:07.960379Z", + "updatedDate": "2021-03-30T13:07:07.960379Z", + "updatedBy": "admin", + "createdBy": "admin" + } + ], + "loopLogs": [ + { + "id": 478, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-05-07T09:32:44Z" + }, + { + "id": 477, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-05-07T09:32:44Z" + }, + { + "id": 476, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-05-07T09:32:43Z" + }, + { + "id": 475, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-05-07T09:32:43Z" + }, + { + "id": 474, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-05-07T09:32:43Z" + }, + { + "id": 473, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-05-07T09:32:43Z" + }, + { + "id": 472, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-05-07T09:32:39Z" + }, + { + "id": 471, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-05-07T09:32:39Z" + }, + { + "id": 470, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-05-07T09:32:35Z" + }, + { + "id": 451, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-07T13:34:30Z" + }, + { + "id": 450, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-07T13:34:30Z" + }, + { + "id": 449, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-07T13:34:30Z" + }, + { + "id": 448, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-07T13:34:30Z" + }, + { + "id": 447, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-07T13:34:30Z" + }, + { + "id": 446, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-07T13:34:30Z" + }, + { + "id": 445, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-07T13:34:26Z" + }, + { + "id": 444, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-07T13:34:26Z" + }, + { + "id": 443, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-07T13:34:22Z" + }, + { + "id": 442, + "logType": "INFO", + "logComponent": "POLICY", + "message": "PDP Group remove ALL status - : ", + "logInstant": "2021-04-07T08:32:06Z" + }, + { + "id": 441, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "STOP request", + "logInstant": "2021-04-07T08:32:02Z" + }, + { + "id": 440, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-07T08:23:46Z" + }, + { + "id": 439, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-07T08:23:46Z" + }, + { + "id": 438, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-07T08:23:46Z" + }, + { + "id": 437, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-07T08:23:46Z" + }, + { + "id": 436, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-07T08:23:46Z" + }, + { + "id": 435, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-07T08:23:46Z" + }, + { + "id": 434, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-07T08:23:42Z" + }, + { + "id": 433, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-07T08:23:41Z" + }, + { + "id": 432, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-07T08:23:37Z" + }, + { + "id": 431, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T15:06:27Z" + }, + { + "id": 430, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T15:06:27Z" + }, + { + "id": 429, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T15:06:27Z" + }, + { + "id": 428, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T15:06:27Z" + }, + { + "id": 427, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T15:06:27Z" + }, + { + "id": 426, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T15:06:27Z" + }, + { + "id": 425, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T15:06:22Z" + }, + { + "id": 424, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T15:06:22Z" + }, + { + "id": 423, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T15:06:18Z" + }, + { + "id": 422, + "logType": "INFO", + "logComponent": "POLICY", + "message": "PDP Group remove ALL status - : ", + "logInstant": "2021-04-06T15:06:04Z" + }, + { + "id": 421, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "STOP request", + "logInstant": "2021-04-06T15:06:00Z" + }, + { + "id": 420, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T15:05:28Z" + }, + { + "id": 419, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T15:05:28Z" + }, + { + "id": 418, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T15:05:28Z" + }, + { + "id": 417, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T15:05:28Z" + }, + { + "id": 416, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T15:05:28Z" + }, + { + "id": 415, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T15:05:28Z" + }, + { + "id": 414, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T15:05:24Z" + }, + { + "id": 413, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T15:05:23Z" + }, + { + "id": 412, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T15:05:19Z" + }, + { + "id": 411, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "UNDEPLOY request successfully executed", + "logInstant": "2021-04-06T15:05:07Z" + }, + { + "id": 410, + "logType": "WARNING", + "logComponent": "CLAMP", + "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !", + "logInstant": "2021-04-06T15:05:07Z" + }, + { + "id": 409, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "DCAE UNDEPLOY request", + "logInstant": "2021-04-06T15:05:07Z" + }, + { + "id": 408, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DEPLOY loop status\n (Dep-id:CLAMP_7ae6f14d-80c8-4403-a174-ecb215d04c81,\n StatusUrl:) - : ", + "logInstant": "2021-04-06T15:02:46Z" + }, + { + "id": 407, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "DCAE DEPLOY request", + "logInstant": "2021-04-06T15:02:42Z" + }, + { + "id": 406, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T15:02:26Z" + }, + { + "id": 405, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T15:02:26Z" + }, + { + "id": 404, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T15:02:26Z" + }, + { + "id": 403, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T15:02:26Z" + }, + { + "id": 402, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T15:02:25Z" + }, + { + "id": 401, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T15:02:25Z" + }, + { + "id": 400, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T15:02:21Z" + }, + { + "id": 399, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T15:02:21Z" + }, + { + "id": 398, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T15:02:17Z" + }, + { + "id": 397, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T14:32:53Z" + }, + { + "id": 396, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T14:32:53Z" + }, + { + "id": 395, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T14:32:53Z" + }, + { + "id": 394, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T14:32:53Z" + }, + { + "id": 393, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T14:32:53Z" + }, + { + "id": 392, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:32:53Z" + }, + { + "id": 391, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T14:32:49Z" + }, + { + "id": 390, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:32:49Z" + }, + { + "id": 389, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T14:32:44Z" + }, + { + "id": 388, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T14:31:37Z" + }, + { + "id": 387, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T14:31:37Z" + }, + { + "id": 386, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T14:31:37Z" + }, + { + "id": 385, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T14:31:37Z" + }, + { + "id": 384, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T14:31:37Z" + }, + { + "id": 383, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:31:37Z" + }, + { + "id": 382, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T14:31:33Z" + }, + { + "id": 381, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:31:33Z" + }, + { + "id": 380, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T14:31:28Z" + }, + { + "id": 379, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T14:30:35Z" + }, + { + "id": 378, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T14:30:35Z" + }, + { + "id": 377, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T14:30:34Z" + }, + { + "id": 376, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T14:30:34Z" + }, + { + "id": 375, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T14:30:34Z" + }, + { + "id": 374, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:30:34Z" + }, + { + "id": 373, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T14:30:30Z" + }, + { + "id": 372, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:30:30Z" + }, + { + "id": 371, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T14:30:26Z" + }, + { + "id": 370, + "logType": "INFO", + "logComponent": "POLICY", + "message": "PDP Group remove ALL status - : ", + "logInstant": "2021-04-06T14:04:21Z" + }, + { + "id": 369, + "logType": "WARNING", + "logComponent": "CLAMP", + "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !", + "logInstant": "2021-04-06T14:04:17Z" + }, + { + "id": 368, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "DELETE request", + "logInstant": "2021-04-06T14:04:17Z" + }, + { + "id": 367, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T14:03:52Z" + }, + { + "id": 366, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T14:03:52Z" + }, + { + "id": 365, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T14:03:51Z" + }, + { + "id": 364, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T14:03:51Z" + }, + { + "id": 363, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T14:03:51Z" + }, + { + "id": 362, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:03:51Z" + }, + { + "id": 361, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T14:03:47Z" + }, + { + "id": 360, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T14:03:47Z" + }, + { + "id": 359, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T14:03:43Z" + }, + { + "id": 358, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "UNDEPLOY request successfully executed", + "logInstant": "2021-04-06T14:03:35Z" + }, + { + "id": 357, + "logType": "WARNING", + "logComponent": "CLAMP", + "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !", + "logInstant": "2021-04-06T14:03:35Z" + }, + { + "id": 356, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "DCAE UNDEPLOY request", + "logInstant": "2021-04-06T14:03:35Z" + }, + { + "id": 355, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T13:57:38Z" + }, + { + "id": 354, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T13:57:38Z" + }, + { + "id": 353, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T13:57:38Z" + }, + { + "id": 352, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T13:57:38Z" + }, + { + "id": 351, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T13:57:37Z" + }, + { + "id": 350, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T13:57:37Z" + }, + { + "id": 349, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T13:57:33Z" + }, + { + "id": 348, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T13:57:33Z" + }, + { + "id": 347, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T13:57:29Z" + }, + { + "id": 346, + "logType": "INFO", + "logComponent": "POLICY", + "message": "PDP Group remove ALL status - : ", + "logInstant": "2021-04-06T13:57:21Z" + }, + { + "id": 345, + "logType": "WARNING", + "logComponent": "CLAMP", + "message": "Cannot Undeploy for the loop: pmsh_loop, the Deployment ID does not exist !", + "logInstant": "2021-04-06T13:57:16Z" + }, + { + "id": 344, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "DELETE request", + "logInstant": "2021-04-06T13:57:16Z" + }, + { + "id": 343, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-06T13:16:29Z" + }, + { + "id": 342, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-06T13:16:29Z" + }, + { + "id": 341, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-06T13:16:29Z" + }, + { + "id": 340, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-06T13:16:29Z" + }, + { + "id": 339, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-06T13:16:29Z" + }, + { + "id": 338, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T13:16:29Z" + }, + { + "id": 337, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-06T13:16:24Z" + }, + { + "id": 336, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-06T13:16:24Z" + }, + { + "id": 335, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-06T13:16:20Z" + }, + { + "id": 334, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "Micro Service policies UPDATED", + "logInstant": "2021-04-01T16:12:47Z" + }, + { + "id": 333, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T16:09:36Z" + }, + { + "id": 332, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T16:09:36Z" + }, + { + "id": 331, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T16:09:36Z" + }, + { + "id": 330, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T16:09:36Z" + }, + { + "id": 329, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T16:09:36Z" + }, + { + "id": 328, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T16:09:36Z" + }, + { + "id": 327, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T16:09:32Z" + }, + { + "id": 326, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T16:09:32Z" + }, + { + "id": 325, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T16:09:27Z" + }, + { + "id": 324, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "Micro Service policies UPDATED", + "logInstant": "2021-04-01T15:16:20Z" + }, + { + "id": 323, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T15:15:57Z" + }, + { + "id": 322, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T15:15:57Z" + }, + { + "id": 321, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T15:15:57Z" + }, + { + "id": 320, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T15:15:57Z" + }, + { + "id": 319, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T15:15:57Z" + }, + { + "id": 318, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T15:15:57Z" + }, + { + "id": 317, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T15:15:52Z" + }, + { + "id": 316, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T15:15:52Z" + }, + { + "id": 315, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T15:15:48Z" + }, + { + "id": 314, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T15:14:19Z" + }, + { + "id": 313, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T15:14:19Z" + }, + { + "id": 312, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T15:14:19Z" + }, + { + "id": 311, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T15:14:19Z" + }, + { + "id": 310, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T15:14:19Z" + }, + { + "id": 309, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T15:14:19Z" + }, + { + "id": 308, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T15:14:15Z" + }, + { + "id": 307, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T15:14:15Z" + }, + { + "id": 306, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T15:14:10Z" + }, + { + "id": 305, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T15:10:59Z" + }, + { + "id": 304, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T15:10:59Z" + }, + { + "id": 303, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T15:10:59Z" + }, + { + "id": 302, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T15:10:59Z" + }, + { + "id": 301, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T15:10:59Z" + }, + { + "id": 300, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T15:10:59Z" + }, + { + "id": 299, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T15:10:55Z" + }, + { + "id": 298, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T15:10:54Z" + }, + { + "id": 297, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T15:10:50Z" + }, + { + "id": 287, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T14:31:38Z" + }, + { + "id": 286, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T14:31:38Z" + }, + { + "id": 285, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T14:31:37Z" + }, + { + "id": 284, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T14:31:37Z" + }, + { + "id": 283, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T14:31:37Z" + }, + { + "id": 282, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T14:31:37Z" + }, + { + "id": 281, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T14:31:33Z" + }, + { + "id": 280, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T14:31:33Z" + }, + { + "id": 279, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "Micro Service policies UPDATED", + "logInstant": "2021-04-01T14:31:32Z" + }, + { + "id": 278, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T14:31:31Z" + }, + { + "id": 277, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T14:31:31Z" + }, + { + "id": 276, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T14:31:30Z" + }, + { + "id": 275, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T14:31:30Z" + }, + { + "id": 274, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 273, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 272, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 271, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 270, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 269, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 268, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 267, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 266, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 265, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 264, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 263, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 262, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 261, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 260, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 259, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 258, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T14:31:29Z" + }, + { + "id": 257, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 256, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 255, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 254, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 253, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 252, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 251, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T14:31:28Z" + }, + { + "id": 250, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "Micro Service policies UPDATED", + "logInstant": "2021-04-01T12:39:55Z" + }, + { + "id": 249, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T12:38:31Z" + }, + { + "id": 248, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T12:38:31Z" + }, + { + "id": 247, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T12:38:30Z" + }, + { + "id": 246, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T12:38:30Z" + }, + { + "id": 245, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T12:38:30Z" + }, + { + "id": 244, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T12:38:30Z" + }, + { + "id": 243, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T12:38:26Z" + }, + { + "id": 242, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T12:38:26Z" + }, + { + "id": 241, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T12:38:22Z" + }, + { + "id": 240, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "Micro Service policies UPDATED", + "logInstant": "2021-04-01T12:37:20Z" + }, + { + "id": 239, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T12:37:19Z" + }, + { + "id": 238, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T12:37:19Z" + }, + { + "id": 237, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T12:37:19Z" + }, + { + "id": 236, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T12:37:19Z" + }, + { + "id": 235, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T12:37:19Z" + }, + { + "id": 234, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T12:37:19Z" + }, + { + "id": 233, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T12:37:14Z" + }, + { + "id": 232, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T12:37:14Z" + }, + { + "id": 231, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T12:37:10Z" + }, + { + "id": 221, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "Micro Service policies UPDATED", + "logInstant": "2021-04-01T11:57:59Z" + }, + { + "id": 220, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-04-01T11:57:34Z" + }, + { + "id": 219, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-04-01T11:57:34Z" + }, + { + "id": 218, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-04-01T11:57:34Z" + }, + { + "id": 217, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-04-01T11:57:33Z" + }, + { + "id": 216, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-04-01T11:57:33Z" + }, + { + "id": 215, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T11:57:33Z" + }, + { + "id": 214, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-04-01T11:57:29Z" + }, + { + "id": 213, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-04-01T11:57:29Z" + }, + { + "id": 212, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-04-01T11:57:25Z" + }, + { + "id": 211, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:50:20Z" + }, + { + "id": 210, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:50:20Z" + }, + { + "id": 209, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:50:20Z" + }, + { + "id": 208, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:50:20Z" + }, + { + "id": 207, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:50:20Z" + }, + { + "id": 206, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:50:20Z" + }, + { + "id": 205, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:50:16Z" + }, + { + "id": 204, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:50:16Z" + }, + { + "id": 203, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:50:11Z" + }, + { + "id": 202, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:49:39Z" + }, + { + "id": 201, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:49:39Z" + }, + { + "id": 200, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:49:39Z" + }, + { + "id": 199, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:49:39Z" + }, + { + "id": 198, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:49:39Z" + }, + { + "id": 197, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:49:39Z" + }, + { + "id": 196, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:49:35Z" + }, + { + "id": 195, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:49:35Z" + }, + { + "id": 194, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:49:30Z" + }, + { + "id": 193, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:49:06Z" + }, + { + "id": 192, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:49:06Z" + }, + { + "id": 191, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:49:06Z" + }, + { + "id": 190, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:49:06Z" + }, + { + "id": 189, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:49:06Z" + }, + { + "id": 188, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:49:06Z" + }, + { + "id": 187, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:49:01Z" + }, + { + "id": 186, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:49:01Z" + }, + { + "id": 185, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:48:57Z" + }, + { + "id": 184, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:47:28Z" + }, + { + "id": 183, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:47:28Z" + }, + { + "id": 182, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:47:28Z" + }, + { + "id": 181, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:47:28Z" + }, + { + "id": 180, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:47:27Z" + }, + { + "id": 179, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:47:27Z" + }, + { + "id": 178, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:47:23Z" + }, + { + "id": 177, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:47:23Z" + }, + { + "id": 176, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:47:19Z" + }, + { + "id": 175, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:43:41Z" + }, + { + "id": 174, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:43:41Z" + }, + { + "id": 173, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:43:41Z" + }, + { + "id": 172, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:43:41Z" + }, + { + "id": 171, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:43:41Z" + }, + { + "id": 170, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:43:41Z" + }, + { + "id": 169, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:43:36Z" + }, + { + "id": 168, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T15:43:36Z" + }, + { + "id": 167, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:43:34Z" + }, + { + "id": 166, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:43:34Z" + }, + { + "id": 165, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T15:43:34Z" + }, + { + "id": 164, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:43:34Z" + }, + { + "id": 163, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:43:34Z" + }, + { + "id": 162, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T15:43:34Z" + }, + { + "id": 161, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 160, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 159, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 158, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 157, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 156, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 155, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 154, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 153, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 152, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 151, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 150, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-03-31T15:43:33Z" + }, + { + "id": 149, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 148, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 147, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 146, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 145, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 144, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connection is still allocated", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 143, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 142, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 141, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 140, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T15:43:32Z" + }, + { + "id": 139, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T10:13:01Z" + }, + { + "id": 138, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T10:13:01Z" + }, + { + "id": 137, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T10:13:00Z" + }, + { + "id": 136, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T10:13:00Z" + }, + { + "id": 135, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T10:13:00Z" + }, + { + "id": 134, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T10:13:00Z" + }, + { + "id": 133, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T10:12:56Z" + }, + { + "id": 132, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T10:12:56Z" + }, + { + "id": 131, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T10:12:52Z" + }, + { + "id": 130, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T09:55:12Z" + }, + { + "id": 129, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T09:55:12Z" + }, + { + "id": 128, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T09:55:12Z" + }, + { + "id": 127, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T09:55:12Z" + }, + { + "id": 126, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T09:55:12Z" + }, + { + "id": 125, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T09:55:12Z" + }, + { + "id": 124, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T09:55:08Z" + }, + { + "id": 123, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T09:55:07Z" + }, + { + "id": 122, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T09:55:03Z" + }, + { + "id": 121, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T09:46:18Z" + }, + { + "id": 120, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T09:46:18Z" + }, + { + "id": 119, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T09:46:18Z" + }, + { + "id": 118, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T09:46:18Z" + }, + { + "id": 117, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T09:46:18Z" + }, + { + "id": 116, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T09:46:18Z" + }, + { + "id": 115, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T09:46:13Z" + }, + { + "id": 114, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T09:46:13Z" + }, + { + "id": 113, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T09:46:09Z" + }, + { + "id": 112, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-31T09:45:56Z" + }, + { + "id": 111, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-31T09:45:56Z" + }, + { + "id": 110, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-31T09:45:56Z" + }, + { + "id": 109, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-31T09:45:56Z" + }, + { + "id": 108, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-31T09:45:56Z" + }, + { + "id": 107, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T09:45:55Z" + }, + { + "id": 106, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-31T09:45:51Z" + }, + { + "id": 105, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-31T09:45:51Z" + }, + { + "id": 104, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-31T09:45:47Z" + }, + { + "id": 103, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T16:00:55Z" + }, + { + "id": 102, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T16:00:55Z" + }, + { + "id": 101, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T16:00:55Z" + }, + { + "id": 100, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T16:00:55Z" + }, + { + "id": 99, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T16:00:55Z" + }, + { + "id": 98, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T16:00:54Z" + }, + { + "id": 97, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T16:00:50Z" + }, + { + "id": 96, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T16:00:50Z" + }, + { + "id": 95, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T16:00:46Z" + }, + { + "id": 94, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T15:58:05Z" + }, + { + "id": 93, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T15:58:05Z" + }, + { + "id": 92, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T15:58:05Z" + }, + { + "id": 91, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T15:58:05Z" + }, + { + "id": 90, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T15:58:05Z" + }, + { + "id": 89, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T15:58:05Z" + }, + { + "id": 88, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T15:58:00Z" + }, + { + "id": 87, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T15:58:00Z" + }, + { + "id": 86, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T15:57:56Z" + }, + { + "id": 85, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T15:00:21Z" + }, + { + "id": 84, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T15:00:21Z" + }, + { + "id": 83, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T15:00:21Z" + }, + { + "id": 82, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T15:00:21Z" + }, + { + "id": 81, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T15:00:21Z" + }, + { + "id": 80, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T15:00:21Z" + }, + { + "id": 79, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T15:00:17Z" + }, + { + "id": 78, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T15:00:17Z" + }, + { + "id": 77, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T15:00:12Z" + }, + { + "id": 76, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T14:51:24Z" + }, + { + "id": 75, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T14:51:23Z" + }, + { + "id": 74, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T14:51:23Z" + }, + { + "id": 73, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T14:51:23Z" + }, + { + "id": 72, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T14:51:23Z" + }, + { + "id": 71, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:51:23Z" + }, + { + "id": 70, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T14:51:19Z" + }, + { + "id": 69, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:51:19Z" + }, + { + "id": 68, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T14:51:15Z" + }, + { + "id": 67, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T14:45:06Z" + }, + { + "id": 66, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T14:45:06Z" + }, + { + "id": 65, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T14:45:06Z" + }, + { + "id": 64, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T14:45:06Z" + }, + { + "id": 63, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T14:45:06Z" + }, + { + "id": 62, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:45:06Z" + }, + { + "id": 61, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T14:45:02Z" + }, + { + "id": 60, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:45:02Z" + }, + { + "id": 59, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T14:44:57Z" + }, + { + "id": 58, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T14:44:31Z" + }, + { + "id": 57, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T14:44:31Z" + }, + { + "id": 56, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T14:44:31Z" + }, + { + "id": 55, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T14:44:31Z" + }, + { + "id": 54, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T14:44:31Z" + }, + { + "id": 53, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:44:31Z" + }, + { + "id": 52, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T14:44:27Z" + }, + { + "id": 51, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:44:26Z" + }, + { + "id": 50, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T14:44:22Z" + }, + { + "id": 49, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T14:32:12Z" + }, + { + "id": 48, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T14:32:12Z" + }, + { + "id": 47, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T14:32:12Z" + }, + { + "id": 46, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T14:32:12Z" + }, + { + "id": 45, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T14:32:12Z" + }, + { + "id": 44, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:32:11Z" + }, + { + "id": 43, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T14:32:07Z" + }, + { + "id": 42, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T14:32:07Z" + }, + { + "id": 41, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T14:32:03Z" + }, + { + "id": 40, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request successfully executed", + "logInstant": "2021-03-30T13:07:24Z" + }, + { + "id": 39, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "New loop state is: DESIGN", + "logInstant": "2021-03-30T13:07:24Z" + }, + { + "id": 38, + "logType": "INFO", + "logComponent": "DCAE", + "message": "DCAE state set to: BLUEPRINT_DEPLOYED - message: ", + "logInstant": "2021-03-30T13:07:24Z" + }, + { + "id": 37, + "logType": "INFO", + "logComponent": "POLICY", + "message": "Policy state set to: NOT_SENT", + "logInstant": "2021-03-30T13:07:24Z" + }, + { + "id": 36, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET Policy deployment\n status - : ", + "logInstant": "2021-03-30T13:07:24Z" + }, + { + "id": 35, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T13:07:24Z" + }, + { + "id": 34, + "logType": "INFO", + "logComponent": "POLICY", + "message": "MICROSERVICE_vLoadBalancerMS_v1_0_dcae-pm-subscription-handler_1_0_0_mHh GET\n Policy status - : ", + "logInstant": "2021-03-30T13:07:19Z" + }, + { + "id": 33, + "logType": "ERROR", + "logComponent": "CLAMP", + "message": "GET policy request failed, Error reported: Connect to localhost:8085 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect", + "logInstant": "2021-03-30T13:07:19Z" + }, + { + "id": 32, + "logType": "INFO", + "logComponent": "CLAMP", + "message": "GET STATUS request", + "logInstant": "2021-03-30T13:07:15Z" + } + ], + "loopTemplate": { + "name": "LOOP_TEMPLATE_k8s_pmsh", + "dcaeBlueprintId": "9dc5dba0-e685-4d5a-b144-8f4d84cfa01f", + "loopElementModelsUsed": [ + { + "loopElementModel": { + "name": "onap.policies.monitoring.dcae-pm-subscription-handler", + "loopElementType": "MICRO_SERVICE_TYPE", + "policyModels": [ + { + "policyModelType": "onap.policies.monitoring.dcae-pm-subscription-handler", + "version": "1.0.0", + "policyAcronym": "dcae-pm-subscription-handler", + "policyPdpGroup": { + "supportedPdpGroups": [ + { + "ControlLoopGroup": [ + "apex", + "xacml" + ] + }, + { + "defaultGroup": [ + "xacml" + ] + } + ] + }, + "createdDate": "2021-03-30T09:55:52.261232Z", + "updatedDate": "2021-03-30T09:56:17.502284Z", + "updatedBy": "Not found", + "createdBy": "Not found" + } + ], + "createdDate": "2021-03-30T08:48:21Z", + "updatedDate": "2021-03-30T08:48:21Z", + "updatedBy": "Not found", + "createdBy": "Not found" + }, + "flowOrder": 0 + } + ], + "modelService": { + "serviceDetails": { + "serviceType": "", + "serviceRole": "", + "description": "vLBMS", + "type": "Service", + "instantiationType": "A-la-carte", + "namingPolicy": "", + "serviceEcompNaming": "true", + "environmentContext": "General_Revenue-Bearing", + "name": "vLoadBalancerMS", + "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f", + "ecompGeneratedNaming": "true", + "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0", + "category": "Network L4+" + }, + "resourceDetails": { + "CP": {}, + "VL": {}, + "VF": { + "vLoadBalancerMS 0": { + "resourceVendor": "Test", + "name": "vLoadBalancerMS", + "resourceVendorModelNumber": "", + "description": "vLBMS", + "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506", + "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6", + "type": "VF", + "category": "Application L4+", + "subcategory": "Load Balancer", + "version": "1.0", + "customizationUUID": "465246dc-7748-45f4-a013-308d92922552", + "resourceVendorRelease": "1.0", + "controllerProperties": { + "sdnc_model_name": "baseconfiguration", + "sdnc_model_version": "1.0.0", + "workflows": { + "resource-assignment": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "activate": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "activate-restconf": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "activate-cli": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "assign-activate": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + }, + "imperative-test-wf": { + "inputs": { + "resource-assignment-properties": { + "type": "object", + "properties": { + "request-id": { + "required": true, + "type": "string", + "input-param": true + }, + "service-instance-id": { + "required": true, + "type": "string", + "input-param": true + }, + "hostname": { + "required": true, + "type": "string", + "input-param": true + }, + "request-info": { + "type": "object", + "properties": { + "prop1": { + "required": true, + "type": "string", + "input-param": true + }, + "prop2": { + "required": true, + "type": "string", + "input-param": true + } + } + } + } + } + } + } + } + } + } + }, + "CR": {}, + "VFC": {}, + "PNF": {}, + "Service": {}, + "CVFC": {}, + "Service Proxy": {}, + "Configuration": {}, + "AllottedResource": {}, + "VFModule": { + "Vloadbalancerms..vpkg..module-1": { + "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vpkg..module-1", + "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc", + "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52", + "min_vf_module_instances": 0, + "vf_module_label": "vpkg", + "max_vf_module_instances": 1, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + }, + "Vloadbalancerms..vdns..module-3": { + "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vdns..module-3", + "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720", + "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1", + "min_vf_module_instances": 0, + "vf_module_label": "vdns", + "max_vf_module_instances": 50, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + }, + "Vloadbalancerms..base_template..module-0": { + "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..base_template..module-0", + "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce", + "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27", + "min_vf_module_instances": 1, + "vf_module_label": "base_template", + "max_vf_module_instances": 1, + "vf_module_type": "Base", + "isBase": true, + "initial_count": 1, + "volume_group": false + }, + "Vloadbalancerms..vlb..module-2": { + "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd", + "vfModuleModelVersion": "1", + "vfModuleModelName": "Vloadbalancerms..vlb..module-2", + "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a", + "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806", + "min_vf_module_instances": 0, + "vf_module_label": "vlb", + "max_vf_module_instances": 1, + "vf_module_type": "Expansion", + "isBase": false, + "initial_count": 0, + "volume_group": false + } + } + } + }, + "maximumInstancesAllowed": 0, + "uniqueBlueprint": true, + "allowedLoopType": "CLOSED", + "createdDate": "2021-03-30T08:48:21Z", + "updatedDate": "2021-03-30T08:48:21Z", + "updatedBy": "Not found", + "createdBy": "Not found" + }, + "createdDate": "2021-03-30T13:07:07.901081Z", + "updatedDate": "2021-03-30T13:07:07.901081Z", + "updatedBy": "admin", + "createdBy": "admin" +} diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java index 86f2817c5..932ebbece 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java @@ -20,34 +20,90 @@ package org.onap.policy.clamp.controlloop.participant.policy.main.handler; -import java.util.List; +import java.time.Instant; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; import java.util.UUID; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics; -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.ControlLoops; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; import org.onap.policy.models.base.PfModelException; -import org.onap.policy.models.pdp.concepts.PdpStatistics; +import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.provider.PolicyModelsProvider; +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; /** * This class handles implementation of controlLoopElement updates. */ public class ControlLoopElementHandler implements ControlLoopElementListener { + private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class); + private static final Map<String, String> policyTypeMap = new LinkedHashMap<>(); + private static final Map<String, String> policyMap = new LinkedHashMap<>(); + /** * Callback method to handle a control loop element state change. * * @param controlLoopElementId the ID of the control loop element * @param currentState the current state of the control loop element * @param newState the state to which the control loop element is changing to + * @throws PfModelException in case of an exception */ @Override - public void controlLoopElementStateChange(UUID controlLoopElementId, ControlLoopState currentState, - ControlLoopOrderedState newState) { + public void controlLoopElementStateChange(UUID controlLoopElementId, + ControlLoopState currentState, + ControlLoopOrderedState newState) throws PfModelException { + PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider(); + switch (newState) { + case UNINITIALISED: + try { + deletePolicyData(controlLoopElementId, newState); + } catch (PfModelRuntimeException e) { + LOGGER.debug("Delete policytpes failed", e); + } + break; + case PASSIVE: + policyProvider.getIntermediaryApi() + .updateControlLoopElementState(controlLoopElementId, newState, + ControlLoopState.PASSIVE); + break; + case RUNNING: + policyProvider.getIntermediaryApi() + .updateControlLoopElementState(controlLoopElementId, newState, + ControlLoopState.RUNNING); + break; + default: + LOGGER.debug("Unknown orderedstate {}", newState); + break; + } + } + + private void deletePolicyData(UUID controlLoopElementId, + ControlLoopOrderedState newState) throws PfModelException { + PolicyModelsProvider dbProvider = PolicyHandler.getInstance().getDatabaseProvider(); + PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider(); + if (policyMap != null) { + // Delete all policies of this controlLoop from policy framework + for (Entry<String, String> policy : policyMap.entrySet()) { + dbProvider.deletePolicy(policy.getKey(), policy.getValue()); + } + } + if (policyTypeMap != null) { + // Delete all policy types of this control loop from policy framework + for (Entry<String, String> policy : policyTypeMap.entrySet()) { + dbProvider.deletePolicyType(policy.getKey(), policy.getValue()); + } + } + policyProvider.getIntermediaryApi() + .updateControlLoopElementState(controlLoopElementId, newState, + ControlLoopState.UNINITIALISED); } /** @@ -60,11 +116,44 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { @Override public void controlLoopElementUpdate(ControlLoopElement element, ToscaServiceTemplate controlLoopDefinition) throws PfModelException { + PolicyModelsProvider dbProvider = PolicyHandler.getInstance().getDatabaseProvider(); + PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider(); + + policyProvider.getIntermediaryApi() + .updateControlLoopElementState(element.getId(), element.getOrderedState(), ControlLoopState.PASSIVE); if (controlLoopDefinition.getPolicyTypes() != null) { - PolicyHandler.getInstance().getDatabaseProvider().createPolicyTypes(controlLoopDefinition); + for (ToscaPolicyType policyType : controlLoopDefinition.getPolicyTypes().values()) { + policyTypeMap.put(policyType.getName(), policyType.getVersion()); + } + dbProvider.createPolicyTypes(controlLoopDefinition); } if (controlLoopDefinition.getToscaTopologyTemplate().getPolicies() != null) { - PolicyHandler.getInstance().getDatabaseProvider().createPolicies(controlLoopDefinition); + for (Map<String, ToscaPolicy> foundPolicyMap : controlLoopDefinition + .getToscaTopologyTemplate().getPolicies()) { + for (ToscaPolicy policy : foundPolicyMap.values()) { + policyMap.put(policy.getName(), policy.getVersion()); + } + } + dbProvider.createPolicies(controlLoopDefinition); + } + } + + /** + * Handle controlLoopElement statistics. + * + * @param controlLoopElementId controlloop element id + */ + @Override + public void handleStatistics(UUID controlLoopElementId) { + PolicyProvider policyProvider = PolicyHandler.getInstance().getPolicyProvider(); + ControlLoopElement clElement = policyProvider.getIntermediaryApi() + .getControlLoopElement(controlLoopElementId); + if (clElement != null) { + ClElementStatistics clElementStatistics = new ClElementStatistics(); + clElementStatistics.setControlLoopState(clElement.getState()); + clElementStatistics.setTimeStamp(Instant.now()); + policyProvider.getIntermediaryApi() + .updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics); } } } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java index 20f392fd4..d62e5f9f3 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyHandler.java @@ -37,7 +37,7 @@ import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderFactory; /** - * This class handles policy of participants and control loop elements. + * This class handles policy participant and control loop elements. * * <p/>It is effectively a singleton that is started at system start. */ @@ -73,26 +73,6 @@ public class PolicyHandler extends ControlLoopHandler { } @Override - public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override - public void startAndRegisterPublishers(List<TopicSink> topicSinks) { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterPublishers() { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override public void startProviders() { try { policyProvider = new PolicyProvider(participantParameters); diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java index 92cf79e49..420c77ee3 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/PolicyProvider.java @@ -22,13 +22,8 @@ package org.onap.policy.clamp.controlloop.participant.policy.main.handler; import java.io.Closeable; import java.io.IOException; -import java.util.List; import lombok.Getter; -import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops; -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryFactory; import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java index 8de3a5b32..98cea821a 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/ParticipantPolicyParameterHandler.java @@ -24,7 +24,7 @@ import java.io.File; import javax.ws.rs.core.Response; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.ParticipantPolicyCommandLineArguments; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -65,7 +65,7 @@ public class ParticipantPolicyParameterHandler { } // validate the parameters - final GroupValidationResult validationResult = parameters.validate(); + final ValidationResult validationResult = parameters.validate(); if (!validationResult.isValid()) { String returnMessage = "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n"; diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json index 2a3a1f1b6..e6b3c8eb1 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/main/resources/config/PolicyParticipantConfig.json @@ -7,6 +7,10 @@ "name": "PolicyParticipant0", "version":"1.0.0" }, + "participantType":{ + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version":"2.3.1" + }, "participantDefinition":{ "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", "version":"2.3.1" @@ -25,4 +29,3 @@ }] } } - diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java index d96530219..abc3e71b8 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/TestPolicyHandler.java @@ -29,7 +29,9 @@ import org.junit.BeforeClass; import org.junit.Test; import org.onap.policy.clamp.controlloop.common.ControlLoopConstants; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; +import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener; import org.onap.policy.clamp.controlloop.participant.policy.main.parameters.CommonTestData; import org.onap.policy.clamp.controlloop.participant.policy.main.startstop.Main; @@ -41,11 +43,14 @@ import org.onap.policy.common.utils.services.Registry; public class TestPolicyHandler { private static ControlLoopUpdateListener clUpdateListener; + private ControlLoopStateChangeListener clStateChangeListener; private static ParticipantControlLoopUpdate participantControlLoopUpdateMsg; + private ParticipantControlLoopStateChange participantControlLoopStateChangeMsg; private static final String PARTICIPANTS_ENDPOINT = "participants"; private static final String ELEMENTS_ENDPOINT = "elements"; private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; private static final String TOPIC = "my-topic"; + private static final Object lockit = new Object(); static CommonTestData commonTestData = new CommonTestData(); /** @@ -66,27 +71,61 @@ public class TestPolicyHandler { .getIntermediaryApi() .getParticipantHandler()); participantControlLoopUpdateMsg = - TestListenerUtils.createControlLoopUpdateMsg("src/test/resources/utils/servicetemplates"); + TestListenerUtils.createControlLoopUpdateMsg(); participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); } @Test - public void testUpdatePolicies() throws Exception { - // Add policy_types to the toscaServiceTemplate - TestListenerUtils.addPolicyTypesToToscaServiceTemplate( - participantControlLoopUpdateMsg.getControlLoopDefinition()); + public void testUpdatePolicyTypes() throws Exception { + // Verify that the ToscaServicetemplate has policy_types + assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition().getPolicyTypes()); + + synchronized (lockit) { + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + } + // Verify the result of GET participants with what is stored + assertEquals("org.onap.PM_Policy", + TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + } + @Test + public void testUpdatePolicies() throws Exception { // Add policies to the toscaServiceTemplate TestListenerUtils.addPoliciesToToscaServiceTemplate(participantControlLoopUpdateMsg.getControlLoopDefinition()); - // Verify that the ToscaServicetemplate has policy_types - assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition().getPolicyTypes()); + // Verify that the ToscaServicetemplate has policies + assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition() + .getToscaTopologyTemplate().getPolicies()); + + synchronized (lockit) { + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + } + // Verify the result of GET participants with what is stored + assertEquals("org.onap.PM_Policy", + TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + } + + @Test + public void testDeletePoliciesAndPolicyTypes() throws Exception { + // Add policies to the toscaServiceTemplate + TestListenerUtils.addPoliciesToToscaServiceTemplate(participantControlLoopUpdateMsg.getControlLoopDefinition()); // Verify that the ToscaServicetemplate has policies assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition() .getToscaTopologyTemplate().getPolicies()); - clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + synchronized (lockit) { + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + } + // Verify the result of GET participants with what is stored + assertEquals("org.onap.PM_Policy", + TestListenerUtils.getParticipantHandler().getParticipantId().getName()); + + clStateChangeListener = new ControlLoopStateChangeListener(TestListenerUtils.getParticipantHandler()); + participantControlLoopStateChangeMsg = + TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED); + participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.UNINITIALISED); + clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg); // Verify the result of GET participants with what is stored assertEquals("org.onap.PM_Policy", diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java index 49984442e..5ffe5101d 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/parameters/TestParticipantPolicyParameters.java @@ -23,10 +23,11 @@ package org.onap.policy.clamp.controlloop.participant.policy.main.parameters; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import java.util.Map; import org.junit.Test; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; public class TestParticipantPolicyParameters { CommonTestData commonTestData = new CommonTestData(); @@ -50,7 +51,7 @@ public class TestParticipantPolicyParameters { final ParticipantPolicyParameters participantParameters = commonTestData .toObject(commonTestData.getParticipantPolicyParametersMap(null), ParticipantPolicyParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); + final ValidationResult validationResult = participantParameters.validate(); assertFalse(validationResult.isValid()); assertEquals(null, participantParameters.getName()); assertThat(validationResult.getResult()).contains("is null"); @@ -61,11 +62,11 @@ public class TestParticipantPolicyParameters { final ParticipantPolicyParameters participantParameters = commonTestData .toObject(commonTestData.getParticipantPolicyParametersMap(""), ParticipantPolicyParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); + final ValidationResult validationResult = participantParameters.validate(); assertFalse(validationResult.isValid()); assertEquals("", participantParameters.getName()); assertThat(validationResult.getResult()).contains( - "field \"name\" type \"java.lang.String\" value \"\" INVALID, " + "must be a non-blank string"); + "item \"name\" value \"\" INVALID, " + "is blank"); } @Test @@ -85,12 +86,8 @@ public class TestParticipantPolicyParameters { map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true)); final ParticipantPolicyParameters participantParameters = commonTestData.toObject(map, ParticipantPolicyParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); - assertFalse(validationResult.isValid()); - assertThat(validationResult.getResult()).contains( - "\"org.onap.policy.clamp.controlloop.participant.policy.main.parameters." - + "ParticipantPolicyParameters\"" - + " INVALID, parameter group has status INVALID"); + final ValidationResult validationResult = participantParameters.validate(); + assertNull(validationResult.getResult()); } @Test @@ -103,10 +100,7 @@ public class TestParticipantPolicyParameters { final ParticipantPolicyParameters participantParameters = commonTestData.toObject(map, ParticipantPolicyParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); - assertFalse(validationResult.isValid()); - assertThat(validationResult.getResult()) - .contains("\"org.onap.policy.common.endpoints.parameters.TopicParameterGroup\" INVALID, " - + "parameter group has status INVALID"); + final ValidationResult validationResult = participantParameters.validate(); + assertNull(validationResult.getResult()); } } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java index 9d5b874b3..4f3d6d62c 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java @@ -25,8 +25,7 @@ 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.List; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -68,7 +67,7 @@ public class TestListenerUtils { private TestListenerUtils() {} /** - * Initializes participantHandler. + * Method to initialize participantHandler. */ public static void initParticipantHandler() { @@ -89,8 +88,8 @@ public class TestListenerUtils { */ public static ControlLoop createControlLoop() { ControlLoop controlLoop = new ControlLoop(); - List<ControlLoopElement> elements = new ArrayList<>(); - ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead("src/test/resources/utils/servicetemplates"); + Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>(); + ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); Map<String, ToscaNodeTemplate> nodeTemplatesMap = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { @@ -106,7 +105,7 @@ public class TestListenerUtils { clElement.setState(ControlLoopState.UNINITIALISED); clElement.setDescription(toscaInputEntry.getValue().getDescription()); clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - elements.add(clElement); + elements.put(clElement.getId(), clElement); } controlLoop.setElements(elements); controlLoop.setName("PMSHInstance0"); @@ -172,7 +171,7 @@ public class TestListenerUtils { * * @return ParticipantControlLoopUpdate message */ - public static ParticipantControlLoopUpdate createControlLoopUpdateMsg(final String inputDirPath) { + public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() { final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate(); ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(); controlLoopId.setName("PMSHInstance0"); @@ -186,8 +185,8 @@ public class TestListenerUtils { clUpdateMsg.setParticipantId(participantId); ControlLoop controlLoop = new ControlLoop(); - List<ControlLoopElement> elements = new ArrayList<>(); - ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(inputDirPath); + Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>(); + ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); Map<String, ToscaNodeTemplate> nodeTemplatesMap = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { @@ -203,7 +202,7 @@ public class TestListenerUtils { clElement.setState(ControlLoopState.UNINITIALISED); clElement.setDescription(toscaInputEntry.getValue().getDescription()); clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - elements.add(clElement); + elements.put(clElement.getId(), clElement); } controlLoop.setElements(elements); controlLoop.setName("PMSHInstance0"); @@ -253,9 +252,9 @@ public class TestListenerUtils { return participantControlLoopUpdateMsg; } - private static ToscaServiceTemplate testControlLoopRead(final String inputDirPath) { + private static ToscaServiceTemplate testControlLoopRead() { Set<String> controlLoopDirectoryContents = - ResourceUtils.getDirectoryContents(inputDirPath); + ResourceUtils.getDirectoryContents("src/test/resources/utils/servicetemplates"); boolean atLeastOneControlLoopTested = false; ToscaServiceTemplate toscaServiceTemplate = null; @@ -268,16 +267,14 @@ public class TestListenerUtils { toscaServiceTemplate = testControlLoopYamlSerialization(controlLoopFilePath); } + // Add policy_types to the toscaServiceTemplate + addPolicyTypesToToscaServiceTemplate(toscaServiceTemplate); + assertTrue(atLeastOneControlLoopTested); return toscaServiceTemplate; } - /** - * Method to add polcies to the toscaServiceTemplate. - * - * @param toscaServiceTemplate to add policies - */ - public static void addPolicyTypesToToscaServiceTemplate( + private static void addPolicyTypesToToscaServiceTemplate( ToscaServiceTemplate toscaServiceTemplate) { Set<String> policyTypeDirectoryContents = ResourceUtils.getDirectoryContents("policytypes"); diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json index 57ffcbd60..1035ccb67 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/InvalidParameters.json @@ -1,4 +1,3 @@ { "name": " } - diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json index caca6cff6..30250be68 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/MinimumParametersH2.json @@ -4,13 +4,13 @@ "name": "Participant parameters", "reportingTimeInterval": 120000, "description": "Participant Description", - "participantId": { - "name": "org.onap.PM_Policy", - "version": "0.0.0" + "participantType":{ + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version":"2.3.1" }, - "participantType": { + "participantId": { "name": "org.onap.PM_Policy", - "version": "0.0.0" + "version": "1.0.0" }, "clampControlLoopTopics": { "topicSources": [ @@ -51,4 +51,3 @@ "persistenceUnit": "ToscaConceptTest" } } - diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json index bfd870e45..7a73a41bf 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/NoParameters.json @@ -1,3 +1,2 @@ { -} - +}
\ No newline at end of file diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml new file mode 100644 index 000000000..c2ffb40a9 --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestCLParams.yaml @@ -0,0 +1,161 @@ +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.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 + 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.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 + participant_id: + 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 + 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 + diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json index caca6cff6..30250be68 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParameters.json @@ -4,13 +4,13 @@ "name": "Participant parameters", "reportingTimeInterval": 120000, "description": "Participant Description", - "participantId": { - "name": "org.onap.PM_Policy", - "version": "0.0.0" + "participantType":{ + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version":"2.3.1" }, - "participantType": { + "participantId": { "name": "org.onap.PM_Policy", - "version": "0.0.0" + "version": "1.0.0" }, "clampControlLoopTopics": { "topicSources": [ @@ -51,4 +51,3 @@ "persistenceUnit": "ToscaConceptTest" } } - diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json index caca6cff6..79540631a 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/TestParametersStd.json @@ -4,13 +4,13 @@ "name": "Participant parameters", "reportingTimeInterval": 120000, "description": "Participant Description", - "participantId": { - "name": "org.onap.PM_Policy", - "version": "0.0.0" - }, "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "participantId": { "name": "org.onap.PM_Policy", - "version": "0.0.0" + "version": "1.0.0" }, "clampControlLoopTopics": { "topicSources": [ @@ -45,10 +45,9 @@ "name": "PolicyProviderParameterGroup", "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", "databaseDriver": "org.h2.Driver", - "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUrl": "jdbc:h2:mem:testdb", "databaseUser": "policy", "databasePassword": "P01icY", "persistenceUnit": "ToscaConceptTest" } } - diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json index 35b5e5fdf..efbfbe29f 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/Unreadable.json @@ -70,3 +70,4 @@ ] } + diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml index 324a92053..cf6b89eb9 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/parameters/logback-test.xml +++ b/tosca-controlloop/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.runtime" level="trace" additivity="false"> + <logger name="org.onap.policy.clamp.controlloop.participant" level="trace" additivity="false"> <appender-ref ref="STDOUT" /> </logger> </configuration> diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java index 7bd2851df..42f458602 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/ParticipantSimulatorParameterHandler.java @@ -24,7 +24,7 @@ import java.io.File; import javax.ws.rs.core.Response; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.participant.simulator.main.startstop.ParticipantSimulatorCommandLineArguments; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -65,7 +65,7 @@ public class ParticipantSimulatorParameterHandler { } // validate the parameters - final GroupValidationResult validationResult = parameters.validate(); + final ValidationResult validationResult = parameters.validate(); if (!validationResult.isValid()) { String returnMessage = "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n"; diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java index 24c4b7d2f..51ac3a4d5 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/main/startstop/ParticipantSimulatorCommandLineArguments.java @@ -37,6 +37,7 @@ import org.apache.commons.cli.ParseException; import org.apache.commons.lang3.StringUtils; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments; import org.onap.policy.common.utils.resources.ResourceUtils; /** @@ -48,6 +49,8 @@ public class ParticipantSimulatorCommandLineArguments { private static final int HELP_LINE_LENGTH = 120; private final Options options; + private final CommonCommandLineArguments commonCommandLineArguments; + @Getter() @Setter() private String configurationFilePath = null; @@ -56,30 +59,8 @@ public class ParticipantSimulatorCommandLineArguments { * Construct the options for the participant component. */ public ParticipantSimulatorCommandLineArguments() { - //@formatter:off options = new Options(); - options.addOption(Option.builder("h") - .longOpt("help") - .desc("outputs the usage of this command") - .required(false) - .type(Boolean.class) - .build()); - options.addOption(Option.builder("v") - .longOpt("version") - .desc("outputs the version of participant") - .required(false) - .type(Boolean.class) - .build()); - options.addOption(Option.builder("c") - .longOpt("config-file") - .desc("the full path to the configuration file to use, " - + "the configuration file must be a Json file containing the participant parameters") - .hasArg() - .argName("CONFIG_FILE") - .required(false) - .type(String.class) - .build()); - //@formatter:on + commonCommandLineArguments = new CommonCommandLineArguments(options); } /** @@ -110,7 +91,6 @@ public class ParticipantSimulatorCommandLineArguments { public String parse(final String[] args) throws ControlLoopException { // Clear all our arguments setConfigurationFilePath(null); - CommandLine commandLine = null; try { commandLine = new DefaultParser().parse(options, args); @@ -128,11 +108,11 @@ public class ParticipantSimulatorCommandLineArguments { } if (commandLine.hasOption('h')) { - return help(Main.class.getName()); + return commonCommandLineArguments.help(Main.class.getName(), options); } if (commandLine.hasOption('v')) { - return version(); + return commonCommandLineArguments.version(); } if (commandLine.hasOption('c')) { @@ -148,33 +128,7 @@ public class ParticipantSimulatorCommandLineArguments { * @throws ControlLoopException on command argument validation errors */ public void validate() throws ControlLoopException { - validateReadableFile("participant configuration", configurationFilePath); - } - - /** - * Print version information for participant. - * - * @return the version string - */ - public String version() { - return ResourceUtils.getResourceAsString("version.txt"); - } - - /** - * Print help information for participant. - * - * @param mainClassName the main class name - * @return the help string - */ - public String help(final String mainClassName) { - final HelpFormatter helpFormatter = new HelpFormatter(); - final StringWriter stringWriter = new StringWriter(); - final PrintWriter printWriter = new PrintWriter(stringWriter); - - helpFormatter.printHelp(printWriter, HELP_LINE_LENGTH, mainClassName + " [options...]", "options", options, 0, - 0, ""); - - return stringWriter.toString(); + commonCommandLineArguments.validate(configurationFilePath); } /** @@ -194,39 +148,4 @@ public class ParticipantSimulatorCommandLineArguments { public boolean checkSetConfigurationFilePath() { return !StringUtils.isEmpty(configurationFilePath); } - - /** - * Validate readable file. - * - * @param fileTag the file tag - * @param fileName the file name - * @throws ControlLoopException on the file name passed as a parameter - */ - private void validateReadableFile(final String fileTag, final String fileName) throws ControlLoopException { - if (StringUtils.isEmpty(fileName)) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + " file was not specified as an argument"); - } - - // The file name refers to a resource on the local file system - final URL fileUrl = ResourceUtils.getUrl4Resource(fileName); - if (fileUrl == null) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); - } - - final File theFile = new File(fileUrl.getPath()); - if (!theFile.exists()) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); - } - if (!theFile.isFile()) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is not a normal file"); - } - if (!theFile.canRead()) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is ureadable"); - } - } } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java index e6e2609da..df7f2a611 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationHandler.java @@ -66,26 +66,6 @@ public class SimulationHandler extends ControlLoopHandler { } @Override - public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override - public void startAndRegisterPublishers(List<TopicSink> topicSinks) { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterPublishers() { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override public void startProviders() { simulationProvider = new SimulationProvider(participantParameters); } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java index fc0a31fcb..1fcbba3af 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java @@ -23,6 +23,8 @@ package org.onap.policy.clamp.controlloop.participant.simulator.simulation; import java.io.Closeable; import java.io.IOException; import java.util.List; +import java.util.Map; +import java.util.UUID; import lombok.Getter; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; @@ -71,22 +73,6 @@ public class SimulationProvider implements Closeable { } /** - * Update the given control loop in the simulator. - * - * @param controlLoop the control loop to update - * @return response simple response returned - * @throws ControlLoopException on errors updating the control loop - */ - public TypedSimpleResponse<ControlLoop> updateControlLoop(ControlLoop controlLoop) - throws ControlLoopException { - TypedSimpleResponse<ControlLoop> response = new TypedSimpleResponse<>(); - ControlLoop updatedControlLoop = intermediaryApi.updateControlLoopState( - controlLoop.getDefinition(), controlLoop.getOrderedState()); - response.setResponse(updatedControlLoop); - return response; - } - - /** * Get the simulated control loop elements. * * @param name the controlLoopElement, null to get all @@ -94,7 +80,8 @@ public class SimulationProvider implements Closeable { * @return the control loop elements * @throws ControlLoopException on errors getting the control loop elements */ - public List<ControlLoopElement> getControlLoopElements(String name, String version) throws ControlLoopException { + public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) + throws ControlLoopException { return intermediaryApi.getControlLoopElements(name, version); } @@ -109,7 +96,7 @@ public class SimulationProvider implements Closeable { throws ControlLoopException { TypedSimpleResponse<ControlLoopElement> response = new TypedSimpleResponse<>(); response.setResponse(intermediaryApi.updateControlLoopElementState( - element.getId(), element.getOrderedState())); + element.getId(), element.getOrderedState(), element.getState())); return response; } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java index f3c146352..1869047c9 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/rest/SimulationElementController.java @@ -29,6 +29,7 @@ import io.swagger.annotations.Extension; import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.ResponseHeader; import java.util.List; +import java.util.Map; import java.util.UUID; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; @@ -104,7 +105,7 @@ public class SimulationElementController extends RestController { @ApiParam(value = "Control loop element version", required = true) @PathParam("version") String version) { try { - List<ControlLoopElement> response = getSimulationProvider().getControlLoopElements(name, version); + Map<UUID, ControlLoopElement> response = getSimulationProvider().getControlLoopElements(name, version); return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.OK)), requestId).entity(response) .build(); diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json index 80f035cb2..3eca87678 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/CDSParticipantConfig.json @@ -3,6 +3,10 @@ "participantStatusParameters":{ "timeIntervalMs": 10000, "description":"Participant Status", + "participantType":{ + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version":"2.2.1" + }, "participantId":{ "name": "CDSParticipant0", "version":"1.0.0" diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json index 5c3d05d6f..e80570f93 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/DCAEParticipantConfig.json @@ -3,6 +3,10 @@ "participantStatusParameters":{ "timeIntervalMs": 10000, "description":"Participant Status", + "participantType":{ + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version":"2.3.4" + }, "participantId":{ "name": "DCAEParticipant0", "version":"1.0.0" diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json index 57c578451..8c8fa33cb 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/main/resources/config/PolicyParticipantConfig.json @@ -3,6 +3,10 @@ "participantStatusParameters":{ "timeIntervalMs":10000, "description":"Participant Status", + "participantType":{ + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version":"2.3.1" + }, "participantId":{ "name": "PolicyParticipant0", "version":"1.0.0" diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java index 2f47641a9..8027d6f08 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/parameters/TestParticipantSimulatorParameters.java @@ -23,10 +23,11 @@ package org.onap.policy.clamp.controlloop.participant.simulator.main.parameters; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import java.util.Map; import org.junit.Test; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; /** * Class to perform unit test of {@link ParticipantParameterGroup}. @@ -54,7 +55,7 @@ public class TestParticipantSimulatorParameters { final ParticipantSimulatorParameters participantParameters = commonTestData .toObject(commonTestData.getParticipantParameterGroupMap(null), ParticipantSimulatorParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); + final ValidationResult validationResult = participantParameters.validate(); assertFalse(validationResult.isValid()); assertEquals(null, participantParameters.getName()); assertThat(validationResult.getResult()).contains("is null"); @@ -65,11 +66,11 @@ public class TestParticipantSimulatorParameters { final ParticipantSimulatorParameters participantParameters = commonTestData .toObject(commonTestData.getParticipantParameterGroupMap(""), ParticipantSimulatorParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); + final ValidationResult validationResult = participantParameters.validate(); assertFalse(validationResult.isValid()); assertEquals("", participantParameters.getName()); assertThat(validationResult.getResult()).contains( - "field \"name\" type \"java.lang.String\" value \"\" INVALID, " + "must be a non-blank string"); + "item \"name\" value \"\" INVALID, " + "is blank"); } @Test @@ -89,12 +90,8 @@ public class TestParticipantSimulatorParameters { map.replace("intermediaryParameters", commonTestData.getIntermediaryParametersMap(true)); final ParticipantSimulatorParameters participantParameters = commonTestData.toObject(map, ParticipantSimulatorParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); - assertFalse(validationResult.isValid()); - assertThat(validationResult.getResult()).contains( - "\"org.onap.policy.clamp.controlloop.participant.simulator.main.parameters." - + "ParticipantSimulatorParameters\"" - + " INVALID, parameter group has status INVALID"); + final ValidationResult validationResult = participantParameters.validate(); + assertNull(validationResult.getResult()); } @Test @@ -107,10 +104,7 @@ public class TestParticipantSimulatorParameters { final ParticipantSimulatorParameters participantParameters = commonTestData.toObject(map, ParticipantSimulatorParameters.class); - final GroupValidationResult validationResult = participantParameters.validate(); - assertFalse(validationResult.isValid()); - assertThat(validationResult.getResult()) - .contains("\"org.onap.policy.common.endpoints.parameters.TopicParameterGroup\" INVALID, " - + "parameter group has status INVALID"); + final ValidationResult validationResult = participantParameters.validate(); + assertNull(validationResult.getResult()); } } diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java index 3ee39d57e..9c20ffe22 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java @@ -26,6 +26,7 @@ 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; @@ -88,7 +89,7 @@ public class TestListenerUtils { */ public static ControlLoop createControlLoop() { ControlLoop controlLoop = new ControlLoop(); - List<ControlLoopElement> elements = new ArrayList<>(); + Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>(); ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); Map<String, ToscaNodeTemplate> nodeTemplatesMap = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); @@ -100,12 +101,13 @@ public class TestListenerUtils { clElementParticipantId.setName(toscaInputEntry.getKey()); clElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion()); clElement.setParticipantId(clElementParticipantId); + clElement.setParticipantType(clElementParticipantId); clElement.setDefinition(clElementParticipantId); clElement.setState(ControlLoopState.UNINITIALISED); clElement.setDescription(toscaInputEntry.getValue().getDescription()); clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - elements.add(clElement); + elements.put(clElement.getId(), clElement); } controlLoop.setElements(elements); controlLoop.setName("PMSHInstance0"); @@ -166,14 +168,15 @@ public class TestListenerUtils { */ public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() { final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate(); - ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0."); + ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier("PMSHInstance0", "1.0.0"); ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_CDS_Blueprint", "1.0.0"); clUpdateMsg.setControlLoopId(controlLoopId); clUpdateMsg.setParticipantId(participantId); + clUpdateMsg.setParticipantType(participantId); ControlLoop controlLoop = new ControlLoop(); - List<ControlLoopElement> elements = new ArrayList<>(); + Map<UUID, ControlLoopElement> elements = new LinkedHashMap<>(); ToscaServiceTemplate toscaServiceTemplate = testControlLoopRead(); Map<String, ToscaNodeTemplate> nodeTemplatesMap = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); @@ -185,12 +188,13 @@ public class TestListenerUtils { clElementParticipantId.setName(toscaInputEntry.getKey()); clElementParticipantId.setVersion(toscaInputEntry.getValue().getVersion()); clElement.setParticipantId(clElementParticipantId); + clElement.setParticipantType(clElementParticipantId); clElement.setDefinition(clElementParticipantId); clElement.setState(ControlLoopState.UNINITIALISED); clElement.setDescription(toscaInputEntry.getValue().getDescription()); clElement.setOrderedState(ControlLoopOrderedState.UNINITIALISED); - elements.add(clElement); + elements.put(clElement.getId(), clElement); } controlLoop.setElements(elements); controlLoop.setName("PMSHInstance0"); diff --git a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java index 1b2b87cfb..472b4beee 100644 --- a/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java +++ b/tosca-controlloop/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestSimulationRestController.java @@ -24,7 +24,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import java.util.Collection; import java.util.List; +import java.util.Map; +import java.util.UUID; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.GenericType; @@ -46,6 +49,7 @@ import org.onap.policy.clamp.controlloop.participant.simulator.simulation.Simula import org.onap.policy.clamp.controlloop.participant.simulator.simulation.SimulationProvider; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; /** * Class to perform unit test of {@link TestSimulationRestController}. @@ -124,11 +128,13 @@ public class TestSimulationRestController extends CommonParticipantRestServer { Response rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); - List<ControlLoopElement> returnValue = rawresp.readEntity(new GenericType<List<ControlLoopElement>>() {}); + Map<UUID, ControlLoopElement> returnValue = + rawresp.readEntity(new GenericType<Map<UUID, ControlLoopElement>>() {}); assertNotNull(returnValue); // Verify the result of GET controlloop elements with what is stored - assertThat(returnValue).hasSize(4); - assertEquals("org.onap.PM_Subscription_Handler", returnValue.get(0).getDefinition().getName()); + assertThat(returnValue).hasSize(1); + returnValue.values().forEach(element -> assertEquals("org.onap.PM_CDS_Blueprint", + element.getDefinition().getName())); } @Test @@ -156,24 +162,25 @@ public class TestSimulationRestController extends CommonParticipantRestServer { public void testUpdateControlLoopElement() throws Exception { ControlLoop controlLoop = TestListenerUtils.createControlLoop(); SimulationProvider provider = SimulationHandler.getInstance().getSimulationProvider(); - List<ControlLoopElement> controlLoopElements = provider.getControlLoopElements( + Map<UUID, ControlLoopElement> controlLoopElements = provider.getControlLoopElements( controlLoop.getDefinition().getName(), controlLoop.getDefinition().getVersion()); - // Check the initial state on the ControlLoopElement, which is UNINITIALISED - assertEquals(ControlLoopOrderedState.UNINITIALISED, controlLoopElements.get(0).getOrderedState()); - - // Change the state of the ControlLoopElement to PASSIVE from UNINITIALISED - controlLoopElements.get(0).setOrderedState(ControlLoopOrderedState.PASSIVE); - Entity<ControlLoopElement> entClElement = Entity.entity(controlLoopElements.get(0), MediaType.APPLICATION_JSON); - - // PUT REST call for updating ControlLoopElement - Invocation.Builder invocationBuilder = sendRequest(ELEMENTS_ENDPOINT); - Response rawresp = invocationBuilder.put(entClElement); - TypedSimpleResponse<ControlLoopElement> resp = rawresp.readEntity(TypedSimpleResponse.class); - assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); - assertNotNull(resp.getResponse()); - // Verify the response and state returned by PUT REST call for updating participants - assertThat(resp.toString()).contains("definition={name=org.onap.PM_Subscription_Handler, version=0.0.0}"); - assertThat(resp.toString()).contains("orderedState=PASSIVE"); + for (Map.Entry<UUID, ControlLoopElement> clElement : controlLoopElements.entrySet()) { + // Check the initial state on the ControlLoopElement, which is UNINITIALISED + assertEquals(ControlLoopOrderedState.UNINITIALISED, clElement.getValue().getOrderedState()); + // Change the state of the ControlLoopElement to PASSIVE from UNINITIALISED + clElement.getValue().setOrderedState(ControlLoopOrderedState.PASSIVE); + Entity<ControlLoopElement> entClElement = Entity.entity(clElement.getValue(), MediaType.APPLICATION_JSON); + + // PUT REST call for updating ControlLoopElement + Invocation.Builder invocationBuilder = sendRequest(ELEMENTS_ENDPOINT); + Response rawresp = invocationBuilder.put(entClElement); + TypedSimpleResponse<ControlLoopElement> resp = rawresp.readEntity(TypedSimpleResponse.class); + assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); + assertNotNull(resp.getResponse()); + // Verify the response and state returned by PUT REST call for updating participants + assertThat(resp.toString()).contains("definition={name=org.onap.PM_CDS_Blueprint, version=1.0.0}"); + assertThat(resp.toString()).contains("orderedState=PASSIVE"); + } } } diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java index ff24d6a10..9e5d2c663 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ControlLoopElementListener.java @@ -24,7 +24,6 @@ import java.util.UUID; 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.ControlLoops; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; @@ -38,17 +37,26 @@ public interface ControlLoopElementListener { * @param controlLoopElementId the ID of the control loop element * @param currentState the current state of the control loop element * @param newState the state to which the control loop element is changing to + * @throws PfModelException in case of a model exception */ public void controlLoopElementStateChange(UUID controlLoopElementId, ControlLoopState currentState, - ControlLoopOrderedState newState); + ControlLoopOrderedState newState) throws PfModelException; /** * Handle an update on a control loop element. * * @param element the information on the control loop element * @param controlLoopDefinition toscaServiceTemplate - * @throws PfModelException in case of a model exception + * @throws PfModelException from Policy framework */ public void controlLoopElementUpdate(ControlLoopElement element, ToscaServiceTemplate controlLoopDefinition) throws PfModelException; + + /** + * Handle controlLoopElement statistics. + * + * @param controlLoopElementId controlLoopElement id + * @throws PfModelException in case of a model exception + */ + public void handleStatistics(UUID controlLoopElementId) throws PfModelException; } diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java index defb1cfa1..d31ae1082 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/ParticipantIntermediaryApi.java @@ -21,11 +21,13 @@ package org.onap.policy.clamp.controlloop.participant.intermediary.api; import java.util.List; +import java.util.Map; import java.util.UUID; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics; 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.ControlLoops; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; @@ -98,39 +100,40 @@ public interface ParticipantIntermediaryApi { * @param version the control loop element version, null for all * @return the control loop elements */ - List<ControlLoopElement> getControlLoopElements(String name, String version); + Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version); /** - * Update the state of a control loop. + * Get control loop element from the intermediary API. * - * @param definition the ID of the control loop to update the state on - * @param state the state of the control loop - * @return ControlLoop updated control loop + * @param id control loop element ID + * @return the control loop element */ - ControlLoop updateControlLoopState(ToscaConceptIdentifier definition, ControlLoopOrderedState state); + ControlLoopElement getControlLoopElement(UUID id); /** * Update the state of a control loop element. * * @param id the ID of the control loop element to update the state on - * @param state the state of the control loop element + * @param currentState the state of the control loop element + * @param newState the state of the control loop element * @return ControlLoopElement updated control loop element */ - ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState state); + ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState currentState, + ControlLoopState newState); /** * Update the control loop element statistics. * + * @param id the ID of the control loop element to update the state on * @param elementStatistics the updated statistics */ - void updateControlLoopElementStatistics(ClElementStatistics elementStatistics); + void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics); /** - * Returns participantHandler, This will not be used in real world, but for junits, + * Return participantHandler, This will not be used in real world, but for junits, * if participantHandler is not returned, there is no way to test state change messages * without dmaap simulator. * - * @return ParticipantHandler returns a participantHandler */ ParticipantHandler getParticipantHandler(); } diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java index 0702868dd..839088d72 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java @@ -20,13 +20,15 @@ package org.onap.policy.clamp.controlloop.participant.intermediary.api.impl; -import java.util.Collections; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.UUID; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics; 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.ControlLoops; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; @@ -85,34 +87,43 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp } @Override - public List<ControlLoopElement> getControlLoopElements(String name, String version) { + public Map<UUID, ControlLoopElement> getControlLoopElements(String name, String version) { List<ControlLoop> controlLoops = activator.getParticipantHandler() .getControlLoopHandler().getControlLoops().getControlLoopList(); for (ControlLoop controlLoop : controlLoops) { - if (controlLoop.getDefinition().getName().equals(name)) { + if (name.equals(controlLoop.getDefinition().getName())) { return controlLoop.getElements(); } } - return Collections.emptyList(); + return new LinkedHashMap<>(); } @Override - public ControlLoop updateControlLoopState(ToscaConceptIdentifier definition, ControlLoopOrderedState state) { - return activator.getParticipantHandler().getControlLoopHandler() - .updateControlLoopState(definition, state); + public ControlLoopElement getControlLoopElement(UUID id) { + List<ControlLoop> controlLoops = activator.getParticipantHandler() + .getControlLoopHandler().getControlLoops().getControlLoopList(); + + for (ControlLoop controlLoop : controlLoops) { + ControlLoopElement clElement = controlLoop.getElements().get(id); + if (clElement != null) { + return clElement; + } + } + return null; } @Override - public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState state) { + public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState currentState, + ControlLoopState newState) { return activator.getParticipantHandler().getControlLoopHandler() - .updateControlLoopElementState(id, state); + .updateControlLoopElementState(id, currentState, newState); } @Override - public void updateControlLoopElementStatistics(ClElementStatistics elementStatistics) { + public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) { activator.getParticipantHandler().getControlLoopHandler() - .updateControlLoopElementStatistics(elementStatistics); + .updateControlLoopElementStatistics(id, elementStatistics); } @Override diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java new file mode 100644 index 000000000..50b8b9cdc --- /dev/null +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopStateChangeListener.java @@ -0,0 +1,68 @@ +/*- + * ============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.intermediary.comm; + +import java.io.Closeable; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; +import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; +import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.endpoints.listeners.ScoListener; +import org.onap.policy.common.utils.coder.StandardCoderObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Listener for Participant State Change messages sent by CLAMP. + */ +public class ControlLoopStateChangeListener extends ScoListener<ParticipantControlLoopStateChange> + implements Closeable { + private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopStateChangeListener.class); + + private final ParticipantHandler participantHandler; + + /** + * Constructs the object. + * + * @param participantHandler the handler for managing the state of the participant + */ + public ControlLoopStateChangeListener(final ParticipantHandler participantHandler) { + super(ParticipantControlLoopStateChange.class); + this.participantHandler = participantHandler; + } + + @Override + public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, + final ParticipantControlLoopStateChange controlLoopStateChangeMsg) { + LOGGER.debug("Control Loop State Change received from CLAMP - {}", controlLoopStateChangeMsg); + + if (participantHandler.canHandle(controlLoopStateChangeMsg)) { + LOGGER.debug("Message for this participant"); + participantHandler.getControlLoopHandler().handleControlLoopStateChange(controlLoopStateChangeMsg); + } else { + LOGGER.debug("Message not for this participant"); + } + } + + @Override + public void close() { + // No explicit action on this class + } +} diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java index 2ba98891f..ab2437c1c 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ControlLoopUpdateListener.java @@ -51,7 +51,13 @@ public class ControlLoopUpdateListener extends ScoListener<ParticipantControlLoo public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, final ParticipantControlLoopUpdate participantControlLoopUpdateMsg) { LOGGER.debug("Control Loop update received from CLAMP - {}", participantControlLoopUpdateMsg); - participantHandler.getControlLoopHandler().handleControlLoopUpdate(participantControlLoopUpdateMsg); + + if (participantHandler.canHandle(participantControlLoopUpdateMsg)) { + LOGGER.debug("Message for this participant"); + participantHandler.getControlLoopHandler().handleControlLoopUpdate(participantControlLoopUpdateMsg); + } else { + LOGGER.debug("Message not for this participant"); + } } @Override diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java index 20490f81d..3128f1eaa 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/MessageSender.java @@ -21,14 +21,22 @@ package org.onap.policy.clamp.controlloop.participant.intermediary.comm; import java.io.Closeable; +import java.time.Instant; import java.util.TimerTask; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +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.ControlLoops; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus; +import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; +import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusPublisher; import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; +import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,7 +94,7 @@ public class MessageSender extends TimerTask implements Closeable { } /** - * Send a response message for this participant. + * Dispatch a response message for this participant. * * @param controlLoopId the control loop to which this message is a response * @param response the details to include in the response message @@ -95,19 +103,55 @@ public class MessageSender extends TimerTask implements Closeable { ParticipantStatus status = new ParticipantStatus(); // Participant related fields + status.setParticipantType(participantHandler.getParticipantType()); status.setParticipantId(participantHandler.getParticipantId()); status.setState(participantHandler.getState()); status.setHealthStatus(participantHandler.getHealthStatus()); // Control loop related fields + ControlLoops controlLoops = participantHandler.getControlLoopHandler().getControlLoops(); status.setControlLoopId(controlLoopId); - status.setControlLoops(participantHandler.getControlLoopHandler().getControlLoops()); + status.setControlLoops(controlLoops); status.setResponse(response); + ParticipantStatistics participantStatistics = new ParticipantStatistics(); + participantStatistics.setTimeStamp(Instant.now()); + participantStatistics.setParticipantId(participantHandler.getParticipantId()); + participantStatistics.setHealthStatus(participantHandler.getHealthStatus()); + participantStatistics.setState(participantHandler.getState()); + status.setParticipantStatistics(participantStatistics); + + for (ControlLoopElementListener clElementListener : + participantHandler.getControlLoopHandler().getListeners()) { + updateClElementStatistics(controlLoops, clElementListener); + } + + status.setControlLoops(controlLoops); + publisher.send(status); } /** + * Update ControlLoopElement statistics. The control loop elements listening will be + * notified to retrieve statistics from respective controlloop elements, and controlloopelements + * data on the handler will be updated. + * + * @param controlLoops the control loops + * @param clElementListener control loop element listener + */ + public void updateClElementStatistics(ControlLoops controlLoops, ControlLoopElementListener clElementListener) { + for (ControlLoop controlLoop : controlLoops.getControlLoopList()) { + for (ControlLoopElement element : controlLoop.getElements().values()) { + try { + clElementListener.handleStatistics(element.getId()); + } catch (PfModelException e) { + LOGGER.debug("Getting statistics for Control loop element failed"); + } + } + } + } + + /** * Makes a new timer pool. * * @return a new timer pool diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java new file mode 100644 index 000000000..e0e6be329 --- /dev/null +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantHealthCheckListener.java @@ -0,0 +1,69 @@ +/*- + * ============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.intermediary.comm; + +import java.io.Closeable; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck; +import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; +import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.endpoints.listeners.ScoListener; +import org.onap.policy.common.utils.coder.StandardCoderObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Listener for Participant health status messages sent by CLAMP. + */ +public class ParticipantHealthCheckListener extends ScoListener<ParticipantHealthCheck> implements Closeable { + private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHealthCheckListener.class); + + private final ParticipantHandler participantHandler; + + /** + * Constructs the object. + * + * @param participantHandler the handler for managing the state and health of the participant + */ + public ParticipantHealthCheckListener(final ParticipantHandler participantHandler) { + super(ParticipantHealthCheck.class); + this.participantHandler = participantHandler; + } + + @Override + public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, + final ParticipantHealthCheck participantHealthCheckMsg) { + LOGGER.debug("Participant Health Check message received from CLAMP - {}", participantHealthCheckMsg); + + + if (participantHandler.canHandle(participantHealthCheckMsg)) { + LOGGER.debug("Message for this participant"); + participantHandler.handleParticipantHealthCheck(participantHealthCheckMsg); + } else { + LOGGER.debug("Message not for this participant"); + } + + } + + @Override + public void close() { + // No explicit action on this class + } +} diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java new file mode 100644 index 000000000..c1a8b5b4a --- /dev/null +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStateChangeListener.java @@ -0,0 +1,68 @@ +/*- + * ============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.intermediary.comm; + +import java.io.Closeable; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; +import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; +import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.endpoints.listeners.ScoListener; +import org.onap.policy.common.utils.coder.StandardCoderObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Listener for Participant State Change messages sent by CLAMP. + * + */ +public class ParticipantStateChangeListener extends ScoListener<ParticipantStateChange> implements Closeable { + private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStateChangeListener.class); + + private final ParticipantHandler participantHandler; + + /** + * Constructs the object. + * + * @param participantHandler the handler for managing the state of the participant + */ + public ParticipantStateChangeListener(final ParticipantHandler participantHandler) { + super(ParticipantStateChange.class); + this.participantHandler = participantHandler; + } + + @Override + public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, + final ParticipantStateChange participantStateChangeMsg) { + LOGGER.debug("Participant State Change received from CLAMP - {}", participantStateChangeMsg); + + if (participantHandler.canHandle(participantStateChangeMsg)) { + LOGGER.debug("Message for this participant"); + participantHandler.handleParticipantStateChange(participantStateChangeMsg); + } else { + LOGGER.debug("Message not for this participant"); + } + } + + @Override + public void close() { + // No explicit action on this class + } +} diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java index e909327cd..bc53b4e9d 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/comm/ParticipantStatusPublisher.java @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; /** * This class is used to send Participant Status messages to clamp using TopicSinkClient. + * */ public class ParticipantStatusPublisher implements Closeable { private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStatusPublisher.class); diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java index 6f8bfffc3..cc2a66b58 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java @@ -52,27 +52,29 @@ import org.slf4j.LoggerFactory; public class ControlLoopHandler implements Closeable { private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopHandler.class); + private ToscaConceptIdentifier participantType = null; private ToscaConceptIdentifier participantId = null; - private MessageSender sender = null; + private MessageSender messageSender = null; private final Map<ToscaConceptIdentifier, ControlLoop> controlLoopMap = new LinkedHashMap<>(); + private final Map<UUID, ControlLoopElement> elementsOnThisParticipant = new LinkedHashMap<>(); @Getter private List<ControlLoopElementListener> listeners = new ArrayList<>(); - public ControlLoopHandler() { - } + public ControlLoopHandler() {} /** - * Constructor, set the participant ID and sender. + * Constructor, set the participant ID and messageSender. * * @param parameters the parameters of the participant - * @param sender the sender for sending responses to messages + * @param messageSender the messageSender for sending responses to messages */ - public ControlLoopHandler(ParticipantIntermediaryParameters parameters, MessageSender sender) { + public ControlLoopHandler(ParticipantIntermediaryParameters parameters, MessageSender messageSender) { + this.participantType = parameters.getParticipantType(); this.participantId = parameters.getParticipantId(); - this.sender = sender; + this.messageSender = messageSender; } @Override @@ -83,15 +85,17 @@ public class ControlLoopHandler implements Closeable { public void registerControlLoopElementListener(ControlLoopElementListener listener) { listeners.add(listener); } - + /** * Handle a control loop element state change message. * * @param id controlloop element id - * @param state the updated state + * @param orderedState the current state + * @param newState the ordered state * @return controlLoopElement the updated controlloop element */ - public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState state) { + public ControlLoopElement updateControlLoopElementState(UUID id, ControlLoopOrderedState orderedState, + ControlLoopState newState) { if (id == null) { return null; @@ -99,42 +103,32 @@ public class ControlLoopHandler implements Closeable { ControlLoopElement clElement = elementsOnThisParticipant.get(id); if (clElement != null) { - clElement.setOrderedState(state); - LOGGER.debug("Control loop element {} ordered state changed to {}", id, state); + clElement.setOrderedState(orderedState); + clElement.setState(newState); + LOGGER.debug("Control loop element {} state changed to {}", id, newState); ParticipantResponseDetails response = new ParticipantResponseDetails(); - sender.sendResponse(response); - return elementsOnThisParticipant.get(id); + response.setResponseStatus(ParticipantResponseStatus.SUCCESS); + response.setResponseMessage("ControlLoopElement state changed to {} " + newState); + messageSender.sendResponse(response); + return clElement; } return null; } - public void updateControlLoopElementStatistics(ClElementStatistics elementStatistics) { - // TODO Handle statistics coming from a participant implementation - } - /** - * Handle a control loop state change message. + * Handle a control loop element statistics. * - * @param definition controlloop id - * @param state the updated state - * @return controlLoop the updated controlloop + * @param id controlloop element id + * @param elementStatistics control loop element Statistics */ - public ControlLoop updateControlLoopState(ToscaConceptIdentifier definition, ControlLoopOrderedState state) { - if (definition == null) { - return null; - } - - ControlLoop controlLoop = controlLoopMap.get(definition); - if (controlLoop == null) { - LOGGER.debug("Control loop {} does not use this participant", definition.getName()); - return null; + public void updateControlLoopElementStatistics(UUID id, ClElementStatistics elementStatistics) { + ControlLoopElement clElement = elementsOnThisParticipant.get(id); + if (clElement != null) { + elementStatistics.setParticipantId(participantId); + elementStatistics.setId(id); + clElement.setClElementStatistics(elementStatistics); } - - ParticipantResponseDetails response = new ParticipantResponseDetails(); - handleState(controlLoop, response, state); - sender.sendResponse(response); - return controlLoop; } /** @@ -156,7 +150,7 @@ public class ControlLoopHandler implements Closeable { ParticipantResponseDetails response = new ParticipantResponseDetails(stateChangeMsg); handleState(controlLoop, response, stateChangeMsg.getOrderedState()); - sender.sendResponse(response); + messageSender.sendResponse(response); } /** @@ -164,19 +158,19 @@ public class ControlLoopHandler implements Closeable { * * @param controlLoop participant response * @param response participant response - * @param state controlloop ordered state + * @param orderedState controlloop ordered state */ private void handleState(final ControlLoop controlLoop, final ParticipantResponseDetails response, - ControlLoopOrderedState state) { - switch (state) { + ControlLoopOrderedState orderedState) { + switch (orderedState) { case UNINITIALISED: - handleUninitialisedState(controlLoop, response); + handleUninitialisedState(controlLoop, orderedState, response); break; case PASSIVE: - handlePassiveState(controlLoop, response); + handlePassiveState(controlLoop, orderedState, response); break; case RUNNING: - handleRunningState(controlLoop, response); + handleRunningState(controlLoop, orderedState, response); break; default: LOGGER.debug("StateChange message has no state, state is null {}", controlLoop.getDefinition()); @@ -190,7 +184,8 @@ public class ControlLoopHandler implements Closeable { * @param updateMsg the update message */ public void handleControlLoopUpdate(ParticipantControlLoopUpdate updateMsg) { - if (!updateMsg.appliesTo(participantId)) { + + if (!updateMsg.appliesTo(participantType, participantId)) { return; } @@ -205,22 +200,25 @@ public class ControlLoopHandler implements Closeable { response.setResponseMessage("Control loop " + updateMsg.getControlLoopId() + " already defined on participant " + participantId); - sender.sendResponse(response); + messageSender.sendResponse(response); return; } controlLoop = updateMsg.getControlLoop(); - controlLoop.getElements().removeIf(element -> participantId.equals(element.getParticipantId())); + controlLoop.getElements().values().removeIf(element -> !participantType.equals(element.getParticipantType())); controlLoopMap.put(updateMsg.getControlLoopId(), controlLoop); - for (ControlLoopElement element : updateMsg.getControlLoop().getElements()) { + for (ControlLoopElement element : updateMsg.getControlLoop().getElements().values()) { element.setState(element.getOrderedState().asState()); + element.setParticipantId(participantId); elementsOnThisParticipant.put(element.getId(), element); } for (ControlLoopElementListener clElementListener : listeners) { try { - clElementListener.controlLoopElementUpdate(null, updateMsg.getControlLoopDefinition()); + for (ControlLoopElement element : updateMsg.getControlLoop().getElements().values()) { + clElementListener.controlLoopElementUpdate(element, updateMsg.getControlLoopDefinition()); + } } catch (PfModelException e) { LOGGER.debug("Control loop element update failed {}", updateMsg.getControlLoopId()); } @@ -230,64 +228,88 @@ public class ControlLoopHandler implements Closeable { response.setResponseMessage( "Control loop " + updateMsg.getControlLoopId() + " defined on participant " + participantId); - sender.sendResponse(response); + messageSender.sendResponse(response); } /** * Method to handle when the new state from participant is UNINITIALISED state. * * @param controlLoop participant response + * @param orderedState orderedState * @param response participant response */ - private void handleUninitialisedState(final ControlLoop controlLoop, final ParticipantResponseDetails response) { - handleStateChange(controlLoop, ControlLoopState.UNINITIALISED, response); + private void handleUninitialisedState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState, + final ParticipantResponseDetails response) { + handleStateChange(controlLoop, orderedState, ControlLoopState.UNINITIALISED, response); controlLoopMap.remove(controlLoop.getKey().asIdentifier()); + + for (ControlLoopElementListener clElementListener : listeners) { + try { + for (ControlLoopElement element : controlLoop.getElements().values()) { + clElementListener.controlLoopElementStateChange(element.getId(), element.getState(), + orderedState); + } + } catch (PfModelException e) { + LOGGER.debug("Control loop element update failed {}", controlLoop.getDefinition()); + } + } } /** * Method to handle when the new state from participant is PASSIVE state. * * @param controlLoop participant response + * @param orderedState orderedState * @param response participant response */ - private void handlePassiveState(final ControlLoop controlLoop, final ParticipantResponseDetails response) { - handleStateChange(controlLoop, ControlLoopState.PASSIVE, response); + private void handlePassiveState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState, + final ParticipantResponseDetails response) { + handleStateChange(controlLoop, orderedState, ControlLoopState.PASSIVE, response); } /** * Method to handle when the new state from participant is RUNNING state. * * @param controlLoop participant response + * @param orderedState orderedState * @param response participant response */ - private void handleRunningState(final ControlLoop controlLoop, final ParticipantResponseDetails response) { - handleStateChange(controlLoop, ControlLoopState.RUNNING, response); + private void handleRunningState(final ControlLoop controlLoop, final ControlLoopOrderedState orderedState, + final ParticipantResponseDetails response) { + handleStateChange(controlLoop, orderedState, ControlLoopState.RUNNING, response); } - + /** * Method to update the state of control loop elements. * * @param controlLoop participant status in memory + * @param orderedState orderedState * @param state new state of the control loop elements */ - private void handleStateChange(ControlLoop controlLoop, ControlLoopState newState, - ParticipantResponseDetails response) { + private void handleStateChange(ControlLoop controlLoop, final ControlLoopOrderedState orderedState, + ControlLoopState newState, ParticipantResponseDetails response) { - if (newState.equals(controlLoop.getState())) { + if (orderedState.equals(controlLoop.getOrderedState())) { response.setResponseStatus(ParticipantResponseStatus.SUCCESS); - response.setResponseMessage("Control loop is already in state " + newState); + response.setResponseMessage("Control loop is already in state " + orderedState); return; } - if (!CollectionUtils.isEmpty(controlLoop.getElements())) { - controlLoop.getElements().forEach(element -> element.setState(newState)); + if (!CollectionUtils.isEmpty(controlLoop.getElements().values())) { + controlLoop.getElements().values().forEach(element -> { + element.setState(newState); + element.setOrderedState(orderedState); + } + ); } response.setResponseStatus(ParticipantResponseStatus.SUCCESS); - response.setResponseMessage("ControlLoop state changed from " + controlLoop.getState() + " to " + newState); - controlLoop.setState(newState); + response.setResponseMessage("ControlLoop state changed from " + controlLoop.getOrderedState() + + " to " + orderedState); + controlLoop.setOrderedState(orderedState); } + /** * Get control loops as a {@link ConrolLoops} class. * diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java index dd0cf30a8..be2fa1a30 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/IntermediaryActivator.java @@ -26,13 +26,22 @@ import javax.ws.rs.core.Response.Status; import lombok.Getter; import lombok.experimental.Delegate; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; +import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener; +import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantHealthCheckListener; +import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStateChangeListener; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ParticipantStatusPublisher; import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; +import org.onap.policy.common.endpoints.listeners.ScoListener; import org.onap.policy.common.utils.services.ServiceManagerContainer; /** @@ -80,6 +89,9 @@ public class IntermediaryActivator extends ServiceManagerContainer { // @formatter:off final AtomicReference<ParticipantStatusPublisher> statusPublisher = new AtomicReference<>(); + final AtomicReference<ParticipantStateChangeListener> participantStateChangeListener = new AtomicReference<>(); + final AtomicReference<ParticipantHealthCheckListener> participantHealthCheckListener = new AtomicReference<>(); + final AtomicReference<ControlLoopStateChangeListener> controlLoopStateChangeListener = new AtomicReference<>(); final AtomicReference<ControlLoopUpdateListener> controlLoopUpdateListener = new AtomicReference<>(); addAction("Topic endpoint management", @@ -94,6 +106,18 @@ public class IntermediaryActivator extends ServiceManagerContainer { () -> participantHandler.set(new ParticipantHandler(parameters, statusPublisher.get())), () -> participantHandler.get().close()); + addAction("Participant State Change Listener", + () -> participantStateChangeListener.set(new ParticipantStateChangeListener(participantHandler.get())), + () -> participantStateChangeListener.get().close()); + + addAction("Participant Health Check Listener", + () -> participantHealthCheckListener.set(new ParticipantHealthCheckListener(participantHandler.get())), + () -> participantHealthCheckListener.get().close()); + + addAction("Control Loop State Change Listener", + () -> controlLoopStateChangeListener.set(new ControlLoopStateChangeListener(participantHandler.get())), + () -> controlLoopStateChangeListener.get().close()); + addAction("Control Loop Update Listener", () -> controlLoopUpdateListener.set(new ControlLoopUpdateListener(participantHandler.get())), () -> controlLoopUpdateListener.get().close()); @@ -106,6 +130,18 @@ public class IntermediaryActivator extends ServiceManagerContainer { * Registers the dispatcher with the topic source(s). */ private void registerMsgDispatcher() { + msgDispatcher.register(ParticipantMessageType.PARTICIPANT_STATE_CHANGE.name(), + (ScoListener<ParticipantStateChange>) new ParticipantStateChangeListener( + participantHandler.get())); + msgDispatcher.register(ParticipantMessageType.PARTICIPANT_HEALTH_CHECK.name(), + (ScoListener<ParticipantHealthCheck>) new ParticipantHealthCheckListener( + participantHandler.get())); + msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_STATE_CHANGE.name(), + (ScoListener<ParticipantControlLoopStateChange>) new ControlLoopStateChangeListener( + participantHandler.get())); + msgDispatcher.register(ParticipantMessageType.PARTICIPANT_CONTROL_LOOP_UPDATE.name(), + (ScoListener<ParticipantControlLoopUpdate>) new ControlLoopUpdateListener( + participantHandler.get())); for (final TopicSource source : topicSources) { source.register(msgDispatcher); } diff --git a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java index 1150471ae..980ab6ec1 100644 --- a/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java +++ b/tosca-controlloop/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java @@ -27,6 +27,9 @@ import lombok.Setter; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantHealthCheck; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessage; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseDetails; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantResponseStatus; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; @@ -44,9 +47,11 @@ import org.slf4j.LoggerFactory; public class ParticipantHandler implements Closeable { private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHandler.class); + private final ToscaConceptIdentifier participantType; private final ToscaConceptIdentifier participantId; private final MessageSender sender; private final ControlLoopHandler controlLoopHandler; + private final ParticipantStatistics participantStatistics; @Setter private ParticipantState state = ParticipantState.UNKNOWN; @@ -61,9 +66,11 @@ public class ParticipantHandler implements Closeable { * @param publisher the publisher for sending responses to messages */ public ParticipantHandler(ParticipantIntermediaryParameters parameters, ParticipantStatusPublisher publisher) { + this.participantType = parameters.getParticipantType(); this.participantId = parameters.getParticipantId(); this.sender = new MessageSender(this, publisher, parameters.getReportingTimeInterval()); this.controlLoopHandler = new ControlLoopHandler(parameters, sender); + this.participantStatistics = new ParticipantStatistics(); } @Override @@ -79,7 +86,7 @@ public class ParticipantHandler implements Closeable { */ public void handleParticipantStateChange(final ParticipantStateChange stateChangeMsg) { - if (!stateChangeMsg.appliesTo(participantId)) { + if (!stateChangeMsg.appliesTo(participantType, participantId)) { return; } @@ -112,6 +119,20 @@ public class ParticipantHandler implements Closeable { sender.sendResponse(response); } + + /** + * Method which handles a participant health check event from clamp. + * + * @param healthCheckMsg participant health check message + */ + public void handleParticipantHealthCheck(final ParticipantHealthCheck healthCheckMsg) { + ParticipantResponseDetails response = new ParticipantResponseDetails(healthCheckMsg); + response.setResponseStatus(ParticipantResponseStatus.SUCCESS); + response.setResponseMessage(healthStatus.toString()); + + sender.sendResponse(response); + } + /** * Method to handle when the new state from participant is active. * @@ -201,4 +222,14 @@ public class ParticipantHandler implements Closeable { } return null; } + + /** + * Check if a participant message applies to this participant handler. + * + * @param partipantMsg the message to check + * @return true if it applies, false otherwise + */ + public boolean canHandle(ParticipantMessage partipantMsg) { + return partipantMsg.appliesTo(participantType, participantId); + } } diff --git a/tosca-controlloop/participant/pom.xml b/tosca-controlloop/participant/pom.xml index 740fa1647..9942b536a 100644 --- a/tosca-controlloop/participant/pom.xml +++ b/tosca-controlloop/participant/pom.xml @@ -32,7 +32,7 @@ <artifactId>participant</artifactId> <name>${project.artifactId}</name> <packaging>pom</packaging> - <description>participants that communicate with the runtime servier to handle control loops</description> + <description>participants that communicate with the runtime server to handle control loops</description> <modules> <module>participant-intermediary</module> diff --git a/tosca-controlloop/runtime/pom.xml b/tosca-controlloop/runtime/pom.xml index e37748066..8433438ff 100644 --- a/tosca-controlloop/runtime/pom.xml +++ b/tosca-controlloop/runtime/pom.xml @@ -32,10 +32,9 @@ <artifactId>controlloop-runtime</artifactId> <name>${project.artifactId}</name> - <description>Runtime server of the TOSCA Control Loop system</description> <dependencies> - <dependency> + <dependency> <groupId>org.onap.policy.clamp.controlloop</groupId> <artifactId>controlloop-common</artifactId> <version>${project.version}</version> @@ -45,10 +44,5 @@ <artifactId>controlloop-models</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>test</scope> - </dependency> </dependencies> -</project> +</project>
\ No newline at end of file diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningHandler.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningHandler.java index ab917b74e..88e8b1df9 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningHandler.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningHandler.java @@ -65,26 +65,6 @@ public final class CommissioningHandler extends ControlLoopHandler { } @Override - public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override - public void startAndRegisterPublishers(List<TopicSink> topicSinks) { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterPublishers() { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override public void startProviders() { provider = new CommissioningProvider(getDatabaseProviderParameters()); } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java index 41d85726e..50f6787b9 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProvider.java @@ -40,6 +40,7 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplates; import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter; /** @@ -190,4 +191,18 @@ public class CommissioningProvider implements Closeable { return controlLoopElementList; } + + /** + * Get the requested control loop definitions. + * + * @param name the name of the definition to get, null for all definitions + * @param version the version of the definition to get, null for all definitions + * @return the control loop definitions + * @throws PfModelException on errors getting control loop definitions + */ + public ToscaServiceTemplate getToscaServiceTemplate(String name, String version) throws PfModelException { + ToscaServiceTemplates serviceTemplates = new ToscaServiceTemplates(); + serviceTemplates.setServiceTemplates(modelsProvider.getServiceTemplateList(name, version)); + return serviceTemplates.getServiceTemplates().get(0); + } } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningController.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningController.java index cd6c08e30..18e1f7787 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningController.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningController.java @@ -44,6 +44,7 @@ import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProv import org.onap.policy.clamp.controlloop.runtime.main.rest.RestController; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.errors.concepts.ErrorResponse; import org.onap.policy.models.errors.concepts.ErrorResponseInfo; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; @@ -131,7 +132,9 @@ public class CommissioningController extends RestController { } catch (PfModelRuntimeException | PfModelException e) { LOGGER.warn("Commissioning of the control loops failed", e); - return createCommissioningErrorResponse(e, requestId); + CommissioningResponse resp = new CommissioningResponse(); + resp.setErrorDetails(e.getErrorResponse().getErrorMessage()); + return returnResponse(e.getErrorResponse().getResponseCode(), requestId, resp); } } @@ -201,7 +204,9 @@ public class CommissioningController extends RestController { } catch (PfModelRuntimeException | PfModelException e) { LOGGER.warn("Decommisssioning of control loop failed", e); - return createCommissioningErrorResponse(e, requestId); + CommissioningResponse resp = new CommissioningResponse(); + resp.setErrorDetails(e.getErrorResponse().getErrorMessage()); + return returnResponse(e.getErrorResponse().getResponseCode(), requestId, resp); } } @@ -255,9 +260,9 @@ public class CommissioningController extends RestController { // @formatter:on public Response query(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId, @ApiParam(value = "Control Loop definition name", required = true) - @QueryParam("name") String name, + @QueryParam("name") String name, @ApiParam(value = "Control Loop definition version", required = true) - @QueryParam("version") String version) { + @QueryParam("version") String version) { try { List<ToscaNodeTemplate> response = provider.getControlLoopDefinitions(name, version); @@ -266,7 +271,9 @@ public class CommissioningController extends RestController { } catch (PfModelRuntimeException | PfModelException e) { LOGGER.warn("Get of control loop definitions failed", e); - return createCommissioningErrorResponse(e, requestId); + CommissioningResponse resp = new CommissioningResponse(); + resp.setErrorDetails(e.getErrorResponse().getErrorMessage()); + return returnResponse(e.getErrorResponse().getResponseCode(), requestId, resp); } } @@ -319,33 +326,35 @@ public class CommissioningController extends RestController { ) // @formatter:on public Response queryElements(@HeaderParam(REQUEST_ID_NAME) @ApiParam(REQUEST_ID_PARAM_DESCRIPTION) UUID requestId, - @ApiParam(value = "Control Loop definition name", required = true) - @QueryParam("name") String name, - @ApiParam(value = "Control Loop definition version", required = true) - @QueryParam("version") String version) throws Exception { + @ApiParam(value = "Control Loop definition name", required = true) + @QueryParam("name") String name, + @ApiParam(value = "Control Loop definition version", required = true) + @QueryParam("version") String version) throws Exception { try { List<ToscaNodeTemplate> nodeTemplate = provider.getControlLoopDefinitions(name, version); //Prevent ambiguous queries with multiple returns if (nodeTemplate.size() > 1) { - throw new Exception(); + CommissioningResponse resp = new CommissioningResponse(); + resp.setErrorDetails("Multiple ControlLoops are not supported"); + return returnResponse(Response.Status.NOT_ACCEPTABLE, requestId, resp); } + List<ToscaNodeTemplate> response = provider.getControlLoopElementDefinitions(nodeTemplate.get(0)); return addLoggingHeaders(addVersionControlHeaders(Response.status(Status.OK)), requestId).entity(response) .build(); } catch (PfModelRuntimeException | PfModelException e) { LOGGER.warn("Get of control loop element definitions failed", e); - return createCommissioningErrorResponse(e, requestId); + CommissioningResponse resp = new CommissioningResponse(); + resp.setErrorDetails(e.getErrorResponse().getErrorMessage()); + return returnResponse(e.getErrorResponse().getResponseCode(), requestId, resp); } } - private Response createCommissioningErrorResponse(ErrorResponseInfo e, UUID requestId) { - CommissioningResponse resp = new CommissioningResponse(); - resp.setErrorDetails(e.getErrorResponse().getErrorMessage()); - return addLoggingHeaders(addVersionControlHeaders(Response.status(e.getErrorResponse().getResponseCode())), + private Response returnResponse(Response.Status status, UUID requestId, CommissioningResponse resp) { + return addLoggingHeaders(addVersionControlHeaders(Response.status(status)), requestId).entity(resp).build(); } - } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java index 6fd5f3225..eb72d9219 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProvider.java @@ -39,6 +39,7 @@ import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand; import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse; import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider; +import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.ObjectValidationResult; import org.onap.policy.common.parameters.ValidationResult; @@ -140,19 +141,21 @@ public class ControlLoopInstantiationProvider implements Closeable { */ private BeanValidationResult validateControlLoops(ControlLoops controlLoops) throws PfModelException { - BeanValidationResult validationResult = new BeanValidationResult("ControlLoops", controlLoops); + BeanValidationResult result = new BeanValidationResult("ControlLoops", controlLoops); for (ControlLoop controlLoop : controlLoops.getControlLoopList()) { + BeanValidationResult subResult = new BeanValidationResult( + "entry " + controlLoop.getDefinition().getName(), controlLoop); List<ToscaNodeTemplate> toscaNodeTemplates = commissioningProvider.getControlLoopDefinitions( controlLoop.getDefinition().getName(), controlLoop.getDefinition().getVersion()); if (toscaNodeTemplates.isEmpty()) { - validationResult + subResult .addResult(new ObjectValidationResult("ControlLoop", controlLoop.getDefinition().getName(), ValidationStatus.INVALID, "Commissioned control loop definition not FOUND")); } else if (toscaNodeTemplates.size() > 1) { - validationResult + subResult .addResult(new ObjectValidationResult("ControlLoop", controlLoop.getDefinition().getName(), ValidationStatus.INVALID, "Commissioned control loop definition not VALID")); } else { @@ -167,12 +170,13 @@ public class ControlLoopInstantiationProvider implements Closeable { .collect(Collectors.toMap(ToscaConceptIdentifier::getName, UnaryOperator.identity())); // @formatter:on - for (ControlLoopElement element : controlLoop.getElements()) { - validationResult.addResult(validateDefinition(definitions, element.getDefinition())); + for (ControlLoopElement element : controlLoop.getElements().values()) { + subResult.addResult(validateDefinition(definitions, element.getDefinition())); } } + result.addResult(subResult); } - return validationResult; + return result; } /** @@ -183,15 +187,13 @@ public class ControlLoopInstantiationProvider implements Closeable { * @result result the validation result */ private ValidationResult validateDefinition(Map<String, ToscaConceptIdentifier> definitions, - ToscaConceptIdentifier definition) { - BeanValidationResult result = new BeanValidationResult(definition.getName(), definition); + ToscaConceptIdentifier definition) { + BeanValidationResult result = new BeanValidationResult("entry " + definition.getName(), definition); ToscaConceptIdentifier identifier = definitions.get(definition.getName()); if (identifier == null) { result.setResult(ValidationStatus.INVALID, "Not FOUND"); } else if (!identifier.equals(definition)) { result.setResult(ValidationStatus.INVALID, "Version not matching"); - } else { - result.setResult(ValidationStatus.CLEAN); } return (result.isClean() ? null : result); } @@ -264,6 +266,8 @@ public class ControlLoopInstantiationProvider implements Closeable { controlLoopProvider.updateControlLoops(controlLoops); } + SupervisionHandler supervisionHandler = SupervisionHandler.getInstance(); + supervisionHandler.triggerControlLoopSupervision(command.getControlLoopIdentifierList()); InstantiationResponse response = new InstantiationResponse(); response.setAffectedControlLoops(command.getControlLoopIdentifierList()); diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationHandler.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationHandler.java index fd5288fda..d81e54ccf 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationHandler.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/InstantiationHandler.java @@ -21,13 +21,11 @@ package org.onap.policy.clamp.controlloop.runtime.instantiation; import java.io.IOException; -import java.util.HashSet; import java.util.List; import java.util.Set; import javax.ws.rs.core.Response; import lombok.Getter; import org.onap.policy.clamp.controlloop.common.handler.ControlLoopHandler; -import org.onap.policy.clamp.controlloop.runtime.commissioning.rest.CommissioningController; import org.onap.policy.clamp.controlloop.runtime.instantiation.rest.InstantiationController; import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup; import org.onap.policy.common.endpoints.event.comm.TopicSink; @@ -36,11 +34,9 @@ import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.base.PfModelRuntimeException; /** - * This class handles instantiation of control loop instances, - * so only one object of this type should be built at a time. + * This class handles instantiation of control loop instances. * - * </p> - * It is effectively a singleton that is started at system start + * <p/>It is effectively a singleton that is started at system start */ public final class InstantiationHandler extends ControlLoopHandler { @@ -71,26 +67,6 @@ public final class InstantiationHandler extends ControlLoopHandler { } @Override - public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override - public void startAndRegisterPublishers(List<TopicSink> topicSinks) { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterPublishers() { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override public void startProviders() { controlLoopInstantiationProvider = new ControlLoopInstantiationProvider(getDatabaseProviderParameters()); } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationController.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationController.java index 807da5d68..7581aaf74 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationController.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationController.java @@ -412,5 +412,5 @@ public class InstantiationController extends RestController { return addLoggingHeaders(addVersionControlHeaders(Response.status(e.getErrorResponse().getResponseCode())), requestId).entity(resp).build(); } - } + diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterHandler.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterHandler.java index a7f5ff34d..a463ad171 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterHandler.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ClRuntimeParameterHandler.java @@ -24,7 +24,7 @@ import java.io.File; import javax.ws.rs.core.Response; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; import org.onap.policy.clamp.controlloop.runtime.main.startstop.ClRuntimeCommandLineArguments; -import org.onap.policy.common.parameters.GroupValidationResult; +import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -66,7 +66,7 @@ public class ClRuntimeParameterHandler { } // validate the parameters - final GroupValidationResult validationResult = clRuntimeParameterGroup.validate(); + final ValidationResult validationResult = clRuntimeParameterGroup.validate(); if (!validationResult.isValid()) { throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, "validation error(s) on parameters from \"" + arguments.getConfigurationFilePath() + "\"\n" + validationResult.getResult()); diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java index f70e7d590..2af5be534 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/parameters/ParticipantUpdateParameters.java @@ -51,3 +51,4 @@ public class ParticipantUpdateParameters extends ParameterGroupImpl { super(ParticipantUpdateParameters.class.getSimpleName()); } } + diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeActivator.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeActivator.java index 5959586da..a4238a9c4 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeActivator.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeActivator.java @@ -32,6 +32,7 @@ import org.onap.policy.clamp.controlloop.runtime.instantiation.InstantiationHand import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup; import org.onap.policy.clamp.controlloop.runtime.main.rest.ControlLoopAafFilter; import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringHandler; +import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler; import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.TopicSource; @@ -65,6 +66,7 @@ public class ClRuntimeActivator extends ServiceManagerContainer { * @param clRuntimeParameterGroup the parameters for the control loop runtime service */ public ClRuntimeActivator(final ClRuntimeParameterGroup clRuntimeParameterGroup) { + if (clRuntimeParameterGroup == null || !clRuntimeParameterGroup.isValid()) { throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, "ParameterGroup not valid"); } @@ -86,28 +88,38 @@ public class ClRuntimeActivator extends ServiceManagerContainer { final AtomicReference<ControlLoopHandler> commissioningHandler = new AtomicReference<>(); final AtomicReference<ControlLoopHandler> instantiationHandler = new AtomicReference<>(); + final AtomicReference<ControlLoopHandler> supervisionHandler = new AtomicReference<>(); final AtomicReference<ControlLoopHandler> monitoringHandler = new AtomicReference<>(); - final AtomicReference<RestServer> restServer = new AtomicReference<>(); + // @formatter:off addAction("Control loop runtime parameters", - () -> ParameterService.register(clRuntimeParameterGroup), - () -> ParameterService.deregister(clRuntimeParameterGroup.getName())); + () -> ParameterService.register(clRuntimeParameterGroup), + () -> ParameterService.deregister(clRuntimeParameterGroup.getName())); + addAction("Topic endpoint management", - () -> TopicEndpointManager.getManager().start(), - () -> TopicEndpointManager.getManager().shutdown()); + () -> TopicEndpointManager.getManager().start(), + () -> TopicEndpointManager.getManager().shutdown()); + addAction("Commissioning Handler", () -> commissioningHandler.set(new CommissioningHandler(clRuntimeParameterGroup)), () -> commissioningHandler.get().close()); + addAction("Instantiation Handler", - () -> instantiationHandler.set(new InstantiationHandler(clRuntimeParameterGroup)), - () -> instantiationHandler.get().close()); + () -> instantiationHandler.set(new InstantiationHandler(clRuntimeParameterGroup)), + () -> instantiationHandler.get().close()); + + addAction("Supervision Handler", + () -> supervisionHandler.set(new SupervisionHandler(clRuntimeParameterGroup)), + () -> supervisionHandler.get().close()); + addAction("Monitoring Handler", () -> monitoringHandler.set(new MonitoringHandler(clRuntimeParameterGroup)), () -> monitoringHandler.get().close()); addHandlerActions("Commissioning", commissioningHandler); addHandlerActions("Instantiation", instantiationHandler); + addHandlerActions("Supervision", supervisionHandler); addHandlerActions("Monitoring", monitoringHandler); addAction("Topic Message Dispatcher", this::registerMsgDispatcher, this::unregisterMsgDispatcher); @@ -115,34 +127,34 @@ public class ClRuntimeActivator extends ServiceManagerContainer { clRuntimeParameterGroup.getRestServerParameters().setName(clRuntimeParameterGroup.getName()); addAction("REST server", - () -> { - Set<Class<?>> providerClasses = new HashSet<>(); - providerClasses.addAll(commissioningHandler.get().getProviderClasses()); - providerClasses.addAll(instantiationHandler.get().getProviderClasses()); - providerClasses.addAll(monitoringHandler.get().getProviderClasses()); - - RestServer server = new RestServer(clRuntimeParameterGroup.getRestServerParameters(), - ControlLoopAafFilter.class, - providerClasses.toArray(new Class<?>[providerClasses.size()])); - restServer.set(server); - restServer.get().start(); - }, - () -> restServer.get().stop()); + () -> { + Set<Class<?>> providerClasses = new HashSet<>(); + providerClasses.addAll(commissioningHandler.get().getProviderClasses()); + providerClasses.addAll(instantiationHandler.get().getProviderClasses()); + providerClasses.addAll(supervisionHandler.get().getProviderClasses()); + providerClasses.addAll(monitoringHandler.get().getProviderClasses()); + + RestServer server = new RestServer(clRuntimeParameterGroup.getRestServerParameters(), + ControlLoopAafFilter.class, + providerClasses.toArray(new Class<?>[providerClasses.size()])); + + restServer.set(server); + restServer.get().start(); + }, + () -> restServer.get().stop()); // @formatter:on } private void addHandlerActions(final String name, final AtomicReference<ControlLoopHandler> handler) { addAction(name + " Providers", - () -> handler.get().startProviders(), - () -> handler.get().stopProviders()); - + () -> handler.get().startProviders(), + () -> handler.get().stopProviders()); addAction(name + " Listeners", - () -> handler.get().startAndRegisterListeners(msgDispatcher), - () -> handler.get().stopAndUnregisterListeners(msgDispatcher)); - + () -> handler.get().startAndRegisterListeners(msgDispatcher), + () -> handler.get().stopAndUnregisterListeners(msgDispatcher)); addAction(name + " Publishers", - () -> handler.get().startAndRegisterPublishers(topicSinks), - () -> handler.get().stopAndUnregisterPublishers()); + () -> handler.get().startAndRegisterPublishers(topicSinks), + () -> handler.get().stopAndUnregisterPublishers()); } /** diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeCommandLineArguments.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeCommandLineArguments.java index fa25b6ddb..f36bb858b 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeCommandLineArguments.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/ClRuntimeCommandLineArguments.java @@ -26,55 +26,58 @@ import java.io.StringWriter; import java.net.URL; import java.util.Arrays; import javax.ws.rs.core.Response; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; +import org.apache.commons.lang3.StringUtils; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.common.startstop.CommonCommandLineArguments; import org.onap.policy.common.utils.resources.ResourceUtils; - /** * This class reads and handles command line parameters for the control loop runtime service. - * */ public class ClRuntimeCommandLineArguments { private static final String FILE_MESSAGE_PREAMBLE = " file \""; private static final int HELP_LINE_LENGTH = 120; private final Options options; + private final CommonCommandLineArguments commonCommandLineArguments; + + @Getter() + @Setter() private String configurationFilePath = null; /** * Construct the options for the control loop runtime component. */ public ClRuntimeCommandLineArguments() { - //@formatter:off options = new Options(); - options.addOption(Option.builder("h") - .longOpt("help") - .desc("outputs the usage of this command") - .required(false) - .type(Boolean.class) - .build()); - options.addOption(Option.builder("v") - .longOpt("version") - .desc("outputs the version of control loop runtime") - .required(false) - .type(Boolean.class) - .build()); - options.addOption(Option.builder("c") - .longOpt("config-file") - .desc("the full path to the configuration file to use, " - + "the configuration file must be a Json file containing the control loop runtime parameters") - .hasArg() - .argName("CONFIG_FILE") - .required(false) - .type(String.class) - .build()); - //@formatter:on + commonCommandLineArguments = new CommonCommandLineArguments(options); + } + + /** + * Construct the options for the CLI editor and parse in the given arguments. + * + * @param args The command line arguments + */ + public ClRuntimeCommandLineArguments(final String[] args) { + // Set up the options with the default constructor + this(); + + // Parse the arguments + try { + parse(args); + } catch (final ControlLoopException e) { + throw new ControlLoopRuntimeException(Response.Status.NOT_ACCEPTABLE, + "parse error on control loop runtime parameters", e); + } } /** @@ -87,13 +90,12 @@ public class ClRuntimeCommandLineArguments { public String parse(final String[] args) throws ControlLoopException { // Clear all our arguments setConfigurationFilePath(null); - CommandLine commandLine = null; try { commandLine = new DefaultParser().parse(options, args); } catch (final ParseException e) { throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - "invalid command line arguments specified", e); + "invalid command line arguments specified : " + e.getMessage()); } // Arguments left over after Commons CLI does its stuff @@ -104,16 +106,12 @@ public class ClRuntimeCommandLineArguments { "too many command line arguments specified : " + Arrays.toString(args)); } - if (remainingArgs.length == 1) { - configurationFilePath = remainingArgs[0]; - } - if (commandLine.hasOption('h')) { - return help(Main.class.getName()); + return commonCommandLineArguments.help(Main.class.getName(), options); } if (commandLine.hasOption('v')) { - return version(); + return commonCommandLineArguments.version(); } if (commandLine.hasOption('c')) { @@ -129,42 +127,7 @@ public class ClRuntimeCommandLineArguments { * @throws ControlLoopException on command argument validation errors */ public void validate() throws ControlLoopException { - validateReadableFile("control loop runtime configuration", configurationFilePath); - } - - /** - * Print version information for control loop runtime. - * - * @return the version string - */ - public String version() { - return ResourceUtils.getResourceAsString("version.txt"); - } - - /** - * Print help information for control loop runtime. - * - * @param mainClassName the main class name - * @return the help string - */ - public String help(final String mainClassName) { - final HelpFormatter helpFormatter = new HelpFormatter(); - final StringWriter stringWriter = new StringWriter(); - final PrintWriter printWriter = new PrintWriter(stringWriter); - - helpFormatter.printHelp(printWriter, HELP_LINE_LENGTH, mainClassName + " [options...]", "options", options, 0, - 0, ""); - - return stringWriter.toString(); - } - - /** - * Gets the configuration file path. - * - * @return the configuration file path - */ - public String getConfigurationFilePath() { - return configurationFilePath; + commonCommandLineArguments.validate(configurationFilePath); } /** @@ -185,39 +148,4 @@ public class ClRuntimeCommandLineArguments { this.configurationFilePath = configurationFilePath; } - - /** - * Validate readable file. - * - * @param fileTag the file tag - * @param fileName the file name - * @throws ControlLoopException on the file name passed as a parameter - */ - private void validateReadableFile(final String fileTag, final String fileName) throws ControlLoopException { - if (fileName == null || fileName.length() == 0) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + " file was not specified as an argument"); - } - - // The file name refers to a resource on the local file system - final URL fileUrl = ResourceUtils.getUrl4Resource(fileName); - if (fileUrl == null) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); - } - - final File theFile = new File(fileUrl.getPath()); - if (!theFile.exists()) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" does not exist"); - } - if (!theFile.isFile()) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is not a normal file"); - } - if (!theFile.canRead()) { - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, - fileTag + FILE_MESSAGE_PREAMBLE + fileName + "\" is ureadable"); - } - } } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringHandler.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringHandler.java index 04f458e7d..a7ad9180a 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringHandler.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringHandler.java @@ -69,26 +69,6 @@ public class MonitoringHandler extends ControlLoopHandler { } @Override - public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override - public void startAndRegisterPublishers(List<TopicSink> topicSinks) { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterPublishers() { - // No topic communication on this handler - } - - @Override - public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { - // No topic communication on this handler - } - - @Override public void startProviders() { monitoringProvider = new MonitoringProvider(getDatabaseProviderParameters()); } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java index e46e66501..193f8d557 100644 --- a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/monitoring/MonitoringProvider.java @@ -206,7 +206,7 @@ public class MonitoringProvider implements Closeable { ControlLoop controlLoop = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(name, version)); if (controlLoop != null) { - clElements.addAll(controlLoop.getElements()); + clElements.addAll(controlLoop.getElements().values()); //Collect control loop element statistics for each cl element. for (ControlLoopElement clElement : clElements) { clElementStats.addAll(fetchFilteredClElementStatistics(clElement.getParticipantId().getName(), @@ -235,7 +235,7 @@ public class MonitoringProvider implements Closeable { List<ToscaConceptIdentifier> participantIds = new ArrayList<>(); ControlLoop controlLoop = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(name, version)); if (controlLoop != null) { - for (ControlLoopElement clElement : controlLoop.getElements()) { + for (ControlLoopElement clElement : controlLoop.getElements().values()) { participantIds.add(clElement.getParticipantId()); } } @@ -256,7 +256,7 @@ public class MonitoringProvider implements Closeable { Map<String, ToscaConceptIdentifier> clElementId = new HashMap<>(); ControlLoop controlLoop = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier(name, version)); if (controlLoop != null) { - for (ControlLoopElement clElement : controlLoop.getElements()) { + for (ControlLoopElement clElement : controlLoop.getElements().values()) { clElementId.put(clElement.getId().toString(), clElement.getParticipantId()); } } diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java new file mode 100644 index 000000000..63bff00fc --- /dev/null +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java @@ -0,0 +1,450 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.runtime.supervision; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import org.apache.commons.collections4.CollectionUtils; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; +import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; +import org.onap.policy.clamp.controlloop.common.handler.ControlLoopHandler; +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.ControlLoopState; +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; +import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider; +import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus; +import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningHandler; +import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider; +import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup; +import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringHandler; +import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider; +import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopStateChangePublisher; +import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopUpdatePublisher; +import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStateChangePublisher; +import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStatusListener; +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.common.utils.services.ServiceManager; +import org.onap.policy.common.utils.services.ServiceManagerException; +import org.onap.policy.models.base.PfModelException; +import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class handles supervision of control loop instances, so only one object of this type should be built at a time. + * + * <p/> It is effectively a singleton that is started at system start. + */ +public class SupervisionHandler extends ControlLoopHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionHandler.class); + + private static final String CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE = "Control loop can't transition from state "; + private static final String CONTROL_LOOP_IS_ALREADY_IN_STATE = "Control loop is already in state "; + private static final String TO_STATE = " to state "; + private static final String AND_TRANSITIONING_TO_STATE = " and transitioning to state "; + + private ControlLoopProvider controlLoopProvider; + private ParticipantProvider participantProvider; + private CommissioningProvider commissioningProvider; + private MonitoringProvider monitoringProvider; + + // Publishers for participant communication + private ParticipantStateChangePublisher stateChangePublisher; + private ParticipantControlLoopUpdatePublisher controlLoopUpdatePublisher; + private ParticipantControlLoopStateChangePublisher controlLoopStateChangePublisher; + + // Database scanner + private SupervisionScanner scanner; + + /** + * Used to manage the services. + */ + private ServiceManager manager; + private ServiceManager publisherManager; + + /** + * Gets the SupervisionHandler. + * + * @return SupervisionHandler + */ + public static SupervisionHandler getInstance() { + return Registry.get(SupervisionHandler.class.getName()); + } + + /** + * Create a handler. + * + * @param clRuntimeParameterGroup the parameters for the control loop runtime + */ + public SupervisionHandler(ClRuntimeParameterGroup clRuntimeParameterGroup) { + super(clRuntimeParameterGroup.getDatabaseProviderParameters()); + // @formatter:off + this.manager = new ServiceManager() + .addAction("ControlLoop Provider", + () -> controlLoopProvider = new ControlLoopProvider(getDatabaseProviderParameters()), + () -> controlLoopProvider = null) + .addAction("Participant Provider", + () -> participantProvider = new ParticipantProvider(getDatabaseProviderParameters()), + () -> participantProvider = null); + // @formatter:on + } + + /** + * Supervision trigger called when a command is issued on control loops. + * + * </p> Causes supervision to start or continue supervision on the control loops in question. + * + * @param controlLoopIdentifierList the control loops for which the supervision command has been issued + * @throws ControlLoopException on supervision triggering exceptions + */ + public void triggerControlLoopSupervision(List<ToscaConceptIdentifier> controlLoopIdentifierList) + throws ControlLoopException { + + LOGGER.debug("triggering control loop supervision on control loops {}", controlLoopIdentifierList); + + if (CollectionUtils.isEmpty(controlLoopIdentifierList)) { + // This is just to force throwing of the exception in certain circumstances. + exceptionOccured(Response.Status.NOT_ACCEPTABLE, + "The list of control loops for supervision is empty"); + } + + for (ToscaConceptIdentifier controlLoopId : controlLoopIdentifierList) { + try { + ControlLoop controlLoop = controlLoopProvider.getControlLoop(controlLoopId); + + superviseControlLoop(controlLoop); + + controlLoopProvider.updateControlLoop(controlLoop); + } catch (PfModelException pfme) { + throw new ControlLoopException(pfme.getErrorResponse().getResponseCode(), pfme.getMessage(), pfme); + } + } + } + + @Override + public void startAndRegisterListeners(MessageTypeDispatcher msgDispatcher) { + msgDispatcher.register(ParticipantMessageType.PARTICIPANT_STATUS.name(), new ParticipantStatusListener()); + } + + @Override + public void startAndRegisterPublishers(List<TopicSink> topicSinks) { + // TODO: Use a parameter for the timeout + // @formatter:off + this.publisherManager = new ServiceManager() + .addAction("Supervision scanner", + () -> scanner = new SupervisionScanner(controlLoopProvider, 10000), + () -> scanner = null) + .addAction("ControlLoopUpdate publisher", + () -> controlLoopUpdatePublisher = new ParticipantControlLoopUpdatePublisher(topicSinks, -1), + () -> controlLoopUpdatePublisher.terminate()) + .addAction("StateChange Publisher", + () -> stateChangePublisher = new ParticipantStateChangePublisher(topicSinks, 10000), + () -> stateChangePublisher.terminate()) + .addAction("ControlLoopStateChange Publisher", + () -> controlLoopStateChangePublisher = + new ParticipantControlLoopStateChangePublisher(topicSinks, -1), + () -> controlLoopStateChangePublisher.terminate()); + // @formatter:on + try { + publisherManager.start(); + } catch (final ServiceManagerException exp) { + throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, + "Supervision handler start of publishers or scanner failed", exp); + } + } + + @Override + public void stopAndUnregisterPublishers() { + try { + publisherManager.stop(); + } catch (final ServiceManagerException exp) { + throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, + "Supervision handler stop of publishers or scanner failed", exp); + } + } + + @Override + public void stopAndUnregisterListeners(MessageTypeDispatcher msgDispatcher) { + msgDispatcher.unregister(ParticipantMessageType.PARTICIPANT_STATUS.name()); + } + + /** + * Handle a ParticipantStatus message from a participant. + * + * @param participantStatusMessage the ParticipantStatus message received from a participant + */ + public void handleParticipantStatusMessage(ParticipantStatus participantStatusMessage) { + LOGGER.debug("Participant Status received {}", participantStatusMessage); + + try { + superviseParticipant(participantStatusMessage); + } catch (PfModelException | ControlLoopException svExc) { + LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc); + return; + } + + try { + superviseControlLoops(participantStatusMessage); + } catch (PfModelException | ControlLoopException svExc) { + LOGGER.warn("error supervising participant {}", participantStatusMessage.getParticipantId(), svExc); + } + } + + /** + * Supervise a control loop, performing whatever actions need to be performed on the control loop. + * + * @param controlLoop the control loop to supervises + * @throws ControlLoopException on supervision errors + */ + private void superviseControlLoop(ControlLoop controlLoop) throws ControlLoopException, PfModelException { + switch (controlLoop.getOrderedState()) { + case UNINITIALISED: + superviseControlLoopUninitialization(controlLoop); + break; + + case PASSIVE: + superviseControlLoopPassivation(controlLoop); + break; + + case RUNNING: + superviseControlLoopActivation(controlLoop); + break; + + default: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, + "A control loop cannot be commanded to go into state " + controlLoop.getOrderedState().name()); + } + } + + /** + * Supervise a control loop uninitialisation, performing whatever actions need to be performed on the control loop, + * control loop ordered state is UNINITIALIZED. + * + * @param controlLoop the control loop to supervises + * @throws ControlLoopException on supervision errors + */ + private void superviseControlLoopUninitialization(ControlLoop controlLoop) throws ControlLoopException { + switch (controlLoop.getState()) { + case UNINITIALISED: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, + CONTROL_LOOP_IS_ALREADY_IN_STATE + controlLoop.getState().name()); + break; + + case UNINITIALISED2PASSIVE: + case PASSIVE: + controlLoop.setState(ControlLoopState.PASSIVE2UNINITIALISED); + sendControlLoopStateChange(controlLoop); + break; + + case PASSIVE2UNINITIALISED: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_IS_ALREADY_IN_STATE + + controlLoop.getState().name() + AND_TRANSITIONING_TO_STATE + controlLoop.getOrderedState()); + break; + + default: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE + + controlLoop.getState().name() + TO_STATE + controlLoop.getOrderedState()); + break; + } + } + + private void superviseControlLoopPassivation(ControlLoop controlLoop) + throws ControlLoopException, PfModelException { + switch (controlLoop.getState()) { + case PASSIVE: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, + CONTROL_LOOP_IS_ALREADY_IN_STATE + controlLoop.getState().name()); + break; + case UNINITIALISED: + controlLoop.setState(ControlLoopState.UNINITIALISED2PASSIVE); + sendControlLoopUpdate(controlLoop); + break; + + case UNINITIALISED2PASSIVE: + case RUNNING2PASSIVE: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_IS_ALREADY_IN_STATE + + controlLoop.getState().name() + AND_TRANSITIONING_TO_STATE + controlLoop.getOrderedState()); + break; + + case RUNNING: + controlLoop.setState(ControlLoopState.RUNNING2PASSIVE); + sendControlLoopStateChange(controlLoop); + break; + + default: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE + + controlLoop.getState().name() + TO_STATE + controlLoop.getOrderedState()); + break; + } + } + + private void superviseControlLoopActivation(ControlLoop controlLoop) throws ControlLoopException { + switch (controlLoop.getState()) { + case RUNNING: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, + CONTROL_LOOP_IS_ALREADY_IN_STATE + controlLoop.getState().name()); + break; + + case PASSIVE2RUNNING: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_IS_ALREADY_IN_STATE + + controlLoop.getState().name() + AND_TRANSITIONING_TO_STATE + controlLoop.getOrderedState()); + break; + + case PASSIVE: + controlLoop.setState(ControlLoopState.PASSIVE2RUNNING); + sendControlLoopStateChange(controlLoop); + break; + + default: + exceptionOccured(Response.Status.NOT_ACCEPTABLE, CONTROL_LOOP_CANNOT_TRANSITION_FROM_STATE + + controlLoop.getState().name() + TO_STATE + controlLoop.getOrderedState()); + break; + } + } + + private void sendControlLoopUpdate(ControlLoop controlLoop) throws PfModelException { + ParticipantControlLoopUpdate pclu = new ParticipantControlLoopUpdate(); + pclu.setControlLoopId(controlLoop.getKey().asIdentifier()); + pclu.setControlLoop(controlLoop); + // TODO: We should look up the correct TOSCA node template here for the control loop + // Tiny hack implemented to return the tosca service template entry from the database and be passed onto dmaap + commissioningProvider = CommissioningHandler.getInstance().getProvider(); + pclu.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null)); + controlLoopUpdatePublisher.send(pclu); + } + + private void sendControlLoopStateChange(ControlLoop controlLoop) { + ParticipantControlLoopStateChange clsc = new ParticipantControlLoopStateChange(); + clsc.setControlLoopId(controlLoop.getKey().asIdentifier()); + clsc.setMessageId(UUID.randomUUID()); + clsc.setOrderedState(controlLoop.getOrderedState()); + + controlLoopStateChangePublisher.send(clsc); + } + + private void superviseParticipant(ParticipantStatus participantStatusMessage) + throws PfModelException, ControlLoopException { + if (participantStatusMessage.getParticipantId() == null) { + exceptionOccured(Response.Status.NOT_FOUND, + "Participant ID on PARTICIPANT_STATUS message is null"); + } + + List<Participant> participantList = + participantProvider.getParticipants(participantStatusMessage.getParticipantId().getName(), + participantStatusMessage.getParticipantId().getVersion()); + + if (CollectionUtils.isEmpty(participantList)) { + Participant participant = new Participant(); + participant.setName(participantStatusMessage.getParticipantId().getName()); + participant.setVersion(participantStatusMessage.getParticipantId().getVersion()); + participant.setDefinition(new ToscaConceptIdentifier("unknown", "0.0.0")); + participant.setParticipantState(participantStatusMessage.getState()); + participant.setHealthStatus(participantStatusMessage.getHealthStatus()); + + participantList.add(participant); + participantProvider.createParticipants(participantList); + } else { + for (Participant participant : participantList) { + participant.setParticipantState(participantStatusMessage.getState()); + participant.setHealthStatus(participantStatusMessage.getHealthStatus()); + } + participantProvider.updateParticipants(participantList); + } + + monitoringProvider = MonitoringHandler.getInstance().getMonitoringProvider(); + monitoringProvider.createParticipantStatistics( + List.of(participantStatusMessage.getParticipantStatistics())); + } + + private void superviseControlLoops(ParticipantStatus participantStatusMessage) + throws PfModelException, ControlLoopException { + if (CollectionUtils.isEmpty(participantStatusMessage.getControlLoops().getControlLoopList())) { + return; + } + + for (ControlLoop controlLoop : participantStatusMessage.getControlLoops().getControlLoopList()) { + if (controlLoop == null) { + exceptionOccured(Response.Status.NOT_FOUND, + "PARTICIPANT_STATUS message references unknown control loop: " + controlLoop); + } + + ControlLoop dbControlLoop = controlLoopProvider + .getControlLoop(new ToscaConceptIdentifier(controlLoop.getName(), controlLoop.getVersion())); + if (dbControlLoop == null) { + exceptionOccured(Response.Status.NOT_FOUND, + "PARTICIPANT_STATUS control loop not found in database: " + controlLoop); + } + + for (ControlLoopElement element : controlLoop.getElements().values()) { + ControlLoopElement dbElement = dbControlLoop.getElements().get(element.getId()); + + if (dbElement == null) { + exceptionOccured(Response.Status.NOT_FOUND, + "PARTICIPANT_STATUS message references unknown control loop element: " + element); + } + + // Replace element entry in the database + dbControlLoop.getElements().put(element.getId(), element); + } + controlLoopProvider.updateControlLoop(dbControlLoop); + } + + monitoringProvider = MonitoringHandler.getInstance().getMonitoringProvider(); + for (ControlLoop controlLoop : participantStatusMessage.getControlLoops().getControlLoopList()) { + monitoringProvider.createClElementStatistics(controlLoop.getControlLoopElementStatisticsList(controlLoop)); + } + } + + @Override + public void startProviders() { + try { + manager.start(); + } catch (final ServiceManagerException exp) { + throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, + "Supervision handler start of providers failed", exp); + } + } + + @Override + public void stopProviders() { + try { + manager.stop(); + } catch (final ServiceManagerException exp) { + throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR, + "Supervision handler stop of providers failed", exp); + } + } + + private void exceptionOccured(Response.Status status, String reason) throws ControlLoopException { + throw new ControlLoopException(status, reason); + } +} diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java new file mode 100644 index 000000000..0ccfddff3 --- /dev/null +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionScanner.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.runtime.supervision; + +import java.io.Closeable; +import java.util.Collection; +import java.util.List; +import java.util.TimerTask; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +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.persistence.provider.ControlLoopProvider; +import org.onap.policy.models.base.PfModelException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class is used to scan the control loops in the database and check if they are in the correct state. + */ +public class SupervisionScanner implements Runnable, Closeable { + private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionScanner.class); + + private ControlLoopProvider controlLoopProvider; + private ScheduledExecutorService timerPool; + + /** + * Constructor for instantiating SupervisionScanner. + * + * @param controlLoopProvider the provider to use to read control loops from the database + * @param interval time interval to perform scans + */ + public SupervisionScanner(final ControlLoopProvider controlLoopProvider, final long interval) { + this.controlLoopProvider = controlLoopProvider; + + // Kick off the timer + timerPool = makeTimerPool(); + timerPool.scheduleAtFixedRate(this, 0, interval, TimeUnit.SECONDS); + } + + @Override + public void run() { + LOGGER.debug("Scanning control loops in the database . . ."); + + try { + for (ControlLoop controlLoop : controlLoopProvider.getControlLoops(null, null)) { + scanControlLoop(controlLoop); + } + } catch (PfModelException pfme) { + LOGGER.warn("error reading control loops from database", pfme); + } + + LOGGER.debug("Control loop scan complete . . ."); + } + + @Override + public void close() { + timerPool.shutdown(); + } + + private void scanControlLoop(final ControlLoop controlLoop) throws PfModelException { + LOGGER.debug("scanning control loop {} . . .", controlLoop.getKey().asIdentifier()); + + if (controlLoop.getState().equals(controlLoop.getOrderedState().asState())) { + LOGGER.debug("control loop {} scanned, OK", controlLoop.getKey().asIdentifier()); + return; + } + + for (ControlLoopElement element : controlLoop.getElements().values()) { + if (!element.getState().equals(element.getOrderedState().asState())) { + LOGGER.debug("control loop scan: transitioning from state {} to {}", controlLoop.getState(), + controlLoop.getOrderedState()); + return; + } + } + + LOGGER.debug("control loop scan: transition from state {} to {} completed", controlLoop.getState(), + controlLoop.getOrderedState()); + + controlLoop.setState(controlLoop.getOrderedState().asState()); + controlLoopProvider.updateControlLoop(controlLoop); + } + + /** + * Makes a new timer pool. + * + * @return a new timer pool + */ + protected ScheduledExecutorService makeTimerPool() { + return Executors.newScheduledThreadPool(1); + } +} diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopStateChangePublisher.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopStateChangePublisher.java new file mode 100644 index 000000000..c9c8ab851 --- /dev/null +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopStateChangePublisher.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.runtime.supervision.comm; + +import java.util.List; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; +import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class is used to send ParticipantControlLoopStateChangePublisher messages to participants on DMaaP. + */ +public class ParticipantControlLoopStateChangePublisher { + private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantControlLoopStateChangePublisher.class); + + private TopicSinkClient topicSinkClient; + + /** + * Constructor for instantiating ParticipantControlLoopStateChangePublisherPublisher. + * + * @param topicSinks the topic sinks + * @param interval time interval to send ParticipantControlLoopStateChangePublisher messages + */ + public ParticipantControlLoopStateChangePublisher(final List<TopicSink> topicSinks, final long interval) { + // TODO: Should not be dependent on the order of topic sinks in the config + this.topicSinkClient = new TopicSinkClient(topicSinks.get(0)); + } + + /** + * Terminates the current timer. + */ + public void terminate() { + // This is a user initiated message and doesn't need a timer. + } + + /** + * Get the current time interval used by the timer task. + * + * @return interval the current time interval + */ + public long getInterval() { + // This is a user initiated message and doesn't need a timer. + return -1; + } + + /** + * Method to send ParticipantControlLoopStateChangePublisher status message to participants on demand. + * + * @param controlLoopStateChange the ParticipantControlLoopStateChangePublisher message + */ + public void send(final ParticipantControlLoopStateChange controlLoopStateChange) { + topicSinkClient.send(controlLoopStateChange); + LOGGER.debug("Sent ParticipantControlLoopStateChange to Participants - {}", controlLoopStateChange); + } +} diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java new file mode 100644 index 000000000..3c5d230c5 --- /dev/null +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.runtime.supervision.comm; + +import java.util.List; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; +import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class is used to send ParticipantControlLoopUpdate messages to participants on DMaaP. + */ +public class ParticipantControlLoopUpdatePublisher { + private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantControlLoopUpdatePublisher.class); + + private TopicSinkClient topicSinkClient; + + /** + * Constructor for instantiating ParticipantUpdatePublisher. + * + * @param topicSinks the topic sinks + * @param interval time interval to send ParticipantControlLoopUpdate messages + */ + public ParticipantControlLoopUpdatePublisher(final List<TopicSink> topicSinks, final long interval) { + // TODO: Should not be dependent on the order of topic sinks in the config + this.topicSinkClient = new TopicSinkClient(topicSinks.get(0)); + } + + /** + * Terminates the current timer. + */ + public void terminate() { + // This is a user initiated message and doesn't need a timer. + } + + /** + * Get the current time interval used by the timer task. + * + * @return interval the current time interval + */ + public long getInterval() { + // This is a user initiated message and doesn't need a timer. + return -1; + } + + /** + * Method to send ParticipantControlLoopUpdate status message to participants on demand. + * + * @param participantControlLoopUpdate the ParticipantControlLoopUpdate message + */ + public void send(final ParticipantControlLoopUpdate participantControlLoopUpdate) { + topicSinkClient.send(participantControlLoopUpdate); + LOGGER.debug("Sent ParticipantControlLoopUpdate to Participants - {}", participantControlLoopUpdate); + } +} diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStateChangePublisher.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStateChangePublisher.java new file mode 100644 index 000000000..099039115 --- /dev/null +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStateChangePublisher.java @@ -0,0 +1,74 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.runtime.supervision.comm; + +import java.util.List; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; +import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * This class is used to send ParticipantStateChange messages to participants on DMaaP. + */ +public class ParticipantStateChangePublisher { + private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStateChangePublisher.class); + + private TopicSinkClient topicSinkClient; + + /** + * Constructor for instantiating ParticipantStateChangePublisher. + * + * @param topicSinks the topic sinks + * @param interval time interval to send ParticipantStateChange messages + */ + public ParticipantStateChangePublisher(final List<TopicSink> topicSinks, final long interval) { + // TODO: Should not be dependent on the order of topic sinks in the config + this.topicSinkClient = new TopicSinkClient(topicSinks.get(0)); + } + + /** + * Terminates the current timer. + */ + public void terminate() { + // Nothing to terminate, this publisher does not have a timer + } + + /** + * Get the current time interval used by the timer task. + * + * @return interval the current time interval + */ + public long getInterval() { + return -1; + } + + /** + * Method to send ParticipantStateChange status message to participants on demand. + * + * @param participantStateChange the ParticipantStateChange message + */ + public void send(final ParticipantStateChange participantStateChange) { + topicSinkClient.send(participantStateChange); + LOGGER.debug("Sent ParticipantStateChange to Participants - {}", participantStateChange); + } +} diff --git a/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusListener.java b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusListener.java new file mode 100644 index 000000000..a05f4aa20 --- /dev/null +++ b/tosca-controlloop/runtime/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantStatusListener.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.runtime.supervision.comm; + +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStatus; +import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler; +import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.endpoints.listeners.ScoListener; +import org.onap.policy.common.utils.coder.StandardCoderObject; +import org.onap.policy.common.utils.services.Registry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Listener for ParticipantStatus messages sent by participants. + */ +public class ParticipantStatusListener extends ScoListener<ParticipantStatus> { + private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantStatusListener.class); + + private final SupervisionHandler supervisionHandler = Registry.get(SupervisionHandler.class.getName()); + + /** + * Constructs the object. + */ + public ParticipantStatusListener() { + super(ParticipantStatus.class); + } + + @Override + public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, + final ParticipantStatus participantStatusMessage) { + LOGGER.debug("ParticipantStatus message received from participant - {}", participantStatusMessage); + supervisionHandler.handleParticipantStatusMessage(participantStatusMessage); + } +} diff --git a/tosca-controlloop/runtime/src/main/resources/META-INF/persistence.xml b/tosca-controlloop/runtime/src/main/resources/META-INF/persistence.xml new file mode 100644 index 000000000..e5d2cab11 --- /dev/null +++ b/tosca-controlloop/runtime/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============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========================================================= +--> +<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> + <persistence-unit name="CommissioningMariaDb" transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaParameter</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirement</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirements</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</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> + + <properties> + <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> + <property name="eclipselink.ddl-generation.output-mode" value="database" /> + <property name="eclipselink.logging.level" value="INFO" /> + + <!-- property name="eclipselink.logging.level" value="ALL" /> + <property name="eclipselink.logging.level.jpa" value="ALL" /> + <property name="eclipselink.logging.level.ddl" value="ALL" /> + <property name="eclipselink.logging.level.connection" value="ALL" /> + <property name="eclipselink.logging.level.sql" value="ALL" /> + <property name="eclipselink.logging.level.transaction" value="ALL" /> + <property name="eclipselink.logging.level.sequencing" value="ALL" /> + <property name="eclipselink.logging.level.server" value="ALL" /> + <property name="eclipselink.logging.level.query" value="ALL" /> + <property name="eclipselink.logging.level.properties" value="ALL" /--> + </properties> + <shared-cache-mode>NONE</shared-cache-mode> + </persistence-unit> + + <persistence-unit name="ToscaConceptTest" transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaParameter</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirement</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirements</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</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> + <properties> + <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> + <property name="eclipselink.ddl-generation.output-mode" value="database" /> + <property name="eclipselink.logging.level" value="INFO" /> + + <!-- property name="eclipselink.logging.level" value="ALL" /> + <property name="eclipselink.logging.level.jpa" value="ALL" /> + <property name="eclipselink.logging.level.ddl" value="ALL" /> + <property name="eclipselink.logging.level.connection" value="ALL" /> + <property name="eclipselink.logging.level.sql" value="ALL" /> + <property name="eclipselink.logging.level.transaction" value="ALL" /> + <property name="eclipselink.logging.level.sequencing" value="ALL" /> + <property name="eclipselink.logging.level.server" value="ALL" /> + <property name="eclipselink.logging.level.query" value="ALL" /> + <property name="eclipselink.logging.level.properties" value="ALL" /--> + </properties> + <shared-cache-mode>NONE</shared-cache-mode> + </persistence-unit> +</persistence> + diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java index 97599cd64..956b5e911 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/CommissioningProviderTest.java @@ -43,7 +43,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; public class CommissioningProviderTest { private static final String TOSCA_SERVICE_TEMPLATE_YAML = - "src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml"; + "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml"; private static final String TEMPLATE_IS_NULL = ".*serviceTemplate is marked non-null but is null"; private static final Coder CODER = new StandardCoder(); private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator(); @@ -149,6 +149,9 @@ public class CommissioningProviderTest { .fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML), ToscaServiceTemplate.class); + listOfTemplates = provider.getControlLoopDefinitions(null, null); + assertThat(listOfTemplates).isEmpty(); + provider.createControlLoopDefinitions(serviceTemplate); listOfTemplates = provider.getControlLoopDefinitions(null, null); assertThat(listOfTemplates).hasSize(2); @@ -171,6 +174,8 @@ public class CommissioningProviderTest { .fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML), ToscaServiceTemplate.class); + provider.getControlLoopDefinitions(null, null); + provider.createControlLoopDefinitions(serviceTemplate); List<ToscaNodeTemplate> controlLoopDefinitionList = provider.getControlLoopDefinitions( "org.onap.domain.pmsh.PMSHControlLoopDefinition", "1.2.3"); diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java index fa146635d..4dbb3ea02 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/commissioning/rest/CommissioningControllerTest.java @@ -44,7 +44,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; public class CommissioningControllerTest extends CommonRestController { private static final String TOSCA_SERVICE_TEMPLATE_YAML = - "src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml"; + "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml"; private static final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator(); private static final String COMMISSIONING_ENDPOINT = "commission"; private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate(); @@ -59,7 +59,7 @@ public class CommissioningControllerTest extends CommonRestController { CommonRestController.setUpBeforeClass("CommissioningApi"); serviceTemplate = yamlTranslator.fromYaml(ResourceUtils.getResourceAsString(TOSCA_SERVICE_TEMPLATE_YAML), - ToscaServiceTemplate.class); + ToscaServiceTemplate.class); } @AfterClass @@ -150,7 +150,7 @@ public class CommissioningControllerTest extends CommonRestController { //Call get elements with no info Invocation.Builder invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT + "/elements"); Response resp = invocationBuilder.buildGet().invoke(); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), resp.getStatus()); + assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), resp.getStatus()); } @Test diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java index 0ec8fe3e8..ccc54b93f 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java @@ -25,16 +25,21 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import org.mockito.Mockito; import org.onap.policy.clamp.controlloop.common.exception.ControlLoopRuntimeException; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoops; import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationCommand; import org.onap.policy.clamp.controlloop.models.messages.rest.instantiation.InstantiationResponse; +import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningHandler; +import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler; import org.onap.policy.clamp.controlloop.runtime.util.CommonTestData; +import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.provider.PolicyModelsProviderParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @@ -51,27 +56,32 @@ public class ControlLoopInstantiationProviderTest { private static final String CL_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/controlloops/PassiveCommand.json"; private static final String CL_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON = - "src/test/resources/rest/controlloops/ControlLoopsElementsNotFound.json"; + "src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json"; private static final String CL_INSTANTIATION_CONTROLLOOP_DEFINITION_NOT_FOUND_JSON = "src/test/resources/rest/controlloops/ControlLoopsNotFound.json"; - private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml"; - + private static final String TOSCA_TEMPLATE_YAML = + "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml"; private static final String CONTROL_LOOP_NOT_FOUND = "Control Loop not found"; private static final String DELETE_BAD_REQUEST = "Control Loop State is still %s"; private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command"; - private static final String CONTROLLOOP_ELEMENT_NAME_NOT_FOUND = "\"ControlLoops\" INVALID, item has status INVALID\n" - + " \"org.onap.domain.pmsh.NotExistFirst\" INVALID, Not FOUND\n" - + " \"org.onap.domain.pmsh.NotExistSecond\" INVALID, Not FOUND\n"; + + " \"entry org.onap.domain.pmsh.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n" + + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not FOUND\n" + + " \"entry org.onap.domain.pmsh.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n" + + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not FOUND\n"; private static final String CONTROLLOOP_DEFINITION_NOT_FOUND = "\"ControlLoops\" INVALID, item has status INVALID\n" - + " item \"ControlLoop\" value \"org.onap.domain.PMSHControlLoopDefinition\" INVALID," + + " \"entry org.onap.domain.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n" + + " item \"ControlLoop\" value \"org.onap.domain.PMSHControlLoopDefinition\" INVALID," + " Commissioned control loop definition not FOUND\n" - + " item \"ControlLoop\" value \"org.onap.domain.PMSHControlLoopDefinition\" INVALID," + + " \"entry org.onap.domain.PMSHControlLoopDefinition\" INVALID, item has status INVALID\n" + + " item \"ControlLoop\" value \"org.onap.domain.PMSHControlLoopDefinition\" INVALID," + " Commissioned control loop definition not FOUND\n"; private static PolicyModelsProviderParameters databaseProviderParameters; + private static SupervisionHandler supervisionHandler; + private static CommissioningHandler commissioningHandler; /** * setup Db Provider Parameters. @@ -82,18 +92,21 @@ public class ControlLoopInstantiationProviderTest { public static void setupDbProviderParameters() throws PfModelException { databaseProviderParameters = CommonTestData.geParameterGroup(0, "instantproviderdb").getDatabaseProviderParameters(); + commissioningHandler = new CommissioningHandler(CommonTestData.geParameterGroup(0, "instantproviderdb")); + commissioningHandler.startProviders(); + supervisionHandler = new SupervisionHandler(CommonTestData.geParameterGroup(0, "instantproviderdb")); + supervisionHandler.startProviders(); + supervisionHandler.startAndRegisterPublishers(Collections.singletonList(Mockito.mock(TopicSink.class))); } @Test public void testInstantiationCrud() throws Exception { ControlLoops controlLoopsCreate = InstantiationUtils.getControlLoopsFromResource(CL_INSTANTIATION_CREATE_JSON, "Crud"); - ControlLoops controlLoopsDb = getControlLoopsFromDb(controlLoopsCreate); assertThat(controlLoopsDb.getControlLoopList()).isEmpty(); - try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { // to validate control Loop, it needs to define ToscaServiceTemplate InstantiationUtils.storeToscaServiceTemplate(TOSCA_TEMPLATE_YAML, databaseProviderParameters); @@ -154,7 +167,7 @@ public class ControlLoopInstantiationProviderTest { controlLoopsDb.setControlLoopList(new ArrayList<>()); try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { for (ControlLoop controlLoop : controlLoopsSource.getControlLoopList()) { ControlLoops controlLoopsFromDb = @@ -174,14 +187,14 @@ public class ControlLoopInstantiationProviderTest { ControlLoop controlLoop0 = controlLoops.getControlLoopList().get(0); try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { // to validate control Loop, it needs to define ToscaServiceTemplate InstantiationUtils.storeToscaServiceTemplate(TOSCA_TEMPLATE_YAML, databaseProviderParameters); assertThatThrownBy( () -> instantiationProvider.deleteControlLoop(controlLoop0.getName(), controlLoop0.getVersion())) - .hasMessageMatching(CONTROL_LOOP_NOT_FOUND); + .hasMessageMatching(CONTROL_LOOP_NOT_FOUND); InstantiationUtils.assertInstantiationResponse(instantiationProvider.createControlLoops(controlLoops), controlLoops); @@ -213,12 +226,12 @@ public class ControlLoopInstantiationProviderTest { controlLoop.setState(state); try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { instantiationProvider.updateControlLoops(controlLoops); assertThatThrownBy( () -> instantiationProvider.deleteControlLoop(controlLoop.getName(), controlLoop.getVersion())) - .hasMessageMatching(String.format(DELETE_BAD_REQUEST, state)); + .hasMessageMatching(String.format(DELETE_BAD_REQUEST, state)); } } @@ -231,7 +244,7 @@ public class ControlLoopInstantiationProviderTest { assertThat(controlLoopsDb.getControlLoopList()).isEmpty(); try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { // to validate control Loop, it needs to define ToscaServiceTemplate InstantiationUtils.storeToscaServiceTemplate(TOSCA_TEMPLATE_YAML, databaseProviderParameters); @@ -254,7 +267,7 @@ public class ControlLoopInstantiationProviderTest { .getControlLoopsFromResource(CL_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON, "ClElementNotFound"); try (ControlLoopInstantiationProvider provider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { // to validate control Loop, it needs to define ToscaServiceTemplate InstantiationUtils.storeToscaServiceTemplate(TOSCA_TEMPLATE_YAML, databaseProviderParameters); @@ -274,7 +287,7 @@ public class ControlLoopInstantiationProviderTest { assertThat(getControlLoopsFromDb(controlLoops).getControlLoopList()).isEmpty(); try (ControlLoopInstantiationProvider provider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { assertThatThrownBy(() -> provider.createControlLoops(controlLoops)) .hasMessageMatching(CONTROLLOOP_DEFINITION_NOT_FOUND); } @@ -283,7 +296,7 @@ public class ControlLoopInstantiationProviderTest { @Test public void testIssueControlLoopCommand_OrderedStateInvalid() throws ControlLoopRuntimeException, IOException { try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { assertThatThrownBy(() -> instantiationProvider.issueControlLoopCommand(new InstantiationCommand())) .hasMessageMatching(ORDERED_STATE_INVALID); } @@ -298,7 +311,7 @@ public class ControlLoopInstantiationProviderTest { assertThat(getControlLoopsFromDb(controlLoopsV1).getControlLoopList()).isEmpty(); try (ControlLoopInstantiationProvider instantiationProvider = - new ControlLoopInstantiationProvider(databaseProviderParameters)) { + new ControlLoopInstantiationProvider(databaseProviderParameters)) { // to validate control Loop, it needs to define ToscaServiceTemplate InstantiationUtils.storeToscaServiceTemplate(TOSCA_TEMPLATE_YAML, databaseProviderParameters); diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java index 63d5a52a4..71e762455 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/rest/InstantiationControllerTest.java @@ -54,12 +54,13 @@ public class InstantiationControllerTest extends CommonRestController { private static final String CL_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/controlloops/PassiveCommand.json"; + private static final String TOSCA_TEMPLATE_YAML = + "src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml"; + private static final String INSTANTIATION_ENDPOINT = "instantiation"; private static final String INSTANTIATION_COMMAND_ENDPOINT = "instantiation/command"; - private static final String TOSCA_TEMPLATE_YAML = "examples/controlloop/PMSubscriptionHandling.yaml"; - /** * starts Main and inserts a commissioning template. * diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/MainTest.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/MainTest.java index 6dd4031ed..b06383c68 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/MainTest.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/main/startstop/MainTest.java @@ -152,6 +152,6 @@ public class MainTest { private void assertThatConfigFileThrownException(final String configFilePath) { final String[] configParameters = new String[] {"-c", configFilePath}; assertThatThrownBy(() -> new Main(configParameters)).isInstanceOf(ControlLoopRuntimeException.class) - .hasMessage(POLICY_CLAMP_FAILURE_MSG); + .hasMessage(String.format(POLICY_CLAMP_FAILURE_MSG)); } } diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java index 888fb1e98..44096eecd 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/monitoring/TestMonitoringProvider.java @@ -29,7 +29,7 @@ import java.io.File; import java.lang.reflect.Field; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.junit.BeforeClass; @@ -231,7 +231,8 @@ public class TestMonitoringProvider { .get(0).getParticipantId().getName(), inputClElementStatistics.getClElementStatistics().get(0) .getParticipantId().getVersion())); ControlLoop mockCL = new ControlLoop(); - mockCL.setElements(Arrays.asList(mockClElement)); + mockCL.setElements(new LinkedHashMap<>()); + mockCL.getElements().put(mockClElement.getId(), mockClElement); //Mock controlloop data to be returned for the given CL Id ControlLoopProvider mockClProvider = Mockito.mock(ControlLoopProvider.class); diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java index 31d4be472..77f802d61 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/CommonTestData.java @@ -57,7 +57,7 @@ public class CommonTestData { * @return the standard Control Loop parameters as string */ public static String getParameterGroupAsString(final int port, final String dbName) { - return ResourceUtils.getResourceAsString("src/test/resources/parameters/ConfigParametersStd.json") + return ResourceUtils.getResourceAsString("src/test/resources/parameters/InstantiationConfigParametersStd.json") .replace("${port}", String.valueOf(port)).replace("${dbName}", "jdbc:h2:mem:" + dbName); } } diff --git a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java index 83cfe9b52..0d668f139 100644 --- a/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java +++ b/tosca-controlloop/runtime/src/test/java/org/onap/policy/clamp/controlloop/runtime/util/rest/CommonRestController.java @@ -260,4 +260,4 @@ public class CommonRestController { Response rawresp = sendNoAuthRequest(endPoint).delete(); assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), rawresp.getStatus()); } -} +}
\ No newline at end of file diff --git a/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml b/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml index 5df575c22..6e31cca47 100644 --- a/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml +++ b/tosca-controlloop/runtime/src/test/resources/META-INF/persistence.xml @@ -19,6 +19,64 @@ ============LICENSE_END========================================================= --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> + <persistence-unit name="CommissioningMariaDb" transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + + <class>org.onap.policy.models.base.PfConceptKey</class> + <class>org.onap.policy.models.dao.converters.CDataConditioner</class> + <class>org.onap.policy.models.dao.converters.Uuid2String</class> + <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class> + <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class> + <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpStatistics</class> + <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaParameter</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirement</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirements</class> + <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> + + <properties> + <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> + <property name="eclipselink.ddl-generation.output-mode" value="database" /> + <property name="eclipselink.logging.level" value="INFO" /> + + <!-- property name="eclipselink.logging.level" value="ALL" /> + <property name="eclipselink.logging.level.jpa" value="ALL" /> + <property name="eclipselink.logging.level.ddl" value="ALL" /> + <property name="eclipselink.logging.level.connection" value="ALL" /> + <property name="eclipselink.logging.level.sql" value="ALL" /> + <property name="eclipselink.logging.level.transaction" value="ALL" /> + <property name="eclipselink.logging.level.sequencing" value="ALL" /> + <property name="eclipselink.logging.level.server" value="ALL" /> + <property name="eclipselink.logging.level.query" value="ALL" /> + <property name="eclipselink.logging.level.properties" value="ALL" /--> + </properties> + <shared-cache-mode>NONE</shared-cache-mode> + </persistence-unit> + <persistence-unit name="ToscaConceptTest" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> @@ -50,6 +108,7 @@ <class>org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts.JpaClElementStatistics</class> <properties> + <property name="eclipselink.target-database" value="MySQL" /> <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.logging.level" value="INFO" /> @@ -57,4 +116,44 @@ <shared-cache-mode>NONE</shared-cache-mode> </persistence-unit> + <persistence-unit name="InstantiationTests" transaction-type="RESOURCE_LOCAL"> + <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> + + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignment</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityAssignments</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaCapabilityTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTemplates</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaNodeTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaParameter</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipType</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRelationshipTypes</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirement</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaRequirements</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate</class> + <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate</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> + + <properties> + <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> + <property name="eclipselink.ddl-generation.output-mode" value="database" /> + <property name="eclipselink.logging.level" value="INFO" /> + </properties> + <shared-cache-mode>NONE</shared-cache-mode> + </persistence-unit> + </persistence> + diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/CommissioningConfig.json b/tosca-controlloop/runtime/src/test/resources/parameters/CommissioningConfig.json new file mode 100644 index 000000000..bda9da6a1 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/CommissioningConfig.json @@ -0,0 +1,20 @@ +{ + "name": "CommissioningGroup", + "restServerParameters": { + "host": "127.0.0.1", + "port": 6969, + "userName": "admin", + "password": "password", + "https": false, + "aaf": false + }, + "databaseProviderParameters": { + "name": "CommissioningProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "controlloop", + "databasePassword": "C0ntr0lL00p", + "persistenceUnit": "ToscaConceptTest" + } +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParametersStd.json b/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParametersStd.json new file mode 100644 index 000000000..7682a1812 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParametersStd.json @@ -0,0 +1,79 @@ +{ + "name": "ControlLoopRuntimeGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": ${port}, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false + }, + "participantParameters": { + "heartBeatMs": 120000, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "${dbName}", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "InstantiationTests" + }, + "topicParameterGroup": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + }, + "healthCheckRestClientParameters": [ + { + "clientName": "api", + "hostname": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "policy/api/v1/healthcheck" + }, + { + "clientName": "distribution", + "hostname": "policy-distribution", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "healthcheck" + } + ] +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParameters_InvalidName.json b/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParameters_InvalidName.json new file mode 100644 index 000000000..b0c322cb9 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParameters_InvalidName.json @@ -0,0 +1,31 @@ +{ + "name":" ", + "restServerParameters": { + "host": "127.0.0.1", + "port": 6969, + "userName": "admin", + "password": "password", + "https": false, + "aaf": false + }, + "pdpParameters": { + "heartBeatMs": 1, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 1 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 1 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "PdpGroupTest" + } +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParameters_sim.json b/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParameters_sim.json new file mode 100644 index 000000000..0977da9ad --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/InstantiationConfigParameters_sim.json @@ -0,0 +1,43 @@ +{ + "name": "Instantiation", + "restServerParameters": { + "host": "127.0.0.1", + "port": 6969, + "userName": "admin", + "password": "password", + "https": false, + "aaf": false + }, + "pdpParameters": { + "heartBeatMs": 10, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://localhost:3306/policyadmin", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "PolicyMariaDb" + }, + "topicParameterGroup": { + "topicSources" : [{ + "topic" : "INSTANTIATION", + "servers" : [ "localhost:6845" ], + "topicCommInfrastructure" : "dmaap" + }], + "topicSinks" : [{ + "topic" : "INSTANTIATION", + "servers" : [ "localhost:6845" ], + "topicCommInfrastructure" : "dmaap" + }] + } +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/MinimumParametersH2.json b/tosca-controlloop/runtime/src/test/resources/parameters/MinimumParametersH2.json new file mode 100644 index 000000000..f784dcd16 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/MinimumParametersH2.json @@ -0,0 +1,59 @@ +{ + "name":"PapGroup", + "restServerParameters":{ + "host":"0.0.0.0", + "port":6969, + "userName":"healthcheck", + "password":"zb!XztG34" + }, + "pdpParameters": { + "heartBeatMs": 1, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 1 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 1 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "PdpGroupTest" + }, + "topicParameterGroup": { + "topicSources" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "message-router" ], + "topicCommInfrastructure" : "dmaap" + }], + "topicSinks" : [{ + "topic" : "POLICY-PDP-PAP", + "servers" : [ "message-router" ], + "topicCommInfrastructure" : "dmaap" + }] + }, + "healthCheckRestClientParameters":[{ + "clientName": "api", + "hostname": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "policy/api/v1/healthcheck" + }, + { + "clientName": "distribution", + "hostname": "policy-distribution", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "healthcheck" + }] +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/TestParametersMariaDB.json b/tosca-controlloop/runtime/src/test/resources/parameters/TestParametersMariaDB.json new file mode 100644 index 000000000..2c0127b16 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/TestParametersMariaDB.json @@ -0,0 +1,79 @@ +{ + "name": "ControlLoopRuntimeGroup", + "restServerParameters": { + "host": "0.0.0.0", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "https": false, + "aaf": false + }, + "participantParameters": { + "heartBeatMs": 120000, + "updateParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + }, + "stateChangeParameters": { + "maxRetryCount": 1, + "maxWaitMs": 30000 + } + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.mariadb.jdbc.Driver", + "databaseUrl": "jdbc:mariadb://localhost:3306/controlloop", + "databaseUser": "policy", + "databasePassword": "P01icY", + "persistenceUnit": "CommissioningMariaDb" + }, + "topicParameterGroup": { + "topicSources": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap", + "fetchTimeout": 15000 + } + ], + "topicSinks": [ + { + "topic": "POLICY-CLRUNTIME-PARTICIPANT", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + }, + { + "topic": "POLICY-NOTIFICATION", + "servers": [ + "localhost" + ], + "topicCommInfrastructure": "dmaap" + } + ] + }, + "healthCheckRestClientParameters": [ + { + "clientName": "api", + "hostname": "policy-api", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "policy/api/v1/healthcheck" + }, + { + "clientName": "distribution", + "hostname": "policy-distribution", + "port": 6969, + "userName": "healthcheck", + "password": "zb!XztG34", + "useHttps": true, + "basePath": "healthcheck" + } + ] +} diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/Unreadable.json b/tosca-controlloop/runtime/src/test/resources/parameters/Unreadable.json index e69de158b..3d117f416 100644 --- a/tosca-controlloop/runtime/src/test/resources/parameters/Unreadable.json +++ b/tosca-controlloop/runtime/src/test/resources/parameters/Unreadable.json @@ -76,4 +76,3 @@ "basePath": "healthcheck" } ] -
\ No newline at end of file diff --git a/tosca-controlloop/runtime/src/test/resources/parameters/logback-test.xml b/tosca-controlloop/runtime/src/test/resources/parameters/logback-test.xml new file mode 100644 index 000000000..e00c36baa --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/parameters/logback-test.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============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========================================================= +--> + +<configuration> + + <contextName>Apex</contextName> + <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" /> + <property name="LOG_DIR" value="${java.io.tmpdir}/clamp_logging/" /> + + <!-- USE FOR STD OUT ONLY --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern> + </encoder> + </appender> + + <root level="info"> + <appender-ref ref="STDOUT" /> + </root> + + <logger name="org.onap.policy.clamp.controlloop.runtime" level="trace" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> +</configuration> diff --git a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsElementsNotFound.json b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json index 2c8ca20d4..faea7cd48 100644 --- a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsElementsNotFound.json +++ b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopElementsNotFound.json @@ -10,64 +10,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 0", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", "definition": { - "name": "org.onap.domain.pmsh.NotExistFirst", + "name": "org.onap.domain.pmsh.DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c22": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 0 control loop" } - ] + } }, { "name": "PMSHInstance1", @@ -79,64 +79,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 1", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c24": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", "definition": { - "name": "org.onap.domain.pmsh.NotExistSecond", + "name": "org.onap.domain.pmsh.DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c25": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c26": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c27": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 1 control loop" } - ] + } } ] } diff --git a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoops.json b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoops.json index 94c6a619f..13ea1bfc4 100644 --- a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoops.json +++ b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoops.json @@ -10,64 +10,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 0", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c22": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 0 control loop" } - ] + } }, { "name": "PMSHInstance1", @@ -79,64 +79,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 1", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c24": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c25": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c26": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c27": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 1 control loop" } - ] + } } ] } diff --git a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsNotFound.json b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsNotFound.json index 2e13c688f..9e9767472 100644 --- a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsNotFound.json +++ b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsNotFound.json @@ -10,64 +10,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 0", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c22": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 0 control loop" } - ] + } }, { "name": "PMSHInstance1", @@ -79,64 +79,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 1", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c24": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c25": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c26": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c27": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 1 control loop" } - ] + } } ] } diff --git a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsUpdate.json b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsUpdate.json index 9dce01ae4..025e2a1fb 100644 --- a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsUpdate.json +++ b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsUpdate.json @@ -10,64 +10,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 1", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c22": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c23": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c24": { "id": "709c62b3-8918-41b9-a747-d21eb79c6c24", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 0 control loop" } - ] + } }, { "name": "PMSHInstance1", @@ -79,64 +79,64 @@ "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "PMSH control loop instance 1", - "elements": [ - { + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c25": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" }, - "participantId": { - "name": "DCAEParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c26": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c27": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "PolicyParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" }, - { + "709c62b3-8918-41b9-a747-d21eb79c6c28": { "id": "709c62b3-8918-41b9-a747-e21eb79c6c28", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", "version": "1.2.3" }, - "participantId": { - "name": "CDSParticipant0", - "version": "1.0.0" + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", "description": "CDS Control Loop Element for the PMSH instance 1 control loop" } - ] + } } ] } diff --git a/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsVersionNotMatches.json b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsVersionNotMatches.json new file mode 100644 index 000000000..76131afc1 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/rest/controlloops/ControlLoopsVersionNotMatches.json @@ -0,0 +1,142 @@ +{ + "controlLoopList": [ + { + "name": "PMSHInstance0", + "version": "1.0.1", + "definition": { + "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition", + "version": "1.2.3" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH control loop instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c23": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "CDS Control Loop Element for the PMSH instance 0 control loop" + } + } + }, + { + "name": "PMSHInstance1", + "version": "1.0.1", + "definition": { + "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition", + "version": "1.2.3" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH control loop instance 1", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c24": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "DCAE Control Loop Element for the PMSH instance 1 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c25": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Control Loop Element for the PMSH instance 1 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c26": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Control Loop Element for the PMSH instance 1 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c27": { + "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant", + "version": "2.2.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "CDS Control Loop Element for the PMSH instance 1 control loop" + } + } + } + ] +} diff --git a/tosca-controlloop/runtime/src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml b/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml index 099e2e945..099e2e945 100644 --- a/tosca-controlloop/runtime/src/test/resources/servicetemplates/pmsh_multiple_cl_tosca.yaml +++ b/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/PMSHMultipleCLTosca.yaml diff --git a/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml b/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml new file mode 100644 index 000000000..01f825fc9 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/pm_control_loop_tosca.yaml @@ -0,0 +1,452 @@ +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.0 + - UNBOUNDED + version: 0.0.0 + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: + - 0.0 + - UNBOUNDED + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + - send: + capability: org.onap.EventConsumer + relationship: org.onap.PropagateEvent + occurrences: + - 0.0 + - UNBOUNDED + version: 0.0.0 + 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.APP + 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.0 + - UNBOUNDED + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + version: 0.0.0 + 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 + version: 0.0.0 + 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 + version: 0.0.0 + - send_0: + capability: cds-rest-receive + node: org.onap.CDS + version: 0.0.0 + - receive_1: + capability: cds-rest-response + node: org.onap.CDS + version: 0.0.0 + - 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 + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + version: 0.0.0 + 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.0 + - UNBOUNDED + version: 0.0.0 + 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.0 + version: 0.0.0 + version: 0.0.0 + org.onap.controlloop0: + type: org.onap.APP + properties: + application_name: Test Control Loop + provider: Ericsson + application_version: 1.0.0 + status: NOT_DEPLOYED + version: 0.0.0 +version: 0.0.0 diff --git a/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml b/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml new file mode 100644 index 000000000..099e2e945 --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/rest/servicetemplates/pmsh_multiple_cl_tosca.yaml @@ -0,0 +1,221 @@ +tosca_definitions_version: tosca_simple_yaml_1_3 +data_types: + onap.datatypes.ToscaConceptIdentifier: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + version: + type: string + required: true +node_types: + org.onap.policy.clamp.controlloop.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + org.onap.policy.clamp.controlloop.ControlLoopElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + participant_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.ControlLoop: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + elements: + type: list + required: true + entry_schema: + type: onap.datatypes.ToscaConceptIdentifier + org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + dcae_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + policy_type_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.CDSControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + cds_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true +topology_template: + node_templates: + org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.policy.controlloop.PolicyControlLoopParticipant: + version: 2.2.1 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant: + version: 2.2.1 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.domain.pmsh.PMSH_DCAEMicroservice: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the DCAE microservice for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant + version: 2.3.4 + dcae_blueprint_id: + name: org.onap.dcae.blueprints.PMSHBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the monitoring policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.monitoring.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the operational policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.operational.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoopElement + type_version: 1.0.0 + description: Control loop element for CDS for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_Id: + name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant + version: 3.2.1 + cds_blueprint_id: + name: org.onap.ccsdk.cds.PMSHCdsBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSHControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Performance Management Subscription Handling + properties: + provider: Ericsson + elements: + - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement + version: 1.2.3 + org.onap.domain.pmsh.PMSD_DCAEMicroservice: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the DCAE microservice for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant + version: 2.3.4 + dcae_blueprint_id: + name: org.onap.dcae.blueprints.PMSDBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the monitoring policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.monitoring.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the operational policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.operational.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoopElement + type_version: 1.0.0 + description: Control loop element for CDS for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_Id: + name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant + version: 3.2.1 + cds_blueprint_id: + name: org.onap.ccsdk.cds.PMSDCdsBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSDControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Performance Management Subscription Handling + properties: + provider: Ericsson + elements: + - name: org.onap.domain.pmsh.PMSD_DCAEMicroservice + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement + version: 1.2.3 diff --git a/tosca-controlloop/runtime/src/test/resources/testscripts/listenOnTopic.sh b/tosca-controlloop/runtime/src/test/resources/testscripts/listenOnTopic.sh new file mode 100644 index 000000000..5e661777b --- /dev/null +++ b/tosca-controlloop/runtime/src/test/resources/testscripts/listenOnTopic.sh @@ -0,0 +1,31 @@ +#! /bin/bash +# ============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========================================================= + +if [ $# -ne 1 ] +then + echo invalid parameters $*, specify a single parameter as the topic to listen on + exit 1 +fi + +while true +do + curl "http://localhost:3904/events/$1/TEST/1?timeout=60000" + echo "" +done + |