aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java108
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java11
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml23
-rw-r--r--adapters/so-appc-orchestrator/pom.xml2
7 files changed, 126 insertions, 65 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index 0a3c6acd84..50ebcc66ee 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -198,7 +198,9 @@ public class MsoCommonUtils {
// Generate an alarm for 5XX and higher errors.
if (re.getStatus() >= 500) {
-
+ logger.error("{} {} OpenStackResponseException with response code {} on {}: ",
+ MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), re.getStatus(), context,
+ e);
}
} else if (e instanceof OpenStackConnectException) {
OpenStackConnectException ce = (OpenStackConnectException) e;
@@ -281,7 +283,9 @@ public class MsoCommonUtils {
// Generate an alarm for 5XX and higher errors.
if (re.getStatus() >= 500) {
-
+ logger.error("{} {} OpenStackBaseException with response code {} on {}: ",
+ MessageEnum.RA_CONNECTION_EXCEPTION, ErrorCode.DataError.getValue(), re.getStatus(), context,
+ e);
}
} else if (e instanceof OpenStackConnectException) {
OpenStackConnectException ce = (OpenStackConnectException) e;
@@ -334,32 +338,6 @@ public class MsoCommonUtils {
protected CreateStackParam createStackParam(String stackName, String heatTemplate, Map<String, ?> stackInputs,
int timeoutMinutes, String environment, Map<String, Object> files, Map<String, Object> heatFiles) {
- // Create local variables checking to see if we have an environment, nested, get_files
- // Could later add some checks to see if it's valid.
- boolean haveEnvtVariable = true;
- if (environment == null || "".equalsIgnoreCase(environment.trim())) {
- haveEnvtVariable = false;
- logger.debug("createStackParam called with no environment variable");
- } else {
- logger.debug("createStackParam called with an environment variable: {}", environment);
- }
-
- boolean haveFiles = true;
- if (files == null || files.isEmpty()) {
- haveFiles = false;
- logger.debug("createStackParam called with no files / child template ids");
- } else {
- logger.debug("createStackParam called with {} files / child template ids", files.size());
- }
-
- boolean haveHeatFiles = true;
- if (heatFiles == null || heatFiles.isEmpty()) {
- haveHeatFiles = false;
- logger.debug("createStackParam called with no heatFiles");
- } else {
- logger.debug("createStackParam called with {} heatFiles", heatFiles.size());
- }
-
// force entire stackInput object to generic Map<String, Object> for openstack compatibility
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> normalized = new HashMap<>();
@@ -370,6 +348,28 @@ public class MsoCommonUtils {
logger.debug("could not map json", e1);
}
+ CreateStackParam stack =
+ createStack(stackName, heatTemplate, timeoutMinutes, environment, files, heatFiles, normalized);
+
+ // 1802 - attempt to add better formatted printout of request to openstack
+ try {
+ Map<String, Object> inputs = new HashMap<>();
+ for (Entry<String, ?> entry : stackInputs.entrySet()) {
+ if (entry.getValue() != null) {
+ inputs.put(entry.getKey(), entry.getValue());
+ }
+ }
+ logger.debug("stack request: {}", stack);
+ } catch (Exception e) {
+ // that's okay - this is a nice-to-have
+ logger.debug("(had an issue printing nicely formatted request to debuglog) {}", e);
+ }
+
+ return stack;
+ }
+
+ private CreateStackParam createStack(String stackName, String heatTemplate, int timeoutMinutes, String environment,
+ Map<String, Object> files, Map<String, Object> heatFiles, Map<String, Object> normalized) {
// Build up the stack to create
// Disable auto-rollback, because error reason is lost. Always rollback in the code.
CreateStackParam stack = new CreateStackParam();
@@ -379,13 +379,13 @@ public class MsoCommonUtils {
stack.setTemplate(heatTemplate);
stack.setDisableRollback(true);
// TJM New for PO Adapter - add envt variable
- if (haveEnvtVariable) {
+ if (isEnvVariablePresent(environment)) {
logger.debug("Found an environment variable - value: {}", environment);
stack.setEnvironment(environment);
}
// Now handle nested templates or get_files - have to combine if we have both
// as they're both treated as "files:" on the stack.
- if (haveFiles && haveHeatFiles) {
+ if (isFilesPresent(files) && isHeatFilesPresent(heatFiles)) {
// Let's do this here - not in the bean
logger.debug("Found files AND heatFiles - combine and add!");
Map<String, Object> combinedFiles = new HashMap<>();
@@ -398,32 +398,50 @@ public class MsoCommonUtils {
stack.setFiles(combinedFiles);
} else {
// Handle if we only have one or neither:
- if (haveFiles) {
+ if (isFilesPresent(files)) {
logger.debug("Found files - adding to stack");
stack.setFiles(files);
}
- if (haveHeatFiles) {
+ if (isHeatFilesPresent(heatFiles)) {
logger.debug("Found heatFiles - adding to stack");
// the setFiles was modified to handle adding the entries
stack.setFiles(heatFiles);
}
}
+ return stack;
+ }
- // 1802 - attempt to add better formatted printout of request to openstack
- try {
- Map<String, Object> inputs = new HashMap<>();
- for (Entry<String, ?> entry : stackInputs.entrySet()) {
- if (entry.getValue() != null) {
- inputs.put(entry.getKey(), entry.getValue());
- }
- }
- logger.debug("stack request: {}", stack.toString());
- } catch (Exception e) {
- // that's okay - this is a nice-to-have
- logger.debug("(had an issue printing nicely formatted request to debuglog) {}", e.getMessage());
+ private boolean isEnvVariablePresent(String environment) {
+ boolean haveEnvVariable = true;
+ if (environment == null || "".equalsIgnoreCase(environment.trim())) {
+ haveEnvVariable = false;
+ logger.debug("createStackParam called with no environment variable");
+ } else {
+ logger.debug("createStackParam called with an environment variable: {}", environment);
}
+ return haveEnvVariable;
+ }
- return stack;
+ private boolean isFilesPresent(Map<String, Object> files) {
+ boolean haveFile = true;
+ if (files == null || files.isEmpty()) {
+ haveFile = false;
+ logger.debug("createStackParam called with no files / child template ids");
+ } else {
+ logger.debug("createStackParam called with {} files / child template ids", files.size());
+ }
+ return haveFile;
+ }
+
+ private boolean isHeatFilesPresent(Map<String, Object> heatFiles) {
+ boolean haveHeatFile = true;
+ if (heatFiles == null || heatFiles.isEmpty()) {
+ haveHeatFile = false;
+ logger.debug("createStackParam called with no heatFiles");
+ } else {
+ logger.debug("createStackParam called with {} heatFiles", heatFiles.size());
+ }
+ return haveHeatFile;
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 8207c7c589..f5464645d6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -70,6 +70,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
@@ -1191,7 +1192,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
InfraActiveRequests request = new InfraActiveRequests();
request.setRequestId(requestId);
request.setResourceStatusMessage(resourceStatusMessage);
- requestDBClient.patchInfraActiveRequests(request);
+ try {
+ requestDBClient.patchInfraActiveRequests(request);
+ } catch (HttpClientErrorException e) {
+ logger.warn("Unable to update active request resource status");
+ }
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 35008b6120..585e001f1a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -24,9 +24,13 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
@@ -53,11 +57,12 @@ public class AuditVServer extends AbstractAudit {
public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
.queryParam("vf-module-name", vfModuleName);
- if (getAaiClient().get(uri).getRelationships().isPresent()) {
+ Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri);
+ if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) {
List<AAIResourceUri> relatedVservers =
- getAaiClient().get(uri).getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+ wrapper.get().getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
if (!relatedVservers.isEmpty()) {
relatedVservers.forEach(vserverUri -> {
Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index 3d9a128318..8e71ec46b0 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -22,17 +22,12 @@ package org.onap.so.adapters.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
-import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Stream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -43,9 +38,8 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -60,8 +54,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.Resource;
-import com.woorea.openstack.heat.model.Resources;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AuditVServerTest extends AuditVServer {
@@ -399,9 +391,9 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
- doReturn(wrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
- .queryParam("vf-module-name", "vfModuleName"));
+ doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
+ "vfModuleName"));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
@@ -417,9 +409,9 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
- doReturn(wrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
- .queryParam("vf-module-name", "vfModuleName"));
+ doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
+ "vfModuleName"));
doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
"cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index bb322eb1d8..977541cc16 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -91,6 +91,24 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/vnfmadapter/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
index a643aaa5b8..dacd5d96b6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -132,6 +132,29 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/etsicatalog/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-grant/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-lcn/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-lcm/src/gen/java/main</source>
+
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index e8e5808eca..66dcc4dd30 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -14,7 +14,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<name>so-appc-orchestrator</name>
<description>MSO APPC-C Orchestrator</description>