From fbb984e6a8823ca26eae20a65c6d261feac02b7b Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Wed, 1 Apr 2020 10:41:17 -0400 Subject: openstack inventory capture Begin heatbridge refactor initial check in of heatbridge Additional commits of heatbridge Update Heat bridge to write more AAI data Update to utlize HeatBrdige to populate AAI Adjust simulator endpoints to work again Remove not needed BB Test case, fix tc Refactor how AAI relationships are being built Issue-ID: SO-2777 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Iffccc24e18b278188c3fe98bcb1ad9685229d0a2 --- .../so/client/aai/AAISingleTransactionClient.java | 18 +++- .../onap/so/client/aai/AAITransactionalClient.java | 17 ++++ .../GraphInventoryTransactionClient.java | 8 ++ .../so/cloud/resource/beans/CloudInformation.java | 101 +++++++++++++++++++++ .../org/onap/so/cloud/resource/beans/NodeType.java | 28 ++++++ 5 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/org/onap/so/cloud/resource/beans/CloudInformation.java create mode 100644 common/src/main/java/org/onap/so/cloud/resource/beans/NodeType.java (limited to 'common/src/main/java/org') diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java index b1d29f445b..687ff09c5a 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java @@ -38,6 +38,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import org.onap.so.client.graphinventory.GraphInventoryTransactionClient; import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Joiner; @@ -85,6 +86,22 @@ public class AAISingleTransactionClient extends } } + @Override + public void execute(boolean dryRun) throws BulkProcessFailed { + final ObjectMapper mapper = new ObjectMapper(); + if (dryRun) { + try { + if (logger.isDebugEnabled()) { + logger.debug("Would execute: {}", mapper.writeValueAsString(this.request)); + } + } catch (JsonProcessingException e) { + logger.debug("Could not format request to JSON", e); + } + } else { + this.execute(); + } + } + protected Optional locateErrorMessages(SingleTransactionResponse response) { final List errorMessages = new ArrayList<>(); final ObjectMapper mapper = new ObjectMapper(); @@ -111,7 +128,6 @@ public class AAISingleTransactionClient extends } } - protected SingleTransactionRequest getRequest() { return this.request; } diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java index 7b7dccc999..a8cd8bae39 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java @@ -42,6 +42,7 @@ import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import org.onap.so.client.graphinventory.GraphInventoryTransactionClient; import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; import org.onap.so.jsonpath.JsonPathUtil; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Joiner; @@ -109,6 +110,22 @@ public class AAITransactionalClient extends } } + @Override + public void execute(boolean dryRun) throws BulkProcessFailed { + final ObjectMapper mapper = new ObjectMapper(); + if (dryRun) { + try { + if (logger.isDebugEnabled()) { + logger.debug("Would execute: {}", mapper.writeValueAsString(this.transactions)); + } + } catch (JsonProcessingException e) { + logger.debug("Could not format request to JSON", e); + } + } else { + this.execute(); + } + } + protected Optional locateErrorMessages(String response) { final List errorMessages = new ArrayList<>(); final List results = JsonPathUtil.getInstance().locateResultList(response, "$..body"); diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java index 3469d73599..8ee5ca4e80 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java @@ -224,6 +224,14 @@ public abstract class GraphInventoryTransactionClient