diff options
Diffstat (limited to 'participant/participant-impl/participant-impl-dcae/src/main')
10 files changed, 248 insertions, 256 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java index fd19d9d3a..74c1ee5c1 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ClampHttpClient.java @@ -21,6 +21,7 @@ package org.onap.policy.clamp.controlloop.participant.dcae.httpclient; import org.apache.http.HttpStatus; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ClampEndPoints; import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; import org.onap.policy.clamp.controlloop.participant.dcae.model.ExternalComponent; import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; @@ -29,12 +30,7 @@ import org.springframework.stereotype.Component; @Component public class ClampHttpClient extends AbstractHttpClient { - 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 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/"; + private final ClampEndPoints endPoints; public static final String STATUS_NOT_FOUND = "STATUS_NOT_FOUND"; public static final String POLICY_NOT_FOUND = "POLICY_NOT_FOUND"; @@ -45,6 +41,7 @@ public class ClampHttpClient extends AbstractHttpClient { */ public ClampHttpClient(ParticipantDcaeParameters parameters) { super(parameters.getClampClientParameters()); + this.endPoints = parameters.getClampClientEndPoints(); } /** @@ -55,7 +52,7 @@ public class ClampHttpClient extends AbstractHttpClient { * @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); + return executePost(String.format(endPoints.getCreate(), loopName, templateName), HttpStatus.SC_OK); } /** @@ -65,7 +62,7 @@ public class ClampHttpClient extends AbstractHttpClient { * @return true */ public boolean deploy(String loopName) { - return executePut(DEPLOY + loopName, HttpStatus.SC_ACCEPTED); + return executePut(endPoints.getDeploy() + loopName, HttpStatus.SC_ACCEPTED); } /** @@ -75,7 +72,7 @@ public class ClampHttpClient extends AbstractHttpClient { * @return the Loop object or null if error occurred */ public Loop getstatus(String loopName) { - return executeGet(STATUS + loopName, HttpStatus.SC_OK); + return executeGet(endPoints.getStatus() + loopName, HttpStatus.SC_OK); } /** @@ -85,7 +82,7 @@ public class ClampHttpClient extends AbstractHttpClient { * @return true */ public boolean undeploy(String loopName) { - return executePut(UNDEPLOY + loopName, HttpStatus.SC_ACCEPTED); + return executePut(endPoints.getUndeploy() + loopName, HttpStatus.SC_ACCEPTED); } /** @@ -95,7 +92,7 @@ public class ClampHttpClient extends AbstractHttpClient { * @return true */ public boolean stop(String loopName) { - return executePut(STOP + loopName, HttpStatus.SC_OK); + return executePut(endPoints.getStop() + loopName, HttpStatus.SC_OK); } /** @@ -105,7 +102,7 @@ public class ClampHttpClient extends AbstractHttpClient { * @return true */ public boolean delete(String loopName) { - return executePut(DELETE + loopName, HttpStatus.SC_OK); + return executePut(endPoints.getDelete() + loopName, HttpStatus.SC_OK); } /** diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java index 154dd09be..4cdcf7c7f 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/httpclient/ConsulDcaeHttpClient.java @@ -21,13 +21,14 @@ package org.onap.policy.clamp.controlloop.participant.dcae.httpclient; import org.apache.http.HttpStatus; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ConsulEndPoints; import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; import org.springframework.stereotype.Component; @Component public class ConsulDcaeHttpClient extends AbstractHttpClient { - private static final String DEPLOY = "/v1/kv/dcae-pmsh:"; + private final ConsulEndPoints endPoints; /** * Constructor. @@ -36,16 +37,17 @@ public class ConsulDcaeHttpClient extends AbstractHttpClient { */ public ConsulDcaeHttpClient(ParticipantDcaeParameters parameters) { super(parameters.getConsulClientParameters()); + this.endPoints = parameters.getConsulClientEndPoints(); } /** - * Call consult. + * Call deploy consult. * * @param name the name to deploy * @param jsonEntity the Entity * @return true */ public boolean deploy(String name, String jsonEntity) { - return executePut(DEPLOY + name, jsonEntity, HttpStatus.SC_OK); + return executePut(endPoints.getDeploy() + name, jsonEntity, HttpStatus.SC_OK); } } diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java index 6c5ff1d78..5a0ddabfd 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/handler/ControlLoopElementHandler.java @@ -30,9 +30,11 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ClampHttpClient; import org.onap.policy.clamp.controlloop.participant.dcae.httpclient.ConsulDcaeHttpClient; +import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.ParticipantDcaeParameters; import org.onap.policy.clamp.controlloop.participant.dcae.model.Loop; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; +import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.Logger; @@ -58,19 +60,11 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { 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\" } ] } } ] } }"; + + private int checkCount; + private int secCount; + + private String bodyConsul; /** * Constructor. @@ -78,9 +72,13 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { * @param clampClient the CLAMP client * @param consulClient the Consul client */ - public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient) { + public ControlLoopElementHandler(ClampHttpClient clampClient, ConsulDcaeHttpClient consulClient, + ParticipantDcaeParameters parameters) { this.clampClient = clampClient; this.consulClient = consulClient; + this.checkCount = parameters.getCheckCount(); + this.secCount = parameters.getSecCount(); + bodyConsul = ResourceUtils.getResourceAsString(parameters.getJsonBodyConsulPath()); } /** @@ -126,7 +124,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { } private void deploy() throws PfModelException { - if (!consulClient.deploy(POLICY, BODY_CONSUL)) { + if (!consulClient.deploy(POLICY, bodyConsul)) { throw new PfModelException(null, "deploy to consul failed"); } if (!clampClient.deploy(LOOP)) { @@ -150,9 +148,9 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { if (BLUEPRINT_DEPLOYED.equals(ClampHttpClient.getStatusCode(loop))) { deploy(); boolean deployedFlag = false; - for (int i = 0; i < CHECK_COUNT; i++) { + for (int i = 0; i < checkCount; i++) { // sleep 10 seconds - TimeUnit.SECONDS.sleep(CHECK_COUNT); + TimeUnit.SECONDS.sleep(secCount); loop = getStatus(); String status = ClampHttpClient.getStatusCode(loop); if (MICROSERVICE_INSTALLED_SUCCESSFULLY.equals(status)) { diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParametersConfig.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java index ee649c993..12b67ebda 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/config/ParametersConfig.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ClampEndPoints.java @@ -18,23 +18,38 @@ * ============LICENSE_END========================================================= */ -package org.onap.policy.clamp.controlloop.participant.dcae.config; +package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters; -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.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; +import javax.validation.constraints.NotBlank; +import lombok.Getter; +import lombok.Setter; +import org.springframework.validation.annotation.Validated; -@Configuration -public class ParametersConfig { +/** + * Class to hold all end points needed for clamp client. + * + */ +@Validated +@Getter +@Setter +public class ClampEndPoints { + + @NotBlank + private String status; + + @NotBlank + private String create; + + @NotBlank + private String deploy; + + @NotBlank + private String stop; + + @NotBlank + private String delete; - @Value("${participant.file}") - private String file; + @NotBlank + private String undeploy; - @Bean - public ParticipantDcaeParameters participantDcaeParameters() throws ControlLoopException { - return new ParticipantDcaeParameterHandler().toParticipantDcaeParameters(file); - } } diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java new file mode 100644 index 000000000..ffbfa409c --- /dev/null +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ConsulEndPoints.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters; + +import javax.validation.constraints.NotBlank; +import lombok.Getter; +import lombok.Setter; +import org.springframework.validation.annotation.Validated; + +/** + * Class to hold all end points needed for consul client. + * + */ +@Validated +@Getter +@Setter +public class ConsulEndPoints { + + @NotBlank + private String deploy; +} diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java deleted file mode 100644 index 689bb40c2..000000000 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameterHandler.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters; - -import java.io.File; -import javax.ws.rs.core.Response; -import org.onap.policy.clamp.controlloop.common.exception.ControlLoopException; -import org.onap.policy.common.parameters.BeanValidationResult; -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; - -/** - * This class handles reading, parsing and validating of control loop runtime parameters from JSON files. - */ -public class ParticipantDcaeParameterHandler { - - private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantDcaeParameterHandler.class); - - private static final Coder CODER = new StandardCoder(); - - /** - * Read the parameters from the path of the file. - * - * @param path path of the config file. - * @return the parameters read from the configuration file - * @throws ControlLoopException on parameter exceptions - */ - public ParticipantDcaeParameters toParticipantDcaeParameters(String path) throws ControlLoopException { - ParticipantDcaeParameters parameters = null; - // Read the parameters - try { - // Read the parameters from JSON - File file = new File(path); - parameters = CODER.decode(file, ParticipantDcaeParameters.class); - } catch (final CoderException e) { - final String errorMessage = - "error reading parameters from \"" + path + "\"\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 \"" + path + "\""; - LOGGER.error(errorMessage); - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, errorMessage); - } - - // validate the parameters - final BeanValidationResult validationResult = parameters.validate(); - if (!validationResult.isValid()) { - final String returnMessage = - "validation error(s) on parameters from \"" + path + "\"\n" + validationResult.getResult(); - - LOGGER.error(returnMessage); - throw new ControlLoopException(Response.Status.NOT_ACCEPTABLE, returnMessage); - } - - return parameters; - } - -} diff --git a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java index 469a6fe79..798781177 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java +++ b/participant/participant-impl/participant-impl-dcae/src/main/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/ParticipantDcaeParameters.java @@ -20,77 +20,56 @@ package org.onap.policy.clamp.controlloop.participant.dcae.main.parameters; +import javax.validation.Valid; +import javax.validation.constraints.Min; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import lombok.Getter; -import org.apache.commons.lang3.StringUtils; +import lombok.Setter; import org.onap.policy.clamp.controlloop.participant.intermediary.parameters.ParticipantIntermediaryParameters; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; -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; +import org.onap.policy.common.endpoints.parameters.RestClientParameters; +import org.onap.policy.common.parameters.validation.ParameterGroupConstraint; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; /** * Class to hold all parameters needed for the participant dcae. * */ -@NotNull -@NotBlank +@Validated @Getter -public class ParticipantDcaeParameters extends ParameterGroupImpl { +@Setter +@ConfigurationProperties(prefix = "participant") +public class ParticipantDcaeParameters { - private static final String MSG_IS_BLANK = "is blank"; + @NotNull + @Min(10) + private int checkCount = 10; - @Valid - private BusTopicParams clampClientParameters; + @NotNull + @Min(1) + private int secCount = 10; + + @NotBlank + private String jsonBodyConsulPath; + @NotNull @Valid - private BusTopicParams consulClientParameters; + private ClampEndPoints clampClientEndPoints; - private ParticipantIntermediaryParameters intermediaryParameters; - private PolicyModelsProviderParameters databaseProviderParameters; + @NotNull + @Valid + private ConsulEndPoints consulClientEndPoints; - /** - * Create the participant dcae parameter group. - * - * @param name the parameter group name - */ - public ParticipantDcaeParameters(final String name) { - super(name); - } + @NotNull + @ParameterGroupConstraint + private RestClientParameters clampClientParameters; - /** - * {@inheritDoc}. - */ - @Override - public BeanValidationResult validate() { - BeanValidationResult result = super.validate(); - if (result.isValid()) { - result.addResult(checkMissingMandatoryParams(clampClientParameters)); - result.addResult(checkMissingMandatoryParams(consulClientParameters)); - } - return result; - } + @NotNull + @ParameterGroupConstraint + private RestClientParameters consulClientParameters; - private BeanValidationResult checkMissingMandatoryParams(BusTopicParams clientParameters) { - BeanValidationResult result = new BeanValidationResult(clientParameters.getClientName(), clientParameters); - if (clientParameters.isHostnameInvalid()) { - result.addResult("Host", clientParameters.getHostname(), ValidationStatus.INVALID, MSG_IS_BLANK); - } - if (clientParameters.isClientNameInvalid()) { - result.addResult("Name", clientParameters.getClientName(), ValidationStatus.INVALID, MSG_IS_BLANK); - } - if (StringUtils.isBlank(clientParameters.getPassword())) { - result.addResult("Password", clientParameters.getPassword(), ValidationStatus.INVALID, MSG_IS_BLANK); - } - if (StringUtils.isBlank(clientParameters.getUserName())) { - result.addResult("UserName", clientParameters.getUserName(), ValidationStatus.INVALID, MSG_IS_BLANK); - } - if (clientParameters.isPortInvalid()) { - result.addResult("Port", clientParameters.getPort(), ValidationStatus.INVALID, "is not valid"); - } - return result; - } + @NotNull + @Valid + private ParticipantIntermediaryParameters intermediaryParameters; } diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json deleted file mode 100644 index a7ea089b2..000000000 --- a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/DCAEParticipantConfig.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "ControlLoopParticipantDcae", - "clampClientParameters": { - "clientName": "Clamp", - "hostname": "0.0.0.0", - "port": 8443, - "userName": "admin", - "password": "password", - "useHttps": true, - "allowSelfSignedCerts": false - }, - "consulClientParameters": { - "clientName": "Consul", - "hostname": "consul", - "port": 31321, - "userName": "admin", - "password": "password", - "useHttps": 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/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml index 58908cf8d..36b9f846a 100644 --- a/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/config/application.yaml @@ -1,3 +1,55 @@ participant: - file: src/main/resources/config/DCAEParticipantConfig.json + name: ControlLoopParticipantDcae + clampClientEndPoints: + status: /restservices/clds/v2/loop/getstatus/ + create: /restservices/clds/v2/loop/create/%s?templateName=%s + deploy: /restservices/clds/v2/loop/deploy/ + stop: /restservices/clds/v2/loop/stop/ + delete: /restservices/clds/v2/loop/delete/ + undeploy: /restservices/clds/v2/loop/undeploy/ + clampClientParameters: + clientName: Clamp + hostname: 0.0.0.0 + port: 8443 + userName: admin + password: password + https: true + aaf: false + consulClientEndPoints: + deploy: "/v1/kv/dcae-pmsh:" + consulClientParameters: + clientName: Consul + hostname: consul + port: 31321 + userName: admin + password: password + https: false + aaf: false + intermediaryParameters: + name: Participant parameters + 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[0]: + topic: POLICY-CLRUNTIME-PARTICIPANT + servers[0]: ${topicServer:message-router} + topicCommInfrastructure: dmaap + fetchTimeout: 15000 + topicSinks[0]: + topic: POLICY-CLRUNTIME-PARTICIPANT + servers[0]: ${topicServer:message-router} + topicCommInfrastructure: dmaap + topicSinks[1]: + topic: POLICY-NOTIFICATION + servers[0]: ${topicServer:message-router} + topicCommInfrastructure: dmaap + checkCount: 10 + secCount: 10 + jsonBodyConsulPath: src/main/resources/parameters/consul.json diff --git a/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json b/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json new file mode 100644 index 000000000..3aad78ee8 --- /dev/null +++ b/participant/participant-impl/participant-impl-dcae/src/main/resources/parameters/consul.json @@ -0,0 +1,62 @@ +{ + "subscription": { + "subscriptionName": "subscriptiona", + "administrativeState": "UNLOCKED", + "fileBasedGP": 15, + "fileLocation": "/pm/pm.xml", + "nfFilter": { + "nfNames": [ + "^pnf1.*" + ], + "modelInvariantIDs": [ + "5845y423-g654-6fju-po78-8n53154532k6", + "7129e420-d396-4efb-af02-6b83499b12f8" + ], + "modelVersionIDs": [ + "e80a6ae3-cafd-4d24-850d-e14c084a5ca9" + ] + }, + "measurementGroups": [ + { + "measurementGroup": { + "measurementTypes": [ + { + "measurementType": "countera" + }, + { + "measurementType": "counterb" + } + ], + "managedObjectDNsBasic": [ + { + "DN": "dna" + }, + { + "DN": "dnb" + } + ] + } + }, + { + "measurementGroup": { + "measurementTypes": [ + { + "measurementType": "counterc" + }, + { + "measurementType": "counterd" + } + ], + "managedObjectDNsBasic": [ + { + "DN": "dnc" + }, + { + "DN": "dnd" + } + ] + } + } + ] + } +} |