aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack')
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java30
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java69
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java66
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java120
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java157
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java31
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java62
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java62
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java109
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java213
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java213
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java30
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java45
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java56
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java56
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java66
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java27
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java54
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java53
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java35
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java35
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java80
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java35
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java44
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java35
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java43
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java107
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java99
28 files changed, 2032 insertions, 0 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java
new file mode 100644
index 0000000000..dd68d37736
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java
new file mode 100644
index 0000000000..228bb2c03d
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/beans/MsoTenant.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java
new file mode 100644
index 0000000000..b06ea0e59f
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/beans/NetworkInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java
new file mode 100644
index 0000000000..6110fa5073
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java
@@ -0,0 +1,120 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * 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<>();
+ private String shared = "";
+
+ public NetworkInfo () {
+ }
+
+ public NetworkInfo (String name, NetworkStatus status) {
+ this.name = name;
+ this.id = name; // Don't have an ID, so just use name
+ this.status = status;
+ }
+
+ 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;
+ }
+
+ public void setSubnets (List<String> subnets) {
+ this.subnets = subnets;
+ }
+
+ public String getShared() {
+ return shared;
+ }
+
+ public void setShared(String shared) {
+ this.shared = shared;
+ }
+
+ @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/onap/so/openstack/beans/NetworkRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java
new file mode 100644
index 0000000000..e95c564f27
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java
@@ -0,0 +1,157 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.onap.so.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 implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 11949663223019185L;
+ 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/onap/so/openstack/beans/NetworkStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java
new file mode 100644
index 0000000000..b7b1366562
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/beans/Pool.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java
new file mode 100644
index 0000000000..1c82907f80
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+
+
+
+
+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/onap/so/openstack/beans/RouteTarget.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java
new file mode 100644
index 0000000000..fcea8796c2
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+import java.io.Serializable;
+
+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 implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5425083030715789604L;
+ 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 setRouteTargetRole(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/onap/so/openstack/beans/StackInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java
new file mode 100644
index 0000000000..028ec9ec8d
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java
@@ -0,0 +1,109 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+/*
+ * 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<>();
+
+ 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 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/onap/so/openstack/beans/Subnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java
new file mode 100644
index 0000000000..3213323101
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java
@@ -0,0 +1,213 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+public class Subnet implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -530027355187604839L;
+
+ 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/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
new file mode 100644
index 0000000000..ba7f6532e1
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
@@ -0,0 +1,213 @@
+/*-
+ * ============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.onap.so.openstack.beans;
+
+import org.onap.so.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;
+ }
+
+ /**
+ *
+ * @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/onap/so/openstack/beans/VnfStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java
new file mode 100644
index 0000000000..9f1ae8813d
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoAdapterException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java
new file mode 100644
index 0000000000..31c4727934
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java
new file mode 100644
index 0000000000..31f3f6f7dd
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.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.onap.so.openstack.exceptions;
+
+
+/**
+ * Cloud site not found exception.
+ */
+public class MsoCloudIdentityNotFound extends MsoException {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 2583769056266415665L;
+
+ /**
+ * Default constructor (needed for BPEL/JAXB)
+ */
+ public MsoCloudIdentityNotFound () {
+ super("Cloud Identity not found");
+ super.category=MsoExceptionCategory.USERDATA;
+ }
+
+ /**
+ * Constructor to create a new MsoOpenstackException instance
+ * @param cloudSite the cloud site
+ */
+ 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/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java
new file mode 100644
index 0000000000..ceb08d8ccb
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.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.onap.so.openstack.exceptions;
+
+
+/**
+ * Cloud site not found exception.
+ */
+public class MsoCloudSiteNotFound extends MsoException {
+
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 2583769056266415664L;
+
+ /**
+ * Default constructor (needed for BPEL/JAXB)
+ */
+ public MsoCloudSiteNotFound () {
+ super("Cloud site not found");
+ super.category=MsoExceptionCategory.USERDATA;
+ }
+
+ /**
+ * Constructor to create a new MsoOpenstackException instance
+ * @param cloudSite the cloud site
+ */
+ 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/onap/so/openstack/exceptions/MsoException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java
new file mode 100644
index 0000000000..625914e820
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoExceptionCategory.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java
new file mode 100644
index 0000000000..ed57488301
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.openstack.exceptions;
+
+
+
+public enum MsoExceptionCategory {
+ OPENSTACK, IO, INTERNAL, USERDATA
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java
new file mode 100644
index 0000000000..dda7384d9e
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============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.onap.so.openstack.exceptions;
+
+/**
+ * MSO Heat not found exception.
+ */
+public class MsoHeatNotFoundException extends MsoException {
+ /**
+ * Serialization id.
+ */
+ private static final long serialVersionUID = 6547134336163166841L;
+
+ /**
+ * Default constructor (needed for BPEL/JAXB)
+ */
+ public MsoHeatNotFoundException() {
+ super("Heat not found");
+ super.category = MsoExceptionCategory.USERDATA;
+ }
+
+ /**
+ * Constructor to create a new MsoHeatNotFoundException instance
+ * @param heat the heat parameter
+ */
+ public MsoHeatNotFoundException(String heat) {
+ // Set the detailed error as the Exception 'message'
+ super("Heat [" + heat + "] not found");
+ super.category = MsoExceptionCategory.USERDATA;
+ }
+
+ @Override
+ public String toString() {
+ return getMessage();
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java
new file mode 100644
index 0000000000..35f2445d41
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java
new file mode 100644
index 0000000000..dd7817d310
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoNetworkNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java
new file mode 100644
index 0000000000..7306142cd0
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoOpenstackException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java
new file mode 100644
index 0000000000..1410650dd2
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoStackAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java
new file mode 100644
index 0000000000..fc98ee95ed
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoStackNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java
new file mode 100644
index 0000000000..1cd6b9650a
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java
new file mode 100644
index 0000000000..5da32847b1
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.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.onap.so.openstack.exceptions;
+
+
+
+public class MsoTenantAlreadyExists extends MsoOpenstackException {
+
+ private static final long serialVersionUID = 1L;
+
+ // Constructor to create a new MsoOpenstackException instance
+ 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/onap/so/openstack/exceptions/MsoTenantNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java
new file mode 100644
index 0000000000..9b135b61b2
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/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.onap.so.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/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java
new file mode 100644
index 0000000000..aa0f17810e
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java
@@ -0,0 +1,107 @@
+/*-
+ * ============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.onap.so.openstack.mappers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.javatuples.Pair;
+import org.onap.so.openstack.beans.NetworkInfo;
+import org.onap.so.openstack.beans.NetworkStatus;
+
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Segment;
+
+public class NetworkInfoMapper {
+
+ private final Network network;
+ private final Map<String,NetworkStatus> networkStatusMap = new HashMap<>();
+
+ public NetworkInfoMapper(Network network) {
+ this.network = network;
+ configureNetworkStatusMap();
+ }
+
+ /**
+ * 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 map() {
+ final NetworkInfo info = new NetworkInfo();
+ if (network == null) {
+ info.setStatus(NetworkStatus.NOTFOUND);
+ } else {
+ info.setName(network.getName());
+ info.setId(network.getId());
+ info.setStatus(this.mapStatus(network.getStatus()));
+ Pair<Optional<String>, List<Integer>> result = locateVlanInformation(network);
+ Optional<String> value0 = result.getValue0();
+ if (value0.isPresent()) {
+ info.setProvider(value0.get());
+ }
+ info.setVlans(result.getValue1());
+ info.setSubnets(network.getSubnets());
+ }
+ return info;
+ }
+
+ protected NetworkStatus mapStatus(String status) {
+ return networkStatusMap.getOrDefault(status, NetworkStatus.UNKNOWN);
+ }
+
+ protected Pair<Optional<String>, List<Integer>> locateVlanInformation(Network network) {
+ final List<Integer> vlans = new ArrayList<>();
+ Optional<String> provider = Optional.empty();
+ if (network.getProviderPhysicalNetwork() != null) {
+ provider = Optional.ofNullable(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 = Optional.ofNullable(s.getProviderPhysicalNetwork());
+ if ("vlan".equals(s.getProviderNetworkType())) {
+ for (Segment s1 : network.getSegments()) {
+ vlans.add(s1.getProviderSegmentationId());
+ }
+ }
+ }
+
+ return Pair.with(provider, vlans);
+ }
+
+ private void configureNetworkStatusMap() {
+ networkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE);
+ networkStatusMap.put("DOWN", NetworkStatus.DOWN);
+ networkStatusMap.put("BUILD", NetworkStatus.BUILD);
+ networkStatusMap.put("ERROR", NetworkStatus.ERROR);
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java
new file mode 100644
index 0000000000..85fd6cc279
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java
@@ -0,0 +1,99 @@
+/*-
+ * ============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.onap.so.openstack.mappers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.openstack.beans.HeatStatus;
+import org.onap.so.openstack.beans.StackInfo;
+
+import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.heat.model.Stack.Output;
+
+public class StackInfoMapper {
+
+ private final Stack stack;
+ private final Map<String,HeatStatus> heatStatusMap = new HashMap<>();
+ public StackInfoMapper(Stack stack) {
+ this.stack = stack;
+ configureHeatStatusMap();
+ }
+
+ public StackInfo map() {
+ final StackInfo info = new StackInfo();
+ if (stack == null) {
+ info.setStatus(HeatStatus.NOTFOUND);
+ } else {
+ info.setName(stack.getStackName());
+ info.setCanonicalName(stack.getStackName() + "/" + stack.getId());
+ info.setStatus(this.mapStatus(stack.getStackStatus()));
+
+ info.setStatusMessage(stack.getStackStatusReason());
+
+ Optional<Map<String, Object>> result = this.mapOutputToMap(stack.getOutputs());
+ if (result.isPresent()) {
+ info.setOutputs(result.get());
+ }
+
+ info.setParameters(stack.getParameters());
+ }
+
+ return info;
+ }
+
+ protected HeatStatus mapStatus(String status) {
+ final HeatStatus result;
+ if (status == null) {
+ result = HeatStatus.INIT;
+ } else {
+ result = heatStatusMap.getOrDefault(status, HeatStatus.UNKNOWN);
+ }
+
+ return result;
+ }
+
+ protected Optional<Map<String, Object>> mapOutputToMap(List<Output> outputs) {
+ Optional<Map<String, Object>> result = Optional.empty();
+ if (outputs != null) {
+ final HashMap<String, Object> map = new HashMap<>();
+ for (Output output : outputs) {
+ map.put(output.getOutputKey(), output.getOutputValue());
+ }
+ result = Optional.of(map);
+ }
+
+ return result;
+ }
+ private void configureHeatStatusMap() {
+ 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);
+ }
+}