aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-14 02:07:32 -0400
committerRob Daugherty <rd472p@att.com>2018-03-14 04:08:41 -0400
commit38f720752af4d4aad8c4e467a288d9048659f688 (patch)
treee81066a8b5c77272e30fb57a64999573c4db4d86 /adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack
parentaee3d223f92a6f250f43e17558a2dfd576ff7294 (diff)
AT&T 1712 and 1802 release code
This is code from AT&T's 1712 and 1802 releases. Change-Id: Ie1e85851e94bc66c4d9514a0226c221939531a04 Issue-ID: SO-425 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java29
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java66
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java151
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java148
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java31
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Pool.java69
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java106
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java200
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java56
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java30
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java45
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java49
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java48
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java66
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java27
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java53
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java35
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java35
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java80
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java35
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java44
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java32
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java43
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java220
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java135
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java10
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java4
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java14
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java2
29 files changed, 360 insertions, 1503 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java
deleted file mode 100644
index 3e4ea27d5f..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java
deleted file mode 100644
index 5e037096df..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java
deleted file mode 100644
index 64460b20bb..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java
deleted file mode 100644
index 6878e5f6b4..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============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;
-
-/**
- * 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.
- *
- *
- */
-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-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java
deleted file mode 100644
index 199028e56c..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Pool.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Pool.java
deleted file mode 100644
index a3a04abc60..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Pool.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java
deleted file mode 100644
index 506b62994d..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*-
- * ============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 com.woorea.openstack.heat.model.Stack;
-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 {
- private String name = "";
- private String canonicalName = "";
- private HeatStatus status;
- private Map<String, Object> outputs = new HashMap<>();
- private Map<String,Object> parameters = new HashMap<>();
- static private 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 (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 {
- this.status = heatStatusMap.getOrDefault(stack.getStackStatus(), HeatStatus.UNKNOWN);
- }
- if (stack.getOutputs() != null) {
- this.outputs = new HashMap<>();
- stack.getOutputs().forEach(output -> 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 HeatStatus getStatus() {
- return status;
- }
-
- public Map<String, Object> getOutputs() {
- return outputs;
- }
-
- public Map<String,Object> getParameters () {
- return parameters;
- }
-
-}
-
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java
deleted file mode 100644
index eea47413e4..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*-
- * ============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 List<String> 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;
- }
-
- /**
- * @return the gw
- */
- public String getGatewayIp() {
- return gatewayIp;
- }
-
- /**
- * @return the hostRoutes
- */
- public List<String> 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<String> 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 + ", hostRoutes=" + hostRoutes
- + ", allocationPools=" + allocationPools + ", dnsNameServers="
- + dnsNameServers + "]";
- }
-
-}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java
index 8cb41deba5..43b742f326 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java
@@ -43,9 +43,24 @@ public class VnfRollback {
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,
@@ -63,6 +78,38 @@ public class VnfRollback {
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;
}
@@ -150,11 +197,18 @@ public class VnfRollback {
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;
+ + ", modelCustomizationUuid=" + this.modelCustomizationUuid
+ + ", mode=" + mode;
}
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java
deleted file mode 100644
index cc7e66eecb..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java
deleted file mode 100644
index 454880cee1..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java
deleted file mode 100644
index 7e21d9d15a..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java
deleted file mode 100644
index 7c6e98d55f..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java
deleted file mode 100644
index b8a7a5571c..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java
deleted file mode 100644
index 81a0edc2d3..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java
deleted file mode 100644
index 9c7f6fa91a..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java
deleted file mode 100644
index 98b85394be..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java
deleted file mode 100644
index 5802aa1208..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java
deleted file mode 100644
index eead8439d4..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java
deleted file mode 100644
index 2901b6b3a7..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java
deleted file mode 100644
index 21082a28c9..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java
deleted file mode 100644
index 7a597d6f4d..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java
deleted file mode 100644
index f26d6b6d49..0000000000
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============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-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java
index 04dbf523d0..92220f8717 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -21,81 +21,219 @@
package org.openecomp.mso.openstack.utils;
+
+
+import java.util.HashSet;
+import java.util.ArrayList;
import java.util.Set;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
import org.openecomp.mso.logger.MsoLogger;
public class MsoHeatEnvironmentEntry {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private Set<MsoHeatEnvironmentParameter> parameters;
- private String rawEntry;
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+ private Set<MsoHeatEnvironmentParameter> parameters = null;
+ private Set<MsoHeatEnvironmentResource> resources = null;
+ private StringBuilder rawEntry = null;
private boolean valid = true;
- private String errorString;
- private String resourceRegistryEntryRaw;
-
- private MsoHeatEnvironmentEntry(String rawEntry) {
- this.rawEntry = rawEntry;
+ private String errorString = null;
+ private StringBuilder resourceRegistryEntryRaw = null;
+
+ public MsoHeatEnvironmentEntry() {
+ super();
}
-
- private MsoHeatEnvironmentEntry(Set<MsoHeatEnvironmentParameter> parameters, String rawEntry, boolean valid,
- String errorString, String resourceRegistryEntryRaw) {
- this.parameters = parameters;
- this.rawEntry = rawEntry;
- this.valid = valid;
- this.errorString = errorString;
- this.resourceRegistryEntryRaw = resourceRegistryEntryRaw;
+
+ public MsoHeatEnvironmentEntry(StringBuilder sb) {
+ this();
+ this.rawEntry = sb;
+ this.processRawEntry();
}
-
+
+ private void processRawEntry() {
+ try {
+ if (this.rawEntry == null || "".equals(this.rawEntry))
+ return;
+ byte[] b = this.rawEntry.toString().getBytes();
+ MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b);
+ this.parameters = yaml.getParameterListFromEnvt();
+ //this.resources = yaml.getResourceListFromEnvt();
+ StringBuilder sb = this.getResourceRegistryRawEntry();
+ if (sb == null) {
+ this.resourceRegistryEntryRaw = new StringBuilder("");
+ } else {
+ this.resourceRegistryEntryRaw = sb;
+ }
+ } catch (Exception e) {
+ LOGGER.debug("Exception:", e);
+ this.valid = false;
+ this.errorString = e.getMessage();
+ //e.printStackTrace();
+ }
+ }
+
public boolean isValid() {
return this.valid;
}
public String getErrorString() {
return this.errorString;
}
-
+
+ public Set<MsoHeatEnvironmentParameter> getParameters() {
+ return this.parameters;
+ }
+ public Set<MsoHeatEnvironmentResource> getResources() {
+ return this.resources;
+ }
+ public void setParameters(Set<MsoHeatEnvironmentParameter> paramSet) {
+ if (paramSet == null) {
+ this.parameters = null;
+ } else {
+ this.parameters = paramSet;
+ }
+ }
+ public void setResources(Set<MsoHeatEnvironmentResource> resourceSet) {
+ if (resourceSet == null) {
+ this.resources = null;
+ } else {
+ this.resources = resourceSet;
+ }
+ }
+
+ public void addParameter(MsoHeatEnvironmentParameter hep) {
+ if (this.parameters == null) {
+ this.parameters = new HashSet<>();
+ }
+ this.parameters.add(hep);
+ }
+ public void addResource(MsoHeatEnvironmentResource her) {
+ if (this.resources == null) {
+ this.resources = new HashSet<>();
+ }
+ this.resources.add(her);
+ }
+
+ public int getNumberOfParameters() {
+ return this.parameters.size();
+ }
+ public int getNumberOfResources() {
+ return this.resources.size();
+ }
+
+ public boolean hasResources() {
+ if (this.resources != null && this.resources.size() > 0) {
+ return true;
+ }
+ return false;
+ }
+ public boolean hasParameters() {
+ if (this.parameters != null && this.parameters.size() > 0) {
+ return true;
+ }
+ return false;
+ }
+
public boolean containsParameter(String paramName) {
+ boolean contains = false;
if (this.parameters == null || this.parameters.size() < 1) {
return false;
}
if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) {
+ contains = true;
+ }
+ return contains;
+ }
+
+ public boolean containsParameter(String paramName, String paramAlias) {
+ if (this.containsParameter(paramName)) {
+ return true;
+ }
+ if (this.containsParameter(paramAlias)) {
return true;
}
return false;
}
-
+
@Override
public String toString() {
return "MsoHeatEnvironmentEntry{" + "parameters=" + parameters +
", resourceRegistryEntryRaw='" + resourceRegistryEntryRaw + '\'' +
'}';
}
-
- public String getRawEntry() {
- return rawEntry;
+
+ public StringBuilder toFullStringExcludeNonParams(Set<HeatTemplateParam> params) {
+ // Basically give back the envt - but exclude the params that aren't in the HeatTemplate
+
+ StringBuilder sb = new StringBuilder();
+ ArrayList<String> paramNameList = new ArrayList<String>(params.size());
+ for (HeatTemplateParam htp : params) {
+ paramNameList.add(htp.getParamName());
+ }
+
+ if (this.hasParameters()) {
+ sb.append("parameters:\n");
+ for (MsoHeatEnvironmentParameter hep : this.parameters) {
+ String paramName = hep.getName();
+ if (paramNameList.contains(paramName)) {
+ // This parameter *is* in the Heat Template - so include it:
+ sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n");
+ // New - 1607 - if any of the params mapped badly - JUST RETURN THE ORIGINAL ENVT!
+ if (hep.getValue().startsWith("_BAD")) {
+ return this.rawEntry;
+ }
+ }
+ }
+ sb.append("\n");
+ }
+// if (this.hasResources()) {
+// sb.append("resource_registry:\n");
+// for (MsoHeatEnvironmentResource her : this.resources) {
+// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n");
+// }
+// }
+ sb.append("\n");
+ sb.append(this.resourceRegistryEntryRaw);
+ return sb;
}
- private static String getResourceRegistryRawEntry(String rawEntry) {
- int indexOf = rawEntry.indexOf("resource_registry:");
- if (indexOf < 0) {
- return "";
+ public StringBuilder toFullString() {
+ StringBuilder sb = new StringBuilder();
+
+ if (this.hasParameters()) {
+ sb.append("parameters:\n");
+ for (MsoHeatEnvironmentParameter hep : this.parameters) {
+ sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n");
+ }
+ sb.append("\n");
}
- return rawEntry.substring(indexOf);
+// if (this.hasResources()) {
+// sb.append("resource_registry:\n");
+// for (MsoHeatEnvironmentResource her : this.resources) {
+// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n");
+// }
+// }
+ sb.append("\n");
+ sb.append(this.resourceRegistryEntryRaw);
+ return sb;
}
-
- public static MsoHeatEnvironmentEntry create(String rawEntry) {
- if (rawEntry == null || rawEntry.isEmpty()) {
- return new MsoHeatEnvironmentEntry(rawEntry);
+
+ public StringBuilder getRawEntry() {
+ return this.rawEntry;
+ }
+
+ private StringBuilder getResourceRegistryRawEntry() {
+
+ if (this.rawEntry == null) {
+ return null;
}
- try {
- Set<MsoHeatEnvironmentParameter> parameters = new MsoYamlEditorWithEnvt(rawEntry.getBytes())
- .getParameterListFromEnvt();
- return new MsoHeatEnvironmentEntry(parameters, rawEntry, true, null,
- getResourceRegistryRawEntry(rawEntry));
- } catch (Exception e) {
- LOGGER.debug(String.format("An exception occurred during processing the following raw entry: %s", rawEntry),
- e);
- return new MsoHeatEnvironmentEntry(null, rawEntry, false, e.getMessage(), null);
+
+ StringBuilder sb = new StringBuilder();
+ int indexOf = this.rawEntry.indexOf("resource_registry:");
+ if (indexOf < 0) { // no resource_registry:
+ return null;
}
+ sb.append(this.rawEntry.substring(indexOf));
+ return sb;
}
-
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
index 6862492d7e..7dd14d865c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -30,10 +30,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParseException;
-
import org.openecomp.mso.cloud.CloudConfig;
import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.cloud.CloudIdentity;
@@ -55,6 +51,10 @@ import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound;
import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.base.client.OpenStackConnectException;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.base.client.OpenStackResponseException;
@@ -359,6 +359,21 @@ public class MsoHeatUtils extends MsoCommonUtils {
stack.setFiles (heatFiles);
}
}
+
+ // 1802 - attempt to add better formatted printout of request to openstack
+ try {
+ Map<String, Object> inputs = new HashMap<String, Object>();
+ for (String key : stackInputs.keySet()) {
+ Object o = (Object) stackInputs.get(key);
+ if (o != null) {
+ inputs.put(key, o);
+ }
+ }
+ LOGGER.debug(this.printStackRequest(tenantId, heatFiles, files, environment, inputs, stackName, heatTemplate, timeoutMinutes, backout, cloudSiteId));
+ } catch (Exception e) {
+ // that's okay - this is a nice-to-have
+ LOGGER.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage());
+ }
Stack heatStack = null;
try {
@@ -372,7 +387,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
request.header ("X-Auth-User", cloudIdentity.getMsoId ());
request.header ("X-Auth-Key", cloudIdentity.getMsoPass ());
LOGGER.debug ("headers added, about to executeAndRecordOpenstackRequest");
- LOGGER.debug(this.requestToStringBuilder(stack).toString());
+ //LOGGER.debug(this.requestToStringBuilder(stack).toString());
// END - try to fix X-Auth-User
heatStack = executeAndRecordOpenstackRequest (request, msoProps);
} catch (OpenStackResponseException e) {
@@ -1416,7 +1431,7 @@ public class MsoHeatUtils extends MsoCommonUtils {
* (heat variable type) -> java Object type
* string -> String
* number -> Integer
- * json -> JsonNode
+ * json -> JsonNode XXX Removed with MSO-1475 / 1802
* comma_delimited_list -> ArrayList
* boolean -> Boolean
* if any of the conversions should fail, we will default to adding it to the inputs
@@ -1506,26 +1521,14 @@ public class MsoHeatUtils extends MsoCommonUtils {
newInputs.put(key, integerString);
}
} else if ("json".equalsIgnoreCase(type)) {
+ // MSO-1475 - Leave this as a string now
String jsonString = inputs.get(key);
- JsonNode jsonNode = null;
- try {
- jsonNode = new ObjectMapper().readTree(jsonString);
- } catch (Exception e) {
- LOGGER.debug("Unable to convert " + jsonString + " to a JsonNode!!", e);
- jsonNode = null;
- }
- if (jsonNode != null) {
- if (alias)
- newInputs.put(realName, jsonNode);
- else
- newInputs.put(key, jsonNode);
- }
- else {
- if (alias)
- newInputs.put(realName, jsonString);
- else
- newInputs.put(key, jsonString);
- }
+ LOGGER.debug("Skipping conversion to jsonNode...");
+ if (alias)
+ newInputs.put(realName, jsonString);
+ else
+ newInputs.put(key, jsonString);
+ //}
} else if ("comma_delimited_list".equalsIgnoreCase(type)) {
String commaSeparated = inputs.get(key);
try {
@@ -1559,5 +1562,85 @@ public class MsoHeatUtils extends MsoCommonUtils {
}
return newInputs;
}
-
+
+
+ /*
+ * Create a string suitable for being dumped to a debug log that creates a
+ * pseudo-JSON request dumping what's being sent to Openstack API in the create or update request
+ */
+
+ private String printStackRequest(String tenantId,
+ Map<String, Object> heatFiles,
+ Map<String, Object> nestedTemplates,
+ String environment,
+ Map<String, Object> inputs,
+ String vfModuleName,
+ String template,
+ int timeoutMinutes,
+ boolean backout,
+ String cloudSiteId) {
+ StringBuffer sb = new StringBuffer();
+ sb.append("CREATE STACK REQUEST (formatted for readability)\n");
+ sb.append("tenant=" + tenantId + ", cloud=" + cloudSiteId);
+ sb.append("{\n");
+ sb.append(" \"stack_name\": \"" + vfModuleName + "\",\n");
+ sb.append(" \"disable_rollback\": " + backout + ",\n");
+ sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n");
+ sb.append(" \"template\": {\n");
+ sb.append(template);
+ sb.append(" },\n");
+ sb.append(" \"environment\": {\n");
+ if (environment == null)
+ sb.append("<none>");
+ else
+ sb.append(environment);
+ sb.append(" },\n");
+ sb.append(" \"files\": {\n");
+ int filesCounter = 0;
+ if (heatFiles != null) {
+ for (String key : heatFiles.keySet()) {
+ filesCounter++;
+ if (filesCounter > 1) {
+ sb.append(",\n");
+ }
+ sb.append(" \"" + key + "\": {\n");
+ sb.append(heatFiles.get(key).toString() + "\n }");
+ }
+ }
+ if (nestedTemplates != null) {
+ for (String key : nestedTemplates.keySet()) {
+ filesCounter++;
+ if (filesCounter > 1) {
+ sb.append(",\n");
+ }
+ sb.append(" \"" + key + "\": {\n");
+ sb.append(nestedTemplates.get(key).toString() + "\n }");
+ }
+ }
+ sb.append("\n },\n");
+ sb.append(" \"parameters\": {\n");
+ int paramCounter = 0;
+ for (String name : inputs.keySet()) {
+ paramCounter++;
+ if (paramCounter > 1) {
+ sb.append(",\n");
+ }
+ Object o = inputs.get(name);
+ if (o instanceof java.lang.String) {
+ sb.append(" \"" + name + "\": \"" + inputs.get(name).toString() + "\"");
+ } else if (o instanceof Integer) {
+ sb.append(" \"" + name + "\": " + inputs.get(name).toString() );
+ } else if (o instanceof ArrayList) {
+ sb.append(" \"" + name + "\": " + inputs.get(name).toString() );
+ } else if (o instanceof Boolean) {
+ sb.append(" \"" + name + "\": " + inputs.get(name).toString() );
+ } else {
+ sb.append(" \"" + name + "\": " + "\"(there was an issue trying to dump this value...)\"" );
+ }
+ }
+ sb.append("\n }\n}\n");
+
+ return sb.toString();
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
index 75bb00351c..595da58270 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -26,10 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.ObjectMapper;
-
import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.cloud.CloudSite;
import org.openecomp.mso.logger.MessageEnum;
@@ -42,12 +38,16 @@ import org.openecomp.mso.openstack.exceptions.MsoStackNotFound;
import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.base.client.OpenStackBaseException;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.heat.Heat;
import com.woorea.openstack.heat.model.Stack;
-import com.woorea.openstack.heat.model.UpdateStackParam;
import com.woorea.openstack.heat.model.Stack.Output;
+import com.woorea.openstack.heat.model.UpdateStackParam;
public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
index 3b710032c1..018396d6ec 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
@@ -383,7 +383,9 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
// Get the Identity service URL. Throws runtime exception if not found per region.
String adminUrl = null;
try {
- adminUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "identity", region, "admin");
+ // TODO: FOR TESTING!!!!
+ adminUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "identity", region, "public");
+ adminUrl = adminUrl.replaceFirst("5000", "35357");
} catch (RuntimeException e) {
String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId ();
alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java
index e36d46841d..cc9e869608 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java
@@ -20,28 +20,30 @@
package org.openecomp.mso.openstack.utils;
+import java.lang.reflect.InvocationTargetException;
+
import org.openecomp.mso.cloud.CloudConfig;
import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.cloud.CloudIdentity;
import org.openecomp.mso.cloud.CloudSite;
-
-import java.lang.reflect.InvocationTargetException;
+import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
public class MsoTenantUtilsFactory {
- private CloudConfigFactory cloudConfigFactory= new CloudConfigFactory();
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private CloudConfigFactory cloudConfigFactory= new CloudConfigFactory();
private CloudConfig cloudConfig;
private String msoPropID;
-
+
public MsoTenantUtilsFactory (String msoPropID) {
this.msoPropID = msoPropID;
}
//based on Cloud IdentityServerType returns ORM or KEYSTONE Utils
public MsoTenantUtils getTenantUtils(String cloudSiteId) throws MsoCloudSiteNotFound {
- // Obtain the cloud site information
+ // Obtain the cloud site information
cloudConfig = cloudConfigFactory.getCloudConfig();
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
@@ -50,7 +52,7 @@ public class MsoTenantUtilsFactory {
public MsoTenantUtils getTenantUtilsByServerType(String serverType) {
- MsoTenantUtils tenantU;
+ MsoTenantUtils tenantU = null;
if (CloudIdentity.IdentityServerType.KEYSTONE.toString().equals(serverType)) {
tenantU = new MsoKeystoneUtils (msoPropID);
} else {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java
index 8002087ddd..8704911e26 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java
@@ -32,7 +32,7 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.yaml.snakeyaml.Yaml;