diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2020-04-01 10:41:17 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-04-17 12:05:16 -0400 |
commit | fbb984e6a8823ca26eae20a65c6d261feac02b7b (patch) | |
tree | 00e6f3c385587a351ab644112ffca733f77465e7 /common | |
parent | eceef88af7a5e13a7840059004116e8b6cbf35ac (diff) |
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) <mb388a@att.com>
Change-Id: Iffccc24e18b278188c3fe98bcb1ad9685229d0a2
Diffstat (limited to 'common')
5 files changed, 171 insertions, 1 deletions
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<String> locateErrorMessages(SingleTransactionResponse response) { final List<String> 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<String> locateErrorMessages(String response) { final List<String> errorMessages = new ArrayList<>(); final List<String> 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<Self, Uri extends GraphInv */ public abstract void execute() throws BulkProcessFailed; + + /** + * Executes all created transactions in A&AI, with optional dry run flag + * + * @throws BulkProcessFailed + */ + public abstract void execute(boolean dryrun) throws BulkProcessFailed; + private Relationship buildRelationship(SingleUri uri) { return buildRelationship(uri, Optional.empty()); } diff --git a/common/src/main/java/org/onap/so/cloud/resource/beans/CloudInformation.java b/common/src/main/java/org/onap/so/cloud/resource/beans/CloudInformation.java new file mode 100644 index 0000000000..c250d6637a --- /dev/null +++ b/common/src/main/java/org/onap/so/cloud/resource/beans/CloudInformation.java @@ -0,0 +1,101 @@ +package org.onap.so.cloud.resource.beans; + +import java.io.Serializable; + +public class CloudInformation implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 4316532011566979075L; + private String owner; + private String regionId; + private String tenantId; + private String tenantName; + private String tenantContext; + private String templateInstanceId; + private String vnfName; + private String vnfId; + private String vfModuleId; + private NodeType nodeType; + + public String getTenantContext() { + return tenantContext; + } + + public void setTenantContext(String tenantContext) { + this.tenantContext = tenantContext; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public String getRegionId() { + return regionId; + } + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + + public String getTemplateInstanceId() { + return templateInstanceId; + } + + public void setTemplateInstanceId(String templateInstanceId) { + this.templateInstanceId = templateInstanceId; + } + + public NodeType getNodeType() { + return nodeType; + } + + public void setNodeType(NodeType nodeType) { + this.nodeType = nodeType; + } + + public String getVnfName() { + return vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } +} diff --git a/common/src/main/java/org/onap/so/cloud/resource/beans/NodeType.java b/common/src/main/java/org/onap/so/cloud/resource/beans/NodeType.java new file mode 100644 index 0000000000..2ca923c1ee --- /dev/null +++ b/common/src/main/java/org/onap/so/cloud/resource/beans/NodeType.java @@ -0,0 +1,28 @@ +package org.onap.so.cloud.resource.beans; + +public enum NodeType { + BROWNFIELD("BROWNFIELD", "OVS", "bond1"), GREENFIELD("GREENFIELD", "OVS-DPDK", "bond0"); + + private final String nodeType; + private final String networkTech; + private final String interfaceName; + + private NodeType(String s, String n, String h) { + this.nodeType = s; + this.networkTech = n; + this.interfaceName = h; + } + + public String getNetworkTechnologyName() { + return networkTech; + } + + public String getInterfaceName() { + return interfaceName; + } + + @Override + public String toString() { + return this.nodeType; + } +} |