summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java8
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/application-test.yaml1
-rw-r--r--adapters/mso-nssmf-adapter/pom.xml1
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml1
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java38
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java9
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java27
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java37
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java20
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy63
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy264
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java24
-rw-r--r--common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java51
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-app16
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image17
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/start-app.sh4
20 files changed, 465 insertions, 157 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index ca0180ae4b..b26b49ec70 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -81,7 +81,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
private static final Integer DEFAULT_MSB_PORT = 80;
private static final String DEFAULT_MSB_IP = "127.0.0.1";
+ private static final String DEFAULT_MSB_SCHEME = "http";
private static final String ONAP_IP = "ONAP_IP";
+ private static final String MSB_SCHEME = "MSB_SCHEME";
private final HttpClientFactory httpClientFactory = new HttpClientFactory();
@Autowired
@@ -795,10 +797,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
msbIp = environment.getProperty("mso.msb-ip", DEFAULT_MSB_IP);
}
Integer msbPort = environment.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
+ String msbScheme = System.getenv().get(MSB_SCHEME);
+ if (null == msbScheme || msbScheme.isEmpty()) {
+ msbScheme = environment.getProperty("mso.msb-scheme", DEFAULT_MSB_SCHEME);
+ }
String path = "/api/multicloud/v1/" + cloudOwner + "/" + cloudSiteId + "/infra_workload";
- String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme("http").build().toString();
+ String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme(msbScheme).build().toString();
if (workloadId != null) {
String middlepart = null;
if (isName) {
diff --git a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
index 32a4db6b80..117d616cd4 100644
--- a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
+++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
@@ -53,6 +53,7 @@ mso:
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
+ msb-scheme: http
catalog:
db:
spring:
diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml
index b6b52ce7c5..bad9c5a81f 100644
--- a/adapters/mso-nssmf-adapter/pom.xml
+++ b/adapters/mso-nssmf-adapter/pom.xml
@@ -28,6 +28,7 @@
<artifactId>adapters</artifactId>
<version>1.6.0-SNAPSHOT</version>
</parent>
+ <groupId>org.onap.so.adapters</groupId>
<artifactId>mso-nssmf-adapter</artifactId>
<packaging>jar</packaging>
<name>mso-nssmf-adapter</name>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 20fd812ab9..6171e7a624 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -66,6 +66,7 @@ mso:
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
+ msb-scheme: http
catalog:
db:
spring:
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
index d0f86c722e..d59984bb52 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
@@ -6,12 +6,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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.
@@ -52,21 +54,25 @@ public final class ASDCStatusCallBack implements IStatusCallback {
try {
- if (iStatus.getStatus() != null) {
- if (iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK)
- || iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) {
- WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository
- .findById(iStatus.getDistributionID()).orElseGet(() -> null);
- if (watchdogDistributionStatus == null) {
- watchdogDistributionStatus = new WatchdogDistributionStatus();
- watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID());
- watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
- }
- logger.debug(event);
- toscaInstaller.installTheComponentStatus(iStatus);
-
- }
+ if (iStatus.getStatus() == null) {
+ logger.info("Missing status on Status Object. ");
+ return;
+ }
+ if (!iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK)
+ && !iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) {
+ logger.info("Status is not 'Component Done OK' or 'Component Done Error'");
+ return;
}
+ WatchdogDistributionStatus watchdogDistributionStatus =
+ watchdogDistributionStatusRepository.findById(iStatus.getDistributionID()).orElseGet(() -> null);
+ if (watchdogDistributionStatus == null) {
+ watchdogDistributionStatus = new WatchdogDistributionStatus();
+ watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID());
+ watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
+ }
+ logger.debug(event);
+ toscaInstaller.installTheComponentStatus(iStatus);
+
} catch (ArtifactInstallerException e) {
logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e);
logger.debug("Error in ASDCStatusCallback {}", e.getMessage());
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
index 13cace404e..0a1b1c531e 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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.
@@ -37,7 +39,6 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage
public FinalDistributionStatusMessage(String distributionId, final DistributionStatusEnum distributionStatusEnum,
final long timestampL, String consumerId) {
- // componentName = componentname;
consumerID = consumerId;
distributionID = distributionId;
status = distributionStatusEnum;
@@ -68,6 +69,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage
this.timestamp = timestamp;
}
+ @Override
public String getComponentName() {
return componentName;
}
@@ -76,6 +78,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage
this.componentName = componentName;
}
+ @Override
public String getConsumerID() {
return consumerID;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
index 7bd9c752a4..34f21ab813 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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.
@@ -50,43 +52,37 @@ public class JsonStatusData implements IStatusData {
@Override
public String getDistributionID() {
- // return (String)this.attributesMap.get("distributionID");
return "35120a87-1f82-4276-9735-f6de5a244d65";
}
@Override
public String getConsumerID() {
- // return (String)this.attributesMap.get("consumerID");
return "mso.123456";
}
@Override
public String getComponentName() {
- // return (String)this.attributesMap.get("componentName");
return "SDN-C";
}
@Override
public Long getTimestamp() {
- // return (String)this.attributesMap.get("timestamp");
return null;
}
@Override
public String getArtifactURL() {
- // return (String)this.attributesMap.get("artifactURL");
return "/sdc/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml";
}
@Override
public DistributionStatusEnum getStatus() {
- // return (DistributionStatusEnum)this.attributesMap.get(DistributionStatusEnum.DEPLOY_OK);
return DistributionStatusEnum.COMPONENT_DONE_OK;
}
/**
* Method instantiate a INotificationData implementation from a JSON file.
- *
+ *
* @param notifFilePath The file path in String
* @return A JsonNotificationData instance
* @throws IOException in case of the file is not readable or not accessible
@@ -96,19 +92,6 @@ public class JsonStatusData implements IStatusData {
InputStream is = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(notifFilePath + "status-structure.json");
- // String fileLocation = System.getProperty("mso.config.path") + "notif-structure.json";
-
- // String source = fileLocation;
- // InputStream is = IOUtils.toInputStream(source, "UTF-8");
-
- // String myString = IOUtils.toString(is, "UTF-8");
-
-
- // System.out.println(myString);
-
- if (is == null) {
- // throw new FileExistsException("Resource Path does not exist: "+notifFilePath);
- }
return mapper.readValue(is, JsonStatusData.class);
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
index 36d6ab96c0..11c1cc33cf 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -25,8 +27,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import org.onap.sdc.api.notification.IVfModuleMetadata;
-import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.db.catalog.beans.VfModule;
@@ -73,23 +73,6 @@ public final class VfModuleStructure {
}
}
- public List<VfModuleArtifact> getOrderedArtifactList() {
-
- List<VfModuleArtifact> artifactsList = new LinkedList<>();
-
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT));
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV));
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL));
-
- artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_NESTED)));
-
- artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_ARTIFACT)));
-
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL));
-
- return null;
- }
-
public IVfModuleData getVfModuleMetadata() {
return vfModuleMetadata;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index f954fe0c5a..f5b0e17cf5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -7,6 +7,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -77,39 +79,38 @@ public class VfResourceStructure extends ResourceStructure {
private Service catalogService;
- public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) {
- super(notificationdata, resourceinstance);
+ public VfResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) {
+ super(notificationData, resourceInstance);
this.resourceType = ResourceType.VF_RESOURCE;
vfModulesStructureList = new LinkedList<>();
vfModulesMetadataList = new ArrayList<>();
}
- public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
+ public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactInfo,
IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
- this.addArtifactToStructure(distributionClient, artifactinfo, clientResult, null);
+ this.addArtifactToStructure(artifactInfo, clientResult, null);
}
- public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
- IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate)
- throws UnsupportedEncodingException {
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo, clientResult, modifiedHeatTemplate);
- addArtifactByType(artifactinfo, clientResult, vfModuleArtifact);
- if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactinfo.getArtifactType())) {
+ public void addArtifactToStructure(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult,
+ String modifiedHeatTemplate) throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult, modifiedHeatTemplate);
+ addArtifactByType(artifactInfo, clientResult, vfModuleArtifact);
+ if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactInfo.getArtifactType())) {
logger.debug("VF_MODULE_ARTIFACT: " + new String(clientResult.getArtifactPayload(), "UTF-8"));
logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(vfModulesMetadataList));
}
}
- public void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo,
+ public void addWorkflowArtifactToStructure(IArtifactInfo artifactInfo,
IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
- WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactinfo, clientResult);
- workflowArtifactsMapByUUID.put(artifactinfo.getArtifactUUID(), workflowArtifact);
+ WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactInfo, clientResult);
+ workflowArtifactsMapByUUID.put(artifactInfo.getArtifactUUID(), workflowArtifact);
}
- protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult,
+ protected void addArtifactByType(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult,
VfModuleArtifact vfModuleArtifact) {
- switch (artifactinfo.getArtifactType()) {
+ switch (artifactInfo.getArtifactType()) {
case ASDCConfiguration.HEAT:
case ASDCConfiguration.HEAT_ENV:
case ASDCConfiguration.HEAT_VOL:
@@ -118,7 +119,7 @@ public class VfResourceStructure extends ResourceStructure {
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
- artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
+ artifactsMapByUUID.put(artifactInfo.getArtifactUUID(), vfModuleArtifact);
break;
case ASDCConfiguration.VF_MODULES_METADATA:
vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
@@ -196,9 +197,7 @@ public class VfResourceStructure extends ResourceStructure {
public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
try {
- List<IVfModuleData> listVFModuleMetaData =
- new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {});
- return listVFModuleMetaData;
+ return new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {});
} catch (JsonParseException e) {
logger.debug("JsonParseException : ", e);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 195aa7e302..db75c31b08 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -27,6 +29,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
@@ -107,18 +110,15 @@ public class BpmnInstaller {
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
}
- return;
}
public boolean containsWorkflows(String csarFilePath) {
- boolean workflowsInCsar = false;
try (ZipFile zipFile = new ZipFile(csarFilePath)) {
Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
while (zipEntries.hasMoreElements()) {
String fileName = zipEntries.nextElement().getName();
if (fileName.endsWith(BPMN_SUFFIX)) {
- workflowsInCsar = true;
- break;
+ return true;
}
}
} catch (Exception e) {
@@ -126,10 +126,11 @@ public class BpmnInstaller {
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath,
e.getMessage(), ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
}
- return workflowsInCsar;
+ return false;
}
- protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) throws Exception {
+ protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version)
+ throws IOException, URISyntaxException {
HttpClient client = HttpClientBuilder.create().build();
URI deploymentUri = new URI(this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH);
HttpPost post = new HttpPost(deploymentUri);
@@ -141,7 +142,7 @@ public class BpmnInstaller {
return client.execute(post);
}
- protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception {
+ protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws IOException {
FileInputStream bpmnFileStream = new FileInputStream(
Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString());
@@ -182,17 +183,14 @@ public class BpmnInstaller {
return requestEntity;
}
- /* protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException */
protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) {
String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", fileName).normalize().toString();
- /* BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); */
try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath))) {
byte[] bytesIn = new byte[4096];
- int read = 0;
+ int read;
while ((read = zipIn.read(bytesIn)) != -1) {
outputStream.write(bytesIn, 0, read);
}
- /* outputStream.close(); */
} catch (IOException e) {
logger.error("Unable to open file.", e);
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 3175839725..1c7ebb7d9a 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1297,6 +1297,9 @@ public class ToscaResourceInstaller {
heatTemplate.setParameters(heatParam);
vfModuleArtifact.setHeatTemplate(heatTemplate);
} else {
+ if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
+ existingHeatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
+ }
vfModuleArtifact.setHeatTemplate(existingHeatTemplate);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
index 00b0b37b18..71026f1fa6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
@@ -141,7 +141,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
* save e2eslice-service instance id and service name
* @param execution
*/
- private void queryCommunicationSeriveFromAAI(DelegateExecution execution)
+ void queryCommunicationSeriveFromAAI(DelegateExecution execution)
{
LOGGER.trace(" ***** begin queryCommunicationSeriveFromAAI *****")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -186,12 +186,11 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String serviceType = execution.getVariable("serviceType")
- AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId)
- if (!resourceClient.exists(resourceUri)) {
+ if (!getAAIClient().exists(resourceUri)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
}
- AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class)
+ AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
return wrapper
}
@@ -233,6 +232,41 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
}
/**
+ * prepare update operation status
+ * @param execution
+ */
+ private void handleNSSMFWFResponse(Response httpResponse, DelegateExecution execution){
+ LOGGER.debug(" ======== STARTED prepareUpdateOperationStatus Process ======== ")
+
+ int nsmfResponseCode = httpResponse.getStatus()
+ LOGGER.debug("nsmfResponseCode${nsmfResponseCode}")
+
+ if (nsmfResponseCode >= 200 && nsmfResponseCode < 204 && httpResponse.hasEntity()) {
+ String nsmfResponse = httpResponse.readEntity(String.class)
+ def e2eOperationId = jsonUtil.getJsonValue(nsmfResponse, "operationId")
+ execution.setVariable("e2eOperationId", e2eOperationId)
+ execution.setVariable("progress","20")
+ execution.setVariable("operationContent","waiting nsmf service delete finished")
+
+ execution.setVariable("currentCycle",0)
+ execution.setVariable("isNSMFTimeOut", "no")
+ execution.setVariable("isNSMFWFRspSucceed","yes")
+ }
+ else
+ {
+ String serviceName = execution.getVariable("serviceInstanceName")
+ execution.setVariable("progress", "100")
+ execution.setVariable("result", "error")
+ execution.setVariable("operationContent", "terminate service failure.")
+ execution.setVariable("reason","NSMF WF asynchronous response failed, status Code:${nsmfResponseCode}")
+ execution.setVariable("isNSMFWFRspSucceed","no")
+ LOGGER.error("nsmf async response error,nsmfResponseCode:${nsmfResponseCode},serivceName:${serviceName}")
+ }
+ setOperationStatus(execution)
+ LOGGER.debug("======== COMPLETED prepareUpdateOperationStatus Process ======== ")
+ }
+
+ /**
* prepare to call sub process
* @param execution
*/
@@ -272,22 +306,20 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
String profileId
try
{
- AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId)
- AAIResultWrapper wrapper = resourceClient.get(resourceUri, NotFoundException.class)
+ AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class)
if(csProfilesOpt.isPresent()){
- CommunicationServiceProfiles csProf
- iles = csProfilesOpt.get()
+ CommunicationServiceProfiles csProfiles = csProfilesOpt.get()
CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0)
profileId = csProfile ? csProfile.getProfileId() : ""
}
resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId)
- if (!resourceClient.exists(resourceUri)) {
+ if (!getAAIClient().exists(resourceUri)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai")
}
-
- resourceClient.delete(resourceUri)
+
+ getAAIClient().delete(resourceUri)
LOGGER.debug("end delete communication service profile from AAI")
}
catch (any)
@@ -308,9 +340,8 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
try
{
LOGGER.debug("start delete communication service from AAI")
- AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId"))
- resourceClient.delete(serviceInstanceUri)
+ getAAIClient().delete(serviceInstanceUri)
execution.setVariable("progress", "100")
execution.setVariable("result", "finished")
@@ -330,12 +361,10 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
LOGGER.debug("Starting sendSyncError")
try {
- String errorMessage
+ String errorMessage = "Sending Sync Error."
if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
WorkflowException wfe = execution.getVariable("WorkflowException")
errorMessage = wfe.getErrorMessage()
- } else {
- errorMessage = "Sending Sync Error."
}
String buildworkflowException =
@@ -397,6 +426,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
void prepareFailureStatus(DelegateExecution execution)
{
+ execution.setVariable("result", "finished")
execution.setVariable("progress", "100")
execution.setVariable("operationContent", "terminate service failure.")
setOperationStatus(execution)
@@ -426,4 +456,5 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
execution.setVariable(paraName, paramValue)
}
}
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy
new file mode 100644
index 0000000000..3beae9aee0
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy
@@ -0,0 +1,264 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+
+import javax.ws.rs.NotFoundException
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+public class DeleteCommunicationServiceTest extends MsoGroovyTest {
+
+ @Before
+ void init() throws IOException {
+ super.init("DeleteCommunicationServiceTest")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+ {
+ "globalSubscriberId ":"5GCustomer",
+ "serviceType ":"5G"
+ }""".replaceAll("\\\\s+", ""))
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+
+ DeleteCommunicationService delCS = new DeleteCommunicationService()
+ delCS.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
+ List<ExecutionEntity> values = captor.getAllValues()
+ assertNotNull(values)
+ }
+
+ @Test
+ void testPreInitUpdateOperationStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("processing")
+ when(mockExecution.getVariable("progress")).thenReturn("0")
+ when(mockExecution.getVariable("operationContent")).thenReturn("delete communication service operation start")
+
+ DeleteCommunicationService delCS = new DeleteCommunicationService()
+ delCS.preInitUpdateOperationStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getAllValues()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testQueryCommunicationSeriveFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceReturn())
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.queryCommunicationSeriveFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("e2eSliceServiceInstanceId"), captor.capture())
+ String e2eSliceServiceInstanceId = captor.getValue()
+ assertNotNull(e2eSliceServiceInstanceId)
+ }
+
+ @Test
+ void testPrepareCallCheckProcessStatus(){
+ DeleteCommunicationService dcs = new DeleteCommunicationService()
+ dcs.prepareCallCheckProcessStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("endProgress"), captor.capture())
+ int endProgress = captor.getValue()
+ assertEquals(90,endProgress)
+ }
+
+ @Test
+ void testDelCSProfileFromAAI()
+ {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceProfile())
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-111111")
+
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.exists(profileUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ doNothing().when(client).delete(profileUri)
+ obj.delCSProfileFromAAI(mockExecution)
+ Mockito.verify(client,times(1)).delete(profileUri)
+ }
+
+ @Test
+ void testPrepareFailureStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("finished")
+ when(mockExecution.getVariable("progress")).thenReturn("100")
+ when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure.")
+
+ DeleteCommunicationService dcs = new DeleteCommunicationService()
+ dcs.prepareFailureStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getAllValues()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testDelCSFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ doNothing().when(client).delete(serviceInstanceUri)
+
+ obj.delCSFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getAllValues()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testPreFailedOperationStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("error")
+ when(mockExecution.getVariable("progress")).thenReturn("100")
+ when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure")
+
+ DeleteCommunicationService deleteCommunicationService = new DeleteCommunicationService()
+ WorkflowException exception = new WorkflowException("11113",7000,"terminate service failure")
+ when(mockExecution.getVariable("WorkflowException")).thenReturn(exception)
+ deleteCommunicationService.preFailedOperationStatus(mockExecution)
+
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getAllValues()
+ assertNotNull(updateOperationStatus)
+ }
+
+
+ private String mockQueryCommunicationServiceReturn()
+ {
+ String expect =
+ """{
+ "service-instance-id": "5G-666",
+ "service-instance-name": "eMBB_Slice_Communication_Service_5GCustomer",
+ "service-type": "eMBB",
+ "service-role": "communication-service",
+ "environment-context": "01-010101",
+ "workload-context": "12",
+ "created-at": "2019-12-11 19:56:00",
+ "description": "",
+ "model-invariant-id": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "model-version-id": "8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "service-instance-location-id": "300-01|300-02",
+ "resource-version": "1582623470778",
+ "orchestration-status": "created",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-777",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-777"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eMBB_e2e_Slice_Service_5GCustomer"
+ }
+ ]
+ }
+ ]
+ }
+ }"""
+ return expect
+ }
+
+ private String mockQueryCommunicationServiceProfile()
+ {
+ String expect =
+ """{
+ "communication-service-profile": [
+ {
+ "profile-id": "5G-111111",
+ "max-number-of-UEs": 50,
+ "coverage-area-list": "longgang,futian",
+ "latency": 20,
+ "exp-data-rate-UL": 300,
+ "exp-data-rate-DL": 500,
+ "ue-mobility-level": "stationary",
+ "resource-sharing-level": "Non-Shared",
+ "resource-version": "1577454950460"
+ }
+ ]
+ }"""
+ return expect
+ }
+
+
+
+
+}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index 4de546e9da..cbad59e968 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
@@ -20,12 +20,12 @@
package org.onap.so.client.dmaap;
-import com.google.common.base.Stopwatch;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime;
import org.onap.so.client.dmaap.rest.RestConsumer;
+import com.google.common.base.Stopwatch;
public abstract class DmaapConsumer extends DmaapClient {
static final int MAX_ELAPSED_TIME = 180000;
@@ -40,7 +40,6 @@ public abstract class DmaapConsumer extends DmaapClient {
public boolean consume() throws Exception {
Consumer mrConsumer = this.getConsumer();
- boolean accepted = false;
Stopwatch stopwatch = Stopwatch.createUnstarted();
try {
while (this.continuePolling()) {
@@ -54,20 +53,17 @@ public abstract class DmaapConsumer extends DmaapClient {
Iterable<String> itr = mrConsumer.fetch();
stopwatch.stop();
for (String message : itr) {
- if (!accepted && this.isAccepted(message)) {
+ if (this.isAccepted(message)) {
logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
- accepted = true;
}
- if (accepted) {
- logger.info("received dmaap message: " + message);
- if (this.isFailure(message)) {
- this.stopProcessingMessages();
- final String errorMsg = "failure received from dmaap topic " + this.getTopic();
- logger.error(errorMsg);
- throw new DMaaPConsumerFailure(errorMsg);
- } else {
- this.processMessage(message);
- }
+ logger.info("received dmaap message: " + message);
+ if (this.isFailure(message)) {
+ this.stopProcessingMessages();
+ final String errorMsg = "failure received from dmaap topic " + this.getTopic();
+ logger.error(errorMsg);
+ throw new DMaaPConsumerFailure(errorMsg);
+ } else {
+ this.processMessage(message);
}
}
}
diff --git a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
index 641bbb28c7..141352edce 100644
--- a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
+++ b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
@@ -21,5 +21,5 @@
package org.onap.so.constants;
public enum OrchestrationRequestFormat {
- DETAIL, STATUSDETAIL, SIMPLE
+ DETAIL, STATUSDETAIL, SIMPLE, SIMPLENOTASKINFO
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index fec93f72e4..b7d3d633d6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -439,11 +439,13 @@ public class OrchestrationRequests {
String retryStatusMessage = iar.getRetryStatusMessage();
String taskName = null;
- if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
- && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
- taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
- if (taskName != null) {
- flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
+ if (format == null || !format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString())) {
+ if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
+ && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
+ taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
+ if (taskName != null) {
+ flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
+ }
}
}
@@ -544,7 +546,8 @@ public class OrchestrationRequests {
}
protected boolean isRequestProcessingDataRequired(String format) {
- if (StringUtils.isNotEmpty(format) && format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())) {
+ if (StringUtils.isNotEmpty(format) && (format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())
+ || format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString()))) {
return false;
} else {
return true;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 47aa3cccb5..22c82bf75c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -27,6 +27,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.doReturn;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
@@ -187,6 +188,50 @@ public class OrchestrationRequestsUnitTest {
}
@Test
+ public void mapRequestStatusNoTaskInfoTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ "FLOW STATUS: FlowStatus RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage");
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.SIMPLENOTASKINFO.toString());
+ assertThat(expected, sameBeanAs(actual));
+ }
+
+ @Test
+ public void mapRequestStatusNullFormatTest() throws ApiException {
+ doReturn("TaskName").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ "FLOW STATUS: FlowStatus TASK INFORMATION: TaskName RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage");
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, null);
+ assertThat(expected, sameBeanAs(actual));
+ }
+
+ @Test
public void mapRequestStatusAndExtSysErrSrcToRequestDetailTest() throws ApiException {
doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
@@ -338,4 +383,10 @@ public class OrchestrationRequestsUnitTest {
orchestrationRequests.infraActiveRequestLookup(iar.getRequestId());
}
+ @Test
+ public void isRequestProcessingDataRequiredTest() {
+ boolean required = orchestrationRequests.isRequestProcessingDataRequired("simpleNoTaskInfo");
+ assertFalse(required);
+ }
+
}
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app
index e8f02f12c6..84bd2987e3 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app
@@ -1,4 +1,4 @@
-FROM onap/so/base-image:1.0
+FROM registry.gitlab.com/onap-integration/docker/onap-java
ARG http_proxy
ENV HTTP_PROXY=$http_proxy
@@ -7,22 +7,18 @@ ARG https_proxy
ENV HTTPS_PROXY=$https_proxy
ENV https_proxy=$HTTPS_PROXY
-RUN mkdir /app && mkdir /app/config && mkdir /app/certificates && mkdir /app/logs && mkdir /app/ca-certificates
+USER root
+RUN mkdir -p /app/{config,certificates,logs,ca-certificates}
+RUN chown -R onap:onap /app && chmod 700 /app/*.sh
+USER onap
COPY maven/app.jar /app
COPY configs/logging/logback-spring.xml /app
COPY scripts/start-app.sh /app
COPY scripts/wait-for.sh /app
COPY ca-certificates/onap-ca.crt /app/ca-certificates/onap-ca.crt
-RUN chown -R so:so /app && chmod 700 /app/*.sh
-
-## TODO for Casablanca: install this in the openstack-adapter container
-## Install heatbridge
-#RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip
-#RUN mkdir /opt/mso/heatbridge
-#COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge
-#RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
+RUN chmod 700 /app/*.sh
# Springboot configuration (required)
VOLUME /app/config
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
deleted file mode 100644
index c0b298e778..0000000000
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
+++ /dev/null
@@ -1,17 +0,0 @@
-FROM docker.io/openjdk:8-jdk-alpine
-
-ARG http_proxy
-ARG https_proxy
-ENV HTTP_PROXY=$http_proxy
-ENV HTTPS_PROXY=$https_proxy
-ENV http_proxy=$HTTP_PROXY
-ENV https_proxy=$HTTPS_PROXY
-
-# Update the package list and upgrade installed packages
-RUN apk update && apk upgrade
-
-# Install commonly needed tools
-RUN apk --no-cache add curl netcat-openbsd sudo nss
-
-# Create 'so' user
-RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so
diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
index 75d64fefa0..ebab3c6ea3 100644
--- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
+++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
@@ -16,9 +16,9 @@ then
update-ca-certificates --fresh
fi
- # Re-exec this script as the 'so' user.
+ # Re-exec this script as the 'onap' user.
this=`readlink -f $0`
- exec su so -c "$this"
+ exec su onap -c "$this"
fi
touch /app/app.jar