diff options
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main')
13 files changed, 205 insertions, 110 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy index c70c971bc7..3652d56303 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy @@ -101,32 +101,49 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess if (isBlank(serviceInstanceId)) { msg = "Input serviceInstanceId' is null" exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(siRequest) - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map<String, String> inputMap = [:] - if (userParams) { - userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value.toString()) - } } - execution.setVariable("operationType", "CompareModel") - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - } catch (BpmnError e) { - throw e; + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + utils.log("INFO", msg, isDebugEnabled) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("serviceType", subscriptionServiceType) + } + + //modelInvariantIdTarget + String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget") + if (isBlank(modelInvariantIdTarget)) { + msg = "Input modelInvariantIdTarget' is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget) + } + + //modelVersionIdTarget + String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget") + if (isBlank(modelVersionIdTarget)) { + msg = "Input modelVersionIdTarget is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("modelVersionIdTarget", modelVersionIdTarget) + } + + execution.setVariable("operationType", "CompareModel") + } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() utils.log("INFO", msg, isDebugEnabled) @@ -143,13 +160,13 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") // RESTResponse (for API Handler(APIH) Reply Task) - String syncResponse = compareModelsResult.toString() + String syncResponse = compareModelsResult.toJsonStringNoRootName() utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String msg = "Exception in sendSyncResponse: " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index a49a0664e8..77b0657514 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -149,7 +149,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { "modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("serviceModelInfo", serviceModelInfo)
+
execution.setVariable("serviceModelInfo_Target", serviceModelInfo)
utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)
@@ -187,7 +187,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { "modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("serviceModelInfo", serviceModelInfo)
+
execution.setVariable("serviceModelInfo_Original", serviceModelInfo)
utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index 30db8c53eb..0172402185 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -34,6 +34,7 @@ import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse; @@ -84,13 +85,12 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce JsonUtils jsonUtil = new JsonUtils() public void preProcessRequest (DelegateExecution execution) { - execution.setVariable("isDebugLogEnabled","true") def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) String msg = "" - utils.log("INFO"," ***** Enter CompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) + utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) execution.setVariable("prefix", Prefix) //Inputs @@ -121,14 +121,14 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String modelInvariantUuid = execution.getVariable('modelInvariantIdTarget') + String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget") if (isBlank(modelInvariantUuid)){ msg = "Input modelInvariantUuid is null" utils.log("INFO", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String modelUuid = execution.getVariable('modelVersionIdTarget') + String modelUuid = execution.getVariable("modelVersionIdTarget") if (isBlank(modelUuid)){ msg = "Input modelUuid is null" utils.log("INFO", msg, isDebugEnabled) @@ -238,7 +238,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce requestInputs.addAll(resourceParameters.keySet()) } - for(Resource rc : deletedResourceList) { + for(Resource rc : delResourceList) { mi = rc.getModelInfo() String resourceCustomizationUuid = mi.getModelCustomizationUuid() ResourceModelInfo rmodel = new ResourceModelInfo() diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index b9319466d9..95747d5a0b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -18,7 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.infrastructure.scripts; +package org.openecomp.mso.bpmn.infrastructure.scripts + +import org.openecomp.mso.bpmn.core.domain.CloudFlavor import java.util.Map import java.util.Currency.CurrencyNameGetter @@ -174,6 +176,12 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) + //flavorList + ArrayList<CloudFlavor> flavorList = execution.getVariable(cloudSiteId + "_flavorList") + if (flavorList != null) { + execution.setVariable("DCVFM_flavorList", flavorList) + logDebug("flavorList is: " + flavorList, isDebugLogEnabled) + } //source - HARDCODED def source = "VID" execution.setVariable("DCVFM_source", source) @@ -927,6 +935,8 @@ public class DoCreateVfModule extends VfModuleBase { def serviceId = execution.getVariable("DCVFM_serviceId") //serviceInstanceId def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId") + //flavorList + ArrayList<CloudFlavor> flavorList = execution.getVariable("DCVFM_flavorList") //backoutOnFailure def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure") //volumeGroupId @@ -962,6 +972,10 @@ public class DoCreateVfModule extends VfModuleBase { } Map<String, String> vnfParamsMap = execution.getVariable("DCVFM_vnfParamsMap") + // Add flavorLabel List to vnfParamsMap + flavorList.each { cloudFlavor -> + vnfParamsMap.put("label_" + cloudFlavor.getFlavorLabel(), cloudFlavor.getFlavor()) + } String vfModuleParams = "" //Get SDNC Response Data for VF Module Topology String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java deleted file mode 100644 index f89b6a7a58..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.openecomp.mso.bpmn.infrastructure.scripts; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; -import org.openecomp.mso.client.dmaap.DmaapConsumer; -import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer; - -public class PnfReadyEventHandler { - - private ExceptionUtil exceptionUtil; - - private static final String TOPIC_NAME = "VES event"; - - public PnfReadyEventHandler() { - exceptionUtil = new ExceptionUtil(); - } - - public void getPnfReadyEventFromDmaap (DelegateExecution execution) throws Exception { - Object correlationIdVar = execution.getVariable("correlationId"); - if (!(correlationIdVar instanceof String)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "correlationId variable is not String type"); - } - String correlationId = (String) correlationIdVar; - DmaapConsumer dmaapConsumer = new PnfReadyEventConsumer(correlationId); - dmaapConsumer.consume(); - // TODO inform camunda process that event has been received - } -} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java index f4483f5923..417bb4668e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java @@ -28,6 +28,7 @@ import java.io.IOException; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection; import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiResponse; import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation; @@ -58,21 +59,16 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { String correlationId = (String) execution.getVariable(CORRELATION_ID); if (correlationId == null) { - //todo: fix Execution -> DelegateExecution in ALL groovy scripts -// new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); - throw new BpmnError("MSOWorkflowException"); + new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); } try { AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection); execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf()); - aaiResponse.getContainsInfoAboutIp().ifPresent( - isIp -> execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, isIp) - ); + execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp()); } catch (IOException e) { - //todo: log this - throw new BpmnError("MSOWorkflowException"); + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); } } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index 6b49908a0f..0d64f2c8b7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -23,6 +23,9 @@ package org.openecomp.mso.bpmn.infrastructure.pnf.delegate; @SuppressWarnings("ALL") public class ExecutionVariableNames { + private ExecutionVariableNames() { + } + public final static String CORRELATION_ID = "correlationId"; public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java new file mode 100644 index 0000000000..e6019f73f0 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.pnf.dmaap; + +import java.io.IOException; +import java.net.URI; +import javax.ws.rs.core.UriBuilder; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; + +public class PnfEventReadyConsumer { + + private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId"; + private HttpClient httpClient; + + private String dmaapHost; + private int dmaapPort; + private String dmaapProtocol; + private String dmaapUriPathPrefix; + private String dmaapTopicName; + private String consumerId; + private String consumerGroup; + + public PnfEventReadyConsumer() { + httpClient = HttpClientBuilder.create().build(); + } + + public void notifyWhenPnfReady(String correlationId) + throws IOException { + HttpGet getRequest = new HttpGet(buildURI(consumerGroup, consumerId)); + HttpResponse response = httpClient.execute(getRequest); + checkIfResponseIsAccepted(response, correlationId); + } + + private boolean checkIfResponseIsAccepted(HttpResponse response, String correlationId) { + // TODO parse response if contains proper correlationId + return false; + } + + private URI buildURI(String consumerGroup, String consumerId) { + return UriBuilder.fromUri(dmaapUriPathPrefix) + .scheme(dmaapProtocol) + .host(dmaapHost) + .port(dmaapPort).path(dmaapTopicName) + .path(consumerGroup).path(consumerId).build(); + } + + public void setDmaapHost(String dmaapHost) { + this.dmaapHost = dmaapHost; + } + + public void setDmaapPort(int dmaapPort) { + this.dmaapPort = dmaapPort; + } + + public void setDmaapProtocol(String dmaapProtocol) { + this.dmaapProtocol = dmaapProtocol; + } + + public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) { + this.dmaapUriPathPrefix = dmaapUriPathPrefix; + } + + public void setDmaapTopicName(String dmaapTopicName) { + this.dmaapTopicName = dmaapTopicName; + } + + public void setConsumerId(String consumerId) { + this.consumerId = consumerId; + } + + public void setConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java index bbb7adc143..5fb7a43e00 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java @@ -24,28 +24,25 @@ import java.util.Optional; import javax.annotation.Nullable; import javax.validation.constraints.NotNull; -public class AaiResponse { +public enum AaiResponse { + NO_ENTRY(false, false), + ENTRY_NO_IP(true, false), + ENTRY_WITH_IP(true, true); - private Boolean containsInfoAboutPnf; - private Boolean containsInfoAboutIp; - private String ipAddress; + private boolean containsInfoAboutPnf; + private boolean containsInfoAboutIp; - public AaiResponse(@NotNull Boolean containsInfoAboutPnf, @Nullable Boolean containsInfoAboutIp, - @Nullable String ipAddress) { + AaiResponse(boolean containsInfoAboutPnf, boolean containsInfoAboutIp) { this.containsInfoAboutPnf = containsInfoAboutPnf; this.containsInfoAboutIp = containsInfoAboutIp; - this.ipAddress = ipAddress; } - public Boolean getContainsInfoAboutPnf() { + public boolean getContainsInfoAboutPnf() { return containsInfoAboutPnf; } - public Optional<Boolean> getContainsInfoAboutIp() { - return Optional.ofNullable(containsInfoAboutIp); + public boolean getContainsInfoAboutIp() { + return containsInfoAboutIp; } - public Optional<String> getIpAddress() { - return Optional.ofNullable(ipAddress); - } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java index 353a3bd5d3..b982a693da 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java @@ -29,15 +29,14 @@ public class CheckAaiForCorrelationIdImplementation { public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException { Optional<Pnf> pnf = aaiConnection.getEntryFor(correlationId); if (!pnf.isPresent()) { - return new AaiResponse(false, null, null); + return AaiResponse.NO_ENTRY; } - Optional<String> ip = extractIp(pnf.get()); - return ip.map( - s -> new AaiResponse(true, true, s) - ).orElseGet( - () -> new AaiResponse(true, false, null) - ); + if(extractIp(pnf.get()).isPresent()) { + return AaiResponse.ENTRY_WITH_IP; + } else { + return AaiResponse.ENTRY_NO_IP; + } } private Optional<String> extractIp(Pnf pnf) { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties new file mode 100644 index 0000000000..3c4dca49cf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties @@ -0,0 +1,7 @@ +dmaapHost=HOSTNAME +dmaapPort=3905 +dmaapProtocol=http +dmaapUriPathPrefix = events +eventReadyTopicName=pnfEventReady +consumerId=consumerId +consumerGroup=group diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties deleted file mode 100644 index d071fdabf8..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties +++ /dev/null @@ -1,20 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### -processEngineName=infrastructure diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml index 46cea5da63..f46cd065ed 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml +++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml @@ -14,4 +14,18 @@ <property name="aaiConnection" ref="aaiConnection"/>
</bean>
+ <bean id="pnfEventReadyConsumer" class="org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyConsumer">
+ <property name="dmaapHost" value="${dmaapHost}" />
+ <property name="dmaapPort" value="${dmaapPort}"/>
+ <property name="dmaapProtocol" value="${dmaapProtocol}"/>
+ <property name="dmaapUriPathPrefix" value="${dmaapUriPathPrefix}"/>
+ <property name="dmaapTopicName" value="${eventReadyTopicName}"/>
+ <property name= "consumerGroup" value="${consumerGroup}"/>
+ <property name="consumerId" value="${consumerId}"/>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="locations" value="classpath:dmaap.properties"/>
+ </bean>
+
</beans>
|