aboutsummaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java18
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java17
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java8
-rw-r--r--common/src/main/java/org/onap/so/cloud/resource/beans/CloudInformation.java101
-rw-r--r--common/src/main/java/org/onap/so/cloud/resource/beans/NodeType.java28
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;
+ }
+}