diff options
Diffstat (limited to 'adapters/mso-adapters-rest-interface')
90 files changed, 2147 insertions, 354 deletions
diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml index 98cd1831c1..706de0a232 100644 --- a/adapters/mso-adapters-rest-interface/pom.xml +++ b/adapters/mso-adapters-rest-interface/pom.xml @@ -27,32 +27,42 @@ </build> <dependencies> <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jaxrs</artifactId> - <version>3.0.19.Final</version> - <scope>provided</scope> +<!-- + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> +--> + <groupId>org.openecomp.so.libs.openstack-java-sdk</groupId> + <artifactId>keystone-client</artifactId> + <version>${openstack.version}</version> </dependency> <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jackson-provider</artifactId> - <version>3.0.19.Final</version> - <scope>provided</scope> +<!-- + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> +--> + <groupId>org.openecomp.so.libs.openstack-java-sdk</groupId> + <artifactId>heat-client</artifactId> + <version>${openstack.version}</version> </dependency> <dependency> - <groupId>org.jboss.resteasy</groupId> - <artifactId>resteasy-jettison-provider</artifactId> - <version>3.0.19.Final</version> +<!-- + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> +--> + <groupId>org.openecomp.so.libs.openstack-java-sdk</groupId> + <artifactId>quantum-client</artifactId> + <version>${openstack.version}</version> </dependency> <dependency> - <groupId>org.onap.so.adapters</groupId> - <artifactId>mso-adapter-utils</artifactId> - <version>${project.version}</version> +<!-- + <groupId>org.onap.so.libs.openstack-java-sdk.client-connectors</groupId> +--> + <groupId>org.openecomp.so.libs.openstack-java-sdk.client-connectors</groupId> + <artifactId>http-connector</artifactId> + <version>${openstack.version}</version> </dependency> <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - <scope>test</scope> + <groupId>org.onap.so</groupId> + <artifactId>common</artifactId> + <version>${project.version}</version> </dependency> + </dependencies> </project> diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java index d3f849f495..60684a3599 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java @@ -22,11 +22,15 @@ package org.openecomp.mso.adapters.nwrest; import java.util.List; +import org.openecomp.mso.openstack.beans.RouteTarget; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("contrailNetwork") public class ContrailNetwork { private String shared = "false"; private String external = "false"; - private List<String> routeTargets; + private List<RouteTarget> routeTargets; private List<String> policyFqdns; private List<String> routeTableFqdns; @@ -34,7 +38,7 @@ public class ContrailNetwork { super(); } - public ContrailNetwork(String shared, String external, List<String> routeTargets, List<String> policyFqdns, List<String> routeTableFqdns) { + public ContrailNetwork(String shared, String external, List<RouteTarget> routeTargets, List<String> policyFqdns, List<String> routeTableFqdns) { super(); this.shared = shared; this.external = external; @@ -59,11 +63,11 @@ public class ContrailNetwork { this.external = external; } - public List<String> getRouteTargets() { + public List<RouteTarget> getRouteTargets() { return routeTargets; } - public void setRouteTargets(List<String> routeTargets) { + public void setRouteTargets(List<RouteTarget> routeTargets) { this.routeTargets = routeTargets; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java index 018667ca4c..4b105cce92 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java @@ -25,12 +25,9 @@ import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "createNetworkError") -@NoJackson public class CreateNetworkError extends NetworkExceptionResponse implements Serializable { private static final long serialVersionUID = -4283402447149144456L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java index 061da6fca2..4c2cc36c83 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java @@ -22,37 +22,26 @@ package org.openecomp.mso.adapters.nwrest; -import org.openecomp.mso.openstack.beans.Subnet; -import org.openecomp.mso.entity.MsoRequest; - +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.HashMap; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; +import org.openecomp.mso.entity.MsoRequest; +import org.openecomp.mso.openstack.beans.Subnet; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonRootName; /* README -* 1) Used JAXB/Jettison - see @NoJackson annotation on class to get RootElements REad by RestEasy -* 2) due to 1) Maps need to use this format - -"networkParams": {"entry": [ - {"key": "network_id", - "value": "59ed7b41-2983-413f-ba93-e7d437433916"}, - {"key": "subnet_id", - "value": "086c9298-5c57-49b7-bb2b-6fd5730c5d92"}, - {"key": "server_name_0", - "value": "RaaNetwork1"} - ]}, - * 3) to output json see toJSonString method below which required the @JsonRootName annotation and the WRAP_ROOT feature enabled - * 4) Tryong to work with RESTEASY JACKSON and JAXB/JETTISON to conform to Json input/output specs + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. */ @JsonRootName("createNetworkRequest") @XmlRootElement(name = "createNetworkRequest") -@NoJackson public class CreateNetworkRequest extends NetworkRequestCommon { private String cloudSiteId; private String tenantId; @@ -69,6 +58,8 @@ public class CreateNetworkRequest extends NetworkRequestCommon { private Boolean backout = true; private Map<String,String> networkParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); + @JsonProperty + private boolean contrailRequest; public CreateNetworkRequest() { super(); @@ -197,4 +188,9 @@ public class CreateNetworkRequest extends NetworkRequestCommon { public boolean isContrailRequest() { return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null); } + + @JsonIgnore + public void setContrailRequest(boolean contrailRequest) { + this.contrailRequest = contrailRequest; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java index ed7c88b394..6db7661905 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java @@ -22,17 +22,17 @@ package org.openecomp.mso.adapters.nwrest; -import org.openecomp.mso.openstack.beans.NetworkRollback; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import org.openecomp.mso.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("createNetworkResponse") @XmlRootElement(name = "createNetworkResponse") -@NoJackson + public class CreateNetworkResponse extends NetworkResponseCommon { private String networkId; private String neutronNetworkId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java index ed6fec1ff3..6a5e354f87 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java @@ -25,12 +25,9 @@ import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "deleteNetworkError") -@NoJackson public class DeleteNetworkError extends NetworkExceptionResponse implements Serializable { private static final long serialVersionUID = 2735474165790444180L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java index d2ba6b69db..d899ac921e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java @@ -22,16 +22,15 @@ package org.openecomp.mso.adapters.nwrest; +import javax.xml.bind.annotation.XmlRootElement; + import org.openecomp.mso.entity.MsoRequest; -import javax.xml.bind.annotation.XmlRootElement; +import com.fasterxml.jackson.annotation.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; @JsonRootName("deleteNetworkRequest") @XmlRootElement(name = "deleteNetworkRequest") -@NoJackson public class DeleteNetworkRequest extends NetworkRequestCommon { private String cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java index 3cf7a52d56..ee62751edb 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java @@ -23,12 +23,11 @@ package org.openecomp.mso.adapters.nwrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; + +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("deleteNetworkResponse") @XmlRootElement(name = "deleteNetworkResponse") -@NoJackson public class DeleteNetworkResponse extends NetworkResponseCommon { private String networkId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java index d9b09fa1b0..56fc19870c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java @@ -28,10 +28,13 @@ import java.io.ByteArrayOutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import org.openecomp.mso.logger.MsoLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + /** * Everything that is common between all Network Requests. */ @@ -40,7 +43,8 @@ public abstract class NetworkRequestCommon { private Boolean skipAAI = false; private String messageId; private String notificationUrl; - + @JsonProperty + private boolean synchronous; public Boolean getSkipAAI() { return skipAAI; } @@ -68,12 +72,17 @@ public abstract class NetworkRequestCommon { public boolean isSynchronous() { return notificationUrl == null || (notificationUrl.isEmpty()); } + + @JsonIgnore + public void setSynchronous(boolean synchronous) { + this.synchronous = synchronous; + } public String toJsonString() { String jsonString = null; try { ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); } catch (Exception e) { LOGGER.debug("Exception:", e); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java index 56ec73d94a..f92f4ea769 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java @@ -28,8 +28,8 @@ import java.io.ByteArrayOutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import org.openecomp.mso.logger.MsoLogger; /** * Everything that is common between all Volume Group Responses, except for QueryVolumeGroupResponse. @@ -58,7 +58,7 @@ public abstract class NetworkResponseCommon { String jsonString = null; try { ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); } catch (Exception e) { LOGGER.debug("Exception:", e); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java index 5b81ab3949..5ff64a47a2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java @@ -25,10 +25,7 @@ import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; - @XmlRootElement(name = "queryNetworkError") -@NoJackson public class QueryNetworkError extends NetworkExceptionResponse implements Serializable { private static final long serialVersionUID = -6125469596399867146L; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java index 1ca36aface..7df5472607 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java @@ -21,40 +21,34 @@ package org.openecomp.mso.adapters.nwrest; - - -import org.openecomp.mso.openstack.beans.NetworkStatus; - import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.annotations.providers.NoJackson; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.openstack.beans.NetworkStatus; +import org.openecomp.mso.openstack.beans.RouteTarget; @XmlRootElement(name = "queryNetworkResponse") -@NoJackson -public class QueryNetworkResponse { +public class QueryNetworkResponse extends NetworkResponseCommon { private String networkId; private String neutronNetworkId; private String networkStackId; private Boolean networkExists; private NetworkStatus networkStatus; private List<Integer> vlans; - private List<String> routeTargets; + private List<RouteTarget> routeTargets; private Map<String, String> subnetIdMap; private Map<String, String> networkOutputs; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - + public QueryNetworkResponse() { super(); } - public QueryNetworkResponse(String networkId, String neutronNetworkId, - String networkStackId, NetworkStatus networkStatus, - Map<String, String> networkOutputs) { + public QueryNetworkResponse(String networkId, String neutronNetworkId, String networkStackId, + NetworkStatus networkStatus, Map<String, String> networkOutputs) { super(); this.networkId = networkId; this.neutronNetworkId = neutronNetworkId; @@ -111,11 +105,11 @@ public class QueryNetworkResponse { this.vlans = vlans; } - public List<String> getRouteTargets() { + public List<RouteTarget> getRouteTargets() { return routeTargets; } - public void setRouteTargets(List<String> routeTargets) { + public void setRouteTargets(List<RouteTarget> routeTargets) { this.routeTargets = routeTargets; } @@ -134,16 +128,4 @@ public class QueryNetworkResponse { public void setNetworkOutputs(Map<String, String> networkOutputs) { this.networkOutputs = networkOutputs; } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - jsonString = mapper.writeValueAsString(this); - } - catch (Exception e) { - LOGGER.debug("Exception:", e); - } - return jsonString; - } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java index 37caacc6bd..67a4b906c7 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java @@ -25,12 +25,9 @@ import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "rollbackNetworkError") -@NoJackson public class RollbackNetworkError extends NetworkExceptionResponse implements Serializable { private static final long serialVersionUID = -3954464103037391980L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java index 5acd9a3f89..03b4123d06 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java @@ -22,16 +22,13 @@ package org.openecomp.mso.adapters.nwrest; -import org.openecomp.mso.openstack.beans.NetworkRollback; - import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.openecomp.mso.openstack.beans.NetworkRollback; @JsonRootName("rollbackNetworkRequest") @XmlRootElement(name = "rollbackNetworkRequest") -@NoJackson public class RollbackNetworkRequest extends NetworkRequestCommon { private NetworkRollback networkRollback; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java index 2e74651b69..f7b80bd63e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java @@ -24,12 +24,11 @@ package org.openecomp.mso.adapters.nwrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("rollbackNetworkResponse") @XmlRootElement(name = "rollbackNetworkResponse") -@NoJackson public class RollbackNetworkResponse extends NetworkResponseCommon { private Boolean networkRolledBack; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java index 3b31a673ab..3385167f60 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java @@ -25,12 +25,9 @@ import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "updateNetworkError") -@NoJackson public class UpdateNetworkError extends NetworkExceptionResponse implements Serializable { private static final long serialVersionUID = 46820809807914392L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java index 09c1b3ee38..7b3236efa5 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java @@ -22,21 +22,22 @@ package org.openecomp.mso.adapters.nwrest; -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.Subnet; - -import java.util.Map; import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; + +import org.openecomp.mso.entity.MsoRequest; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.openstack.beans.Subnet; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateNetworkRequest") @XmlRootElement(name = "updateNetworkRequest") -@NoJackson public class UpdateNetworkRequest extends NetworkRequestCommon { private String cloudSiteId; private String tenantId; @@ -54,7 +55,8 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { private Map<String,String> networkParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - + @JsonProperty + private boolean contrailRequest; public UpdateNetworkRequest() { super(); } @@ -186,4 +188,9 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { public boolean isContrailRequest() { return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null); } + + @JsonIgnore + public void setContrailRequest() { + this.contrailRequest = contrailRequest; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java index 88f6ad2705..3ca6824a49 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java @@ -25,7 +25,7 @@ package org.openecomp.mso.adapters.nwrest; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateNetworkResponse") @XmlRootElement(name = "updateNetworkResponse") diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java new file mode 100644 index 0000000000..aa55c6349d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.adapters.providers; + +import javax.ws.rs.Produces; +import javax.ws.rs.ext.ContextResolver; +import javax.ws.rs.ext.Provider; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@Provider +@Produces("application/json") +public class JettisonStyleMapperProvider implements ContextResolver<ObjectMapper> { + + final ObjectMapper mapper; + + public JettisonStyleMapperProvider() { + + mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + mapper.enable(MapperFeature.USE_ANNOTATIONS); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + } + + @Override + public ObjectMapper getContext(Class<?> type) { + return mapper; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java index 70d4110831..3dc81fbdda 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java @@ -19,7 +19,7 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; import javax.xml.bind.annotation.XmlElement; import java.io.Serializable; @@ -43,6 +43,12 @@ public class RequestInformation implements Serializable { // request-action // request-sub-action + // Identifies the request action + private String requestAction; + + // Identifies the request sub action + private String requestSubAction; + public RequestInformation(String requestId, String source, String notificationUrl) { this.requestId = requestId; this.source = source; @@ -84,4 +90,26 @@ public class RequestInformation implements Serializable { public void setNotificationUrl(String notificationUrl) { this.notificationUrl = notificationUrl; } + + @JsonProperty("requestAction") + @XmlElement(name = "requestAction") + public String getRequestAction() { + return requestAction; + } + + @JsonProperty("requestAction") + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + @JsonProperty("requestSubAction") + @XmlElement(name = "requestSubAction") + public String getRequestSubAction() { + return requestSubAction; + } + + @JsonProperty("requestSubAction") + public void setRequestSubAction(String requestSubAction) { + this.requestSubAction = requestSubAction; + } }
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java index c4e22e0680..3dbeaef17f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java @@ -20,47 +20,35 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.openecomp.mso.adapters.json.MapDeserializer; -import org.openecomp.mso.adapters.json.MapSerializer; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonDeserialize; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; -import org.jboss.resteasy.annotations.providers.NoJackson; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; import java.io.IOException; import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + import org.openecomp.mso.logger.MsoLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + // NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, // even though we are using JSON exclusively. The @NoJackson annotation // is also required in this environment. /** - * SDNC adapter success response for "agnostic" API services. Note that the - * map of response parameters is represented this way in JSON: - * <pre> - * "params": { - * "entry": [ - * {"key": "P1", "value": "V1"}, - * {"key": "P2", "value": "V2"}, - * ... - * {"key": "PN", "value": "VN"} - * ] - * } + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. * </pre> */ @JsonRootName("SDNCEvent") -@JsonSerialize(include= Inclusion.NON_NULL) +@JsonInclude(Include.NON_NULL) @XmlRootElement(name = "SDNCEvent") -@NoJackson public class SDNCEvent implements Serializable { private static final long serialVersionUID = 1L; @@ -121,14 +109,12 @@ public class SDNCEvent implements Serializable { } @JsonProperty("params") - @JsonDeserialize(using = MapDeserializer.class) @XmlElement(name = "params") public Map<String, String> getParams() { return params; } @JsonProperty("params") - @JsonSerialize(using = MapSerializer.class, include= Inclusion.NON_NULL) public void setParams(Map<String, String> params) { this.params = params; } @@ -143,8 +129,8 @@ public class SDNCEvent implements Serializable { public String toJson() { try { ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - mapper.setSerializationInclusion(Inclusion.NON_NULL); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Include.NON_NULL); return mapper.writeValueAsString(this); } catch (IOException e) { LOGGER.debug("Exception:", e); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java index 45609168ee..e1ee9894e2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java @@ -19,17 +19,19 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.codehaus.jackson.annotate.JsonIgnore; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; - -import javax.xml.bind.annotation.XmlElement; import java.io.IOException; import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + import org.openecomp.mso.logger.MsoLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + /** * Base class for all SDNC adapter requests. */ @@ -100,8 +102,8 @@ public abstract class SDNCRequestCommon implements Serializable { public String toJson() { try { ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - mapper.setSerializationInclusion(Inclusion.NON_NULL); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Include.NON_NULL); return mapper.writeValueAsString(this); } catch (IOException e) { LOGGER.debug("Exception:", e); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java index 5e6b9394a6..7265d67923 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java @@ -20,16 +20,18 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; - -import javax.xml.bind.annotation.XmlElement; import java.io.IOException; import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + import org.openecomp.mso.logger.MsoLogger; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + /** * Base class for all SDNC adapter responses, including errors. */ @@ -109,8 +111,8 @@ public abstract class SDNCResponseCommon implements Serializable { public String toJson() { try { ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); - mapper.setSerializationInclusion(Inclusion.NON_NULL); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Include.NON_NULL); return mapper.writeValueAsString(this); } catch (IOException e) { LOGGER.debug("Exception:", e); diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java index cf5ab77a5f..8d693e932a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java @@ -19,12 +19,13 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.jboss.resteasy.annotations.providers.NoJackson; +import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonRootName; // NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, // even though we are using JSON exclusively. The @NoJackson annotation @@ -34,9 +35,8 @@ import java.io.Serializable; * SDNC adapter error response for "agnostic" API services. */ @JsonRootName("SDNCServiceError") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonInclude(Include.NON_NULL) @XmlRootElement(name = "SDNCServiceError") -@NoJackson public class SDNCServiceError extends SDNCErrorCommon implements Serializable { private static final long serialVersionUID = 1; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java index 5148cf431f..a21585764f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java @@ -19,14 +19,15 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.jboss.resteasy.annotations.providers.NoJackson; +import java.io.Serializable; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; // NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, // even though we are using JSON exclusively. The @NoJackson annotation @@ -37,9 +38,8 @@ import java.io.Serializable; * The target action is determined by a service type and an operation. */ @JsonRootName("SDNCServiceRequest") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonInclude(Include.NON_NULL) @XmlRootElement(name = "SDNCServiceRequest") -@NoJackson public class SDNCServiceRequest extends SDNCRequestCommon implements Serializable { private static final long serialVersionUID = 1L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java index 65d8a25dff..c74fb08972 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java @@ -19,42 +19,30 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.openecomp.mso.adapters.json.MapDeserializer; -import org.openecomp.mso.adapters.json.MapSerializer; -import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.map.annotate.JsonDeserialize; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonSerialize; -import org.jboss.resteasy.annotations.providers.NoJackson; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.LinkedHashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + // NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, // even though we are using JSON exclusively. The @NoJackson annotation // is also required in this environment. /** - * SDNC adapter success response for "agnostic" API services. Note that the - * map of response parameters is represented this way in JSON: - * <pre> - * "params": { - * "entry": [ - * {"key": "P1", "value": "V1"}, - * {"key": "P2", "value": "V2"}, - * ... - * {"key": "PN", "value": "VN"} - * ] - * } + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. * </pre> */ @JsonRootName("SDNCServiceResponse") -@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@JsonInclude(Include.NON_NULL) @XmlRootElement(name = "SDNCServiceResponse") -@NoJackson public class SDNCServiceResponse extends SDNCResponseCommon implements Serializable { private static final long serialVersionUID = 1L; @@ -70,14 +58,12 @@ public class SDNCServiceResponse extends SDNCResponseCommon implements Serializa } @JsonProperty("params") - @JsonDeserialize(using = MapDeserializer.class) @XmlElement(name = "params") public Map<String, String> getParams() { return params; } @JsonProperty("params") - @JsonSerialize(using = MapSerializer.class, include=JsonSerialize.Inclusion.NON_NULL) public void setParams(Map<String, String> params) { this.params = params; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java index 59edd0721b..1cdea6518a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java @@ -19,7 +19,7 @@ */ package org.openecomp.mso.adapters.sdncrest; -import org.codehaus.jackson.annotate.JsonProperty; +import com.fasterxml.jackson.annotation.JsonProperty; import javax.xml.bind.annotation.XmlElement; import java.io.Serializable; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java index 82cf40230a..38fb4ac3f8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java @@ -24,11 +24,9 @@ package org.openecomp.mso.adapters.tenantrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "createTenantError") -@NoJackson public class CreateTenantError implements Serializable { private static final long serialVersionUID = 7305288262646805568L; private String message; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java index f54380486a..227e58338d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java @@ -26,10 +26,8 @@ import org.openecomp.mso.entity.MsoRequest; import java.util.Map; import java.util.HashMap; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "createTenantRequest") -@NoJackson public class CreateTenantRequest extends TenantRequestCommon { private String cloudSiteId; private String tenantName; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java index 3168a39dae..f091a22bcb 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java @@ -24,10 +24,8 @@ package org.openecomp.mso.adapters.tenantrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "createTenantResponse") -@NoJackson public class CreateTenantResponse implements Serializable { private static final long serialVersionUID = -456155026754759682L; private String cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java index aed57e8f0a..17af950f3f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java @@ -24,11 +24,9 @@ package org.openecomp.mso.adapters.tenantrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "deleteTenantError") -@NoJackson public class DeleteTenantError implements Serializable { private static final long serialVersionUID = -5778340182805870809L; private String message; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java index dd2be4ab04..47761ce086 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java @@ -24,10 +24,8 @@ package org.openecomp.mso.adapters.tenantrest; import org.openecomp.mso.entity.MsoRequest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "deleteTenantRequest") -@NoJackson public class DeleteTenantRequest extends TenantRequestCommon { private String cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java index e6ee7d81fe..9c18734a17 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java @@ -23,10 +23,8 @@ package org.openecomp.mso.adapters.tenantrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "deleteTenantResponse") -@NoJackson public class DeleteTenantResponse { private Boolean tenantDeleted; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java index c008435dde..1347f78fbe 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java @@ -24,11 +24,9 @@ package org.openecomp.mso.adapters.tenantrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "queryTenantError") -@NoJackson public class QueryTenantError implements Serializable { private static final long serialVersionUID = 7358240830662453507L; private String message; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java index 8b35e8dc38..4d667b6a0e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java @@ -24,10 +24,8 @@ package org.openecomp.mso.adapters.tenantrest; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "queryTenantResponse") -@NoJackson public class QueryTenantResponse extends TenantRequestCommon { private String tenantId; private String tenantName; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java index 2d359e059f..af76d689fe 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java @@ -24,11 +24,9 @@ package org.openecomp.mso.adapters.tenantrest; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "rollbackTenantError") -@NoJackson public class RollbackTenantError implements Serializable { private static final long serialVersionUID = -5313713674529615223L; private String message; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java index 55224e23b1..7a67ffeaaa 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java @@ -23,10 +23,8 @@ package org.openecomp.mso.adapters.tenantrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "rollbackTenantRequest") -@NoJackson public class RollbackTenantRequest extends TenantRequestCommon { private TenantRollback tenantRollback; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java index f0c50209b4..da329b8a29 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java @@ -23,10 +23,8 @@ package org.openecomp.mso.adapters.tenantrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "rollbackTenantResponse") -@NoJackson public class RollbackTenantResponse { private Boolean tenantRolledback; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java index c5105aa683..930f46271b 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java @@ -23,10 +23,8 @@ package org.openecomp.mso.adapters.tenantrest; import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; @XmlRootElement(name = "createTenantResponse") -@NoJackson public class TenantExceptionResponse implements Serializable { private static final long serialVersionUID = -9062290006520066109L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java index 778a329979..b00b98ef3e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java @@ -27,8 +27,8 @@ import java.io.ByteArrayOutputStream; import javax.xml.bind.JAXBContext; import javax.xml.bind.Marshaller; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import org.openecomp.mso.logger.MsoLogger; @@ -38,7 +38,7 @@ public class TenantRequestCommon { try { String jsonString; ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); return jsonString; } catch (Exception e) { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java index 228fcc47a1..27aab8d3ff 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java @@ -25,7 +25,6 @@ package org.openecomp.mso.adapters.tenantrest; import javax.xml.bind.annotation.XmlRootElement; import org.openecomp.mso.entity.MsoRequest; -import org.jboss.resteasy.annotations.providers.NoJackson; /** * Javabean representing the rollback criteria following a "Create Tenant" @@ -36,7 +35,6 @@ import org.jboss.resteasy.annotations.providers.NoJackson; */ @XmlRootElement(name = "rollbackTenantRequest") -@NoJackson public class TenantRollback extends TenantRequestCommon { private String tenantId; private String cloudId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java index 43ac1f1f3c..dac09d4cd1 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java @@ -21,35 +21,22 @@ package org.openecomp.mso.adapters.vnfrest; -import org.openecomp.mso.entity.MsoRequest; - -import java.util.Map; import java.util.HashMap; +import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; +import org.openecomp.mso.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; -import org.codehaus.jackson.map.annotate.JsonRootName; /* README -* 1) Used JAXB/Jettison - see @NoJackson annotation on class to get RootElements REad by RestEasy -* 2) due to 1) Maps need to use this format - -"vfModuleParams": {"entry": [ - {"key": "network_id", - "value": "59ed7b41-2983-413f-ba93-e7d437433916"}, - {"key": "subnet_id", - "value": "086c9298-5c57-49b7-bb2b-6fd5730c5d92"}, - {"key": "server_name_0", - "value": "RaaVnf1"} - ]}, - * 3) to output json see toJSonString method below which required the @JsonRootName annotation and the WRAP_ROOT feature enabled - * 4) Tryong to work with RESTEASY JACKSON and JAXB/JETTISON to conform to Json input/output specs + Map<String, String> elements when marshalled to XML produce a list of <entry><key>${key}</key><value>${value}</value></entry> elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. */ @JsonRootName("createVfModuleRequest") @XmlRootElement(name = "createVfModuleRequest") -@NoJackson public class CreateVfModuleRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java index 84b8caa096..70c9535a32 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java @@ -25,12 +25,11 @@ import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; + +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("createVfModuleResponse") @XmlRootElement(name = "createVfModuleResponse") -@NoJackson public class CreateVfModuleResponse extends VfResponseCommon { private String vnfId; private String vfModuleId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java index e66271c24a..2c684e0aa4 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -26,14 +26,12 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.entity.MsoRequest; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("createVolumeGroupRequest") @XmlRootElement(name = "createVolumeGroupRequest") -@NoJackson public class CreateVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java index cc2f6da29e..18a348aa05 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java @@ -26,12 +26,11 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("createVolumeGroupResponse") @XmlRootElement(name = "createVolumeGroupResponse") -@NoJackson public class CreateVolumeGroupResponse extends VfResponseCommon { private String volumeGroupId; private String volumeGroupStackId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java index 1ddbd8ae1c..b2b602ae33 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java @@ -21,15 +21,14 @@ package org.openecomp.mso.adapters.vnfrest; +import javax.xml.bind.annotation.XmlRootElement; + import org.openecomp.mso.entity.MsoRequest; -import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("deleteVfModuleRequest") @XmlRootElement(name = "deleteVfModuleRequest") -@NoJackson public class DeleteVfModuleRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java index c5b8bb7d59..db04d5b20c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java @@ -21,16 +21,15 @@ package org.openecomp.mso.adapters.vnfrest; -import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; - import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("deleteVfModuleResponse") @XmlRootElement(name = "deleteVfModuleResponse") -@NoJackson public class DeleteVfModuleResponse extends VfResponseCommon { private String vnfId; private String vfModuleId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java index 53229ad85a..fc600e2d75 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java @@ -23,14 +23,12 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.entity.MsoRequest; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("deleteVolumeGroupRequest") @XmlRootElement(name = "deleteVolumeGroupRequest") -@NoJackson public class DeleteVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java index d70ffb756e..553cc0e8e0 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java @@ -23,12 +23,10 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("deleteVolumeGroupResponse") @XmlRootElement(name = "deleteVolumeGroupResponse") -@NoJackson public class DeleteVolumeGroupResponse extends VfResponseCommon { private Boolean volumeGroupDeleted; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java index 2395495a36..222644ca1c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java @@ -21,33 +21,30 @@ package org.openecomp.mso.adapters.vnfrest; -import org.openecomp.mso.logger.MsoLogger; - - import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.annotations.providers.NoJackson; +import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.openstack.beans.VnfStatus; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("queryVfModuleResponse") @XmlRootElement(name = "queryVfModuleResponse") -@NoJackson -public class QueryVfModuleResponse { +public class QueryVfModuleResponse extends VfResponseCommon{ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); private String vnfId; private String vfModuleId; private String vfModuleStackId; private VnfStatus vnfStatus; - private Map<String,String> vfModuleOutputs; + private Map<String, String> vfModuleOutputs; public QueryVfModuleResponse() { super(); } - public QueryVfModuleResponse(String vnfId, String vfModuleId, - String vfModuleStackId, VnfStatus vnfStatus, + public QueryVfModuleResponse(String vnfId, String vfModuleId, String vfModuleStackId, VnfStatus vnfStatus, Map<String, String> vfModuleOutputs) { super(); this.vnfId = vnfId; @@ -96,16 +93,5 @@ public class QueryVfModuleResponse { public void setVfModuleOutputs(Map<String, String> vfModuleOutputs) { this.vfModuleOutputs = vfModuleOutputs; } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - jsonString = mapper.writeValueAsString(this); - } - catch (Exception e) { - LOGGER.debug("Exception :",e); - } - return jsonString; - } + } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java index e70b9ddc71..41226c3696 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java @@ -26,16 +26,13 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.logger.MsoLogger; - import org.openecomp.mso.openstack.beans.VnfStatus; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + @XmlRootElement(name = "queryVolumeGroupResponse") -@NoJackson public class QueryVolumeGroupResponse { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); private String volumeGroupId; @@ -95,7 +92,7 @@ public class QueryVolumeGroupResponse { String jsonString = null; try { ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); } catch (Exception e) { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java index e67fa0058b..aa9b35bb98 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java @@ -23,12 +23,11 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("rollbackVfModuleRequest") @XmlRootElement(name = "rollbackVfModuleRequest") -@NoJackson public class RollbackVfModuleRequest extends VfRequestCommon { private VfModuleRollback vfModuleRollback; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java index d64f1ccc0d..c77155fe81 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java @@ -23,12 +23,10 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("rollbackVfModuleResponse") @XmlRootElement(name = "rollbackVfModuleResponse") -@NoJackson public class RollbackVfModuleResponse extends VfResponseCommon { private Boolean vfModuleRolledback; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java index 1db969c8e5..d7f49fd530 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java @@ -23,12 +23,10 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("rollbackVolumeGroupRequest") @XmlRootElement(name = "rollbackVolumeGroupRequest") -@NoJackson public class RollbackVolumeGroupRequest extends VfRequestCommon { private VolumeGroupRollback volumeGroupRollback; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java index 50b513523a..22164d9508 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java @@ -23,12 +23,10 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("rollbackVolumeGroupResponse") @XmlRootElement(name = "rollbackVolumeGroupResponse") -@NoJackson public class RollbackVolumeGroupResponse extends VfResponseCommon { private Boolean volumeGroupRolledBack; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java index ba576e36b2..c52cc60b35 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java @@ -21,17 +21,17 @@ package org.openecomp.mso.adapters.vnfrest; -import org.openecomp.mso.entity.MsoRequest; - -import java.util.Map; import java.util.HashMap; +import java.util.Map; + import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; + +import org.openecomp.mso.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateVfModuleRequest") @XmlRootElement(name = "updateVfModuleRequest") -@NoJackson public class UpdateVfModuleRequest extends VfRequestCommon { private String cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java index bf50008bc7..aa9a3aad31 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java @@ -23,13 +23,13 @@ package org.openecomp.mso.adapters.vnfrest; import java.util.HashMap; import java.util.Map; + import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; + +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("updateVfModuleResponse") @XmlRootElement(name = "updateVfModuleResponse") -@NoJackson public class UpdateVfModuleResponse extends VfResponseCommon { private String vnfId; private String vfModuleId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java index 2cd2cd49fb..983e81602c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -26,14 +26,12 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.entity.MsoRequest; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("updateVolumeGroupRequest") @XmlRootElement(name = "updateVolumeGroupRequest") -@NoJackson public class UpdateVolumeGroupRequest extends VfRequestCommon { private String cloudSiteId; private String tenantId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java index 7f1c70314f..d71ef275e1 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java @@ -26,12 +26,11 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("updateVolumeGroupResponse") @XmlRootElement(name = "updateVolumeGroupResponse") -@NoJackson public class UpdateVolumeGroupResponse extends VfResponseCommon { private String volumeGroupId; private String volumeGroupStackId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java index 7ace036ef5..6416d2df5e 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java @@ -22,12 +22,13 @@ package org.openecomp.mso.adapters.vnfrest; import java.io.Serializable; + import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; + import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "vfModuleException") -@NoJackson + public class VfModuleExceptionResponse extends VfResponseCommon implements Serializable { private static final long serialVersionUID = -9062290006520066109L; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java index 49e0f9743d..59bd5020d2 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java @@ -25,12 +25,11 @@ import javax.xml.bind.annotation.XmlRootElement; import org.openecomp.mso.entity.MsoRequest; import org.openecomp.mso.openstack.beans.VnfRollback; -import org.jboss.resteasy.annotations.providers.NoJackson; -import org.codehaus.jackson.map.annotate.JsonRootName; + +import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("VfModuleRollback") @XmlRootElement(name = "VfModuleRollback") -@NoJackson public class VfModuleRollback { private String vnfId; private String vfModuleId; @@ -40,6 +39,7 @@ public class VfModuleRollback { private String cloudSiteId; private MsoRequest msoRequest; private String messageId; + private String mode = "HEAT"; // default public VfModuleRollback() { } @@ -54,6 +54,7 @@ public class VfModuleRollback { this.cloudSiteId = vrb.getCloudSiteId(); this.msoRequest = vrb.getMsoRequest(); this.messageId = messageId; + this.mode = vrb.getMode(); } public VfModuleRollback(String vnfId, String vfModuleId, @@ -120,4 +121,10 @@ public class VfModuleRollback { public void setMessageId(String messageId) { this.messageId = messageId; } + public String getMode() { + return mode; + } + public void setMode(String mode) { + this.mode = mode; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java index 76cbda1ef4..4f55c5a615 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java @@ -29,8 +29,8 @@ import javax.xml.bind.Marshaller; import org.openecomp.mso.logger.MsoLogger; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; /** * Everything that is common between all VfModule and VolumeGroup Responses, @@ -60,7 +60,7 @@ public abstract class VfResponseCommon { try { String jsonString; ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); jsonString = mapper.writeValueAsString(this); return jsonString; } catch (Exception e) { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java index 4c230dccfd..4c3a0a6d60 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java @@ -23,12 +23,9 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; @XmlRootElement(name = "volumeGroupException") -@NoJackson public class VolumeGroupExceptionResponse extends VfModuleExceptionResponse { // Exactly the same as a VfModuleExceptionResponse diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java index bdc8585222..c815a7658c 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java @@ -23,14 +23,12 @@ package org.openecomp.mso.adapters.vnfrest; import javax.xml.bind.annotation.XmlRootElement; -import org.codehaus.jackson.map.annotate.JsonRootName; -import org.jboss.resteasy.annotations.providers.NoJackson; - import org.openecomp.mso.entity.MsoRequest; +import com.fasterxml.jackson.annotation.JsonRootName; + @JsonRootName("VolumeGroupRollback") @XmlRootElement(name = "VolumeGroupRollback") -@NoJackson public class VolumeGroupRollback { // “volumeGroupRollback”: { // “volumeGroupId”: “<A&AI_ VOLUME_GROUP_ID>”, diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java new file mode 100644 index 0000000000..8e223b7bcb --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + +/* + * Enum status values to mirror the Openstack Heat stack status values + */ +public enum HeatStatus { + INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java new file mode 100644 index 0000000000..4d9dc0009e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "prefix", + "nextHop" +}) +public class HostRoute { + + private String prefix; + private String nextHop; + + /** + * @return the prefix + */ + public String getPrefix() { + return prefix; + } + /** + * @param prefix the prefix to set + */ + public void setPrefix(String prefix) { + this.prefix = prefix; + } + /** + * @return the nextHop + */ + public String getNextHop() { + return nextHop; + } + /** + * @param nextHop the nextHop to set + */ + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + + @Override + public String toString() { + return "Host_route [prefix=" + prefix + ", nextHop=" + nextHop + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java new file mode 100644 index 0000000000..5e037096df --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + + +import java.util.Map; + +/** + * This bean class represents the Openstack tenant properties that are + * needed by MSO. + * + * + */ +public class MsoTenant { + private String tenantId; + private String tenantName; + private Map<String,String> metadata; + + public MsoTenant() {} + + public MsoTenant (String id, String name, Map<String,String> metadata) { + this.tenantId = id; + this.tenantName = name; + this.metadata = metadata; + } + + 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 Map<String, String> getMetadata() { + return metadata; + } + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java new file mode 100644 index 0000000000..64460b20bb --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; + +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Segment; + +/* + * This Java bean class relays Network details (including status) to ActiveVOS processes. + * + * This bean is returned by all Network-specific adapter operations (create, query, delete) + */ +public class NetworkInfo { + // Set defaults for everything + private String name = ""; + private String id = ""; + private NetworkStatus status = NetworkStatus.UNKNOWN; + private String provider = ""; + private List<Integer> vlans = new ArrayList<>(); + private List<String> subnets = new ArrayList<>(); + + static Map<String,NetworkStatus> NetworkStatusMap; + static { + NetworkStatusMap = new HashMap<>(); + NetworkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE); + NetworkStatusMap.put("DOWN", NetworkStatus.DOWN); + NetworkStatusMap.put("BUILD", NetworkStatus.BUILD); + NetworkStatusMap.put("ERROR", NetworkStatus.ERROR); + } + + /** + * Capture the data from a Neutron Network object. + * + * For MSO, there are assumptions regarding all networks. + * - Everything will be a provider network + * - All provider networks are VLANs + * - Multiple VLANs are supported, and indicated by multi-provider segments. + * Each will have the same physical network & network type "vlan". + * + * @param network + */ + public NetworkInfo(Network network) { + if (network != null) { + initFieldsWithDataFromNetwork(network); + } else { + status = NetworkStatus.NOTFOUND; + } + } + + private void initFieldsWithDataFromNetwork(Network network){ + name = network.getName(); + id = network.getId(); + + if (network.getStatus() != null && NetworkStatusMap.containsKey(network.getStatus())) { + status = NetworkStatusMap.get(network.getStatus()); + } + if (network.getProviderPhysicalNetwork() != null) { + provider = network.getProviderPhysicalNetwork(); + if ("vlan".equals(network.getProviderNetworkType())) { + vlans.add(network.getProviderSegmentationId()); + } + } + else if (network.getSegments() != null && !network.getSegments().isEmpty()) { + Segment s = network.getSegments().get(0); + provider = s.getProviderPhysicalNetwork(); + if ("vlan".equals(s.getProviderNetworkType())) { + network.getSegments().forEach(segment -> vlans.add(segment.getProviderSegmentationId())); + } + } + subnets = network.getSubnets(); + } + + public String getName() { + return name; + } + + public void setName (String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId (String id) { + this.id = id; + } + + public NetworkStatus getStatus() { + return status; + } + + public void setStatus (NetworkStatus status) { + this.status = status; + } + + public String getProvider() { + return provider; + } + + public void setProvider (String provider) { + this.provider = provider; + } + + public List<Integer> getVlans () { + return vlans; + } + + public void setVlans (List<Integer> vlans) { + this.vlans = vlans; + } + + public List<String> getSubnets () { + return subnets; + } + + @Override + public String toString() { + return "NetworkInfo{" + "name='" + name + '\'' + + ", id='" + id + '\'' + + ", status=" + status + + ", provider='" + provider + '\'' + + ", vlans=" + vlans + + ", subnets=" + subnets + + '}'; + } +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java new file mode 100644 index 0000000000..a965122921 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java @@ -0,0 +1,152 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + +import java.util.List; + +import org.openecomp.mso.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +/** + * Javabean representing the rollback criteria following a "Create Network" + * or "Update Network" operation. This structure can be passed back to the + * "Rollback Network" operation to undo the effects of the create/update. + * + * Once a network is created, the only possible update through MSO is to + * the set of VLANs supported by the network. The vlans attribute of the + * rollback object contains the previous VLANs before update. + * + * + */ +@JsonInclude(Include.NON_EMPTY) +public class NetworkRollback { + private String networkId; + private String neutronNetworkId; + private String networkStackId; + private String tenantId; + private String cloudId; + private String networkType; + private String modelCustomizationUuid; + private boolean networkCreated = false; + // Previous values for updates + private String networkName = null; + private String physicalNetwork = null; + private List<Integer> vlans = null; + private MsoRequest msoRequest; + + public String getNetworkId() { + return networkId; + } + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNetworkStackId() { + return networkStackId; + } + public void setNetworkStackId(String networkStackId) { + this.networkStackId = networkStackId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getCloudId() { + return cloudId; + } + public void setCloudId(String cloudId) { + this.cloudId = cloudId; + } + + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public boolean getNetworkCreated() { + return networkCreated; + } + public void setNetworkCreated(boolean networkCreated) { + this.networkCreated = networkCreated; + } + + public String getNetworkName() { + return networkName; + } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getPhysicalNetwork() { + return physicalNetwork; + } + public void setPhysicalNetwork(String physicalNetwork) { + this.physicalNetwork = physicalNetwork; + } + + public List<Integer> getVlans () { + return vlans; + } + public void setVlans (List<Integer> vlans) { + this.vlans = vlans; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest (MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + @Override + public String toString() { + return "NetworkRollback [networkId=" + networkId + + ", neutronNetworkId=" + neutronNetworkId + ", networkStackId=" + + networkStackId + ", tenantId=" + tenantId + ", cloudId=" + + cloudId + ", networkType=" + networkType + + ", networkCreated=" + networkCreated + ", networkName=" + networkName + + ", physicalNetwork=" + physicalNetwork + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java new file mode 100644 index 0000000000..199028e56c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + +/** + * Enum status values to mirror the Openstack Neutron + * network status values + */ +public enum NetworkStatus { + NOTFOUND, ACTIVE, DOWN, BUILD, ERROR, UNKNOWN +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java new file mode 100644 index 0000000000..a3a04abc60 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "start", + "end" +}) +public class Pool { + + private String start; + private String end; + + /** + * @return the start + */ + public String getStart() { + return start; + } + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + /** + * @return the end + */ + public String getEnd() { + return end; + } + /** + * @param end the end to set + */ + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "Allocation_pool [start=" + start + ", end=" + end + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java new file mode 100644 index 0000000000..7903b08ff9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "routeTarget", + "routeTargetRole" +}) +public class RouteTarget { + + private String routeTarget; + private String routeTargetRole; + + public String getRouteTarget() { + return routeTarget; + } + public void setRouteTarget(String routeTarget) { + this.routeTarget = routeTarget; + } + public String getRouteTargetRole() { + return routeTargetRole; + } + public void setRole(String routeTargetRole) { + this.routeTargetRole = routeTargetRole; + } + + + @Override + public String toString() { + return "RouteTarget [routeTarget=" + routeTarget + ", routeTargetRole=" + routeTargetRole + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java new file mode 100644 index 0000000000..e88b5f87a0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + +import java.util.Map; +import java.util.HashMap; + +import com.woorea.openstack.heat.model.Stack; + +/* + * This Java bean class relays Heat stack status information to ActiveVOS processes. + * + * This bean is returned by all Heat-specific adapter operations (create, query, delete) + */ + +public class StackInfo { + // Set defaults for everything + private String name = ""; + private String canonicalName = ""; + private HeatStatus status = HeatStatus.UNKNOWN; + private String statusMessage = ""; + private Map<String,Object> outputs = new HashMap<>(); + private Map<String,Object> parameters = new HashMap<>(); + + static Map<String,HeatStatus> HeatStatusMap; + static { + HeatStatusMap = new HashMap<>(); + HeatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING); + HeatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED); + HeatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED); + HeatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING); + HeatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND); + HeatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED); + HeatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING); + HeatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED); + HeatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED); + } + + public StackInfo () { + } + + public StackInfo (String name, HeatStatus status, String statusMessage, Map<String,Object> outputs) { + this.name = name; + this.canonicalName = name; // Don't have an ID, so just use name + + this.status = status; + if (statusMessage != null) this.statusMessage = statusMessage; + if (outputs != null) this.outputs = outputs; + } + + public StackInfo (String name, HeatStatus status) { + this.name = name; + this.canonicalName = name; // Don't have an ID, so just use name + this.status = status; + } + + public StackInfo (Stack stack) + { + if (stack == null) { + this.status = HeatStatus.NOTFOUND; + return; + } + + this.name = stack.getStackName(); + this.canonicalName = stack.getStackName() + "/" + stack.getId(); + + if (stack.getStackStatus() == null) { + this.status = HeatStatus.INIT; + } else if (HeatStatusMap.containsKey(stack.getStackStatus())) { + this.status = HeatStatusMap.get(stack.getStackStatus()); + } else { + this.status = HeatStatusMap.getOrDefault(stack.getStackStatus(), HeatStatus.UNKNOWN); + } + + this.statusMessage = stack.getStackStatusReason(); + + if (stack.getOutputs() != null) { + this.outputs = new HashMap<>(); + for (Stack.Output output : stack.getOutputs()) { + this.outputs.put(output.getOutputKey(), output.getOutputValue()); + } + } + + this.parameters = stack.getParameters(); + } + + public String getName() { + return name; + } + + public void setName (String name) { + this.name = name; + } + + public String getCanonicalName() { + return canonicalName; + } + + public void setCanonicalName (String name) { + this.canonicalName = name; + } + + public HeatStatus getStatus() { + return status; + } + + public void setStatus (HeatStatus status) { + this.status = status; + } + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage (String statusMessage) { + this.statusMessage = statusMessage; + } + + public Map<String,Object> getOutputs () { + return outputs; + } + + public void setOutputs (Map<String,Object> outputs) { + this.outputs = outputs; + } + + public Map<String,Object> getParameters () { + return parameters; + } + + public void setParameters (Map<String,Object> parameters) { + this.parameters = parameters; + } + +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java new file mode 100644 index 0000000000..086395cc93 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java @@ -0,0 +1,207 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + + +import java.util.List; + +import javax.xml.bind.annotation.XmlTransient; + +public class Subnet { + + private String subnetName; + + private String neutronId; + + private String subnetId; // value from aai + + private String cidr; //Only field required + + private String gatewayIp=""; + + private String ipVersion="4"; + + private Boolean enableDHCP=false; + + private Boolean addrFromStart=true; + + private List<HostRoute> hostRoutes; + + private List<Pool> allocationPools; + + private List<String> dnsNameServers; + + public Subnet () { + } + + public String getSubnetName() { + return subnetName; + } + + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + + public List<Pool> getAllocationPools() { + return allocationPools; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @return the dnsNames + */ + public List<String> getDnsNameServers() { + return dnsNameServers; + } + + + public Boolean getEnableDHCP() { + return enableDHCP; + } + + public Boolean getAddrFromStart() { + return addrFromStart; + } + + public void setAddrFromStart(Boolean addrFromStart) { + this.addrFromStart = addrFromStart; + } + + /** + * @return the gw + */ + public String getGatewayIp() { + return gatewayIp; + } + + /** + * @return the hostRoutes + */ + public List<HostRoute> getHostRoutes() { + return hostRoutes; + } + + /** + * @return the NeutronId + */ + @XmlTransient + public String getNeutronId() { + return neutronId; + } + + /** + * @return the ipversion + */ + public String getIpVersion() { + return ipVersion; + } + + /** + * @return the name + */ + public String getSubnetId() { + return subnetId; + } + + public void setAllocationPools(List<Pool> allocationPools) { + this.allocationPools = allocationPools; + } + + /** + * @param cidr + * the cidr to set + */ + public void setCidr(String cidr) { + this.cidr = cidr; + } + + /** + * @param dnsNames + * the dnsNames to set + */ + public void setDnsNameServers(List<String> dnsNameServers) { + this.dnsNameServers = dnsNameServers; + } + + /** + * @param enableDHCP + * the enableDHCP to set + */ + public void setEnableDHCP(Boolean enableDHCP) { + this.enableDHCP = enableDHCP; + } + + /** + * @param gw + * the gw to set + */ + public void setGatewayIp(String gatewayIp) { + this.gatewayIp = gatewayIp; + } + + /** + * @param hostRoutes + * the hostRoutes to set + */ + public void setHostRoutes(List<HostRoute> hostRoutes) { + this.hostRoutes = hostRoutes; + } + + /** + * @param neutronId + * the id to set + */ + public void setNeutronId(String neutronId) { + this.neutronId = neutronId; + } + + /** + * @param ipversion + * the ipversion to set + */ + public void setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + } + + /** + * @param name + * the name to set + */ + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + @Override + public String toString() { + return "Subnet [subnetName=" + subnetName + ", neutronId=" + neutronId + ", subnetId=" + subnetId + ", cidr=" + + cidr + ", gatewayIp=" + gatewayIp + ", ipVersion=" + ipVersion + ", enableDHCP=" + enableDHCP + + ", addrFromStart=" + addrFromStart + ", hostRoutes=" + hostRoutes + ", allocationPools=" + + allocationPools + ", dnsNameServers=" + dnsNameServers + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java new file mode 100644 index 0000000000..c4f63138e0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java @@ -0,0 +1,214 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + +import org.openecomp.mso.entity.MsoRequest; +/** + * Javabean representing the rollback criteria following a "Create VNF" + * operation. This structure can be passed back to the "Rollback VNF" + * operation to undo the effects of the create. + * + * + */ +public class VnfRollback { + private String vnfId; + private String tenantId; + private String cloudSiteId; + private boolean tenantCreated = false; + private boolean vnfCreated = false; + private MsoRequest msoRequest; + private String volumeGroupName; + private String volumeGroupId; + private String requestType; + private String volumeGroupHeatStackId; + private String baseGroupHeatStackId; + private boolean isBase = false; + private String vfModuleStackId; + private String modelCustomizationUuid; //NOTE: this is the vfModule's modelCustomizationUuid + private String mode = "HEAT"; + + public VnfRollback() {} + + /** + * For backwards compatibility... orchestration mode defaults to HEAT + * + * @param vnfId + * @param tenantId + * @param cloudSiteId + * @param tenantCreated + * @param vnfCreated + * @param msoRequest + * @param volumeGroupName + * @param volumeGroupId + * @param requestType + * @param modelCustomizationUuid + */ + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, + boolean tenantCreated, boolean vnfCreated, + MsoRequest msoRequest, + String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) { + super(); + this.vnfId = vnfId; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.tenantCreated = tenantCreated; + this.vnfCreated = vnfCreated; + this.msoRequest = msoRequest; + this.volumeGroupName = volumeGroupName; + this.volumeGroupId = volumeGroupId; + this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; + } + + /** + * For backwards compatibility... orchestration mode defaults to HEAT + * + * @param vnfId + * @param tenantId + * @param cloudSiteId + * @param tenantCreated + * @param vnfCreated + * @param msoRequest + * @param volumeGroupName + * @param volumeGroupId + * @param requestType + * @param modelCustomizationUuid + */ + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, + boolean tenantCreated, boolean vnfCreated, + MsoRequest msoRequest, String volumeGroupName, String volumeGroupId, + String requestType, String modelCustomizationUuid, String orchestrationMode) { + super(); + this.vnfId = vnfId; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.tenantCreated = tenantCreated; + this.vnfCreated = vnfCreated; + this.msoRequest = msoRequest; + this.volumeGroupName = volumeGroupName; + this.volumeGroupId = volumeGroupId; + this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; + this.mode = orchestrationMode; + } + + public String getVnfId() { + return vnfId; + } + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudId) { + this.cloudSiteId = cloudId; + } + public boolean getTenantCreated() { + return tenantCreated; + } + public void setTenantCreated(boolean tenantCreated) { + this.tenantCreated = tenantCreated; + } + public boolean getVnfCreated() { + return vnfCreated; + } + public void setVnfCreated(boolean vnfCreated) { + this.vnfCreated = vnfCreated; + } + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest (MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + public String getVolumeGroupName() { + return this.volumeGroupName; + } + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + public String getVolumeGroupId() { + return this.volumeGroupId; + } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + public String getRequestType() { + return this.requestType; + } + public void setRequestType(String requestType) { + this.requestType = requestType; + } + public String getVolumeGroupHeatStackId() { + return this.volumeGroupHeatStackId; + } + public void setVolumeGroupHeatStackId(String volumeGroupHeatStackId) { + this.volumeGroupHeatStackId = volumeGroupHeatStackId; + } + + public String getBaseGroupHeatStackId() { + return this.baseGroupHeatStackId; + } + public void setBaseGroupHeatStackId(String baseGroupHeatStackId) { + this.baseGroupHeatStackId = baseGroupHeatStackId; + } + + public boolean isBase() { + return this.isBase; + } + public void setIsBase(boolean isBase) { + this.isBase = isBase; + } + public String getVfModuleStackId() { + return this.vfModuleStackId; + } + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getMode() { + return this.mode; + } + public void setMode(String mode) { + this.mode = mode; + } + @Override + public String toString() { + return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId + + ", vnf=" + vnfId + ", tenantCreated=" + tenantCreated + + ", vnfCreated=" + vnfCreated + ", requestType = " + requestType + + ", modelCustomizationUuid=" + this.modelCustomizationUuid + + ", mode=" + mode; + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java new file mode 100644 index 0000000000..cc7e66eecb --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.beans; + + +/* + * Enum status values to mirror the Openstack Heat stack status values + */ +public enum VnfStatus { + ACTIVE, FAILED, NOTFOUND, UNKNOWN +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java new file mode 100644 index 0000000000..454880cee1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + + +/** + * General MSO Exception class for any non-specific errors. + * + * + */ +public class MsoAdapterException extends MsoException +{ + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoException instance + public MsoAdapterException (String message) { + super(message); + super.category = MsoExceptionCategory.INTERNAL; + } + + // Constructor to wrap a nested exception + public MsoAdapterException (String message, Throwable t) { + super(message, t); + super.category = MsoExceptionCategory.INTERNAL; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java new file mode 100644 index 0000000000..7e21d9d15a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + +/** + * Signals that an attempt to find a specific mso cloud identity has failed. + */ +public class MsoCloudIdentityNotFound extends MsoException { + + private static final long serialVersionUID = 2583769056266415665L; + + + /** + * Default constructor (needed for BPEL/JAXB) + */ + public MsoCloudIdentityNotFound () { + super("Cloud Identity not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + public MsoCloudIdentityNotFound (String cloudIdentity) { + // Set the detailed error as the Exception 'message' + super("Cloud Identity [" + cloudIdentity + "] not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + @Override + public String toString () { + return getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java new file mode 100644 index 0000000000..7c6e98d55f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + +/** + * Signals that an attempt to find a specific mso cloud site has failed. + */ +public class MsoCloudSiteNotFound extends MsoException { + + private static final long serialVersionUID = 2583769056266415664L; + + /** + * Default constructor (needed for BPEL/JAXB) + */ + public MsoCloudSiteNotFound () { + super("Cloud site not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + public MsoCloudSiteNotFound (String cloudSite) { + // Set the detailed error as the Exception 'message' + super("Cloud Site [" + cloudSite + "] not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + @Override + public String toString () { + return getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java new file mode 100644 index 0000000000..b8a7a5571c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + + +public abstract class MsoException extends Exception +{ + private static final long serialVersionUID = 1L; + + protected MsoExceptionCategory category = MsoExceptionCategory.INTERNAL; + protected String context = null; + + protected MsoException (String message) { + super(message); + } + + protected MsoException (String message, Throwable t) { + super(message,t); + } + + public MsoExceptionCategory getCategory() { + return category; + } + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public String getContext () { + return context; + } + public void setContext (String context) { + this.context = context; + } + public void addContext (String ctx) { + if (this.context != null) + this.context = ctx + ":" + this.context; + else + this.context = ctx; + } + + public String getContextMessage () { + if (this.context == null) + return getMessage(); + else + return "[" + context + "] " + getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java new file mode 100644 index 0000000000..81a0edc2d3 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + + +public enum MsoExceptionCategory { + OPENSTACK, IO, INTERNAL, USERDATA +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java new file mode 100644 index 0000000000..9c7f6fa91a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + +/** + * I/O exception + */ +public class MsoIOException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 6752445132721635760L; + + /** + * Basic constructor with message + * @param message the error message + */ + public MsoIOException (String message) { + super(message); + super.category = MsoExceptionCategory.IO; + } + + /** + * Constructor to wrap a nested exception + * @param message the error message + * @param t the cause + */ + public MsoIOException (String message, Throwable t) { + super (message, t); + super.category = MsoExceptionCategory.IO; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java new file mode 100644 index 0000000000..98b85394be --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + + +public class MsoNetworkAlreadyExists extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoNetworkAlreadyExists (String stack, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Stack " + stack + " already exists in Tenant + " + tenant + " in Cloud " + cloud); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java new file mode 100644 index 0000000000..5802aa1208 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + + +public class MsoNetworkNotFound extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoNetworkNotFound (String networkId, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(404, "Not Found", "Network " + networkId + " does not exist in Cloud/Tenant " + cloud + "/" + tenant); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java new file mode 100644 index 0000000000..eead8439d4 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + +/** + * OpenStack exception. + */ +public class MsoOpenstackException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 3313636124141766495L; + + private int statusCode; + private String statusMessage; + private String errorDetail; + + /** + * Constructor to create a new MsoOpenstackException instance + * @param code the error code + * @param message the error message + * @param detail error details + */ + public MsoOpenstackException (int code, String message, String detail) { + // Set the detailed error as the Exception 'message' + super(detail); + super.category = MsoExceptionCategory.OPENSTACK; + + this.statusCode = code; + this.statusMessage = message; + this.errorDetail = detail; + } + + /** + * Constructor to propagate the caught exception (mostly for stack trace) + * @param code the error code + * @param message the error message + * @param detail error details + * @param e the cause + */ + public MsoOpenstackException (int code, String message, String detail, Exception e) { + // Set the detailed error as the Exception 'message' + super(detail, e); + super.category = MsoExceptionCategory.OPENSTACK; + + this.statusCode = code; + this.statusMessage = message; + this.errorDetail = detail; + } + + @Override + public String toString() { + return statusCode + + " " + + statusMessage + + ": " + + errorDetail; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java new file mode 100644 index 0000000000..2901b6b3a7 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + + +public class MsoStackAlreadyExists extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoStackAlreadyExists (String stack, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Stack " + stack + " already exists in Tenant + " + tenant + " in Cloud " + cloud); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java new file mode 100644 index 0000000000..21082a28c9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + +/** + * Thrown when HEAT stack is not found or deleted. + */ +public class MsoStackNotFound extends MsoOpenstackException { + + /** + * Serialization id. + */ + private static final long serialVersionUID = 7354069716354359246L; + + /** + * Constructor to create a new MsoOpenstackException instance. + * @param stack the stack name + * @param tenant the tenant name + * @param cloud the cloud name + */ + public MsoStackNotFound (String stack, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(404, "Not Found", "Stack " + stack + " does not exist in Cloud/Tenant " + cloud + "/" + tenant); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java new file mode 100644 index 0000000000..7a597d6f4d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + +public class MsoTenantAlreadyExists extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + public MsoTenantAlreadyExists (String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Tenant " + tenant + " already exists in Cloud " + cloud); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java new file mode 100644 index 0000000000..f26d6b6d49 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.mso.openstack.exceptions; + + +/** + * Tenant not found exception. + */ +public class MsoTenantNotFound extends MsoOpenstackException { + + /** + * Serialization id. + */ + private static final long serialVersionUID = 5640069939645577063L; + + /** + * Constructor to create the exception + * @param tenant the tenant id + * @param cloud the cloud id + */ + public MsoTenantNotFound (String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(404, "Not Found", "Tenant " + tenant + " does not exist in Cloud " + cloud); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java index 897c69d144..fd0855e221 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java @@ -27,8 +27,8 @@ import java.util.Map; import org.codehaus.jackson.JsonParser; import org.codehaus.jackson.map.DeserializationContext; import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; +import org.json.JSONException; +import org.json.JSONObject; import org.junit.Test; public class MapDeserializerTest { |