diff options
Diffstat (limited to 'tosca-controlloop/participant/participant-impl')
62 files changed, 7722 insertions, 3545 deletions
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/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json new file mode 100644 index 000000000..581ce8f4f --- /dev/null +++ b/tosca-controlloop/participant/participant-impl/participant-impl-dcae/src/test/resources/parameters/Unreadable.json @@ -0,0 +1,81 @@ +{ + "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": "ToscaConceptTest" + }, + "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/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-policy/src/test/resources/pmsh/PMSubscriptionHandling.yaml b/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/pmsh/PMSubscriptionHandling.yaml deleted file mode 100644 index c15d11643..000000000 --- a/tosca-controlloop/participant/participant-impl/participant-impl-policy/src/test/resources/pmsh/PMSubscriptionHandling.yaml +++ /dev/null @@ -1,3274 +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========================================================= -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 -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_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/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"); + } } } |