aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-dcae/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-dcae/src/main')
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java43
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParticipantConfig.java43
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java112
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java126
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java53
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java207
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java55
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java39
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java76
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java35
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java34
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java36
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml57
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json62
-rw-r--r--participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt4
15 files changed, 0 insertions, 982 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java
deleted file mode 100644
index 9be83bbd3..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/DcaeParticipantApplication.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
-import org.springframework.context.annotation.ComponentScan;
-
-/**
- * Starter.
- *
- */
-@SpringBootApplication
-@ComponentScan({
- "org.onap.policy.clamp.controlloop.participant.dcae",
- "org.onap.policy.clamp.controlloop.participant.intermediary"
-})
-@ConfigurationPropertiesScan("org.onap.policy.clamp.controlloop.participant.dcae.main.parameters")
-public class DcaeParticipantApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(DcaeParticipantApplication.class, args);
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParticipantConfig.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParticipantConfig.java
deleted file mode 100644
index 965c3f143..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParticipantConfig.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.config;
-
-import org.onap.policy.clamp.controlloop.participant.dcae.main.handler.ControlLoopElementHandler;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class ParticipantConfig {
-
- /**
- * Register ControlLoopElementListener.
- *
- * @param intermediaryApi the ParticipantIntermediaryApi
- * @param clElementHandler the ControlLoop Element Handler
- */
- @Autowired
- public void registerControlLoopElementListener(ParticipantIntermediaryApi intermediaryApi,
- ControlLoopElementHandler clElementHandler) {
- intermediaryApi.registerControlLoopElementListener(clElementHandler);
- clElementHandler.setIntermediaryApi(intermediaryApi);
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
deleted file mode 100644
index 43326e725..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/AbstractHttpClient.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Collections;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.Response.Status;
-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.event.comm.bus.internal.BusTopicParams;
-import org.onap.policy.common.endpoints.http.client.HttpClient;
-import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
-import org.onap.policy.common.utils.coder.Coder;
-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 String MSG_REQUEST_FAILED = "request to {} failed";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AbstractHttpClient.class);
- private final HttpClient httpclient;
- public static final Coder CODER = new StandardCoder();
-
- /**
- * Constructor.
- *
- * @param restClientParameters the REST client parameters
- * @throws ControlLoopRuntimeException on errors
- */
- protected AbstractHttpClient(BusTopicParams restClientParameters) {
- try {
- httpclient = HttpClientFactoryInstance.getClientFactory().build(restClientParameters);
- } catch (final Exception e) {
- throw new ControlLoopRuntimeException(Status.INTERNAL_SERVER_ERROR,
- restClientParameters.getClientName() + " Client failed to start", e);
- }
- }
-
- protected boolean executePut(String path, String jsonEntity, int statusCode) {
- try {
- var response = httpclient.put(path, Entity.json(jsonEntity), Collections.emptyMap());
- return response.getStatus() == statusCode;
- } catch (Exception e) {
- LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e);
- return false;
- }
- }
-
- protected boolean executePut(String path, int statusCode) {
- try {
- var response = httpclient.put(path, Entity.json(""), Collections.emptyMap());
- return response.getStatus() == statusCode;
- } catch (Exception e) {
- LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e);
- return false;
- }
- }
-
- protected Loop executePost(String path, int statusCode) {
- try {
- var response = httpclient.post(path, Entity.json(""), Collections.emptyMap());
- if (response.getStatus() != statusCode) {
- return null;
- }
- return response.readEntity(Loop.class);
- } catch (Exception e) {
- LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e);
- return null;
- }
- }
-
- protected Loop executeGet(String path, int statusCode) {
- try {
- var response = httpclient.get(path);
-
- if (response.getStatus() != statusCode) {
- return null;
- }
- return response.readEntity(Loop.class);
- } catch (Exception e) {
- LOGGER.error(MSG_REQUEST_FAILED, httpclient.getName(), e);
- return null;
- }
- }
-
- @Override
- public void close() throws IOException {
- httpclient.shutdown();
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
deleted file mode 100644
index 3d8308bc1..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
-
-import org.apache.http.HttpStatus;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ClampEndPoints;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
-import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ClampHttpClient extends AbstractHttpClient {
-
- private final ClampEndPoints endPoints;
- public static final String STATUS_NOT_FOUND = "STATUS_NOT_FOUND";
- public static final String POLICY_NOT_FOUND = "POLICY_NOT_FOUND";
-
- /**
- * Constructor.
- *
- * @param parameters the DCAE parameters
- */
- public ClampHttpClient(ParticipantDcaeParameters parameters) {
- super(parameters.getClampClientParameters());
- this.endPoints = parameters.getClampClientEndPoints();
- }
-
- /**
- * 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(endPoints.getCreate(), loopName, templateName), HttpStatus.SC_OK);
- }
-
- /**
- * Deploy.
- *
- * @param loopName the loopName
- * @return true
- */
- public boolean deploy(String loopName) {
- return executePut(endPoints.getDeploy() + 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(endPoints.getStatus() + loopName, HttpStatus.SC_OK);
- }
-
- /**
- * Undeploy.
- *
- * @param loopName the loopName
- * @return true
- */
- public boolean undeploy(String loopName) {
- return executePut(endPoints.getUndeploy() + loopName, HttpStatus.SC_ACCEPTED);
- }
-
- /**
- * Stop.
- *
- * @param loopName the loopName
- * @return true
- */
- public boolean stop(String loopName) {
- return executePut(endPoints.getStop() + loopName, HttpStatus.SC_OK);
- }
-
- /**
- * Delete.
- *
- * @param loopName the loopName
- * @return true
- */
- public boolean delete(String loopName) {
- return executePut(endPoints.getDelete() + 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;
- }
- var externalComponent = loop.getComponents().get("DCAE");
- if (externalComponent == null || externalComponent.getComponentState() == null) {
- return STATUS_NOT_FOUND;
- }
-
- return externalComponent.getComponentState().getStateName();
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
deleted file mode 100644
index 4cdcf7c7f..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.httpclient;
-
-import org.apache.http.HttpStatus;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ConsulEndPoints;
-import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ConsulDcaeHttpClient extends AbstractHttpClient {
-
- private final ConsulEndPoints endPoints;
-
- /**
- * Constructor.
- *
- * @param parameters the DCAE parameters
- */
- public ConsulDcaeHttpClient(ParticipantDcaeParameters parameters) {
- super(parameters.getConsulClientParameters());
- this.endPoints = parameters.getConsulClientEndPoints();
- }
-
- /**
- * Call deploy consult.
- *
- * @param name the name to deploy
- * @param jsonEntity the Entity
- * @return true
- */
- public boolean deploy(String name, String jsonEntity) {
- return executePut(endPoints.getDeploy() + name, jsonEntity, HttpStatus.SC_OK);
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
deleted file mode 100644
index ca763f119..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.handler;
-
-import java.time.Instant;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import lombok.Setter;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementStatistics;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ClampHttpClient;
-import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ConsulDcaeHttpClient;
-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.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener;
-import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi;
-import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-/**
- * This class handles implementation of controlLoopElement updates.
- */
-@Component
-public class ControlLoopElementHandler implements ControlLoopElementListener {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ControlLoopElementHandler.class);
- private final ClampHttpClient clampClient;
- private final ConsulDcaeHttpClient consulClient;
-
- @Setter
- private ParticipantIntermediaryApi intermediaryApi;
-
- private static final String LOOP = "pmsh_loop";
- private static final String TEMPLATE = "LOOP_TEMPLATE_k8s_pmsh";
- private static final String POLICY = "policy";
-
- private static final String BLUEPRINT_DEPLOYED = "BLUEPRINT_DEPLOYED";
- private static final String MICROSERVICE_INSTALLED_SUCCESSFULLY = "MICROSERVICE_INSTALLED_SUCCESSFULLY";
-
- private int checkCount;
- private int secCount;
-
- private String bodyConsul;
-
- /**
- * Constructor.
- *
- * @param clampClient the CLAMP client
- * @param consulClient the Consul client
- */
- public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient,
- ParticipantDcaeParameters parameters) {
- this.clampClient = clampClient;
- this.consulClient = consulClient;
- this.checkCount = parameters.getCheckCount();
- this.secCount = parameters.getSecCount();
- bodyConsul = ResourceUtils.getResourceAsString(parameters.getJsonBodyConsulPath());
- }
-
- /**
- * 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(ToscaConceptIdentifier controlLoopId,
- UUID controlLoopElementId, ControlLoopState currentState,
- ControlLoopOrderedState newState) {
- switch (newState) {
- case UNINITIALISED:
- var loop = clampClient.getstatus(LOOP);
- if (loop != null) {
- clampClient.undeploy(LOOP);
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState,
- ControlLoopState.UNINITIALISED, ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- }
- break;
- case PASSIVE:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- break;
- case RUNNING:
- intermediaryApi.updateControlLoopElementState(controlLoopId,
- controlLoopElementId, newState, ControlLoopState.RUNNING,
- ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE);
- break;
- default:
- LOGGER.debug("Unknown orderedstate {}", newState);
- break;
- }
- }
-
- private Loop getStatus() throws PfModelException {
- var 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(POLICY, bodyConsul)) {
- 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 nodeTemplate toscaNodeTemplate
- * @throws PfModelException in case of an exception
- */
- @Override
- public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId,
- ControlLoopElement element, ToscaNodeTemplate nodeTemplate)
- throws PfModelException {
- try {
- var loop = getStatus();
-
- if (BLUEPRINT_DEPLOYED.equals(ClampHttpClient.getStatusCode(loop))) {
- deploy();
- var deployedFlag = false;
- for (var i = 0; i < checkCount; i++) {
- // sleep 10 seconds
- TimeUnit.SECONDS.sleep(secCount);
- loop = getStatus();
- String status = ClampHttpClient.getStatusCode(loop);
- if (MICROSERVICE_INSTALLED_SUCCESSFULLY.equals(status)) {
- intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(),
- element.getOrderedState(), ControlLoopState.PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_UPDATE);
- deployedFlag = true;
- break;
- }
- }
- if (!deployedFlag) {
- LOGGER.warn("DCAE is not deployed properly, ClElement state will be UNINITIALISED2PASSIVE");
- intermediaryApi.updateControlLoopElementState(controlLoopId, element.getId(),
- element.getOrderedState(), ControlLoopState.UNINITIALISED2PASSIVE,
- ParticipantMessageType.CONTROL_LOOP_UPDATE);
- }
- }
- } catch (PfModelException e) {
- throw e;
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new PfModelException(null, e.getMessage(), 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) {
- var clElement = intermediaryApi.getControlLoopElement(controlLoopElementId);
- if (clElement != null) {
- var clElementStatistics = new ClElementStatistics();
- clElementStatistics.setControlLoopState(clElement.getState());
- clElementStatistics.setTimeStamp(Instant.now());
- intermediaryApi.updateControlLoopElementStatistics(controlLoopElementId, clElementStatistics);
- }
- }
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java
deleted file mode 100644
index 12b67ebda..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-
-import javax.validation.constraints.NotBlank;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.validation.annotation.Validated;
-
-/**
- * Class to hold all end points needed for clamp client.
- *
- */
-@Validated
-@Getter
-@Setter
-public class ClampEndPoints {
-
- @NotBlank
- private String status;
-
- @NotBlank
- private String create;
-
- @NotBlank
- private String deploy;
-
- @NotBlank
- private String stop;
-
- @NotBlank
- private String delete;
-
- @NotBlank
- private String undeploy;
-
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java
deleted file mode 100644
index ffbfa409c..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-
-import javax.validation.constraints.NotBlank;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.validation.annotation.Validated;
-
-/**
- * Class to hold all end points needed for consul client.
- *
- */
-@Validated
-@Getter
-@Setter
-public class ConsulEndPoints {
-
- @NotBlank
- private String deploy;
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
deleted file mode 100644
index 1ef9e2fdd..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters;
-
-import javax.validation.Valid;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import lombok.Getter;
-import lombok.Setter;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters;
-import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantParameters;
-import org.onap.policy.common.endpoints.parameters.RestClientParameters;
-import org.onap.policy.common.parameters.validation.ParameterGroupConstraint;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.validation.annotation.Validated;
-
-/**
- * Class to hold all parameters needed for the participant dcae.
- *
- */
-@Validated
-@Getter
-@Setter
-@ConfigurationProperties(prefix = "participant")
-public class ParticipantDcaeParameters implements ParticipantParameters {
-
- @NotNull
- @Min(10)
- private int checkCount = 10;
-
- @NotNull
- @Min(1)
- private int secCount = 10;
-
- @NotBlank
- private String jsonBodyConsulPath;
-
- @NotNull
- @Valid
- private ClampEndPoints clampClientEndPoints;
-
- @NotNull
- @Valid
- private ConsulEndPoints consulClientEndPoints;
-
- @NotNull
- @ParameterGroupConstraint
- private RestClientParameters clampClientParameters;
-
- @NotNull
- @ParameterGroupConstraint
- private RestClientParameters consulClientParameters;
-
- @NotNull
- @Valid
- private ParticipantIntermediaryParameters intermediaryParameters;
-}
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java
deleted file mode 100644
index 01a514f43..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.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/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java
deleted file mode 100644
index da7360a9b..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/ExternalComponentState.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.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/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java
deleted file mode 100644
index d84270500..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/model/Loop.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.clamp.controlloop.participant.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/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
deleted file mode 100644
index a873f76b3..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml
+++ /dev/null
@@ -1,57 +0,0 @@
-server:
- port: 8081
-
-participant:
- name: ControlLoopParticipantDcae
- clampClientEndPoints:
- status: /restservices/clds/v2/loop/getstatus/
- create: /restservices/clds/v2/loop/create/%s?templateName=%s
- deploy: /restservices/clds/v2/loop/deploy/
- stop: /restservices/clds/v2/loop/stop/
- delete: /restservices/clds/v2/loop/delete/
- undeploy: /restservices/clds/v2/loop/undeploy/
- clampClientParameters:
- clientName: Clamp
- hostname: 0.0.0.0
- port: 8443
- userName: admin
- password: password
- https: true
- aaf: false
- consulClientEndPoints:
- deploy: "/v1/kv/dcae-pmsh:"
- consulClientParameters:
- clientName: Consul
- hostname: consul
- port: 31321
- userName: admin
- password: password
- https: false
- aaf: false
- intermediaryParameters:
- name: Participant parameters
- reportingTimeIntervalMs: 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:
- - ${topicServer:localhost}
- topicCommInfrastructure: dmaap
- fetchTimeout: 15000
- topicSinks:
- -
- topic: POLICY-CLRUNTIME-PARTICIPANT
- servers:
- - ${topicServer:localhost}
- topicCommInfrastructure: dmaap
- checkCount: 10
- secCount: 10
- jsonBodyConsulPath: src/main/resources/parameters/consul.json
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json b/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json
deleted file mode 100644
index 3aad78ee8..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "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/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt b/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt
deleted file mode 100644
index dbd67585f..000000000
--- a/participant/participant-impl/participant-impl-dcae/src/main/resources/version.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-ONAP Tosca defined control loop Participant
-Version: ${project.version}
-Built (UTC): ${maven.build.timestamp}
-ONAP https://wiki.onap.org