diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
new file mode 100644
index 0000000..abcea2d
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java
@@ -0,0 +1,262 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.DeserializationConfig;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.annotate.JsonRootName;
+
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud
+ * configuration file to Java. The CloudConfig contains information about
+ * Openstack cloud configurations (in particular for the NVP/AIC cloud).
+ * It includes:
+ * - CloudIdentity objects, representing DCP nodes (Openstack Identity Service)
+ * - CloudSite objects, representing LCP nodes (Openstack Compute & other services)
+ *
+ * Note that this is only used to access Cloud Configurations loaded from a
+ * JSON config file, so there are no explicit property setters.
+ *
+ * This class also contains methods to query cloud sites and/or identity
+ * services by ID.
+ *
+ */
+
+@JsonRootName("cloud_config")
+public class CloudConfig {
+
+    @JsonProperty("identity_services")
+    private Map <String, CloudIdentity> identityServices = new HashMap <String, CloudIdentity> ();
+    @JsonProperty("cloud_sites")
+    private Map <String, CloudSite> cloudSites = new HashMap <String, CloudSite> ();
+
+    private static ObjectMapper mapper = new ObjectMapper ();
+
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+    protected String configFilePath;
+
+    protected int refreshTimerInMinutes;
+
+    public CloudConfig () {
+    	 mapper.enable (DeserializationConfig.Feature.UNWRAP_ROOT_VALUE);
+         mapper.enable (DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+    }
+
+	/**
+	 * Get a Map of all IdentityServices that have been loaded.
+	 * @return the Map
+	 */
+    public synchronized Map <String, CloudIdentity> getIdentityServices () {
+        return identityServices;
+    }
+
+	/**
+	 * Get a Map of all CloudSites that have been loaded.
+	 * @return the Map
+	 */
+	public synchronized Map <String, CloudSite> getCloudSites () {
+		return cloudSites;
+	}
+
+	/**
+	 * Get a specific CloudSites, based on an ID.  The ID is first checked against
+	 * the regions, and if no match is found there, then against individual entries
+	 * to try and find one with a CLLI that matches the ID and an AIC version of 2.5.
+	 * @param id the ID to match
+	 * @return a CloudSite, or null of no match found
+	 */
+	public synchronized CloudSite getCloudSite (String id) {
+		if (id != null) {
+			if (cloudSites.containsKey (id)) {
+				return cloudSites.get (id);
+			}
+			// check for id == CLLI now as well
+			return getCloudSiteWithClli(id, "2.5");
+		}
+		return null;
+	}
+
+	/**
+	 * Get a specific CloudSites, based on a CLLI and (optional) version, which will be matched
+	 * against the aic_version field of the CloudSite.
+	 * @param clli the CLLI to match
+	 * @param version the version to match; may be null in which case any version matches
+	 * @return a CloudSite, or null of no match found
+	 */
+	public synchronized CloudSite getCloudSiteWithClli(String clli, String version) {
+		if (clli != null) {
+	        // New with 1610 - find cloud site called "DEFAULT" - return that object, 
+	        // with the name modified to match what they asked for. We're looping thru
+			// the cloud sites anyway - so save off the default one in case we need it.
+			CloudSite defaultCloudSite = null;
+	        for (CloudSite cs : cloudSites.values()) {
+	        	if (cs.getClli() != null && clli.equals(cs.getClli())) {
+	        		if (version == null || version.equals(cs.getAic_version())) {
+	            		return cs;
+	        		}
+	        	} else if (cs.getId().equalsIgnoreCase("default")) {
+	        		// save it off in case we need it
+	        		defaultCloudSite = cs.clone();
+	        	}
+	        }
+	        // If we get here - we didn't find a match - so return the default cloud site
+            if (defaultCloudSite != null) {
+                defaultCloudSite.setRegionId(clli);
+                defaultCloudSite.setId(clli);
+            }
+	        return defaultCloudSite;
+		}
+        return null;
+	}
+
+	/**
+	 * Get a specific CloudIdentity, based on an ID.
+	 * @param id the ID to match
+	 * @return a CloudIdentity, or null of no match found
+	 */
+	public synchronized CloudIdentity getIdentityService (String id) {
+		if (identityServices.containsKey (id)) {
+			return identityServices.get (id);
+		}
+		return null;
+	}
+
+    protected synchronized void reloadPropertiesFile() throws JsonParseException, JsonMappingException, IOException  {
+		this.loadCloudConfig(this.configFilePath, this.refreshTimerInMinutes);
+	}
+
+    protected synchronized void loadCloudConfig (String configFile, int refreshTimer) throws JsonParseException, JsonMappingException, IOException {
+ 
+    	FileReader reader=null;
+    	configFilePath=configFile;
+    	this.refreshTimerInMinutes = refreshTimer;
+ 
+    	CloudConfig cloudConfig = null;
+ 
+    	try {
+    		reader = new FileReader (configFile);
+	        // Parse the JSON input into a CloudConfig
+
+	        cloudConfig = mapper.readValue (reader, CloudConfig.class);
+
+	        this.cloudSites = cloudConfig.cloudSites;
+	        this.identityServices = cloudConfig.identityServices;
+
+	        // Copy Cloud Identity IDs to CloudIdentity objects
+	        for (Entry <String, CloudIdentity> entry : cloudConfig.getIdentityServices ().entrySet ()) {
+	            entry.getValue ().setId (entry.getKey ());
+	        }
+
+	        // Copy Cloud Site IDs to CloudSite objects, and set up internal
+	        // pointers to their corresponding identity service.
+	        for (Entry <String, CloudSite> entry : cloudConfig.getCloudSites ().entrySet ()) {
+	            CloudSite s = entry.getValue ();
+	            s.setId (entry.getKey ());
+	            s.setIdentityService (cloudConfig.getIdentityService (s.getIdentityServiceId ()));
+	        }
+    	} finally {
+    		try {
+				if (reader != null) {
+					reader.close();
+				}
+			} catch (IOException e) {
+				LOGGER.debug("Exception while closing reader for file:" + configFilePath, e);
+			}
+    	}
+    }
+
+	public String getConfigFilePath() {
+		return configFilePath;
+	}
+
+	@Override
+	public synchronized CloudConfig clone() {
+		CloudConfig ccCopy = new CloudConfig();
+		for (Entry<String,CloudIdentity> e:identityServices.entrySet()) {
+
+			ccCopy.identityServices.put(e.getKey(), e.getValue().clone());
+		}
+
+		for (Entry<String,CloudSite> e:cloudSites.entrySet()) {
+
+			ccCopy.cloudSites.put(e.getKey(), e.getValue().clone());
+		}
+
+		ccCopy.configFilePath = this.configFilePath;
+
+		ccCopy.refreshTimerInMinutes = this.refreshTimerInMinutes;
+
+		return ccCopy;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((cloudSites == null) ? 0 : cloudSites.hashCode());
+		result = prime * result + ((configFilePath == null) ? 0 : configFilePath.hashCode());
+		result = prime * result + ((identityServices == null) ? 0 : identityServices.hashCode());
+		result = prime * result + refreshTimerInMinutes;
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		CloudConfig other = (CloudConfig) obj;
+		if (cloudSites == null) {
+			if (other.cloudSites != null)
+				return false;
+		} else if (!cloudSites.equals(other.cloudSites))
+			return false;
+		if (configFilePath == null) {
+			if (other.configFilePath != null)
+				return false;
+		} else if (!configFilePath.equals(other.configFilePath))
+			return false;
+		if (identityServices == null) {
+			if (other.identityServices != null)
+				return false;
+		} else if (!identityServices.equals(other.identityServices))
+			return false;
+		if (refreshTimerInMinutes != other.refreshTimerInMinutes)
+			return false;
+		return true;
+	}
+}
+
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java
new file mode 100644
index 0000000..6ee6721
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java
@@ -0,0 +1,226 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import javax.ejb.ConcurrencyManagement;
+import javax.ejb.ConcurrencyManagementType;
+import javax.ejb.LocalBean;
+import javax.ejb.Schedule;
+import javax.ejb.Singleton;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.openstack.utils.MsoHeatUtils;
+import org.openecomp.mso.openstack.utils.MsoKeystoneUtils;
+import org.openecomp.mso.openstack.utils.MsoNeutronUtils;
+import org.openecomp.mso.properties.MsoPropertiesException;
+import org.openecomp.mso.logger.MessageEnum;
+
+/**
+ * This class returns a cloud Config instances
+ *
+ *
+ */
+
+@Singleton(name = "CloudConfigFactory")
+@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
+@LocalBean
+@Path("/cloud")
+public class CloudConfigFactory implements Serializable {
+
+    private static final long serialVersionUID = 2956662716453261085L;
+
+    private static CloudConfig cloudConfigCache = new CloudConfig ();
+
+    protected static String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
+
+    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+    private static int refreshTimer;
+
+    private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock ();
+
+    static {
+        if (prefixMsoPropertiesPath == null) {
+            prefixMsoPropertiesPath = "";
+        }
+    }
+
+    public void initializeCloudConfig (String filePath, int refreshTimer) {
+
+        rwl.writeLock ().lock ();
+        try {
+            cloudConfigCache.loadCloudConfig (prefixMsoPropertiesPath + filePath, refreshTimer);
+            LOGGER.info (MessageEnum.RA_CONFIG_LOAD, prefixMsoPropertiesPath + filePath, "", "");
+        } catch (JsonParseException e) {
+            LOGGER.error (MessageEnum.RA_CONFIG_EXC, "Error parsing cloud config file " + filePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonParseException", e);
+        } catch (JsonMappingException e) {
+            LOGGER.error (MessageEnum.RA_CONFIG_EXC, "Error parsing cloud config file " + filePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonMappingException", e);
+        } catch (IOException e) {
+            LOGGER.error (MessageEnum.RA_CONFIG_NOT_FOUND, filePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - config not found", e);
+        } finally {
+            rwl.writeLock ().unlock ();
+        }
+    }
+
+    public void changeMsoPropertiesFilePath (String newMsoPropPath) throws MsoPropertiesException {
+        rwl.writeLock ().lock ();
+        try {
+            CloudConfigFactory.cloudConfigCache.configFilePath = prefixMsoPropertiesPath + newMsoPropPath;
+        } finally {
+            rwl.writeLock ().unlock ();
+        }
+    }
+
+    public CloudConfigFactory () {
+    }
+
+    public CloudConfig getCloudConfig () {
+        rwl.readLock ().lock ();
+        try {
+            return cloudConfigCache.clone ();
+        } finally {
+            rwl.readLock ().unlock ();
+        }
+    }
+
+    /**
+     * This method is not intended to be called, it's used to refresh the config
+     * automatically
+     *
+     * @return true if Properties have been reloaded, false otherwise
+     */
+    @Schedule(minute = "*/1", hour = "*", persistent = false)
+    public void reloadCloudConfig () {
+
+        try {
+            if (!rwl.writeLock ().tryLock () && !rwl.writeLock ().tryLock (30L, TimeUnit.SECONDS)) {
+                LOGGER.debug ("Busy write lock on mso cloud config factory, skipping the reloading");
+                return;
+            }
+        } catch (InterruptedException e1) {
+            LOGGER.debug ("Interrupted while trying to acquire write lock on cloud config factory, skipping the reloading");
+            Thread.currentThread ().interrupt ();
+            return;
+        }
+        try {
+            //LOGGER.debug ("Processing a reload of the mso properties file entries");
+            try {
+
+                if (refreshTimer <= 1) {
+                	CloudConfig oldCloudConfig = cloudConfigCache.clone();
+                    cloudConfigCache.reloadPropertiesFile ();
+                    refreshTimer = cloudConfigCache.refreshTimerInMinutes;
+                    if (!cloudConfigCache.equals(oldCloudConfig)) {
+                    	LOGGER.info (MessageEnum.RA_CONFIG_LOAD, prefixMsoPropertiesPath + cloudConfigCache.configFilePath, "", "");
+                    }
+
+                } else {
+                    --refreshTimer;
+                }
+
+            } catch (JsonParseException e) {
+                LOGGER.error (MessageEnum.RA_CONFIG_EXC,
+                              "Error parsing cloud config file " + cloudConfigCache.configFilePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonParseException",
+                              e);
+            } catch (JsonMappingException e) {
+                LOGGER.error (MessageEnum.RA_CONFIG_EXC,
+                              "Error parsing cloud config file " + cloudConfigCache.configFilePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonMappingException",
+                              e);
+            } catch (IOException e) {
+                LOGGER.error (MessageEnum.RA_CONFIG_NOT_FOUND, cloudConfigCache.configFilePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - config not found", e);
+            }
+        } catch (Exception e) {
+            LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Global issue while reloading", "", "", MsoLogger.ErrorCode.DataError, "Exception - Global issue while reloading\"", e);
+        } finally {
+            rwl.writeLock ().unlock ();
+        }
+    }
+
+    @GET
+    @Path("/showConfig")
+    @Produces("text/plain")
+    public Response showCloudConfig () {
+        CloudConfig cloudConfig = this.getCloudConfig ();
+
+        StringBuffer response = new StringBuffer ();
+        response.append ("Cloud Sites:\n");
+        for (CloudSite site : cloudConfig.getCloudSites ().values ()) {
+            response.append (site.toString () + "\n");
+        }
+
+        response.append ("\n\nCloud Identity Services:\n");
+        for (CloudIdentity identity : cloudConfig.getIdentityServices ().values ()) {
+            response.append (identity.toString () + "\n");
+        }
+
+        return Response.status (200).entity (response).build ();
+    }
+
+    @GET
+    @Path("/resetClientCaches")
+    @Produces("text/plain")
+    public Response resetClientCaches () {
+        // Reset all cached clients/credentials
+        MsoKeystoneUtils.adminCacheReset ();
+        MsoHeatUtils.heatCacheReset ();
+        MsoNeutronUtils.neutronCacheReset ();
+
+        String response = "Client caches reset.  All entries removed.";
+        return Response.status (200).entity (response).build ();
+    }
+
+    @GET
+    @Path("/cleanupClientCaches")
+    @Produces("text/plain")
+    public Response cleanupClientCaches () {
+        // Reset all cached clients/credentials
+        MsoKeystoneUtils.adminCacheCleanup ();
+        MsoHeatUtils.heatCacheCleanup ();
+        MsoNeutronUtils.neutronCacheCleanup ();
+
+        String response = "Client caches cleaned up.  All expired entries removed";
+        return Response.status (200).entity (response).build ();
+    }
+
+    @GET
+    @Path("/encryptPassword/{pwd}")
+    @Produces("text/plain")
+    public Response encryptPassword (@PathParam("pwd") String pwd) {
+        String encryptedPassword = CloudIdentity.encryptPassword (pwd);
+
+        String response = "Encrypted Password = " + encryptedPassword;
+        return Response.status (200).entity (response).build ();
+    }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java
new file mode 100644
index 0000000..a777e41
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java
@@ -0,0 +1,316 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+import java.security.GeneralSecurityException;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import com.woorea.openstack.keystone.model.authentication.RackspaceAuthentication;
+import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
+import org.openecomp.mso.utils.CryptoUtils;
+import com.woorea.openstack.keystone.model.Authentication;
+
+/**
+ * JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity
+ * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via
+ * CloudConfig object, of which it is a component (a CloudConfig JSON configuration
+ * file may contain multiple CloudIdentity definitions).
+ *
+ * Note that this is only used to access Cloud Configurations loaded from a
+ * JSON config file, so there are no explicit setters.
+ *
+ */
+public class CloudIdentity {
+
+    private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+    
+    public enum IdentityServerType {KEYSTONE};
+
+    public enum IdentityAuthenticationType { USERNAME_PASSWORD, RACKSPACE_APIKEY };
+    
+    @JsonProperty
+    private String id;
+    @JsonProperty("identity_url")
+    private String identityUrl;
+    @JsonProperty("mso_id")
+    private String msoId;
+    @JsonProperty("mso_pass")
+    private String msoPass;
+    @JsonProperty("admin_tenant")
+    private String adminTenant;
+    @JsonProperty("member_role")
+    private String memberRole;
+    @JsonProperty("tenant_metadata")
+    private Boolean tenantMetadata;
+    @JsonProperty("identity_server_type")
+    private IdentityServerType identityServerType;
+    @JsonProperty("identity_authentication_type")
+    private IdentityAuthenticationType identityAuthenticationType;
+    
+    private static String cloudKey = "aa3871669d893c7fb8abbcda31b88b4f";
+
+    public CloudIdentity () {
+    }
+
+    public String getId () {
+        return id;
+    }
+
+    public void setId (String id) {
+        this.id = id;
+    }
+
+    //DEPRECATED
+    public String getKeystoneUrl () throws MsoException {
+    	if (this.identityServerType.equals(IdentityServerType.KEYSTONE))
+    		return this.identityUrl;
+    	else
+    		return null;
+    }
+    
+    public String getKeystoneUrl (String regionId, String msoPropID) throws MsoException {
+    	if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) {
+    		return this.identityUrl;
+    	}
+    	else {
+    		return null;
+    	}
+    }
+    
+    public Authentication getAuthentication () throws MsoException {
+    	if (IdentityAuthenticationType.RACKSPACE_APIKEY.equals(this.identityAuthenticationType)) {
+    		return new RackspaceAuthentication (this.getMsoId (),this.getMsoPass ());
+    	}
+    	else {
+    		// Use default case
+    		return new UsernamePassword (this.getMsoId (),this.getMsoPass ());
+    	}
+    		
+    }
+
+    public void setKeystoneUrl (String url) {
+    	if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) {
+    		this.identityUrl = url;	
+    	}
+    }
+    
+    public String getIdentityUrl() {
+    	return this.identityUrl;
+    }
+    public void setIdentityUrl(String url) {
+    	this.identityUrl = url;
+    }
+
+    public String getMsoId () {
+        return msoId;
+    }
+
+    public void setMsoId (String id) {
+        this.msoId = id;
+    }
+
+    public String getMsoPass () {
+        try {
+            return CryptoUtils.decrypt (msoPass, cloudKey);
+        } catch (GeneralSecurityException e) {
+            LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in getMsoPass", e);
+            return null;
+        }
+    }
+
+    public void setMsoPass (String pwd) {
+        this.msoPass = pwd;
+    }
+
+    public String getAdminTenant () {
+        return adminTenant;
+    }
+
+    public void setAdminTenant (String tenant) {
+        this.adminTenant = tenant;
+    }
+
+    public String getMemberRole () {
+        return memberRole;
+    }
+
+    public void setMemberRole (String role) {
+        this.memberRole = role;
+    }
+
+    public boolean hasTenantMetadata () {
+        return tenantMetadata;
+    }
+
+    public void setTenantMetadata (boolean meta) {
+        this.tenantMetadata = meta;
+    }
+    
+    public IdentityServerType getIdentityServerType() {
+    	return this.identityServerType;
+    }
+    public void setIdentityServerType(IdentityServerType ist) {
+    	this.identityServerType = ist;
+    }
+    public String getIdentityServerTypeAsString() {
+    	return this.identityServerType.toString();
+    }
+    /**
+	 * @return the identityAuthenticationType
+	 */
+	public IdentityAuthenticationType getIdentityAuthenticationType() {
+		return identityAuthenticationType;
+	}
+
+	/**
+	 * @param identityAuthenticationType the identityAuthenticationType to set
+	 */
+	public void setIdentityAuthenticationType(IdentityAuthenticationType identityAuthenticationType) {
+		this.identityAuthenticationType = identityAuthenticationType;
+	}
+	
+	@Override
+    public String toString () {
+        StringBuilder stringBuilder = new StringBuilder ();
+        stringBuilder.append ("Cloud Identity Service: id=")
+                     .append (id)
+                     .append (", identityUrl=")
+                     .append (this.identityUrl)
+                     .append (", msoId=")
+                     .append (msoId)
+                     .append (", adminTenant=")
+                     .append (adminTenant)
+                     .append (", memberRole=")
+                     .append (memberRole)
+                     .append (", tenantMetadata=")
+                     .append (tenantMetadata)
+                     .append (", identityServerType=")
+                     .append (identityServerType.toString())
+                     .append (", identityAuthenticationType=")
+                     .append (identityAuthenticationType.toString());
+        
+        return stringBuilder.toString ();
+    }
+
+    public static String encryptPassword (String msoPass) {
+        try {
+            return CryptoUtils.encrypt (msoPass, cloudKey);
+        } catch (GeneralSecurityException e) {
+            LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
+            return null;
+        }
+    }
+
+
+	@Override
+	public CloudIdentity clone() {
+		CloudIdentity cloudIdentityCopy = new CloudIdentity();
+
+		cloudIdentityCopy.id = this.id;
+		cloudIdentityCopy.identityUrl = this.identityUrl;
+		cloudIdentityCopy.msoId = this.msoId;
+		cloudIdentityCopy.msoPass = this.msoPass;
+		cloudIdentityCopy.adminTenant = this.adminTenant;
+		cloudIdentityCopy.memberRole = this.memberRole;
+		cloudIdentityCopy.tenantMetadata = this.tenantMetadata;
+		cloudIdentityCopy.identityServerType = this.identityServerType;
+		cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType;
+
+		return cloudIdentityCopy;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((adminTenant == null) ? 0 : adminTenant.hashCode());
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		result = prime * result + ((identityUrl == null) ? 0 : identityUrl.hashCode());
+		result = prime * result + ((memberRole == null) ? 0 : memberRole.hashCode());
+		result = prime * result + ((msoId == null) ? 0 : msoId.hashCode());
+		result = prime * result + ((msoPass == null) ? 0 : msoPass.hashCode());
+		result = prime * result + ((tenantMetadata == null) ? 0 : tenantMetadata.hashCode());
+		result = prime * result + ((identityServerType == null) ? 0 : identityServerType.hashCode());
+		result = prime * result + ((identityAuthenticationType == null) ? 0 : identityAuthenticationType.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		CloudIdentity other = (CloudIdentity) obj;
+		if (adminTenant == null) {
+			if (other.adminTenant != null)
+				return false;
+		} else if (!adminTenant.equals(other.adminTenant))
+			return false;
+		if (id == null) {
+			if (other.id != null)
+				return false;
+		} else if (!id.equals(other.id))
+			return false;
+		if (identityUrl == null) {
+			if (other.identityUrl != null)
+				return false;
+		} else if (!identityUrl.equals(other.identityUrl))
+			return false;
+		if (memberRole == null) {
+			if (other.memberRole != null)
+				return false;
+		} else if (!memberRole.equals(other.memberRole))
+			return false;
+		if (msoId == null) {
+			if (other.msoId != null)
+				return false;
+		} else if (!msoId.equals(other.msoId))
+			return false;
+		if (msoPass == null) {
+			if (other.msoPass != null)
+				return false;
+		} else if (!msoPass.equals(other.msoPass))
+			return false;
+		if (tenantMetadata == null) {
+			if (other.tenantMetadata != null)
+				return false;
+		} else if (!tenantMetadata.equals(other.tenantMetadata))
+			return false;
+		if (identityServerType == null) {
+			if (other.getIdentityServerType() != null)
+				return false;
+		} else if (!identityServerType.equals(other.getIdentityServerType()))
+			return false;
+		if (identityAuthenticationType == null) {
+			if (other.getIdentityAuthenticationType() != null)
+				return false;
+		} else if (!identityAuthenticationType.equals(other.getIdentityAuthenticationType()))
+			return false;
+		
+		return true;
+	}
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java
new file mode 100644
index 0000000..16963de
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * JavaBean JSON class for a CloudSite.  This bean represents a cloud location
+ * (i.e. and LCP node) in the NVP/AIC cloud.  It will be loaded via CloudConfig
+ * object, of which it is a component (a CloudConfig JSON configuration file
+ * will contain multiple CloudSite definitions).
+ *
+ * Note that this is only used to access Cloud Configurations loaded from a
+ * JSON config file, so there are no explicit setters.
+ *
+ */
+public class CloudSite {
+	@JsonProperty
+	private String id;
+	@JsonProperty("region_id")
+	private String regionId;
+	@JsonProperty("identity_service_id")
+	private String identityServiceId;
+	@JsonProperty("aic_version")
+	private String aic_version;
+	@JsonProperty("clli")
+	private String clli;
+
+	// Derived property (set by CloudConfig loader based on identityServiceId)
+	private CloudIdentity identityService;
+
+	public CloudSite() {}
+	
+	public String getId() {
+		return id;
+	}
+	public void setId(String id) {
+		this.id = id;
+	}
+	
+	public String getRegionId() {
+		return regionId;
+	}
+	
+	public void setRegionId(String regionId) {
+		this.regionId = regionId;
+	}
+
+	public String getIdentityServiceId() {
+		return identityServiceId;
+	}
+
+	public CloudIdentity getIdentityService () {
+		return identityService;
+	}
+
+	public void setIdentityService (CloudIdentity identity) {
+		this.identityService = identity;
+	}
+	
+	public String getAic_version() {
+		return aic_version;
+	}
+
+	public void setAic_version(String aic_version) {
+		this.aic_version = aic_version;
+	}
+
+	public String getClli() {
+		return clli;
+	}
+
+	public void setClli(String clli) {
+		this.clli = clli;
+	}
+
+	@Override
+	public String toString() {
+		return "CloudSite: id=" + id +
+			", regionId=" + regionId +
+			", identityServiceId=" + identityServiceId +
+			", aic_version=" + aic_version +
+			", clli=" + clli;
+	}
+
+	@Override
+	public CloudSite clone() {
+		CloudSite cloudSiteCopy = new CloudSite();
+		cloudSiteCopy.id = this.id;
+		cloudSiteCopy.regionId = this.regionId;
+		cloudSiteCopy.identityServiceId = this.identityServiceId;
+		cloudSiteCopy.aic_version = this.aic_version;
+		cloudSiteCopy.clli = this.clli;
+		cloudSiteCopy.identityService = this.identityService.clone();
+		return cloudSiteCopy;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		result = prime * result + ((identityService == null) ? 0 : identityService.hashCode());
+		result = prime * result + ((identityServiceId == null) ? 0 : identityServiceId.hashCode());
+		result = prime * result + ((regionId == null) ? 0 : regionId.hashCode());
+		result = prime * result + ((aic_version == null) ? 0 : aic_version.hashCode());
+		result = prime * result + ((clli == null) ? 0 : clli.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		CloudSite other = (CloudSite) obj;
+		if (!cmp(id, other.id))
+			return false;
+		if (!cmp(regionId, other.regionId))
+			return false;
+		if (!cmp(identityServiceId, other.identityServiceId))
+			return false;
+		if (!cmp(aic_version, other.aic_version))
+			return false;
+		if (!cmp(clli, other.clli))
+			return false;
+		if (!cmp(identityService, other.identityService))
+			return false;
+		return true;
+	}
+	private boolean cmp(Object a, Object b) {
+		if (a == null) {
+			return (b == null);
+		} else {
+			return a.equals(b);
+		}
+	}
+}
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
new file mode 100644
index 0000000..8c51c74
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..95a58f3
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..11bf63b
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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<Integer>();
+	private List<String> subnets = new ArrayList<String>();
+	private String shared = "";
+
+	static Map<String,NetworkStatus> NetworkStatusMap;
+	static {
+		NetworkStatusMap = new HashMap<String,NetworkStatus>();
+		NetworkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE);
+		NetworkStatusMap.put("DOWN", NetworkStatus.DOWN);
+		NetworkStatusMap.put("BUILD", NetworkStatus.BUILD);
+		NetworkStatusMap.put("ERROR", NetworkStatus.ERROR);
+	}
+
+	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;
+	}
+
+	/**
+	 * 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) {
+			this.status = NetworkStatus.NOTFOUND;
+			return;
+		}
+
+		this.name = network.getName();
+		this.id = network.getId();
+
+		if (network.getStatus() == null) {
+			// Can this happen on a newly created network?
+			this.status = NetworkStatus.UNKNOWN;
+		} else if (NetworkStatusMap.containsKey(network.getStatus())) {
+			this.status = NetworkStatusMap.get(network.getStatus());
+		} else {
+			this.status = NetworkStatus.UNKNOWN;
+		}
+
+		if (network.getProviderPhysicalNetwork() != null) {
+			this.provider = network.getProviderPhysicalNetwork();
+			if (network.getProviderNetworkType().equals("vlan")) {
+                this.vlans.add(network.getProviderSegmentationId());
+            }
+		}
+		else if (network.getSegments() != null && network.getSegments().size() > 0) {
+			Segment s = network.getSegments().get(0);
+			this.provider = s.getProviderPhysicalNetwork();
+			if (s.getProviderNetworkType().equals("vlan")) {
+                for (Segment s1 : network.getSegments()) {
+					this.vlans.add(s1.getProviderSegmentationId());
+				}
+            }
+		}
+		this.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;
+	}
+
+	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 "Network: name=" + name + ",id=" + id + ",status=" + status +
+				",provider=" + provider + ",vlans=" + vlans + ",subnets=" + subnets + ",shared=" + shared;
+	}
+}
+
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
new file mode 100644
index 0000000..11a74d4
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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 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 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
new file mode 100644
index 0000000..f1a5dad
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..ae179c4
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Pool.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..cdf4b2c
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+
+import java.util.Map;
+import java.util.HashMap;
+
+import com.woorea.openstack.heat.model.Stack;
+
+/*
+ * This Java bean class relays Heat stack status information to ActiveVOS processes.
+ * 
+ * This bean is returned by all Heat-specific adapter operations (create, query, delete)
+ */
+
+public class StackInfo {
+	// Set defaults for everything
+	private String name = "";
+	private String canonicalName = "";
+	private HeatStatus status = HeatStatus.UNKNOWN;
+	private String statusMessage = "";
+	private Map<String,Object> outputs = new HashMap<String,Object>();
+	private Map<String,Object> parameters = new HashMap<String,Object>();
+	
+	static Map<String,HeatStatus> HeatStatusMap;
+	static {
+		HeatStatusMap = new HashMap<String,HeatStatus>();
+		HeatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING);
+		HeatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED);
+		HeatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED);
+		HeatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING);
+		HeatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND);
+		HeatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED);
+		HeatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING);
+		HeatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED);
+		HeatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED);
+	}
+
+	public StackInfo () {
+	}
+	
+	public StackInfo (String name, HeatStatus status, String statusMessage, Map<String,Object> outputs) {
+		this.name = name;
+		this.canonicalName = name;	// Don't have an ID, so just use name
+
+		this.status = status;
+		if (statusMessage != null)  this.statusMessage = statusMessage;
+		if (outputs != null)  this.outputs = outputs;
+	}
+	
+	public StackInfo (String name, HeatStatus status) {
+		this.name = name;
+		this.canonicalName = name;	// Don't have an ID, so just use name
+		this.status = status;
+	}
+	
+	public StackInfo (Stack stack)
+	{
+		if (stack == null) {
+			this.status = HeatStatus.NOTFOUND;
+			return;
+		}
+	
+		this.name = stack.getStackName();
+		this.canonicalName = stack.getStackName() + "/" + stack.getId();
+
+		if (stack.getStackStatus() == null) {
+			this.status = HeatStatus.INIT;
+		} else if (HeatStatusMap.containsKey(stack.getStackStatus())) {
+			this.status = HeatStatusMap.get(stack.getStackStatus());
+		} else {
+			this.status = HeatStatus.UNKNOWN;
+		}
+		
+		this.statusMessage = stack.getStackStatusReason();
+		
+		if (stack.getOutputs() != null) {
+			this.outputs = new HashMap<String,Object>();
+			for (Stack.Output output : stack.getOutputs()) {
+				this.outputs.put(output.getOutputKey(), output.getOutputValue());
+			}
+		}
+		
+		this.parameters = stack.getParameters();
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setName (String name) {
+		this.name = name;
+	}
+	
+	public String getCanonicalName() {
+		return canonicalName;
+	}
+	
+	public void setCanonicalName (String name) {
+		this.canonicalName = name;
+	}
+	
+	public HeatStatus getStatus() {
+		return status;
+	}
+	
+	public void setStatus (HeatStatus status) {
+		this.status = status;
+	}
+	
+	public String getStatusMessage() {
+		return statusMessage;
+	}
+	
+	public void setStatusMessage (String statusMessage) {
+		this.statusMessage = statusMessage;
+	}
+	
+	public Map<String,Object> getOutputs () {
+		return outputs;
+	}
+	
+	public void setOutputs (Map<String,Object> outputs) {
+		this.outputs = outputs;
+	}
+	
+	public Map<String,Object> getParameters () {
+		return parameters;
+	}
+	
+	public void setParameters (Map<String,Object> parameters) {
+		this.parameters = parameters;
+	}
+	
+}
+
diff --git a/adapters/mso-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
new file mode 100644
index 0000000..eb514cd
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java
@@ -0,0 +1,200 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..b6e4a6e
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.openecomp.mso.entity.MsoRequest;
+/**
+ * Javabean representing the rollback criteria following a "Create VNF"
+ * operation.  This structure can be passed back to the "Rollback VNF"
+ * operation to undo the effects of the create.
+ *
+ *
+ */
+public class VnfRollback {
+	private String vnfId;
+	private String tenantId;
+	private String cloudSiteId;
+	private boolean tenantCreated = false;
+	private boolean vnfCreated = false;
+	private MsoRequest msoRequest;
+	private String volumeGroupName;
+	private String volumeGroupId;
+	private String requestType;
+	private String volumeGroupHeatStackId;
+	private String baseGroupHeatStackId;
+	private boolean isBase = false;
+	private String vfModuleStackId;
+
+	public VnfRollback() {}
+	
+	public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+			boolean tenantCreated, boolean vnfCreated,
+			MsoRequest msoRequest,
+			String volumeGroupName, String volumeGroupId, String requestType) {
+		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;
+	}
+
+	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;
+	}
+
+	@Override
+    public String toString() {
+		return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId +
+				", vnf=" + vnfId + ", tenantCreated=" + tenantCreated +
+				", vnfCreated=" + vnfCreated + ", requestType = " + requestType;
+	}
+}
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
new file mode 100644
index 0000000..40f4671
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..d7198ae
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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/MsoCloudSiteNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java
new file mode 100644
index 0000000..4392ee0
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+
+/**
+ * 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-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
new file mode 100644
index 0000000..538a60d
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..4cc6b41
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..eafb033
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..d234bbf
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..8aa7115
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..2ad0f5b
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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 () {
+		String error = "" + statusCode + " " + statusMessage + ": " + errorDetail;
+		return error;
+	}
+}
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
new file mode 100644
index 0000000..2aba5b9
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..583d976
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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
new file mode 100644
index 0000000..9edfdea
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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;
+
+	// 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-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
new file mode 100644
index 0000000..bd09938
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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/CloudConfigInitializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java
new file mode 100644
index 0000000..3d9c23c
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+import javax.ejb.EJB;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * This class will attempt to initialize Cloud Config when part of a web application.
+ * 
+ *
+ *
+ */
+@WebListener
+public class CloudConfigInitializer implements ServletContextListener
+{
+
+	private CloudConfigFactory cloudConfigFactory=new CloudConfigFactory();
+
+	public CloudConfigInitializer () {
+	}
+
+	@Override
+	public void contextDestroyed(ServletContextEvent event) {
+		// Nothing to do...
+	}
+
+
+	@Override
+	public void contextInitialized(ServletContextEvent event)
+	{
+
+		// Note - this logger may be before or after MSO Logging configuration applied
+		MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+		try {
+			// Look first in the init-parameters
+			String msoPropConfigParam = event.getServletContext().getInitParameter("mso.cloud_config.configuration");
+
+			String[] configFileSplit = msoPropConfigParam.split(",");
+			for (String msoPropConfig:configFileSplit) {
+				String[] msoPropDecoded = msoPropConfig.split("=");
+
+				try {
+					cloudConfigFactory.initializeCloudConfig(msoPropDecoded[0], Integer.valueOf(msoPropDecoded[1]));
+					initLogger.info(MessageEnum.RA_CONFIG_LOAD, msoPropDecoded[0], "", "");
+					initLogger.debug("Mso properties successfully loaded:"+msoPropDecoded[0]+"(Timer(mins):"+Integer.valueOf(msoPropDecoded[1]));
+				} catch (NumberFormatException ne) {
+					initLogger.error(MessageEnum.RA_CONFIG_EXC, msoPropDecoded[0] + ". MSO Properties failed due to conversion error (in web.xml file)", "", "", MsoLogger.ErrorCode.DataError, "MSO Properties failed due to conversion error (in web.xml file)", ne);
+				}
+			}
+		}
+		catch (Exception e) {
+			initLogger.error(MessageEnum.RA_CONFIG_EXC,  "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception - MSO Properties failed to initialize completely", e);
+		}
+	}
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java
new file mode 100644
index 0000000..6787e72
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java
@@ -0,0 +1,315 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+import java.lang.StackTraceElement;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
+import org.openecomp.mso.openstack.exceptions.MsoIOException;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.heat.model.Explanation;
+import com.woorea.openstack.keystone.model.Error;
+import com.woorea.openstack.quantum.model.NeutronError;
+
+public class MsoCommonUtils {
+
+	private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+	protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+	
+	protected static String retryDelayProp = "ecomp.mso.adapters.po.retryDelay";
+    protected static String retryCountProp = "ecomp.mso.adapters.po.retryCount";
+    protected static String retryCodesProp = "ecomp.mso.adapters.po.retryCodes";
+	
+	protected static int retryDelayDefault = 5;
+    protected static int retryCountDefault = 3;
+    protected static String retryCodesDefault = "504";
+  
+    /*
+     * Method to execute an Openstack command and track its execution time.
+     * For the metrics log, a category of "Openstack" is used along with a
+     * sub-category that identifies the specific call (using the real
+     * openstack-java-sdk classname of the OpenStackRequest<T> parameter).
+     */
+    
+    protected static <T> T executeAndRecordOpenstackRequest (OpenStackRequest <T> request)
+    {
+    	return executeAndRecordOpenstackRequest (request, null);
+    }
+    protected static <T> T executeAndRecordOpenstackRequest (OpenStackRequest <T> request, MsoJavaProperties msoProps) {
+    	
+    	int limit;
+        // Get the name and method name of the parent class, which triggered this method
+        StackTraceElement[] classArr = new Exception ().getStackTrace ();
+        if (classArr.length >=2) {
+        	limit = 3;
+        } else {
+        	limit = classArr.length;
+        }
+    	String parentServiceMethodName = classArr[0].getClassName () + "." + classArr[0].getMethodName ();
+    	for (int i = 1; i < limit; i++) {
+            String className = classArr[i].getClassName ();
+            if (!className.equals (MsoCommonUtils.class.getName ())) {
+            	parentServiceMethodName = className + "." + classArr[i].getMethodName ();
+            	break;
+            }
+        }
+
+        long start = System.currentTimeMillis ();
+    	String requestType;
+        if (request.getClass ().getEnclosingClass () != null) {
+            requestType = request.getClass ().getEnclosingClass ().getSimpleName () + "."
+                          + request.getClass ().getSimpleName ();
+        } else {
+            requestType = request.getClass ().getSimpleName ();
+        }
+        
+        int retryDelay = retryDelayDefault;
+        int retryCount = retryCountDefault;
+        String retryCodes  = retryCodesDefault;
+        if (msoProps != null) //extra check to avoid NPE
+        {
+        	retryDelay = msoProps.getIntProperty (retryDelayProp, retryDelayDefault);
+        	retryCount = msoProps.getIntProperty (retryCountProp, retryCountDefault);
+        	retryCodes = msoProps.getProperty (retryCodesProp, retryCodesDefault);
+        }
+    	
+        // Run the actual command. All exceptions will be propagated
+        while (true)
+        {
+        	try {
+                return request.execute ();
+        	} 
+        	catch (OpenStackResponseException e) {
+        		boolean retry = false;
+        		if (retryCodes != null ) {
+        			int code = e.getStatus();
+        			LOGGER.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code);
+        			for (String rCode : retryCodes.split (",")) {
+        				try {
+        					if (retryCount > 0 && code == Integer.parseInt (rCode))
+        					{
+        						retryCount--;
+        						retry = true;
+        						LOGGER.debug ("OpenStackResponseException ResponseCode:" + code +  " at:" + parentServiceMethodName + " request:" + requestType +  " Retry indicated. Attempts remaining:" + retryCount);
+        						break;
+        					}
+        				} catch (NumberFormatException e1) {
+        					LOGGER.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config");
+        					throw e;
+        				}
+        			}
+        		}
+        		if (retry)
+    			{
+    				try {
+    					Thread.sleep (retryDelay * 1000L);
+    				} catch (InterruptedException e1) {
+    					LOGGER.debug ("Thread interrupted while sleeping", e1);
+    				}
+    			}
+        		else
+        			throw e; // exceeded retryCount or code is not retryable
+        	}
+        	catch (OpenStackConnectException e) {
+        		// Connection to Openstack failed
+        		if (retryCount > 0)
+        		{
+        			retryCount--;
+        			LOGGER.debug ("OpenstackConnectException at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount);
+        			try {
+        				Thread.sleep (retryDelay * 1000L);
+        			} catch (InterruptedException e1) {
+        				LOGGER.debug ("Thread interrupted while sleeping", e1);
+        			}
+        		}
+        		else
+        			throw e;
+        			
+        	}
+        }
+    }
+  
+    /*
+     * Convert an Openstack Exception on a Keystone call to an MsoException.
+     * This method supports both OpenstackResponseException and OpenStackConnectException.
+     */
+    protected static MsoException keystoneErrorToMsoException (OpenStackBaseException e, String context) {
+        MsoException me = null;
+
+        if (e instanceof OpenStackResponseException) {
+            OpenStackResponseException re = (OpenStackResponseException) e;
+
+            try {
+                // Failed Keystone calls return an Error entity body.
+                Error error = re.getResponse ().getErrorEntity (Error.class);
+                LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Keystone Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone Error on " + context);
+				me = new MsoOpenstackException (error.getCode (), error.getTitle (), error.getMessage ());
+            } catch (Exception e2) {
+                // Can't parse the body as an "Error". Report the HTTP error
+            	LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "HTTP Error on " + context + ": " + re.getStatus() + "," + re.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "HTTP Error on " + context, e2);
+				me = new MsoOpenstackException (re.getStatus (), re.getMessage (), "");
+            }
+
+            // Add the context of the error
+            me.addContext (context);
+
+            // Generate an alarm for 5XX and higher errors.
+            if (re.getStatus () >= 500) {
+                alarmLogger.sendAlarm ("KeystoneError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+            }
+        } else if (e instanceof OpenStackConnectException) {
+            OpenStackConnectException ce = (OpenStackConnectException) e;
+
+            me = new MsoIOException (ce.getMessage ());
+            me.addContext (context);
+
+            // Generate an alarm for all connection errors.
+            LOGGER.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context);
+			alarmLogger.sendAlarm ("KeystoneIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+        }
+
+        return me;
+    }
+
+    /*
+     * Convert an Openstack Exception on a Heat call to an MsoOpenstackException.
+     * This method supports both OpenstackResponseException and OpenStackConnectException.
+     */
+    protected MsoException heatExceptionToMsoException (OpenStackBaseException e, String context) {
+        MsoException me = null;
+
+        if (e instanceof OpenStackResponseException) {
+            OpenStackResponseException re = (OpenStackResponseException) e;
+
+            try {
+                // Failed Heat calls return an Explanation entity body.
+                Explanation explanation = re.getResponse ().getErrorEntity (Explanation.class);
+                LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error on " + context + ": " + explanation.toString(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Openstack Error on " + context);
+                String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType() + ", error.message=" + explanation.getError().getMessage();
+                LOGGER.debug(fullError);
+				me = new MsoOpenstackException (explanation.getCode (),
+                                                explanation.getTitle (),
+                                                //explanation.getExplanation ());
+                                                fullError);
+            } catch (Exception e2) {
+                // Couldn't parse the body as an "Explanation". Report the original HTTP error.
+            	LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2);
+				me = new MsoOpenstackException (re.getStatus (), re.getMessage (), "");
+            }
+
+            // Add the context of the error
+            me.addContext (context);
+
+            // Generate an alarm for 5XX and higher errors.
+            if (re.getStatus () >= 500) {
+                alarmLogger.sendAlarm ("HeatError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+            }
+        } else if (e instanceof OpenStackConnectException) {
+            OpenStackConnectException ce = (OpenStackConnectException) e;
+
+            me = new MsoIOException (ce.getMessage ());
+            me.addContext (context);
+
+            // Generate an alarm for all connection errors.
+            alarmLogger.sendAlarm ("HeatIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+            LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context);
+    	}
+
+        return me;
+    }
+
+    /*
+     * Convert an Openstack Exception on a Neutron call to an MsoOpenstackException.
+     * This method supports both OpenstackResponseException and OpenStackConnectException.
+     */
+    protected MsoException neutronExceptionToMsoException (OpenStackBaseException e, String context) {
+        MsoException me = null;
+
+        if (e instanceof OpenStackResponseException) {
+            OpenStackResponseException re = (OpenStackResponseException) e;
+
+            try {
+                // Failed Neutron calls return an NeutronError entity body
+                NeutronError error = re.getResponse ().getErrorEntity (NeutronError.class);
+                LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Error on " + context);
+				me = new MsoOpenstackException (re.getStatus (), error.getType (), error.getMessage ());
+            } catch (Exception e2) {
+                // Couldn't parse body as a NeutronError. Report the HTTP error.
+            	LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack HTTP Error on " + context, e2);
+				me = new MsoOpenstackException (re.getStatus (), re.getMessage (), null);
+            }
+
+            // Add the context of the error
+            me.addContext (context);
+
+            // Generate an alarm for 5XX and higher errors.
+            if (re.getStatus () >= 500) {
+                alarmLogger.sendAlarm ("NeutronError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+            }
+        } else if (e instanceof OpenStackConnectException) {
+            OpenStackConnectException ce = (OpenStackConnectException) e;
+
+            me = new MsoIOException (ce.getMessage ());
+            me.addContext (context);
+
+            // Generate an alarm for all connection errors.
+            alarmLogger.sendAlarm ("NeutronIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+            LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context);
+    	}
+
+        return me;
+    }
+
+    /*
+     * Convert a Java Runtime Exception to an MsoException.
+     * All Runtime exceptions will be translated into an MsoAdapterException,
+     * which captures internal errors.
+     * Alarms will be generated on all such exceptions.
+     */
+    protected MsoException runtimeExceptionToMsoException (RuntimeException e, String context) {
+        MsoAdapterException me = new MsoAdapterException (e.getMessage (), e);
+        me.addContext (context);
+        me.setCategory (MsoExceptionCategory.INTERNAL);
+
+        // Always generate an alarm for internal exceptions
+        LOGGER.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on  "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on  "+ context);
+		alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+
+        return me;
+    }
+
+    public static boolean isNullOrEmpty (String s) {
+        return s == null || s.isEmpty();
+    }
+    
+    
+
+}
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
new file mode 100644
index 0000000..13ea433
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+
+import java.util.HashSet;
+import java.util.ArrayList;
+import java.util.Set;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+
+public class MsoHeatEnvironmentEntry {
+
+	private Set<MsoHeatEnvironmentParameter> parameters = null;
+	private Set<MsoHeatEnvironmentResource> resources = null;
+	private StringBuilder rawEntry = null;
+	private boolean valid = true;
+	private String errorString = null;
+	private StringBuilder resourceRegistryEntryRaw = null;
+	
+	public MsoHeatEnvironmentEntry() {
+		super();
+	}
+	
+	public MsoHeatEnvironmentEntry(StringBuilder sb) {
+		this();
+		this.rawEntry = sb;
+		this.processRawEntry();
+	}
+	
+	private void processRawEntry() {
+		try {
+			if (this.rawEntry == null || this.rawEntry.equals(""))
+				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) {
+			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<MsoHeatEnvironmentParameter>();
+		}
+		this.parameters.add(hep);
+	}
+	public void addResource(MsoHeatEnvironmentResource her) {
+		if (this.resources == null) {
+			this.resources = new HashSet<MsoHeatEnvironmentResource>();
+		}
+		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;
+	}
+	
+	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;
+	}
+	
+	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");
+		}
+//		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 StringBuilder getRawEntry() {
+		return this.rawEntry;
+	}
+	
+	private StringBuilder getResourceRegistryRawEntry() {
+		
+		if (this.rawEntry == null) {
+			return 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/MsoHeatEnvironmentParameter.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java
new file mode 100644
index 0000000..4cf9023
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+
+public class MsoHeatEnvironmentParameter {
+
+	private String name;
+	private String value;
+	
+	public MsoHeatEnvironmentParameter(String name, String value) {
+		super();
+		this.name = name;
+		this.value = value;
+	}
+	public MsoHeatEnvironmentParameter(String name) {
+		// Allow to initialize with a null value
+		this(name, null);
+	}
+	public MsoHeatEnvironmentParameter() {
+		this(null, null);
+	}
+	
+	public String getName() {
+		return this.name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public String getValue() {
+		return this.value;
+	}
+	public void setValue(String value) {
+		this.value = value;
+	}
+	public String toString() {
+		return this.name + ": " + this.value;
+	}
+	
+	public boolean equals(Object o) {	
+		if (!(o instanceof MsoHeatEnvironmentParameter)) {
+			return false;
+		}
+		if (this == o) {
+			return true;
+		}
+		MsoHeatEnvironmentParameter hep = (MsoHeatEnvironmentParameter) o;	
+		// If the name of the parameter is the same, then they're equal
+		if (hep.getName().equals(this.getName())) {
+			return true;
+		}
+		return false;
+	}
+	
+	public int hashCode() {
+		int result = 0;
+		try {
+			result = this.name.hashCode();
+		} catch (Exception e) {
+			// in case it's null - return zero
+		}
+		return result;
+	}
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java
new file mode 100644
index 0000000..202a084
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+
+public class MsoHeatEnvironmentResource {
+
+	private String name;
+	private String value;
+	
+	public MsoHeatEnvironmentResource(String name, String value) {
+		super();
+		this.name = name;
+		this.value = value;
+	}
+	public MsoHeatEnvironmentResource(String name) {
+		// Allow to initialize with a null value
+		this(name, null);
+	}
+	public MsoHeatEnvironmentResource() {
+		this(null, null);
+	}
+	
+	public String getName() {
+		return this.name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	public String getValue() {
+		return this.value;
+	}
+	public void setValue(String value) {
+		this.value = value;
+	}
+	public String toString() {
+		return "\"" + this.name + "\": " + this.value;
+	}
+	
+	public boolean equals(Object o) {	
+		if (!(o instanceof MsoHeatEnvironmentResource)) {
+			return false;
+		}
+		if (this == o) {
+			return true;
+		}
+		MsoHeatEnvironmentResource her = (MsoHeatEnvironmentResource) o;	
+		// If the name of the parameter is the same, then they're equal
+		if (her.getName().equals(this.getName())) {
+			return true;
+		}
+		return false;
+	}
+	
+	public int hashCode() {
+		int result = 0;
+		try {
+			result = this.name.hashCode();
+		} catch (Exception e) {
+			// in case it's null - return zero
+		}
+		return result;
+	}
+
+
+}
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
new file mode 100644
index 0000000..8d66505
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java
@@ -0,0 +1,1229 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.db.catalog.beans.HeatTemplate;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.openstack.beans.HeatStatus;
+import org.openecomp.mso.openstack.beans.StackInfo;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoIOException;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+import org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists;
+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.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.heat.model.Stacks;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+
+public class MsoHeatUtils extends MsoCommonUtils {
+
+	private MsoPropertiesFactory msoPropertiesFactory;
+
+	private CloudConfigFactory cloudConfigFactory;
+	
+    private static final String TOKEN_AUTH = "TokenAuth";
+
+    private static final String QUERY_ALL_STACKS = "QueryAllStacks";
+
+    private static final String DELETE_STACK = "DeleteStack";
+
+    private static final String HEAT_ERROR = "HeatError";
+
+    private static final String CREATE_STACK = "CreateStack";
+
+    // Cache Heat Clients statically. Since there is just one MSO user, there is no
+    // benefit to re-authentication on every request (or across different flows). The
+    // token will be used until it expires.
+    //
+    // The cache key is "tenantId:cloudId"
+    private static Map <String, HeatCacheEntry> heatClientCache = new HashMap <String, HeatCacheEntry> ();
+
+    // Fetch cloud configuration each time (may be cached in CloudConfig class)
+    protected CloudConfig cloudConfig;
+
+    private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+    protected MsoJavaProperties msoProps = null;
+
+    // Properties names and variables (with default values)
+    protected String createPollIntervalProp = "ecomp.mso.adapters.heat.create.pollInterval";
+    private String deletePollIntervalProp = "ecomp.mso.adapters.heat.delete.pollInterval";
+    private String deletePollTimeoutProp = "ecomp.mso.adapters.heat.delete.pollTimeout";
+
+    protected int createPollIntervalDefault = 15;
+    private int deletePollIntervalDefault = 15;
+    private int deletePollTimeoutDefault = 300;
+    private String msoPropID;
+    
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
+    /**
+     * This constructor MUST be used ONLY in the JUNIT tests, not for real code.
+     * The MsoPropertiesFactory will be added by EJB injection.
+     *
+     * @param msoPropID ID of the mso pro config as defined in web.xml
+     * @param msoPropFactory The mso properties factory instanciated by EJB injection
+     * @param cloudConfFactory the Cloud Config instantiated by EJB injection
+     */
+    public MsoHeatUtils (String msoPropID, MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfFactory) {
+    	msoPropertiesFactory = msoPropFactory;
+    	cloudConfigFactory = cloudConfFactory;
+    	this.msoPropID = msoPropID;
+    	// Dynamically get properties each time (in case reloaded).
+
+    	try {
+			msoProps = msoPropertiesFactory.getMsoJavaProperties (msoPropID);
+		} catch (MsoPropertiesException e) {
+			LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
+		}
+        cloudConfig = cloudConfigFactory.getCloudConfig ();
+        LOGGER.debug("MsoHeatUtils:" + msoPropID);
+        
+    }
+
+
+    /**
+     * keep this old method signature here to maintain backwards compatibility. keep others as well.
+     * this method does not include environment, files, or heatFiles
+     */
+    public StackInfo createStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, ? extends Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes) throws MsoException {
+        // Just call the new method with the environment & files variable set to null
+        return this.createStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 null,
+                                 null,
+                                 null,
+                                 true);
+    }
+
+    // This method has environment, but not files or heatFiles
+    public StackInfo createStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, ? extends Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment) throws MsoException {
+        // Just call the new method with the files/heatFiles variables set to null
+        return this.createStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 environment,
+                                 null,
+                                 null,
+                                 true);
+    }
+
+    // This method has environment and files, but not heatFiles.
+    public StackInfo createStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, ? extends Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment,
+                                  Map <String, Object> files) throws MsoException {
+        return this.createStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 environment,
+                                 files,
+                                 null,
+                                 true);
+    }
+    
+    // This method has environment, files, heatfiles
+    public StackInfo createStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, ? extends Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment,
+                                  Map <String, Object> files,
+                                  Map <String, Object> heatFiles) throws MsoException {
+        return this.createStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 environment,
+                                 files,
+                                 heatFiles,
+                                 true);
+    }
+
+    /**
+     * Create a new Stack in the specified cloud location and tenant. The Heat template
+     * and parameter map are passed in as arguments, along with the cloud access credentials.
+     * It is expected that parameters have been validated and contain at minimum the required
+     * parameters for the given template with no extra (undefined) parameters..
+     *
+     * The Stack name supplied by the caller must be unique in the scope of this tenant.
+     * However, it should also be globally unique, as it will be the identifier for the
+     * resource going forward in Inventory. This latter is managed by the higher levels
+     * invoking this function.
+     *
+     * The caller may choose to let this function poll Openstack for completion of the
+     * stack creation, or may handle polling itself via separate calls to query the status.
+     * In either case, a StackInfo object will be returned containing the current status.
+     * When polling is enabled, a status of CREATED is expected. When not polling, a
+     * status of BUILDING is expected.
+     *
+     * An error will be thrown if the requested Stack already exists in the specified
+     * Tenant and Cloud.
+     *
+     * For 1510 - add "environment", "files" (nested templates), and "heatFiles" (get_files) as
+     * parameters for createStack. If environment is non-null, it will be added to the stack.
+     * The nested templates and get_file entries both end up being added to the "files" on the
+     * stack. We must combine them before we add them to the stack if they're both non-null.
+     *
+     * @param cloudSiteId The cloud (may be a region) in which to create the stack.
+     * @param tenantId The Openstack ID of the tenant in which to create the Stack
+     * @param stackName The name of the stack to create
+     * @param stackTemplate The Heat template
+     * @param stackInputs A map of key/value inputs
+     * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
+     * @param environment An optional yaml-format string to specify environmental parameters
+     * @param files a Map<String, Object> that lists the child template IDs (file is the string, object is an int of
+     *        Template id)
+     * @param heatFiles a Map<String, Object> that lists the get_file entries (fileName, fileBody)
+     * @param backout Donot delete stack on create Failure - defaulted to True
+     * @return A StackInfo object
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
+     */
+
+    @SuppressWarnings("unchecked")
+    public StackInfo createStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, ? extends Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment,
+                                  Map <String, Object> files,
+                                  Map <String, Object> heatFiles,
+                                  boolean backout) throws MsoException {
+        // Create local variables checking to see if we have an environment, nested, get_files
+        // Could later add some checks to see if it's valid.
+        boolean haveEnvtVariable = true;
+        if (environment == null || "".equalsIgnoreCase (environment.trim ())) {
+            haveEnvtVariable = false;
+            LOGGER.debug ("createStack called with no environment variable");
+        } else {
+            LOGGER.debug ("createStack called with an environment variable: " + environment);
+        }
+
+        boolean haveFiles = true;
+        if (files == null || files.isEmpty ()) {
+            haveFiles = false;
+            LOGGER.debug ("createStack called with no files / child template ids");
+        } else {
+            LOGGER.debug ("createStack called with " + files.size () + " files / child template ids");
+        }
+
+        boolean haveHeatFiles = true;
+        if (heatFiles == null || heatFiles.isEmpty ()) {
+            haveHeatFiles = false;
+            LOGGER.debug ("createStack called with no heatFiles");
+        } else {
+            LOGGER.debug ("createStack called with " + heatFiles.size () + " heatFiles");
+        }
+
+        // Obtain the cloud site information where we will create the stack
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+        // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
+        // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated)
+        Heat heatClient = getHeatClient (cloudSite, tenantId);
+
+        LOGGER.debug ("Ready to Create Stack (" + heatTemplate + ") with input params: " + stackInputs);
+
+        // Build up the stack to create
+        // Disable auto-rollback, because error reason is lost. Always rollback in the code.
+        CreateStackParam stack = new CreateStackParam ();
+        stack.setStackName (stackName);
+        stack.setTimeoutMinutes (timeoutMinutes);
+        stack.setParameters ((Map <String, Object>) stackInputs);
+        stack.setTemplate (heatTemplate);
+        stack.setDisableRollback (true);
+        // TJM New for PO Adapter - add envt variable
+        if (haveEnvtVariable) {
+            LOGGER.debug ("Found an environment variable - value: " + environment);
+            stack.setEnvironment (environment);
+        }
+        // Now handle nested templates or get_files - have to combine if we have both
+        // as they're both treated as "files:" on the stack.
+        if (haveFiles && haveHeatFiles) {
+            // Let's do this here - not in the bean
+            LOGGER.debug ("Found files AND heatFiles - combine and add!");
+            Map <String, Object> combinedFiles = new HashMap <String, Object> ();
+            for (String keyString : files.keySet ()) {
+                combinedFiles.put (keyString, files.get (keyString));
+            }
+            for (String keyString : heatFiles.keySet ()) {
+                combinedFiles.put (keyString, heatFiles.get (keyString));
+            }
+            stack.setFiles (combinedFiles);
+        } else {
+            // Handle if we only have one or neither:
+            if (haveFiles) {
+                LOGGER.debug ("Found files - adding to stack");
+                stack.setFiles (files);
+            }
+            if (haveHeatFiles) {
+                LOGGER.debug ("Found heatFiles - adding to stack");
+                // the setFiles was modified to handle adding the entries
+                stack.setFiles (heatFiles);
+            }
+        }
+
+        Stack heatStack = null;
+        try {
+            // Execute the actual Openstack command to create the Heat stack
+            OpenStackRequest <Stack> request = heatClient.getStacks ().create (stack);
+            // Begin X-Auth-User
+            // Obtain an MSO token for the tenant
+            CloudIdentity cloudIdentity = cloudSite.getIdentityService ();
+            // cloudIdentity.getMsoId(), cloudIdentity.getMsoPass()
+            //req
+            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());
+            // END - try to fix X-Auth-User
+            heatStack = executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            // Since this came on the 'Create Stack' command, nothing was changed
+            // in the cloud. Return the error as an exception.
+            if (e.getStatus () == 409) {
+                // Stack already exists. Return a specific error for this case
+                MsoStackAlreadyExists me = new MsoStackAlreadyExists (stackName, tenantId, cloudSiteId);
+                me.addContext (CREATE_STACK);
+                throw me;
+            } else {
+                // Convert the OpenStackResponseException to an MsoOpenstackException
+            	LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage());
+                throw heatExceptionToMsoException (e, CREATE_STACK);
+            }
+        } catch (OpenStackConnectException e) {
+            // Error connecting to Openstack instance. Convert to an MsoException
+            throw heatExceptionToMsoException (e, CREATE_STACK);
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, CREATE_STACK);
+        }
+
+        // Subsequent access by the canonical name "<stack name>/<stack-id>".
+        // Otherwise, simple query by name returns a 302 redirect.
+        // NOTE: This is specific to the v1 Orchestration API.
+        String canonicalName = stackName + "/" + heatStack.getId ();
+
+        // If client has requested a final response, poll for stack completion
+        if (pollForCompletion) {
+            // Set a time limit on overall polling.
+            // Use the resource (template) timeout for Openstack (expressed in minutes)
+            // and add one poll interval to give Openstack a chance to fail on its own.
+            int createPollInterval = msoProps.getIntProperty (createPollIntervalProp, createPollIntervalDefault);
+            int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
+            // New 1610 - poll on delete if we rollback - use same values for now
+            int deletePollInterval = createPollInterval;
+            int deletePollTimeout = pollTimeout;
+            boolean createTimedOut = false;
+            StringBuilder stackErrorStatusReason = new StringBuilder("");
+            LOGGER.debug("createPollInterval=" + createPollInterval + ", pollTimeout=" + pollTimeout);
+
+            while (true) {
+                try {
+                    heatStack = queryHeatStack (heatClient, canonicalName);
+                    LOGGER.debug (heatStack.getStackStatus () + " (" + canonicalName + ")");
+
+                    if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) {
+                        // Stack creation is still running.
+                        // Sleep and try again unless timeout has been reached
+                        if (pollTimeout <= 0) {
+                            // Note that this should not occur, since there is a timeout specified
+                            // in the Openstack call.
+                            LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Create stack timeout");
+                            createTimedOut = true;
+                            break;
+                        }
+                        try {
+                            Thread.sleep (createPollInterval * 1000L);
+                        } catch (InterruptedException e) {
+                            LOGGER.debug ("Thread interrupted while sleeping", e);
+                        }
+
+                        pollTimeout -= createPollInterval;
+                		LOGGER.debug("pollTimeout remaining: " + pollTimeout);
+                    } else {
+                    	//save off the status & reason msg before we attempt delete
+                    	stackErrorStatusReason.append("Stack error (" + heatStack.getStackStatus() + "): " + heatStack.getStackStatusReason());
+                        break;
+                    }
+                } catch (MsoException me) {
+                	// Cannot query the stack status. Something is wrong.
+                	// Try to roll back the stack
+                	if (!backout)
+                	{
+                		LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack, stack deletion suppressed");
+                	}	
+                	else
+                	{
+                		try {
+                			LOGGER.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + canonicalName + " - This will likely fail and/or we won't be able to query to see if delete worked");
+                			OpenStackRequest <Void> request = heatClient.getStacks ().deleteByName (canonicalName);
+                			executeAndRecordOpenstackRequest (request, msoProps);
+                			// this may be a waste of time - if we just got an exception trying to query the stack - we'll just
+                			// get another one, n'est-ce pas? 
+                			boolean deleted = false;
+                			while (!deleted) {
+                				try {
+                					heatStack = queryHeatStack(heatClient, canonicalName);
+                					if (heatStack != null) {
+                    					LOGGER.debug(heatStack.getStackStatus());
+                    					if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
+                    						if (deletePollTimeout <= 0) {
+                    							LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, 
+                    									heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, 
+                    									"Rollback: DELETE stack timeout");
+                    							break;
+                    						} else {
+                    							try {
+                    								Thread.sleep(deletePollInterval * 1000L);
+                    							} catch (InterruptedException ie) {
+                    								LOGGER.debug("Thread interrupted while sleeping", ie);
+                    							}
+                    							deletePollTimeout -= deletePollInterval;
+                    						}
+                    					} else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())){
+                    						LOGGER.debug("DELETE_COMPLETE for " + canonicalName);
+                    						deleted = true;
+                    						continue;
+                    					} else {
+                    						//got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate
+                    						break;
+                    					}
+                    				} else {
+                    					// assume if we can't find it - it's deleted
+                    					LOGGER.debug("heatStack returned null - assume the stack " + canonicalName + " has been deleted");
+                    					deleted = true;
+                    					continue;
+                					}
+                					
+                				} catch (Exception e3) {
+                					// Just log this one. We will report the original exception.
+                					LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack on error on query");
+                					
+                				}
+                			}
+                		} catch (Exception e2) {
+                			// Just log this one. We will report the original exception.
+                			LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack");
+                		}
+                	}
+
+                    // Propagate the original exception from Stack Query.
+                    me.addContext (CREATE_STACK);
+                    throw me;
+                }
+            }
+
+            if (!"CREATE_COMPLETE".equals (heatStack.getStackStatus ())) {
+                LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack error:  Polling complete with non-success status: "
+                              + heatStack.getStackStatus () + ", " + heatStack.getStackStatusReason (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error");
+
+                // Rollback the stack creation, since it is in an indeterminate state.
+                if (!backout)
+                {
+                	LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion suppressed");
+                }
+                else
+                {
+                	try {
+                		LOGGER.debug("Create Stack errored - attempting to DELETE stack: " + canonicalName);
+                		LOGGER.debug("deletePollInterval=" + deletePollInterval + ", deletePollTimeout=" + deletePollTimeout);
+                		OpenStackRequest <Void> request = heatClient.getStacks ().deleteByName (canonicalName);
+                		executeAndRecordOpenstackRequest (request, msoProps);
+                		boolean deleted = false;
+                		while (!deleted) {
+                			try {
+                				heatStack = queryHeatStack(heatClient, canonicalName);
+                				if (heatStack != null) {
+                					LOGGER.debug(heatStack.getStackStatus() + " (" + canonicalName + ")");
+                					if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) {
+                						if (deletePollTimeout <= 0) {
+                							LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, 
+                									heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, 
+                									"Rollback: DELETE stack timeout");
+                							break;
+                						} else {
+                							try {
+                								Thread.sleep(deletePollInterval * 1000L);
+                							} catch (InterruptedException ie) {
+                								LOGGER.debug("Thread interrupted while sleeping", ie);
+                							}
+                							deletePollTimeout -= deletePollInterval;
+                							LOGGER.debug("deletePollTimeout remaining: " + deletePollTimeout);
+                						}
+                					} else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())){
+                						LOGGER.debug("DELETE_COMPLETE for " + canonicalName);
+                						deleted = true;
+                						continue;
+                					} else if ("DELETE_FAILED".equals(heatStack.getStackStatus())) {
+                						// Warn about this (?) - but still throw the original exception
+                						LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion FAILED", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion FAILED");
+                						LOGGER.debug("Stack deletion FAILED on a rollback of a create - " + canonicalName + ", status=" + heatStack.getStackStatus() + ", reason=" + heatStack.getStackStatusReason());
+                						break;
+                					} else {
+                						//got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate
+                						break;
+                					}
+                				} else {
+                					// assume if we can't find it - it's deleted
+                					LOGGER.debug("heatStack returned null - assume the stack " + canonicalName + " has been deleted");
+                					deleted = true;
+                					continue;
+                				}
+                				
+                			} catch (MsoException me2) {
+                				// We got an exception on the delete - don't throw this exception - throw the original - just log.
+                				LOGGER.debug("Exception thrown trying to delete " + canonicalName + " on a create->rollback: " + me2.getContextMessage());
+                				LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError, me2.getContextMessage());
+                			}
+                			
+                		} // end while !deleted
+                		StringBuilder errorContextMessage = null;
+                		if (createTimedOut) {
+                			errorContextMessage = new StringBuilder("Stack Creation Timeout");
+                		} else {
+                			errorContextMessage  = stackErrorStatusReason;
+                		}
+                		if (deleted) {
+                			errorContextMessage.append(" - stack successfully deleted");
+                		} else {
+                			errorContextMessage.append(" - encountered an error trying to delete the stack");
+                		}
+//                		MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
+ //               		me.addContext(CREATE_STACK);
+  //              		alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage());
+   //             		throw me;
+                	} catch (Exception e2) {
+                		// shouldn't happen - but handle
+                		LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack: rolling back stack");
+                	}
+                } 
+                MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString());
+                me.addContext(CREATE_STACK);
+                alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage());
+                throw me;
+            }
+
+        } else {
+            // Get initial status, since it will have been null after the create.
+            heatStack = queryHeatStack (heatClient, canonicalName);
+            LOGGER.debug (heatStack.getStackStatus ());
+        }
+
+        return new StackInfo (heatStack);
+    }
+
+    /**
+     * Query for a single stack (by Name) in a tenant. This call will always return a
+     * StackInfo object. If the stack does not exist, an "empty" StackInfo will be
+     * returned - containing only the stack name and a status of NOTFOUND.
+     *
+     * @param tenantId The Openstack ID of the tenant in which to query
+     * @param cloudSiteId The cloud identifier (may be a region) in which to query
+     * @param stackName The name of the stack to query (may be simple or canonical)
+     * @return A StackInfo object
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
+     */
+    public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException {
+        LOGGER.debug ("Query HEAT stack: " + stackName + " in tenant " + tenantId);
+
+        // Obtain the cloud site information where we will create the stack
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+
+        // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
+        Heat heatClient = null;
+        try {
+            heatClient = getHeatClient (cloudSite, tenantId);
+        } catch (MsoTenantNotFound e) {
+            // Tenant doesn't exist, so stack doesn't either
+            LOGGER.debug ("Tenant with id " + tenantId + "not found.", e);
+            return new StackInfo (stackName, HeatStatus.NOTFOUND, null, null);
+        } catch (MsoException me) {
+            // Got an Openstack error. Propagate it
+            LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Exception on Token request: " + me, "Openstack", "", MsoLogger.ErrorCode.AvailabilityError, "Connection Exception");
+            me.addContext ("QueryStack");
+            throw me;
+        }
+
+        // Query the Stack.
+        // An MsoException will propagate transparently to the caller.
+        Stack heatStack = queryHeatStack (heatClient, stackName);
+
+        if (heatStack == null) {
+            // Stack does not exist. Return a StackInfo with status NOTFOUND
+            StackInfo stackInfo = new StackInfo (stackName, HeatStatus.NOTFOUND, null, null);
+            return stackInfo;
+        }
+
+        return new StackInfo (heatStack);
+    }
+
+    /**
+     * Delete a stack (by Name/ID) in a tenant. If the stack is not found, it will be
+     * considered a successful deletion. The return value is a StackInfo object which
+     * contains the current stack status.
+     *
+     * The client may choose to let the adapter poll Openstack for completion of the
+     * stack deletion, or may handle polling itself via separate query calls. In either
+     * case, a StackInfo object will be returned. When polling is enabled, a final
+     * status of NOTFOUND is expected. When not polling, a status of DELETING is expected.
+     *
+     * There is no rollback from a successful stack deletion. A deletion failure will
+     * also result in an undefined stack state - the components may or may not have been
+     * all or partially deleted, so the resulting stack must be considered invalid.
+     *
+     * @param tenantId The Openstack ID of the tenant in which to perform the delete
+     * @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack.
+     * @param stackName The name/id of the stack to delete. May be simple or canonical
+     * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
+     * @return A StackInfo object
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
+     * @throws MsoCloudSiteNotFound
+     */
+    public StackInfo deleteStack (String tenantId,
+                                  String cloudSiteId,
+                                  String stackName,
+                                  boolean pollForCompletion) throws MsoException {
+        // Obtain the cloud site information where we will create the stack
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+
+        // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
+        Heat heatClient = null;
+        try {
+            heatClient = getHeatClient (cloudSite, tenantId);
+        } catch (MsoTenantNotFound e) {
+            // Tenant doesn't exist, so stack doesn't either
+            LOGGER.debug ("Tenant with id " + tenantId + "not found.", e);
+            return new StackInfo (stackName, HeatStatus.NOTFOUND, null, null);
+        } catch (MsoException me) {
+            // Got an Openstack error. Propagate it
+            LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack", "Openstack Exception on Token request: " + me, "Openstack", "", MsoLogger.ErrorCode.AvailabilityError, "Connection Exception");
+            me.addContext (DELETE_STACK);
+            throw me;
+        }
+
+        // OK if stack not found, perform a query first
+        Stack heatStack = queryHeatStack (heatClient, stackName);
+        if (heatStack == null || "DELETE_COMPLETE".equals (heatStack.getStackStatus ())) {
+            // Not found. Return a StackInfo with status NOTFOUND
+            return new StackInfo (stackName, HeatStatus.NOTFOUND, null, null);
+        }
+
+        // Delete the stack.
+
+        // Use canonical name "<stack name>/<stack-id>" to delete.
+        // Otherwise, deletion by name returns a 302 redirect.
+        // NOTE: This is specific to the v1 Orchestration API.
+        String canonicalName = heatStack.getStackName () + "/" + heatStack.getId ();
+
+        try {
+            OpenStackRequest <Void> request = heatClient.getStacks ().deleteByName (canonicalName);
+            executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                // Not found. We are OK with this. Return a StackInfo with status NOTFOUND
+                return new StackInfo (stackName, HeatStatus.NOTFOUND, null, null);
+            } else {
+                // Convert the OpenStackResponseException to an MsoOpenstackException
+                throw heatExceptionToMsoException (e, DELETE_STACK);
+            }
+        } catch (OpenStackConnectException e) {
+            // Error connecting to Openstack instance. Convert to an MsoException
+            throw heatExceptionToMsoException (e, DELETE_STACK);
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, DELETE_STACK);
+        }
+
+        // Requery the stack for current status.
+        // It will probably still exist with "DELETE_IN_PROGRESS" status.
+        heatStack = queryHeatStack (heatClient, canonicalName);
+
+        if (pollForCompletion) {
+            // Set a timeout on polling
+            int pollInterval = msoProps.getIntProperty (deletePollIntervalProp, deletePollIntervalDefault);
+            int pollTimeout = msoProps.getIntProperty (deletePollTimeoutProp, deletePollTimeoutDefault);
+
+            // When querying by canonical name, Openstack returns DELETE_COMPLETE status
+            // instead of "404" (which would result from query by stack name).
+            while (heatStack != null && !"DELETE_COMPLETE".equals (heatStack.getStackStatus ())) {
+                LOGGER.debug ("Stack status: " + heatStack.getStackStatus ());
+
+                if ("DELETE_FAILED".equals (heatStack.getStackStatus ())) {
+                    // Throw a 'special case' of MsoOpenstackException to report the Heat status
+                    String error = "Stack delete error (" + heatStack.getStackStatus ()
+                                   + "): "
+                                   + heatStack.getStackStatusReason ();
+                    MsoOpenstackException me = new MsoOpenstackException (0, "", error);
+                    me.addContext (DELETE_STACK);
+
+                    // Alarm this condition, stack deletion failed
+                    alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+
+                    throw me;
+                }
+
+                if (pollTimeout <= 0) {
+                    LOGGER.error (MessageEnum.RA_DELETE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Delete Stack Timeout");
+
+                    // Throw a 'special case' of MsoOpenstackException to report the Heat status
+                    MsoOpenstackException me = new MsoOpenstackException (0, "", "Stack Deletion Timeout");
+                    me.addContext (DELETE_STACK);
+
+                    // Alarm this condition, stack deletion failed
+                    alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ());
+
+                    throw me;
+                }
+
+                try {
+                    Thread.sleep (pollInterval * 1000L);
+                } catch (InterruptedException e) {
+                    LOGGER.debug ("Thread interrupted while sleeping", e);
+                }
+
+                pollTimeout -= pollInterval;
+
+                heatStack = queryHeatStack (heatClient, canonicalName);
+            }
+
+            // The stack is gone when this point is reached
+            return new StackInfo (stackName, HeatStatus.NOTFOUND, null, null);
+        }
+
+        // Return the current status (if not polling, the delete may still be in progress)
+        StackInfo stackInfo = new StackInfo (heatStack);
+        stackInfo.setName (stackName);
+
+        return stackInfo;
+    }
+
+    /**
+     * Query for all stacks in a tenant site. This call will return a List of StackInfo
+     * objects, one for each deployed stack.
+     *
+     * Note that this is limited to a single site. To ensure that a tenant is truly
+     * empty would require looping across all tenant endpoints.
+     *
+     * @param tenantId The Openstack ID of the tenant to query
+     * @param cloudSiteId The cloud identifier (may be a region) in which to query.
+     * @return A List of StackInfo objects
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
+     * @throws MsoCloudSiteNotFound
+     */
+    public List <StackInfo> queryAllStacks (String tenantId, String cloudSiteId) throws MsoException {
+        // Obtain the cloud site information where we will create the stack
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+
+        // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
+        Heat heatClient = getHeatClient (cloudSite, tenantId);
+
+        try {
+            OpenStackRequest <Stacks> request = heatClient.getStacks ().list ();
+            Stacks stacks = executeAndRecordOpenstackRequest (request, msoProps);
+
+            List <StackInfo> stackList = new ArrayList <StackInfo> ();
+
+            // Not sure if returns an empty list or null if no stacks exist
+            if (stacks != null) {
+                for (Stack stack : stacks) {
+                    stackList.add (new StackInfo (stack));
+                }
+            }
+
+            return stackList;
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                // Not sure if this can happen, but return an empty list
+                LOGGER.debug ("queryAllStacks - stack not found: ");
+                return new ArrayList <StackInfo> ();
+            } else {
+                // Convert the OpenStackResponseException to an MsoOpenstackException
+                throw heatExceptionToMsoException (e, QUERY_ALL_STACKS);
+            }
+        } catch (OpenStackConnectException e) {
+            // Error connecting to Openstack instance. Convert to an MsoException
+            throw heatExceptionToMsoException (e, QUERY_ALL_STACKS);
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, QUERY_ALL_STACKS);
+        }
+    }
+
+    /**
+     * Validate parameters to be passed to Heat template. This method performs
+     * three functions:
+     * 1. Apply default values to parameters which have them defined
+     * 2. Report any required parameters that are missing. This will generate an
+     * exception in the caller, since stack create/update operations would fail.
+     * 3. Report and remove any extraneous parameters. This will allow clients to
+     * pass supersets of parameters and not get errors.
+     *
+     * These functions depend on the HeatTemplate definition from the MSO Catalog DB,
+     * along with the input parameter Map. The output is an updated parameter map.
+     * If the parameters are invalid for the template, an IllegalArgumentException
+     * is thrown.
+     */
+    public Map <String, Object> validateStackParams (Map <String, Object> inputParams,
+                                                     HeatTemplate heatTemplate) throws IllegalArgumentException {
+        // Check that required parameters have been supplied for this template type
+        String missingParams = null;
+        List <String> paramList = new ArrayList <String> ();
+
+        // TODO: Enhance DB to support defaults for Heat Template parameters
+
+        for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
+            if (parm.isRequired () && !inputParams.containsKey (parm.getParamName ())) {
+                if (missingParams == null) {
+                    missingParams = parm.getParamName ();
+                } else {
+                    missingParams += "," + parm.getParamName ();
+                }
+            }
+            paramList.add (parm.getParamName ());
+        }
+        if (missingParams != null) {
+            // Problem - missing one or more required parameters
+            String error = "Missing Required inputs for HEAT Template: " + missingParams;
+            LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams + " for HEAT Template", "", "", MsoLogger.ErrorCode.SchemaError, "Missing Required inputs for HEAT Template: " + missingParams);
+            throw new IllegalArgumentException (error);
+        }
+
+        // Remove any extraneous parameters (don't throw an error)
+        Map <String, Object> updatedParams = new HashMap <String, Object> ();
+        List <String> extraParams = new ArrayList <String> ();
+        for (String key : inputParams.keySet ()) {
+            if (!paramList.contains (key)) {
+                // This is not a valid parameter for this template
+                extraParams.add (key);
+            } else {
+                updatedParams.put (key, inputParams.get (key));
+            }
+        }
+        if (!extraParams.isEmpty ()) {
+            LOGGER.warn (MessageEnum.RA_GENERAL_WARNING, "Heat Stack (" + heatTemplate.getTemplateName ()
+                         + ") extra input params received: "
+                         + extraParams, "", "", MsoLogger.ErrorCode.DataError, "Heat Stack (" + heatTemplate.getTemplateName () + ") extra input params received: "+ extraParams);
+        }
+
+        return updatedParams;
+    }
+
+    // ---------------------------------------------------------------
+    // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS
+
+    /**
+     * Get a Heat client for the Openstack Identity service.
+     * This requires a 'member'-level userId + password, which will be retrieved from
+     * properties based on the specified cloud Id. The tenant in which to operate
+     * must also be provided.
+     * <p>
+     * On successful authentication, the Heat object will be cached for the
+     * tenantID + cloudId so that it can be reused without reauthenticating with
+     * Openstack every time.
+     *
+     * @param tenantName
+     * @param cloudId
+     * @return an authenticated Heat object
+     */
+    public Heat getHeatClient (CloudSite cloudSite, String tenantId) throws MsoException {
+        String cloudId = cloudSite.getId ();
+
+        // Check first in the cache of previously authorized clients
+        String cacheKey = cloudId + ":" + tenantId;
+        if (heatClientCache.containsKey (cacheKey)) {
+            if (!heatClientCache.get (cacheKey).isExpired ()) {
+                LOGGER.debug ("Using Cached HEAT Client for " + cacheKey);
+                return heatClientCache.get (cacheKey).getHeatClient ();
+            } else {
+                // Token is expired. Remove it from cache.
+                heatClientCache.remove (cacheKey);
+                LOGGER.debug ("Expired Cached HEAT Client for " + cacheKey);
+            }
+        }
+
+        // Obtain an MSO token for the tenant
+        CloudIdentity cloudIdentity = cloudSite.getIdentityService ();
+        String keystoneUrl = cloudIdentity.getKeystoneUrl (cloudId, msoPropID);
+        Keystone keystoneTenantClient = new Keystone (keystoneUrl);
+        Access access = null;
+        try {
+        	Authentication credentials = cloudIdentity.getAuthentication ();
+                	
+        	OpenStackRequest <Access> request = keystoneTenantClient.tokens ()
+                       .authenticate (credentials).withTenantId (tenantId);
+        	
+            access = executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 401) {
+                // Authentication error.
+                String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId ();
+                alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error);
+                throw new MsoAdapterException (error);
+            } else {
+                throw keystoneErrorToMsoException (e, TOKEN_AUTH);
+            }
+        } catch (OpenStackConnectException e) {
+            // Connection to Openstack failed
+            MsoIOException me = new MsoIOException (e.getMessage (), e);
+            me.addContext (TOKEN_AUTH);
+            throw me;
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, TOKEN_AUTH);
+        }
+
+        // For DCP/LCP, the region should be the cloudId.
+        String region = cloudSite.getRegionId ();
+        String heatUrl = null;
+        try {
+            heatUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "orchestration", region, "public");
+        } catch (RuntimeException e) {
+            // This comes back for not found (probably an incorrect region ID)
+            String error = "Orchestration service not found: region=" + region + ",cloud=" + cloudIdentity.getId ();
+            alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error);
+            throw new MsoAdapterException (error, e);
+        }
+        // This is needed for testing in the MT cloud
+        if ("MT".equals (cloudId)) {
+            heatUrl = heatUrl.replace ("controller", "mtdnj02bh01wt.bvoip.labs.att.com");
+        }
+
+        Heat heatClient = new Heat (heatUrl);
+        heatClient.token (access.getToken ().getId ());
+
+        heatClientCache.put (cacheKey,
+                             new HeatCacheEntry (heatUrl,
+                                                 access.getToken ().getId (),
+                                                 access.getToken ().getExpires ()));
+        LOGGER.debug ("Caching HEAT Client for " + cacheKey);
+
+        return heatClient;
+    }
+
+    /**
+     * Forcibly expire a HEAT client from the cache. This call is for use by
+     * the KeystoneClient in case where a tenant is deleted. In that case,
+     * all cached credentials must be purged so that fresh authentication is
+     * done if a similarly named tenant is re-created.
+     * <p>
+     * Note: This is probably only applicable to dev/test environments where
+     * the same Tenant Name is repeatedly used for creation/deletion.
+     * <p>
+     *
+     * @param tenantName
+     * @param cloudId
+     */
+    public static void expireHeatClient (String tenantId, String cloudId) {
+        String cacheKey = cloudId + ":" + tenantId;
+        if (heatClientCache.containsKey (cacheKey)) {
+            heatClientCache.remove (cacheKey);
+            LOGGER.debug ("Deleted Cached HEAT Client for " + cacheKey);
+        }
+    }
+
+    /*
+     * Query for a Heat Stack. This function is needed in several places, so
+     * a common method is useful. This method takes an authenticated Heat Client
+     * (which internally identifies the cloud & tenant to search), and returns
+     * a Stack object if found, Null if not found, or an MsoOpenstackException
+     * if the Openstack API call fails.
+     *
+     * The stack name may be a simple name or a canonical name ("{name}/{id}").
+     * When simple name is used, Openstack always returns a 302 redirect which
+     * results in a 2nd request (to the canonical name). Note that query by
+     * canonical name for a deleted stack returns a Stack object with status
+     * "DELETE_COMPLETE" while query by simple name for a deleted stack returns
+     * HTTP 404.
+     *
+     * @param heatClient an authenticated Heat client
+     *
+     * @param stackName the stack name to query
+     *
+     * @return a Stack object that describes the current stack or null if the
+     * requested stack doesn't exist.
+     *
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+     */
+    protected Stack queryHeatStack (Heat heatClient, String stackName) throws MsoException {
+        if (stackName == null) {
+            return null;
+        }
+        try {
+            OpenStackRequest <Stack> request = heatClient.getStacks ().byName (stackName);
+            return executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                LOGGER.debug ("queryHeatStack - stack not found: " + stackName);
+                return null;
+            } else {
+                // Convert the OpenStackResponseException to an MsoOpenstackException
+                throw heatExceptionToMsoException (e, "QueryStack");
+            }
+        } catch (OpenStackConnectException e) {
+            // Connection to Openstack failed
+            throw heatExceptionToMsoException (e, "QueryAllStack");
+        }
+    }
+
+    /*
+     * An entry in the Heat Client Cache. It saves the Heat client object
+     * along with the token expiration. After this interval, this cache
+     * item will no longer be used.
+     */
+    private static class HeatCacheEntry implements Serializable {
+
+        private static final long serialVersionUID = 1L;
+
+        private String heatUrl;
+        private String token;
+        private Calendar expires;
+
+        public HeatCacheEntry (String heatUrl, String token, Calendar expires) {
+            this.heatUrl = heatUrl;
+            this.token = token;
+            this.expires = expires;
+        }
+
+        public Heat getHeatClient () {
+            Heat heatClient = new Heat (heatUrl);
+            heatClient.token (token);
+            return heatClient;
+        }
+
+        public boolean isExpired () {
+            if (expires == null) {
+                return true;
+            }
+
+            Calendar now = Calendar.getInstance ();
+            if (now.after (expires)) {
+                return true;
+            }
+
+            return false;
+        }
+    }
+
+    /**
+     * Clean up the Heat client cache to remove expired entries.
+     */
+    public static void heatCacheCleanup () {
+        for (String cacheKey : heatClientCache.keySet ()) {
+            if (heatClientCache.get (cacheKey).isExpired ()) {
+                heatClientCache.remove (cacheKey);
+                LOGGER.debug ("Cleaned Up Cached Heat Client for " + cacheKey);
+            }
+        }
+    }
+
+    /**
+     * Reset the Heat client cache.
+     * This may be useful if cached credentials get out of sync.
+     */
+    public static void heatCacheReset () {
+        heatClientCache = new HashMap <String, HeatCacheEntry> ();
+    }
+    
+	public Map<String, Object> queryStackForOutputs(String cloudSiteId,
+			String tenantId, String stackName) throws MsoException {
+		LOGGER.debug("MsoHeatUtils.queryStackForOutputs)");
+		StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName);
+		if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
+			return null;
+		}
+		Map<String, Object> outputs = heatStack.getOutputs();
+		return outputs;
+	}
+
+	public void queryAndCopyOutputsToInputs(String cloudSiteId,
+			String tenantId, String stackName, Map<String, String> inputs,
+			boolean overWrite) throws MsoException {
+		LOGGER.debug("MsoHeatUtils.queryAndCopyOutputsToInputs");
+		Map<String, Object> outputs = this.queryStackForOutputs(cloudSiteId,
+				tenantId, stackName);
+		this.copyStringOutputsToInputs(inputs, outputs, overWrite);
+		return;
+	}
+
+	public void copyStringOutputsToInputs(Map<String, String> inputs,
+			Map<String, Object> otherStackOutputs, boolean overWrite) {
+		if (inputs == null || otherStackOutputs == null)
+			return;
+		for (String key : otherStackOutputs.keySet()) {
+			if (!inputs.containsKey(key)) {
+				Object obj = otherStackOutputs.get(key);
+				if (obj instanceof String) {
+					inputs.put(key, (String) otherStackOutputs.get(key));
+				} else if (obj instanceof JsonNode ){
+					// This is a bit of mess - but I think it's the least impacting
+					// let's convert it BACK to a string - then it will get converted back later
+					try {
+						String str = this.convertNode((JsonNode) obj);
+						inputs.put(key, str);
+					} catch (Exception e) {
+						LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for "+ key);
+						//effect here is this value will not have been copied to the inputs - and therefore will error out downstream
+					}
+				} else if (obj instanceof java.util.LinkedHashMap) {
+					LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
+					try {
+						String str = JSON_MAPPER.writeValueAsString(obj);
+						inputs.put(key, str);
+					} catch (Exception e) {
+						LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for "+ key);
+					}
+				} else {
+					// just try to cast it - could be an integer or some such
+					try {
+						String str = (String) obj;
+						inputs.put(key, str);
+					} catch (Exception e) {
+						LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for "+ key);
+						//effect here is this value will not have been copied to the inputs - and therefore will error out downstream
+					}
+				}
+			}
+		}
+		return;
+	}
+	public StringBuilder requestToStringBuilder(CreateStackParam stack) {
+		StringBuilder sb = new StringBuilder();
+		sb.append("Stack:\n");
+		sb.append("\tStackName: " + stack.getStackName());
+		sb.append("\tTemplateUrl: " + stack.getTemplateUrl());
+		sb.append("\tTemplate: " + stack.getTemplate());
+		sb.append("\tEnvironment: " + stack.getEnvironment());
+		sb.append("\tTimeout: " + stack.getTimeoutMinutes());
+		sb.append("\tParameters:\n");
+		Map<String, Object> params = stack.getParameters();
+		if (params == null || params.size() < 1) {
+			sb.append("\tNONE");
+		} else {
+			for (String key : params.keySet()) {
+				if (params.get(key) instanceof String) {
+					sb.append("\t" + key + "=" + (String) params.get(key));
+				} else if (params.get(key) instanceof JsonNode) {
+					String jsonStringOut = this.convertNode((JsonNode)params.get(key));
+					sb.append("\t" + key + "=" + jsonStringOut);
+				} else {
+					sb.append("\t" + key + "= [some non-string/non-json]");
+				}
+			}
+		}
+		return sb;
+	}
+	
+	private String convertNode(final JsonNode node) {
+		try {
+			final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
+			final String json = JSON_MAPPER.writeValueAsString(obj);
+			return json;
+		} catch (JsonParseException jpe) {
+			LOGGER.debug("Error converting json to string " + jpe.getMessage());
+		} catch (Exception e) {
+			LOGGER.debug("Error converting json to string " + e.getMessage());
+		}
+		return "[Error converting json to string]";
+	}
+}
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
new file mode 100644
index 0000000..04dfa12
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -0,0 +1,333 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.openstack.beans.StackInfo;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+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.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;
+
+public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
+
+    private static final String UPDATE_STACK = "UpdateStack";
+    private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+    protected MsoJavaProperties msoProps = null;
+
+    public MsoHeatUtilsWithUpdate (String msoPropID, MsoPropertiesFactory msoPropertiesFactory, CloudConfigFactory cloudConfFactory) {
+        super (msoPropID,msoPropertiesFactory,cloudConfFactory);
+        
+    	try {
+			msoProps = msoPropertiesFactory.getMsoJavaProperties (msoPropID);
+		} catch (MsoPropertiesException e) {
+			LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception Mso Properties ID not found in cache: " + msoPropID, e);
+		}
+    }
+    
+    /*
+     * Keep these methods around for backward compatibility
+     */
+
+    public StackInfo updateStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes) throws MsoException {
+        // Keeping this method to allow compatibility with no environment or files variable sent. In this case,
+        // simply return the new method with the environment variable set to null.
+        return this.updateStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 null,
+                                 null,
+                                 null);
+    }
+
+    public StackInfo updateStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment) throws MsoException {
+        // Keeping this method to allow compatibility with no environment variable sent. In this case,
+        // simply return the new method with the files variable set to null.
+        return this.updateStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 environment,
+                                 null,
+                                 null);
+    }
+
+    public StackInfo updateStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment,
+                                  Map <String, Object> files) throws MsoException {
+        return this.updateStack (cloudSiteId,
+                                 tenantId,
+                                 stackName,
+                                 heatTemplate,
+                                 stackInputs,
+                                 pollForCompletion,
+                                 timeoutMinutes,
+                                 environment,
+                                 files,
+                                 null);
+    }
+
+    /**
+     * Update a Stack in the specified cloud location and tenant. The Heat template
+     * and parameter map are passed in as arguments, along with the cloud access credentials.
+     * It is expected that parameters have been validated and contain at minimum the required
+     * parameters for the given template with no extra (undefined) parameters..
+     *
+     * The Stack name supplied by the caller must be unique in the scope of this tenant.
+     * However, it should also be globally unique, as it will be the identifier for the
+     * resource going forward in Inventory. This latter is managed by the higher levels
+     * invoking this function.
+     *
+     * The caller may choose to let this function poll Openstack for completion of the
+     * stack creation, or may handle polling itself via separate calls to query the status.
+     * In either case, a StackInfo object will be returned containing the current status.
+     * When polling is enabled, a status of CREATED is expected. When not polling, a
+     * status of BUILDING is expected.
+     *
+     * An error will be thrown if the requested Stack already exists in the specified
+     * Tenant and Cloud.
+     *
+     * @param tenantId The Openstack ID of the tenant in which to create the Stack
+     * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant.
+     * @param stackName The name of the stack to update
+     * @param stackTemplate The Heat template
+     * @param stackInputs A map of key/value inputs
+     * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
+     * @param environment An optional yaml-format string to specify environmental parameters
+     * @param files a Map<String, Object> for listing child template IDs
+     * @param heatFiles a Map<String, Object> for listing get_file entries (fileName, fileBody)
+     * @return A StackInfo object
+     * @throws MsoException Thrown if the Openstack API call returns an exception.
+     */
+
+    public StackInfo updateStack (String cloudSiteId,
+                                  String tenantId,
+                                  String stackName,
+                                  String heatTemplate,
+                                  Map <String, Object> stackInputs,
+                                  boolean pollForCompletion,
+                                  int timeoutMinutes,
+                                  String environment,
+                                  Map <String, Object> files,
+                                  Map <String, Object> heatFiles) throws MsoException {
+        boolean heatEnvtVariable = true;
+        if (environment == null || "".equalsIgnoreCase (environment.trim ())) {
+            heatEnvtVariable = false;
+        }
+        boolean haveFiles = true;
+        if (files == null || files.isEmpty ()) {
+            haveFiles = false;
+        }
+        boolean haveHeatFiles = true;
+        if (heatFiles == null || heatFiles.isEmpty ()) {
+            haveHeatFiles = false;
+        }
+
+        // Obtain the cloud site information where we will create the stack
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+        // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId)
+        // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated)
+        Heat heatClient = getHeatClient (cloudSite, tenantId);
+
+        // Perform a query first to get the current status
+        Stack heatStack = queryHeatStack (heatClient, stackName);
+        if (heatStack == null || "DELETE_COMPLETE".equals (heatStack.getStackStatus ())) {
+            // Not found. Return a StackInfo with status NOTFOUND
+            throw new MsoStackNotFound (stackName, tenantId, cloudSiteId);
+        }
+
+        // Use canonical name "<stack name>/<stack-id>" to update the stack.
+        // Otherwise, update by name returns a 302 redirect.
+        // NOTE: This is specific to the v1 Orchestration API.
+        String canonicalName = heatStack.getStackName () + "/" + heatStack.getId ();
+
+        LOGGER.debug ("Ready to Update Stack (" + canonicalName + ") with input params: " + stackInputs);
+
+        // Build up the stack update parameters
+        // Disable auto-rollback, because error reason is lost. Always rollback in the code.
+        UpdateStackParam stack = new UpdateStackParam ();
+        stack.setTimeoutMinutes (timeoutMinutes);
+        stack.setParameters (stackInputs);
+        stack.setTemplate (heatTemplate);
+        stack.setDisableRollback (true);
+        // TJM add envt to stack
+        if (heatEnvtVariable) {
+            stack.setEnvironment (environment);
+        }
+
+        // Handle nested templates & get_files here. if we have both - must combine
+        // and then add to stack (both are part of "files:" being added to stack)
+        if (haveFiles && haveHeatFiles) {
+            // Let's do this here - not in the bean
+            LOGGER.debug ("Found files AND heatFiles - combine and add!");
+            Map <String, Object> combinedFiles = new HashMap <String, Object> ();
+            for (String keyString : files.keySet ()) {
+                combinedFiles.put (keyString, files.get (keyString));
+            }
+            for (String keyString : heatFiles.keySet ()) {
+                combinedFiles.put (keyString, heatFiles.get (keyString));
+            }
+            stack.setFiles (combinedFiles);
+        } else {
+            // Handle case where we have one or neither
+            if (haveFiles) {
+                stack.setFiles (files);
+            }
+            if (haveHeatFiles) {
+                // setFiles method modified to handle adding a map.
+                stack.setFiles (heatFiles);
+            }
+        }
+
+        try {
+            // Execute the actual Openstack command to update the Heat stack
+            OpenStackRequest <Void> request = heatClient.getStacks ().update (canonicalName, stack);
+            executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackBaseException e) {
+            // Since this came on the 'Update Stack' command, nothing was changed
+            // in the cloud. Rethrow the error as an MSO exception.
+            throw heatExceptionToMsoException (e, UPDATE_STACK);
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, UPDATE_STACK);
+        }
+
+        // If client has requested a final response, poll for stack completion
+        Stack updateStack = null;
+        if (pollForCompletion) {
+            // Set a time limit on overall polling.
+            // Use the resource (template) timeout for Openstack (expressed in minutes)
+            // and add one poll interval to give Openstack a chance to fail on its own.
+            int createPollInterval = msoProps.getIntProperty (createPollIntervalProp, createPollIntervalDefault);
+            int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
+
+            boolean loopAgain = true;
+            while (loopAgain) {
+                try {
+                    updateStack = queryHeatStack (heatClient, canonicalName);
+                    LOGGER.debug (updateStack.getStackStatus ());
+
+                    if ("UPDATE_IN_PROGRESS".equals (updateStack.getStackStatus ())) {
+                        // Stack update is still running.
+                        // Sleep and try again unless timeout has been reached
+                        if (pollTimeout <= 0) {
+                            // Note that this should not occur, since there is a timeout specified
+                            // in the Openstack call.
+                        	LOGGER.error (MessageEnum.RA_UPDATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, updateStack.getStackStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError, "Update stack timeout");
+                            loopAgain = false;
+                        } else {
+                            try {
+                                Thread.sleep (createPollInterval * 1000L);
+                            } catch (InterruptedException e) {
+                                // If we are interrupted, we should stop ASAP.
+                                loopAgain = false;
+                                // Set again the interrupted flag
+                                Thread.currentThread().interrupt();
+                            }
+                        }
+                        pollTimeout -= createPollInterval;
+                    } else {
+                        loopAgain = false;
+                    }
+                } catch (MsoException e) {
+                    // Cannot query the stack. Something is wrong.
+
+                    // TODO: No way to roll back the stack at this point. What to do?
+                    e.addContext (UPDATE_STACK);
+                    throw e;
+                }
+            }
+
+            if (!"UPDATE_COMPLETE".equals (updateStack.getStackStatus ())) {
+            	LOGGER.error (MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(), "", "", MsoLogger.ErrorCode.DataError, "Update Stack error");
+
+                // TODO: No way to roll back the stack at this point. What to do?
+                // Throw a 'special case' of MsoOpenstackException to report the Heat status
+                MsoOpenstackException me = null;
+                if ("UPDATE_IN_PROGRESS".equals (updateStack.getStackStatus ())) {
+                    me = new MsoOpenstackException (0, "", "Stack Update Timeout");
+                } else {
+                    String error = "Stack error (" + updateStack.getStackStatus ()
+                                   + "): "
+                                   + updateStack.getStackStatusReason ();
+                    me = new MsoOpenstackException (0, "", error);
+                }
+                me.addContext (UPDATE_STACK);
+                throw me;
+            }
+
+        } else {
+            // Return the current status.
+            updateStack = queryHeatStack (heatClient, canonicalName);
+            if (updateStack != null) {
+                LOGGER.debug ("UpdateStack, status = " + updateStack.getStackStatus ());
+            } else {
+                LOGGER.debug ("UpdateStack, stack not found");
+            }
+        }
+        return new StackInfo (updateStack);
+    }
+}
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
new file mode 100644
index 0000000..82203d0
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java
@@ -0,0 +1,684 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+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 org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.openstack.beans.MsoTenant;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+import org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesException;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.model.Metadata;
+import com.woorea.openstack.keystone.model.Role;
+import com.woorea.openstack.keystone.model.Roles;
+import com.woorea.openstack.keystone.model.Tenant;
+import com.woorea.openstack.keystone.model.User;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+import com.woorea.openstack.keystone.model.Authentication;
+
+public class MsoKeystoneUtils extends MsoTenantUtils {
+
+    // Cache the Keystone Clients statically. Since there is just one MSO user, there is no
+    // benefit to re-authentication on every request (or across different flows). The
+    // token will be used until it expires.
+    //
+    // The cache key is "cloudId"
+    private static Map <String, KeystoneCacheEntry> adminClientCache = new HashMap <String, KeystoneCacheEntry> ();
+
+	private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+	String msoPropID;
+	
+    public MsoKeystoneUtils (String msoPropID) {
+		super(msoPropID);
+		this.msoPropID = msoPropID;
+		LOGGER.debug("MsoKeyStoneUtils:" + msoPropID);
+	}
+
+    /**
+     * Create a tenant with the specified name in the given cloud. If the tenant already exists,
+     * an Exception will be thrown. The MSO User will also be added to the "member" list of
+     * the new tenant to perform subsequent Nova/Heat commands in the tenant. If the MSO User
+     * association fails, the entire transaction will be rolled back.
+     * <p>
+     * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin
+     * requests go to the centralized identity service in DCP. However, if some artifact
+     * must exist in each local LCP instance as well, then it will be needed to access the
+     * correct region.
+     * <p>
+     *
+     * @param tenantName The tenant name to create
+     * @param cloudId The cloud identifier (may be a region) in which to create the tenant.
+     * @return the tenant ID of the newly created tenant
+     * @throws MsoTenantAlreadyExists Thrown if the requested tenant already exists
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+     */
+    public String createTenant (String tenantName,
+                                String cloudSiteId,
+                                Map <String, String> metadata,
+                                boolean backout) throws MsoException {
+        // Obtain the cloud site information where we will create the tenant
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+        	LOGGER.error(MessageEnum.RA_CREATE_TENANT_ERR, "MSOCloudSite not found", "", "", MsoLogger.ErrorCode.DataError, "MSOCloudSite not found");
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+        Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
+
+        Tenant tenant = null;
+        try {
+            // Check if the tenant already exists
+            tenant = findTenantByName (keystoneAdminClient, tenantName);
+
+            if (tenant != null) {
+                // Tenant already exists. Throw an exception
+            	LOGGER.error(MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant already exists");
+                throw new MsoTenantAlreadyExists (tenantName, cloudSiteId);
+            }
+
+            // Does not exist, create a new one
+            tenant = new Tenant ();
+            tenant.setName (tenantName);
+            tenant.setDescription ("SDN Tenant (via MSO)");
+            tenant.setEnabled (true);
+
+            OpenStackRequest <Tenant> request = keystoneAdminClient.tenants ().create (tenant);
+            tenant = executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackBaseException e) {
+            // Convert Keystone OpenStackResponseException to MsoOpenstackException
+            throw keystoneErrorToMsoException (e, "CreateTenant");
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, "CreateTenant");
+        }
+
+        // Add MSO User to the tenant as a member and
+        // apply tenant metadata if supported by the cloud site
+        try {
+            CloudIdentity cloudIdentity = cloudSite.getIdentityService ();
+
+            User msoUser = findUserByNameOrId (keystoneAdminClient, cloudIdentity.getMsoId ());
+            Role memberRole = findRoleByNameOrId (keystoneAdminClient, cloudIdentity.getMemberRole ());
+
+            OpenStackRequest <Void> request = keystoneAdminClient.tenants ().addUser (tenant.getId (),
+                                                                                      msoUser.getId (),
+                                                                                      memberRole.getId ());
+            executeAndRecordOpenstackRequest (request, msoProps);
+
+            if (cloudIdentity.hasTenantMetadata () && metadata != null && !metadata.isEmpty ()) {
+                Metadata tenantMetadata = new Metadata ();
+                tenantMetadata.setMetadata (metadata);
+
+                OpenStackRequest <Metadata> metaRequest = keystoneAdminClient.tenants ()
+                                                                             .createOrUpdateMetadata (tenant.getId (),
+                                                                                                      tenantMetadata);
+                executeAndRecordOpenstackRequest (metaRequest, msoProps);
+            }
+        } catch (Exception e) {
+            // Failed to attach MSO User to the new tenant. Can't operate without access,
+            // so roll back the tenant.
+        	if (!backout)
+        	{
+        		LOGGER.warn(MessageEnum.RA_CREATE_TENANT_ERR, "Create Tenant errored, Tenant deletion suppressed", "Openstack", "", MsoLogger.ErrorCode.DataError, "Create Tenant error, Tenant deletion suppressed");
+        	}
+        	else
+        	{
+        		try {
+        			OpenStackRequest <Void> request = keystoneAdminClient.tenants ().delete (tenant.getId ());
+        			executeAndRecordOpenstackRequest (request, msoProps);
+        		} catch (Exception e2) {
+        			// Just log this one. We will report the original exception.
+        			LOGGER.error (MessageEnum.RA_CREATE_TENANT_ERR, "Nested exception rolling back tenant", "Openstack", "", MsoLogger.ErrorCode.DataError, "Create Tenant error, Nested exception rolling back tenant", e2);
+        		}
+        	}
+        	
+
+            // Propagate the original exception on user/role/tenant mapping
+            if (e instanceof OpenStackBaseException) {
+                // Convert Keystone Exception to MsoOpenstackException
+                throw keystoneErrorToMsoException ((OpenStackBaseException) e, "CreateTenantUser");
+            } else {
+                MsoAdapterException me = new MsoAdapterException (e.getMessage (), e);
+                me.addContext ("CreateTenantUser");
+                throw me;
+            }
+        }
+        return tenant.getId ();
+    }
+
+    /**
+     * Query for a tenant by ID in the given cloud. If the tenant exists,
+     * return an MsoTenant object. If not, return null.
+     * <p>
+     * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin
+     * requests go to the centralized identity service in DCP. However, if some artifact
+     * must exist in each local LCP instance as well, then it will be needed to access the
+     * correct region.
+     * <p>
+     *
+     * @param tenantId The Openstack ID of the tenant to query
+     * @param cloudSiteId The cloud identifier (may be a region) in which to query the tenant.
+     * @return the tenant properties of the queried tenant, or null if not found
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+     */
+    public MsoTenant queryTenant (String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound {
+        // Obtain the cloud site information where we will query the tenant
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+
+        Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
+
+        // Check if the tenant exists and return its Tenant Id
+        try {
+            Tenant tenant = findTenantById (keystoneAdminClient, tenantId);
+            if (tenant == null) {
+                return null;
+            }
+
+            Map <String, String> metadata = new HashMap <String, String> ();
+            if (cloudSite.getIdentityService ().hasTenantMetadata ()) {
+                OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ());
+                Metadata tenantMetadata = executeAndRecordOpenstackRequest (request, msoProps);
+                if (tenantMetadata != null) {
+                    metadata = tenantMetadata.getMetadata ();
+                }
+            }
+            return new MsoTenant (tenant.getId (), tenant.getName (), metadata);
+        } catch (OpenStackBaseException e) {
+            // Convert Keystone OpenStackResponseException to MsoOpenstackException
+            throw keystoneErrorToMsoException (e, "QueryTenant");
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, "QueryTenant");
+        }
+    }
+
+    /**
+     * Query for a tenant with the specified name in the given cloud. If the tenant exists,
+     * return an MsoTenant object. If not, return null. This query is useful if the client
+     * knows it has the tenant name, skipping an initial lookup by ID that would always fail.
+     * <p>
+     * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin
+     * requests go to the centralized identity service in DCP. However, if some artifact
+     * must exist in each local LCP instance as well, then it will be needed to access the
+     * correct region.
+     * <p>
+     *
+     * @param tenantName The name of the tenant to query
+     * @param cloudSiteId The cloud identifier (may be a region) in which to query the tenant.
+     * @return the tenant properties of the queried tenant, or null if not found
+     * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+     */
+    public MsoTenant queryTenantByName (String tenantName, String cloudSiteId) throws MsoException {
+        // Obtain the cloud site information where we will query the tenant
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+        Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
+
+        try {
+            Tenant tenant = findTenantByName (keystoneAdminClient, tenantName);
+            if (tenant == null) {
+                return null;
+            }
+
+            Map <String, String> metadata = new HashMap <String, String> ();
+            if (cloudSite.getIdentityService ().hasTenantMetadata ()) {
+                OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ());
+                Metadata tenantMetadata = executeAndRecordOpenstackRequest (request, msoProps);
+                if (tenantMetadata != null) {
+                    metadata = tenantMetadata.getMetadata ();
+                }
+            }
+            return new MsoTenant (tenant.getId (), tenant.getName (), metadata);
+        } catch (OpenStackBaseException e) {
+            // Convert Keystone OpenStackResponseException to MsoOpenstackException
+            throw keystoneErrorToMsoException (e, "QueryTenantName");
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, "QueryTenantName");
+        }
+    }
+
+    /**
+     * Delete the specified Tenant (by ID) in the given cloud. This method returns true or
+     * false, depending on whether the tenant existed and was successfully deleted, or if
+     * the tenant already did not exist. Both cases are treated as success (no Exceptions).
+     * <p>
+     * Note for the AIC Cloud (DCP/LCP): all admin requests go to the centralized identity
+     * service in DCP. So deleting a tenant from one cloudSiteId will remove it from all
+     * sites managed by that identity service.
+     * <p>
+     *
+     * @param tenantId The Openstack ID of the tenant to delete
+     * @param cloudSiteId The cloud identifier from which to delete the tenant.
+     * @return true if the tenant was deleted, false if the tenant did not exist.
+     * @throws MsoOpenstackException If the Openstack API call returns an exception.
+     */
+    public boolean deleteTenant (String tenantId, String cloudSiteId) throws MsoException {
+        // Obtain the cloud site information where we will query the tenant
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+        Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
+
+        try {
+            // Check that the tenant exists. Also, need the ID to delete
+            Tenant tenant = findTenantById (keystoneAdminClient, tenantId);
+            if (tenant == null) {
+            	LOGGER.error(MessageEnum.RA_TENANT_NOT_FOUND, tenantId, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant not found");
+                return false;
+            }
+
+            OpenStackRequest <Void> request = keystoneAdminClient.tenants ().delete (tenant.getId ());
+            executeAndRecordOpenstackRequest (request, msoProps);
+            LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")");
+
+            // Clear any cached clients. Not really needed, ID will not be reused.
+            MsoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId);
+            MsoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId);
+        } catch (OpenStackBaseException e) {
+            // Convert Keystone OpenStackResponseException to MsoOpenstackException
+            throw keystoneErrorToMsoException (e, "Delete Tenant");
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, "DeleteTenant");
+        }
+
+        return true;
+    }
+
+    /**
+     * Delete the specified Tenant (by Name) in the given cloud. This method returns true or
+     * false, depending on whether the tenant existed and was successfully deleted, or if
+     * the tenant already did not exist. Both cases are treated as success (no Exceptions).
+     * <p>
+     * Note for the AIC Cloud (DCP/LCP): all admin requests go to the centralized identity
+     * service in DCP. So deleting a tenant from one cloudSiteId will remove it from all
+     * sites managed by that identity service.
+     * <p>
+     *
+     * @param tenantName The name of the tenant to delete
+     * @param cloudSiteId The cloud identifier from which to delete the tenant.
+     * @return true if the tenant was deleted, false if the tenant did not exist.
+     * @throws MsoOpenstackException If the Openstack API call returns an exception.
+     */
+    public boolean deleteTenantByName (String tenantName, String cloudSiteId) throws MsoException {
+        // Obtain the cloud site information where we will query the tenant
+        CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        if (cloudSite == null) {
+            throw new MsoCloudSiteNotFound (cloudSiteId);
+        }
+        Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite);
+
+        try {
+            // Need the Tenant ID to delete (can't directly delete by name)
+            Tenant tenant = findTenantByName (keystoneAdminClient, tenantName);
+            if (tenant == null) {
+                // OK if tenant already doesn't exist.
+            	LOGGER.error(MessageEnum.RA_TENANT_NOT_FOUND, tenantName, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant not found");
+                return false;
+            }
+
+            // Execute the Delete. It has no return value.
+            OpenStackRequest <Void> request = keystoneAdminClient.tenants ().delete (tenant.getId ());
+            executeAndRecordOpenstackRequest (request, msoProps);
+
+            LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")");
+
+            // Clear any cached clients. Not really needed, ID will not be reused.
+            MsoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId);
+            MsoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId);
+        } catch (OpenStackBaseException e) {
+            // Note: It doesn't seem to matter if tenant doesn't exist, no exception is thrown.
+            // Convert Keystone OpenStackResponseException to MsoOpenstackException
+            throw keystoneErrorToMsoException (e, "DeleteTenant");
+        } catch (RuntimeException e) {
+            // Catch-all
+            throw runtimeExceptionToMsoException (e, "DeleteTenant");
+        }
+
+        return true;
+    }
+
+    // -------------------------------------------------------------------
+    // PRIVATE UTILITY FUNCTIONS FOR USE WITHIN THIS CLASS
+
+    /*
+     * Get a Keystone Admin client for the Openstack Identity service.
+     * This requires an 'admin'-level userId + password along with an 'admin' tenant
+     * in the target cloud. These values will be retrieved from properties based
+     * on the specified cloud ID.
+     * <p>
+     * On successful authentication, the Keystone object will be cached for the cloudId
+     * so that it can be reused without going back to Openstack every time.
+     *
+     * @param cloudId
+     *
+     * @return an authenticated Keystone object
+     */
+    public Keystone getKeystoneAdminClient (CloudSite cloudSite) throws MsoException {
+        CloudIdentity cloudIdentity = cloudSite.getIdentityService ();
+
+        String cloudId = cloudIdentity.getId ();
+        String adminTenantName = cloudIdentity.getAdminTenant ();
+        String region = cloudSite.getRegionId ();
+
+        // Check first in the cache of previously authorized clients
+        KeystoneCacheEntry entry = adminClientCache.get (cloudId);
+        if (entry != null) {
+            if (!entry.isExpired ()) {
+                return entry.getKeystoneClient ();
+            } else {
+                // Token is expired. Remove it from cache.
+                adminClientCache.remove (cloudId);
+            }
+        }
+
+        Keystone keystone = new Keystone (cloudIdentity.getKeystoneUrl (region, msoPropID));
+
+        // Must authenticate against the 'admin' tenant to get the services endpoints
+        Access access = null;
+        String token = null;
+        try {
+        	Authentication credentials = cloudIdentity.getAuthentication ();
+            OpenStackRequest <Access> request = keystone.tokens ()
+                                                        .authenticate (credentials)
+                                                        .withTenantName (adminTenantName);
+            access = executeAndRecordOpenstackRequest (request, msoProps);
+            token = access.getToken ().getId ();
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 401) {
+                // Authentication error. Can't access admin tenant - something is mis-configured
+                String error = "MSO Authentication Failed for " + cloudIdentity.getId ();
+                alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error);
+                throw new MsoAdapterException (error);
+            } else {
+                throw keystoneErrorToMsoException (e, "TokenAuth");
+            }
+        } catch (OpenStackConnectException e) {
+            // Connection to Openstack failed
+            throw keystoneErrorToMsoException (e, "TokenAuth");
+        }
+
+        // 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");
+        } catch (RuntimeException e) {
+            String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId ();
+            alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error);
+            LOGGER.error(MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in findEndpointURL");
+            throw new MsoAdapterException (error, e);
+        }
+        // The following is needed for the MT lab.
+        if ("MT".equals (cloudSite.getId ())) {
+            adminUrl = adminUrl.replace ("controller", "mtdnj02bh01wt.bvoip.labs.att.com");
+        }
+
+        // A new Keystone object is required for the new URL. Use the auth token from above.
+        // Note: this doesn't go back to Openstack, it's just a local object.
+        keystone = new Keystone (adminUrl);
+        keystone.token (token);
+
+        // Cache to avoid re-authentication for every call.
+        KeystoneCacheEntry cacheEntry = new KeystoneCacheEntry (adminUrl, token, access.getToken ().getExpires ());
+        adminClientCache.put (cloudId, cacheEntry);
+
+        return keystone;
+    }
+
+    /*
+     * Find a tenant (or query its existance) by its Name or Id. Check first against the
+     * ID. If that fails, then try by name.
+     *
+     * @param adminClient an authenticated Keystone object
+     *
+     * @param tenantName the tenant name or ID to query
+     *
+     * @return a Tenant object or null if not found
+     */
+    public Tenant findTenantByNameOrId (Keystone adminClient, String tenantNameOrId) {
+        if (tenantNameOrId == null) {
+            return null;
+        }
+
+        Tenant tenant = findTenantById (adminClient, tenantNameOrId);
+        if (tenant == null) {
+            tenant = findTenantByName (adminClient, tenantNameOrId);
+        }
+
+        return tenant;
+    }
+
+    /*
+     * Find a tenant (or query its existance) by its Id.
+     *
+     * @param adminClient an authenticated Keystone object
+     *
+     * @param tenantName the tenant ID to query
+     *
+     * @return a Tenant object or null if not found
+     */
+    private Tenant findTenantById (Keystone adminClient, String tenantId) {
+        if (tenantId == null) {
+            return null;
+        }
+
+        try {
+            OpenStackRequest <Tenant> request = adminClient.tenants ().show (tenantId);
+            return executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                return null;
+            } else {
+            	LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET Tenant by Id (" + tenantId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET tenant by Id");
+                throw e;
+            }
+        }
+    }
+
+    /*
+     * Find a tenant (or query its existance) by its Name. This method avoids an
+     * initial lookup by ID when it's known that we have the tenant Name.
+     *
+     * @param adminClient an authenticated Keystone object
+     *
+     * @param tenantName the tenant name to query
+     *
+     * @return a Tenant object or null if not found
+     */
+    public Tenant findTenantByName (Keystone adminClient, String tenantName) {
+        if (tenantName == null) {
+            return null;
+        }
+
+        try {
+            OpenStackRequest <Tenant> request = adminClient.tenants ().show ("").queryParam ("name", tenantName);
+            return executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                return null;
+            } else {
+            	LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET Tenant By Name (" + tenantName + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET Tenant By Name");
+                throw e;
+            }
+        }
+    }
+
+    /*
+     * Look up an Openstack User by Name or Openstack ID. Check the ID first, and if that
+     * fails, try the Name.
+     *
+     * @param adminClient an authenticated Keystone object
+     *
+     * @param userName the user name or ID to query
+     *
+     * @return a User object or null if not found
+     */
+    private User findUserByNameOrId (Keystone adminClient, String userNameOrId) {
+        if (userNameOrId == null) {
+            return null;
+        }
+
+        try {
+            OpenStackRequest <User> request = adminClient.users ().show (userNameOrId);
+            return executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                // Not found by ID. Search for name
+                return findUserByName (adminClient, userNameOrId);
+            } else {
+            	LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET User (" + userNameOrId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET User");
+                throw e;
+            }
+        }
+    }
+
+    /*
+     * Look up an Openstack User by Name. This avoids initial Openstack query by ID
+     * if we know we have the User Name.
+     *
+     * @param adminClient an authenticated Keystone object
+     *
+     * @param userName the user name to query
+     *
+     * @return a User object or null if not found
+     */
+    public User findUserByName (Keystone adminClient, String userName) {
+        if (userName == null) {
+            return null;
+        }
+
+        try {
+            OpenStackRequest <User> request = adminClient.users ().show ("").queryParam ("name", userName);
+            return executeAndRecordOpenstackRequest (request, msoProps);
+        } catch (OpenStackResponseException e) {
+            if (e.getStatus () == 404) {
+                return null;
+            } else {
+            	LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET User By Name (" + userName + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET User By Name");
+                throw e;
+            }
+        }
+    }
+
+    /*
+     * Look up an Openstack Role by Name or Id. There is no direct query for Roles, so
+     * need to retrieve a full list from Openstack and look for a match. By default,
+     * Openstack should have a "_member_" role for normal VM-level privileges and an
+     * "admin" role for expanded privileges (e.g. administer tenants, users, and roles).
+     * <p>
+     *
+     * @param adminClient an authenticated Keystone object
+     *
+     * @param roleNameOrId the Role name or ID to look up
+     *
+     * @return a Role object
+     */
+    private  Role findRoleByNameOrId (Keystone adminClient, String roleNameOrId) {
+        if (roleNameOrId == null) {
+            return null;
+        }
+
+        // Search by name or ID. Must search in list
+        OpenStackRequest <Roles> request = adminClient.roles ().list ();
+        Roles roles = executeAndRecordOpenstackRequest (request, msoProps);
+
+        for (Role role : roles) {
+            if (roleNameOrId.equals (role.getName ()) || roleNameOrId.equals (role.getId ())) {
+                return role;
+            }
+        }
+
+        return null;
+    }
+
+    private static class KeystoneCacheEntry implements Serializable {
+
+        private static final long serialVersionUID = 1L;
+
+        private String keystoneUrl;
+        private String token;
+        private Calendar expires;
+
+        public KeystoneCacheEntry (String url, String token, Calendar expires) {
+            this.keystoneUrl = url;
+            this.token = token;
+            this.expires = expires;
+        }
+
+        public Keystone getKeystoneClient () {
+            Keystone keystone = new Keystone (keystoneUrl);
+            keystone.token (token);
+            return keystone;
+        }
+
+        public boolean isExpired () {
+            return Calendar.getInstance ().after (expires);
+        }
+    }
+
+    /**
+     * Clean up the Admin client cache to remove expired entries.
+     */
+    public static void adminCacheCleanup () {
+        for (String cacheKey : adminClientCache.keySet ()) {
+            if (adminClientCache.get (cacheKey).isExpired ()) {
+                adminClientCache.remove (cacheKey);
+                LOGGER.debug ("Cleaned Up Cached Admin Client for " + cacheKey);
+            }
+        }
+    }
+
+    /**
+     * Reset the Admin client cache.
+     * This may be useful if cached credentials get out of sync.
+     */
+    public static void adminCacheReset () {
+        adminClientCache = new HashMap <String, KeystoneCacheEntry> ();
+    }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
new file mode 100644
index 0000000..7e388a5
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java
@@ -0,0 +1,616 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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 org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.openstack.beans.NetworkInfo;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoIOException;
+import org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists;
+import org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+import com.woorea.openstack.quantum.Quantum;
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Networks;
+import com.woorea.openstack.quantum.model.Segment;
+import com.woorea.openstack.keystone.model.Authentication;
+
+public class MsoNeutronUtils extends MsoCommonUtils
+{
+	// Cache Neutron Clients statically.  Since there is just one MSO user, there is no
+	// benefit to re-authentication on every request (or across different flows).  The
+	// token will be used until it expires.
+	//
+	// The cache key is "tenantId:cloudId"
+	private static Map<String,NeutronCacheEntry> neutronClientCache = new HashMap<String,NeutronCacheEntry>();
+
+	// Fetch cloud configuration each time (may be cached in CloudConfig class)
+	private CloudConfig cloudConfig;
+
+	private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+	private String msoPropID;
+	
+	public enum NetworkType {
+		BASIC, PROVIDER, MULTI_PROVIDER
+	};
+
+	public MsoNeutronUtils(String msoPropID, CloudConfigFactory cloudConfigFactory) {
+		cloudConfig = cloudConfigFactory.getCloudConfig();
+		this.msoPropID = msoPropID;
+	}
+
+	/**
+	 * Create a network with the specified parameters in the given cloud/tenant.
+	 *
+	 * If a network already exists with the same name, an exception will be thrown.  Note that
+	 * this is an MSO-imposed restriction.  Openstack does not require uniqueness on network names.
+	 * <p>
+	 * @param cloudSiteId The cloud identifier (may be a region) in which to create the network.
+	 * @param tenantId The tenant in which to create the network
+	 * @param type The type of network to create (Basic, Provider, Multi-Provider)
+	 * @param networkName The network name to create
+	 * @param provider The provider network name (for Provider or Multi-Provider networks)
+	 * @param vlans A list of VLAN segments for the network (for Provider or Multi-Provider networks)
+	 * @return a NetworkInfo object which describes the newly created network
+	 * @throws MsoNetworkAlreadyExists Thrown if a network with the same name already exists
+	 * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+	 * @throws MsoCloudSiteNotFound Thrown if the cloudSite is invalid or unknown
+	 */
+	public NetworkInfo createNetwork (String cloudSiteId, String tenantId, NetworkType type, String networkName, String provider, List<Integer> vlans)
+		throws MsoException, MsoNetworkAlreadyExists, MsoCloudSiteNotFound
+	{
+		// Obtain the cloud site information where we will create the stack
+		CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+		if (cloudSite == null) {
+			throw new MsoCloudSiteNotFound(cloudSiteId);
+		}
+
+		Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+
+		// Check if a network already exists with this name
+		// Openstack will allow duplicate name, so require explicit check
+		Network network = findNetworkByName (neutronClient, networkName);
+
+		if (network != null) {
+			// Network already exists.  Throw an exception
+			LOGGER.error(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network already exists");
+			throw new MsoNetworkAlreadyExists (networkName, tenantId, cloudSiteId);
+		}
+
+		// Does not exist, create a new one
+		network = new Network();
+		network.setName(networkName);
+		network.setAdminStateUp(true);
+
+		if (type == NetworkType.PROVIDER) {
+			if (provider != null && vlans != null && vlans.size() > 0) {
+				network.setProviderPhysicalNetwork (provider);
+				network.setProviderNetworkType("vlan");
+				network.setProviderSegmentationId (vlans.get(0));
+			}
+		} else if (type == NetworkType.MULTI_PROVIDER) {
+			if (provider != null && vlans != null && vlans.size() > 0) {
+				List<Segment> segments = new ArrayList<Segment>(vlans.size());
+				for (int vlan : vlans) {
+					Segment segment = new Segment();
+					segment.setProviderPhysicalNetwork (provider);
+					segment.setProviderNetworkType("vlan");
+					segment.setProviderSegmentationId (vlan);
+
+					segments.add(segment);
+				}
+				network.setSegments(segments);
+			}
+		}
+
+		try {
+			OpenStackRequest<Network> request = neutronClient.networks().create(network);
+			Network newNetwork = executeAndRecordOpenstackRequest(request);
+			return new NetworkInfo(newNetwork);
+		}
+		catch (OpenStackBaseException e) {
+			// Convert Neutron exception to an MsoOpenstackException
+			MsoException me = neutronExceptionToMsoException (e, "CreateNetwork");
+			throw me;
+		}
+		catch (RuntimeException e) {
+			// Catch-all
+			MsoException me = runtimeExceptionToMsoException(e, "CreateNetwork");
+			throw me;
+		}
+	}
+
+
+	/**
+	 * Query for a network with the specified name or ID in the given cloud.  If the network exists,
+	 * return an NetworkInfo object.  If not, return null.
+	 * <p>
+	 * Whenever possible, the network ID should be used as it is much more efficient.  Query by
+	 * name requires retrieval of all networks for the tenant and search for matching name.
+	 * <p>
+	 * @param networkNameOrId The network to query
+	 * @param tenantId The Openstack tenant to look in for the network
+	 * @param cloudSiteId The cloud identifier (may be a region) in which to query the network.
+	 * @return a NetworkInfo object describing the queried network, or null if not found
+	 * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+	 * @throws MsoCloudSiteNotFound
+	 */
+	public NetworkInfo queryNetwork (String networkNameOrId, String tenantId, String cloudSiteId)
+		throws MsoException, MsoCloudSiteNotFound
+	{
+		LOGGER.debug("In queryNetwork");
+
+		// Obtain the cloud site information
+		CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+		if (cloudSite == null) {
+			throw new MsoCloudSiteNotFound(cloudSiteId);
+		}
+
+		Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+
+		// Check if the network exists and return its info
+		try {
+			Network network = findNetworkByNameOrId (neutronClient, networkNameOrId);
+			if (network == null) {
+				LOGGER.debug ("Query Network: " + networkNameOrId + " not found in tenant " + tenantId);
+				return null;
+			}
+			return new NetworkInfo(network);
+		}
+		catch (OpenStackBaseException e) {
+			// Convert Neutron exception to an MsoOpenstackException
+			MsoException me = neutronExceptionToMsoException (e, "QueryNetwork");
+			throw me;
+		}
+		catch (RuntimeException e) {
+			// Catch-all
+			MsoException me = runtimeExceptionToMsoException(e, "QueryNetwork");
+			throw me;
+		}
+	}
+
+	/**
+	 * Delete the specified Network (by ID) in the given cloud.
+	 * If the network does not exist, success is returned.
+	 * <p>
+	 * @param networkNameOrId The name or Openstack ID of the network to delete
+	 * @param cloudId The cloud identifier (may be a region) from which to delete the network.
+	 * @return true if the network was deleted, false if the network did not exist
+	 * @throws MsoOpenstackException If the Openstack API call returns an exception, this local
+	 * exception will be thrown.
+	 * @throws MsoCloudSiteNotFound
+	 */
+	public boolean deleteNetwork (String networkId, String tenantId, String cloudSiteId)
+		throws MsoException, MsoCloudSiteNotFound
+	{
+		// Obtain the cloud site information where we will create the stack
+		CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+		if (cloudSite == null) {
+			throw new MsoCloudSiteNotFound(cloudSiteId);
+		}
+
+		Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+
+		try {
+			// Check that the network exists.
+			Network network = findNetworkById (neutronClient, networkId);
+			if (network == null) {
+				LOGGER.info(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", "");
+				return false;
+			}
+
+			OpenStackRequest<Void> request = neutronClient.networks().delete(network.getId());
+			executeAndRecordOpenstackRequest(request);
+
+			LOGGER.debug ("Deleted Network " + network.getId() + " (" + network.getName() + ")");
+		}
+		catch (OpenStackBaseException e) {
+			// Convert Neutron exception to an MsoOpenstackException
+			MsoException me = neutronExceptionToMsoException (e, "Delete Network");
+			throw me;
+		}
+		catch (RuntimeException e) {
+			// Catch-all
+			MsoException me = runtimeExceptionToMsoException(e, "DeleteNetwork");
+			throw me;
+		}
+
+		return true;
+	}
+
+
+	/**
+	 * Update a network with the specified parameters in the given cloud/tenant.
+	 *
+	 * Specifically, this call is intended to update the VLAN segments on a
+	 * multi-provider network.  The provider segments will be replaced with the
+	 * supplied list of VLANs.
+	 * <p>
+	 * Note that updating the 'segments' array is not normally supported by Neutron.
+	 * This method relies on a Platform Orchestration extension (using SDN controller
+	 * to manage the virtual networking).
+	 *
+	 * @param cloudSiteId The cloud site ID (may be a region) in which to update the network.
+	 * @param the Openstack ID of the tenant in which to update the network
+	 * @param networkId The unique Openstack ID of the network to be updated
+	 * @param type The network type (Basic, Provider, Multi-Provider)
+	 * @param provider The provider network name.  This should not change.
+	 * @param vlans The list of VLAN segments to replace
+	 * @return a NetworkInfo object which describes the updated network
+	 * @throws MsoNetworkNotFound Thrown if the requested network does not exist
+	 * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception
+	 * @throws MsoCloudSiteNotFound
+	 */
+	public NetworkInfo updateNetwork (String cloudSiteId, String tenantId, String networkId, NetworkType type, String provider, List<Integer> vlans)
+		throws MsoException, MsoNetworkNotFound, MsoCloudSiteNotFound
+	{
+		// Obtain the cloud site information where we will create the stack
+		CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+		if (cloudSite == null) {
+			throw new MsoCloudSiteNotFound(cloudSiteId);
+		}
+		Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+
+		// Check that the network exists
+		Network network = findNetworkById (neutronClient, networkId);
+
+		if (network == null) {
+			// Network not found.  Throw an exception
+			LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network not found");
+			throw new MsoNetworkNotFound (networkId, tenantId, cloudSiteId);
+		}
+
+		// Overwrite the properties to be updated
+		if (type == NetworkType.PROVIDER) {
+			if (provider != null && vlans != null && vlans.size() > 0) {
+				network.setProviderPhysicalNetwork (provider);
+				network.setProviderNetworkType("vlan");
+				network.setProviderSegmentationId (vlans.get(0));
+			}
+		} else if (type == NetworkType.MULTI_PROVIDER) {
+			if (provider != null && vlans != null && vlans.size() > 0) {
+				List<Segment> segments = new ArrayList<Segment>(vlans.size());
+				for (int vlan : vlans) {
+					Segment segment = new Segment();
+					segment.setProviderPhysicalNetwork (provider);
+					segment.setProviderNetworkType("vlan");
+					segment.setProviderSegmentationId (vlan);
+
+					segments.add(segment);
+				}
+				network.setSegments(segments);
+			}
+		}
+
+		try {
+			OpenStackRequest<Network> request = neutronClient.networks().update(network);
+			Network newNetwork = executeAndRecordOpenstackRequest(request);
+			return new NetworkInfo(newNetwork);
+		}
+		catch (OpenStackBaseException e) {
+			// Convert Neutron exception to an MsoOpenstackException
+			MsoException me = neutronExceptionToMsoException (e, "UpdateNetwork");
+			throw me;
+		}
+		catch (RuntimeException e) {
+			// Catch-all
+			MsoException me = runtimeExceptionToMsoException(e, "UpdateNetwork");
+			throw me;
+		}
+	}
+
+
+	// -------------------------------------------------------------------
+	// PRIVATE UTILITY FUNCTIONS FOR USE WITHIN THIS CLASS
+
+	/**
+	 * Get a Neutron (Quantum) client for the Openstack Network service.
+	 * This requires a 'member'-level userId + password, which will be retrieved from
+	 * properties based on the specified cloud Id.  The tenant in which to operate
+	 * must also be provided.
+	 * <p>
+	 * On successful authentication, the Quantum object will be cached for the
+	 * tenantID + cloudId so that it can be reused without reauthenticating with
+	 *  Openstack every time.
+	 *
+	 * @param cloudSite - a cloud site definition
+	 * @param tenantId - Openstack tenant ID
+	 * @return an authenticated Quantum object
+	 */
+	private Quantum getNeutronClient (CloudSite cloudSite, String tenantId)
+		throws MsoTenantNotFound, MsoException
+	{
+		String cloudId = cloudSite.getId();
+
+		// Check first in the cache of previously authorized clients
+		String cacheKey = cloudId + ":" + tenantId;
+		if (neutronClientCache.containsKey(cacheKey)) {
+			if (! neutronClientCache.get(cacheKey).isExpired()) {
+				LOGGER.debug ("Using Cached HEAT Client for " + cacheKey);
+				Quantum neutronClient = neutronClientCache.get(cacheKey).getNeutronClient();
+				return neutronClient;
+			}
+			else {
+				// Token is expired.  Remove it from cache.
+				neutronClientCache.remove(cacheKey);
+				LOGGER.debug ("Expired Cached Neutron Client for " + cacheKey);
+			}
+		}
+
+		// Obtain an MSO token for the tenant from the identity service
+		CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+		Keystone keystoneTenantClient = new Keystone (cloudIdentity.getKeystoneUrl(cloudId, msoPropID));
+		Access access = null;
+		try {
+			Authentication credentials = cloudIdentity.getAuthentication ();
+			OpenStackRequest<Access> request = keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId);
+			access = executeAndRecordOpenstackRequest(request);
+		}
+		catch (OpenStackResponseException e) {
+			if (e.getStatus() == 401) {
+				// Authentication error.
+				String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId();
+				alarmLogger .sendAlarm("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error);
+				throw new MsoAdapterException(error);
+			}
+			else {
+				MsoException me = keystoneErrorToMsoException(e, "TokenAuth");
+				throw me;
+			}
+		}
+		catch (OpenStackConnectException e) {
+			// Connection to Openstack failed
+			MsoIOException me = new MsoIOException (e.getMessage(), e);
+			me.addContext("TokenAuth");
+			throw me;
+		}
+		catch (RuntimeException e) {
+			// Catch-all
+			MsoException me = runtimeExceptionToMsoException(e, "TokenAuth");
+			throw me;
+		}
+
+		String region = cloudSite.getRegionId();
+		String neutronUrl = null;
+		try {
+			neutronUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", region, "public");
+			if (! neutronUrl.endsWith("/")) {
+                neutronUrl += "/v2.0/";
+            }
+		} catch (RuntimeException e) {
+			// This comes back for not found (probably an incorrect region ID)
+			String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId();
+			alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error);
+			throw new MsoAdapterException (error, e);
+		}
+		// This is needed for testing in the MT cloud
+		if (cloudId.equals("MT")) {
+            neutronUrl = neutronUrl.replace("controller", "mtdnj02bh01wt.bvoip.labs.att.com");
+        }
+
+		Quantum neutronClient = new Quantum(neutronUrl);
+		neutronClient.token(access.getToken().getId());
+
+		neutronClientCache.put(cacheKey, new NeutronCacheEntry(neutronUrl, access.getToken().getId(), access.getToken().getExpires()));
+		LOGGER.debug ("Caching Neutron Client for " + cacheKey);
+
+		return neutronClient;
+	}
+
+	/**
+	 * Forcibly expire a Neutron client from the cache.  This call is for use by
+	 * the KeystoneClient in case where a tenant is deleted.  In that case,
+	 * all cached credentials must be purged so that fresh authentication is
+	 * done on subsequent calls.
+	 * <p>
+	 * @param tenantName
+	 * @param cloudId
+	 */
+	public static void expireNeutronClient (String tenantId, String cloudId) {
+		String cacheKey = cloudId + ":" + tenantId;
+		if (neutronClientCache.containsKey(cacheKey)) {
+			neutronClientCache.remove(cacheKey);
+			LOGGER.debug ("Deleted Cached Neutron Client for " + cacheKey);
+		}
+	}
+
+
+	/*
+	 * Find a tenant (or query its existence) by its Name or Id.  Check first against the
+	 * ID.  If that fails, then try by name.
+	 *
+	 * @param adminClient an authenticated Keystone object
+	 * @param tenantName the tenant name or ID to query
+	 * @return a Tenant object or null if not found
+	 */
+	public Network findNetworkByNameOrId (Quantum neutronClient, String networkNameOrId)
+	{
+		if (networkNameOrId == null) {
+            return null;
+        }
+
+		Network network = findNetworkById(neutronClient, networkNameOrId);
+
+		if (network == null) {
+            network = findNetworkByName(neutronClient, networkNameOrId);
+        }
+
+		return network;
+	}
+
+	/*
+	 * Find a network (or query its existence) by its Id.
+	 *
+	 * @param neutronClient an authenticated Quantum object
+	 * @param networkId the network ID to query
+	 * @return a Network object or null if not found
+	 */
+	private static Network findNetworkById (Quantum neutronClient, String networkId)
+	{
+		if (networkId == null) {
+            return null;
+        }
+
+		try {
+			OpenStackRequest<Network> request = neutronClient.networks().show(networkId);
+			Network network = executeAndRecordOpenstackRequest(request);
+			return network;
+		}
+		catch (OpenStackResponseException e) {
+			if (e.getStatus() == 404) {
+				return null;
+			} else {
+				LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error, GET Network By ID (" + networkId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack");
+				throw e;
+			}
+		}
+	}
+
+	/*
+	 * Find a network (or query its existence) by its Name.  This method avoids an
+	 * initial lookup by ID when it's known that we have the network Name.
+	 *
+	 * Neutron does not support 'name=*' query parameter for Network query (show).
+	 * The only way to query by name is to retrieve all networks and look for the
+	 * match.  While inefficient, this capability will be provided as it is needed
+	 * by MSO, but should be avoided in favor of ID whenever possible.
+	 *
+	 * TODO:
+	 * Network names are not required to be unique, though MSO will attempt to enforce
+	 * uniqueness.  This call probably needs to return an error (instead of returning
+	 * the first match).
+	 *
+	 * @param neutronClient an authenticated Quantum object
+	 * @param networkName the network name to query
+	 * @return a Network object or null if not found
+	 */
+	public Network findNetworkByName (Quantum neutronClient, String networkName)
+	{
+		if (networkName == null) {
+            return null;
+        }
+
+		try {
+			OpenStackRequest<Networks> request = neutronClient.networks().list();
+			Networks networks = executeAndRecordOpenstackRequest(request);
+			for (Network network : networks.getList()) {
+				if (network.getName().equals(networkName)) {
+					LOGGER.debug ("Found match on network name: " + networkName);
+					return network;
+				}
+			}
+			LOGGER.debug ("findNetworkByName - no match found for " + networkName);
+			return null;
+		}
+		catch (OpenStackResponseException e) {
+			if (e.getStatus() == 404) {
+				return null;
+			} else {
+				LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error, GET Network By Name (" + networkName + "): " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception in OpenStack");
+				throw e;
+			}
+		}
+	}
+
+
+	/*
+	 * An entry in the Neutron Client Cache.  It saves the Neutron client object
+	 * along with the token expiration.  After this interval, this cache
+	 * item will no longer be used.
+	 */
+	private static class NeutronCacheEntry implements Serializable
+	{
+		private static final long serialVersionUID = 1L;
+
+		private String neutronUrl;
+		private String token;
+		private Calendar expires;
+
+		public NeutronCacheEntry (String neutronUrl, String token, Calendar expires) {
+			this.neutronUrl = neutronUrl;
+			this.token = token;
+			this.expires = expires;
+		}
+
+		public Quantum getNeutronClient () {
+			Quantum neutronClient = new Quantum(neutronUrl);
+			neutronClient.token(token);
+			return neutronClient;
+		}
+
+		public boolean isExpired() {
+			if (expires == null) {
+                return true;
+            }
+
+			Calendar now = Calendar.getInstance();
+			if (now.after(expires)) {
+                return true;
+            }
+
+			return false;
+		}
+	}
+
+	/**
+	 * Clean up the Neutron client cache to remove expired entries.
+	 */
+	public static void neutronCacheCleanup () {
+		for (String cacheKey : neutronClientCache.keySet()) {
+			if (neutronClientCache.get(cacheKey).isExpired()) {
+				neutronClientCache.remove(cacheKey);
+				LOGGER.debug ("Cleaned Up Cached Neutron Client for " + cacheKey);
+			}
+		}
+	}
+
+	/**
+	 * Reset the Neutron client cache.
+	 * This may be useful if cached credentials get out of sync.
+	 */
+	public static void neutronCacheReset () {
+		neutronClientCache = new HashMap<String,NeutronCacheEntry>();
+	}
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java
new file mode 100644
index 0000000..4110470
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.mso.cloud.CloudConfig;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.openstack.beans.MsoTenant;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+import org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesException;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import com.woorea.openstack.keystone.Keystone;
+
+public abstract class MsoTenantUtils extends MsoCommonUtils {
+
+    protected CloudConfigFactory cloudConfigFactory;
+	protected MsoPropertiesFactory msoPropFactory;
+	protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+	protected MsoJavaProperties msoProps;
+    protected CloudConfig cloudConfig;
+
+    public MsoTenantUtils (String msoPropID) {
+    	cloudConfigFactory = new CloudConfigFactory();
+    	msoPropFactory = new MsoPropertiesFactory();
+    	cloudConfig = cloudConfigFactory.getCloudConfig ();
+
+    	LOGGER.debug("msoTenantUtils:" + msoPropID);
+		
+    	try {
+			msoProps = msoPropFactory.getMsoJavaProperties (msoPropID);
+		} catch (MsoPropertiesException e) {
+			LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
+		}
+    }
+
+    public abstract String createTenant (String tenantName, String cloudSiteId, Map <String, String> metadata, boolean backout) 
+    		throws MsoException;
+       
+    public abstract MsoTenant queryTenant (String tenantId, String cloudSiteId) 
+    		throws MsoException, MsoCloudSiteNotFound;
+    
+    public abstract MsoTenant queryTenantByName (String tenantName, String cloudSiteId) 
+    		throws MsoException, MsoCloudSiteNotFound;
+
+    public abstract boolean deleteTenant (String tenantId, String cloudSiteId) 
+    		throws MsoException;
+    
+}
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
new file mode 100644
index 0000000..6fd7a63
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+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 org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.openstack.utils.MsoKeystoneUtils;
+
+
+public class MsoTenantUtilsFactory {
+
+	private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+	private CloudConfigFactory cloudConfigFactory= new CloudConfigFactory(); 
+	protected CloudConfig cloudConfig;
+	protected MsoJavaProperties msoProps = null;
+	private String msoPropID;
+
+	public MsoTenantUtilsFactory (String msoPropID) {
+		this.msoPropID = msoPropID;
+	}
+
+	//based on Cloud IdentityServerType returns ORM or KEYSTONE Utils
+	public MsoTenantUtils getTenantUtils(String cloudSiteId) {
+
+		// Obtain the cloud site information 
+		cloudConfig = cloudConfigFactory.getCloudConfig();
+		CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+
+		MsoTenantUtils tenantU = null;
+		if (cloudSite.getIdentityService().getIdentityServerType() == CloudIdentity.IdentityServerType.KEYSTONE)
+		{
+			tenantU = new MsoKeystoneUtils (msoPropID);
+		}
+		return tenantU;
+	}
+}
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
new file mode 100644
index 0000000..d124658
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java
@@ -0,0 +1,163 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.utils;
+
+
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Iterator;
+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 java.util.LinkedHashMap;
+
+import org.yaml.snakeyaml.Yaml;
+
+
+public class MsoYamlEditorWithEnvt {
+
+    private Map <String, Object> yml;
+    private Yaml yaml = new Yaml ();
+    private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
+	public MsoYamlEditorWithEnvt() {
+		super();
+	}
+	public MsoYamlEditorWithEnvt(byte[] b) {
+		init(b);
+	}
+
+    @SuppressWarnings("unchecked")
+    private synchronized void init (byte[] body) {
+        InputStream input = new ByteArrayInputStream (body);
+        yml = (Map <String, Object>) yaml.load (input);
+    }	
+
+    @SuppressWarnings("unchecked")
+	public synchronized Set <MsoHeatEnvironmentParameter> getParameterListFromEnvt() {
+    	// In an environment entry, the parameters section can only contain the name:value - 
+    	// not other attributes.
+    	Set <MsoHeatEnvironmentParameter> paramSet = new HashSet<MsoHeatEnvironmentParameter>();
+    	Map<String, Object> resourceMap = null;
+    	try {
+    		resourceMap = (Map<String,Object>) yml.get("parameters");
+    	} catch (Exception e) {
+    		return paramSet;
+    	}
+    	if (resourceMap == null) {
+    		return paramSet;
+    	}
+    	Iterator <Entry <String, Object>> it = resourceMap.entrySet().iterator();
+    	
+    	while (it.hasNext()) {
+    		MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter();
+    		Map.Entry <String, Object> pair = it.next();
+    		//Map<String, String> resourceEntry = (Map <String, String>) pair.getValue();
+    		//String value = null;
+    		String value = null;
+    		Object obj = pair.getValue();
+    		if (obj instanceof java.lang.String) {
+    			//value = (String) pair.getValue();
+    			// handle block scalar - literals and folded:
+    			value = yaml.dump(obj);
+    			// but this adds an extra '\n' at the end - which won't hurt - but we don't need it
+    			value = value.substring(0, value.length() - 1);
+    		} else if (obj instanceof java.util.LinkedHashMap) {
+    			//Handle that it's json
+    			try {
+    				value = JSON_MAPPER.writeValueAsString(obj);
+    			} catch (Exception e) {
+    				value = "_BAD_JSON_MAPPING";
+    			}
+    		} else {
+    			//this handles integers/longs/floats/etc.
+    			value = String.valueOf(obj);
+    		}
+    		hep.setName((String) pair.getKey());
+    		hep.setValue(value);
+    		paramSet.add(hep);
+    	}
+    	return paramSet;
+    }
+    public synchronized Set <MsoHeatEnvironmentResource> getResourceListFromEnvt() {
+    	try {
+    		Set<MsoHeatEnvironmentResource> resourceList = new HashSet<MsoHeatEnvironmentResource>();
+    		@SuppressWarnings("unchecked")
+    		Map<String, Object> resourceMap = (Map<String,Object>) yml.get("resource_registry");
+    		Iterator<Entry <String,Object>> it = resourceMap.entrySet().iterator();
+    	
+    		while (it.hasNext()) {
+    			MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource();
+    			Map.Entry<String, Object> pair = it.next();
+    			her.setName((String) pair.getKey());
+    			her.setValue((String) pair.getValue());
+    			resourceList.add(her);
+    		}
+    		return resourceList;
+    	} catch (Exception e) {
+    		
+    	}
+    	return null;
+    }
+    public synchronized Set <HeatTemplateParam> getParameterList () {
+        Set <HeatTemplateParam> paramSet = new HashSet <HeatTemplateParam> ();
+        @SuppressWarnings("unchecked")
+        Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("parameters");
+        Iterator <Entry <String, Object>> it = resourceMap.entrySet ().iterator ();
+
+        while (it.hasNext ()) {
+            HeatTemplateParam param = new HeatTemplateParam ();
+            Map.Entry <String, Object> pair = it.next ();
+            @SuppressWarnings("unchecked")
+            Map <String, String> resourceEntry = (Map <String, String>) pair.getValue ();
+            String value = null;
+            try {
+            	value = resourceEntry.get ("default");
+            } catch (java.lang.ClassCastException cce) {
+            	// This exception only - the value is an integer. For what we're doing
+            	// here - we don't care - so set value to something - and it will 
+            	// get marked as not being required - which is correct.
+            	//System.out.println("cce exception!");
+            	value = "300"; 
+            	// okay
+            }
+            param.setParamName ((String) pair.getKey ());
+            if (value != null) {
+                param.setRequired (false);
+            } else {
+                param.setRequired (true);
+            }
+            value = resourceEntry.get ("type");
+            param.setParamType (value);
+
+            paramSet.add (param);
+
+        }
+        return paramSet;
+
+    }
+
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java
new file mode 100644
index 0000000..8632d02
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.adapter_utils.tests;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import java.util.Map;
+import org.openecomp.mso.cloud.CloudConfig;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudIdentity;
+import org.openecomp.mso.cloud.CloudSite;
+
+
+/**
+ * This class implements test methods of the CloudConfig features.
+ *
+ *
+ */
+public class CloudConfigTest {
+   
+	private static CloudConfig con;
+	private static CloudConfigFactory cloudConfigFactory= new CloudConfigFactory();
+	
+	public CloudConfigTest () {
+		   
+	}
+	
+	/**
+    * This method is called before any test occurs.
+    * It creates a fake tree from scratch
+    */
+   @BeforeClass
+   public static final void prepare () {
+	   ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
+	   String config = classLoader.getResource("cloud_config.json").toString().substring(5);
+	   
+	   cloudConfigFactory.initializeCloudConfig(config,1);
+	   con = cloudConfigFactory.getCloudConfig();
+   }
+ 
+   /**
+    * This method implements a test for the getCloudConfig method.
+    */
+   @Test
+   public final void testGetCloudConfig () {
+	   assertNotNull(con);
+   }
+
+   /**
+    * This method implements a test for the getCloudSites method.
+    */
+   @Test
+   public final void testGetCloudSites () {
+	   Map<String,CloudSite> siteMap = con.getCloudSites();
+	   assertNotNull(siteMap);
+
+	   CloudSite site1 = siteMap.get("MT");
+	   CloudSite site2 = siteMap.get("DAN");
+	   CloudSite site3 = siteMap.get("MTINJVCC101");
+	   
+	   assertEquals (site1.getRegionId(), "regionOne");
+	   assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE");
+	   assertEquals (site2.getRegionId(), "RegionOne");
+	   assertEquals (site2.getIdentityServiceId(), "DAN_KEYSTONE");
+	   assertEquals (site3.getRegionId(), "regionTwo");
+	   assertEquals (site3.getIdentityServiceId(), "MTINJVCC101_DCP");
+	 
+   }
+   
+   
+   /**
+    * This method implements a test for the getIdentityServices method.
+    */
+   @Test
+   public final void testGetIdentityServices () {
+	   Map<String,CloudIdentity> identityMap = con.getIdentityServices ();
+	   assertNotNull(identityMap);
+	   
+	   CloudIdentity identity1 = identityMap.get("MT_KEYSTONE");
+	   CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE");
+	   CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP");
+	   CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1");
+	   
+//	   assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0");
+//	   assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0");
+	   assertEquals (identity1.getMsoId(), "john");
+	   assertEquals (identity1.getMsoPass(), "changeme");
+	   assertEquals (identity1.getAdminTenant(), "admin");
+	   assertEquals (identity1.getMemberRole(), "_member_");
+	   assertEquals (identity1.hasTenantMetadata(), false);
+	   
+//	   assertEquals (identity2.getKeystoneUrl(), "http://localhost:5000/v2.0");
+//	   assertEquals (identity2.getIdentityUrl(), "http://localhost:5000/v2.0");
+	   assertEquals (identity2.getMsoId(), "mockId");
+	   assertEquals (identity2.getMsoPass(), "stack123");
+	   assertEquals (identity2.getAdminTenant(), "service");
+	   assertEquals (identity2.getMemberRole(), "_member_");
+	   assertEquals (identity2.hasTenantMetadata(), false);
+	   
+//	   assertEquals (identity3.getKeystoneUrl(), "http://localhost:5000/v2.0");
+//	   assertEquals (identity3.getIdentityUrl(), "http://localhost:5000/v2.0");
+	   assertEquals (identity3.getMsoId(), "mockIdToo");
+	   assertEquals (identity3.getMsoPass(), "AICG@mm@@2015");
+	   assertEquals (identity3.getAdminTenant(), "service");
+	   assertEquals (identity3.getMemberRole(), "admin");
+	   assertEquals (identity3.hasTenantMetadata(), true);
+	   
+//	   assertEquals (identity4.getKeystoneUrl(), "https://localhost:5000/v2.0");
+//	   assertEquals (identity4.getIdentityUrl(), "https://localhost:5000/v2.0");
+	   assertEquals (identity4.getMsoId(), "mockIdToo");
+	   assertEquals (identity4.getMsoPass(), "2315QRS2015srq");
+	   assertEquals (identity4.getAdminTenant(), "service");
+	   assertEquals (identity4.getMemberRole(), "admin");
+	   assertEquals (identity4.hasTenantMetadata(), true);
+
+   }
+   
+   /**
+    * This method implements a test for the getCloudSite method.
+    */
+   @Test
+   public final void testGetCloudSite () {
+	   CloudSite site1  = con.getCloudSite("MT");
+	   assertNotNull(site1);
+	   assertEquals (site1.getRegionId(), "regionOne");
+	   assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE");
+	   
+	 
+
+   }
+
+   /**
+    * This method implements a test for the getIdentityService method.
+    */
+   @Test
+   public final void testGetIdentityService () {
+	   CloudIdentity identity1  = con.getIdentityService("MT_KEYSTONE");
+	   assertNotNull(identity1);
+//	   assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0");
+//	   assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0");
+	   assertEquals (identity1.getMsoId(), "john");
+	   assertEquals (identity1.getMsoPass(), "changeme");
+	   assertEquals (identity1.getAdminTenant(), "admin");
+	   assertEquals (identity1.getMemberRole(), "_member_");
+	   assertEquals (identity1.hasTenantMetadata(), false);
+	   
+	   CloudIdentity identity2  = con.getIdentityService("Test");
+	   assertNull(identity2);
+   }
+
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java
new file mode 100644
index 0000000..9f17283
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.adapter_utils.tests;
+
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
+import org.openecomp.mso.openstack.exceptions.MsoIOException;
+import org.openecomp.mso.openstack.exceptions.MsoOpenstackException;
+import org.openecomp.mso.openstack.utils.MsoCommonUtils;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesException;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+
+
+/**
+ * This class implements test methods of the MsoCommonUtils
+ *
+ *
+ */
+public class MsoCommonUtilsTest extends MsoCommonUtils {
+
+	public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+	
+	@Test
+    public final void testExecuteAndRecordOpenstackRequest () {
+		OpenStackRequest openstackRequest = Mockito.mock(OpenStackRequest.class);
+		Mockito.when(openstackRequest.endpoint()).thenReturn("localhost");
+		Mockito.when(openstackRequest.path()).thenReturn("/test");
+		//TODO:Must try a real connection
+		assertNull(super.executeAndRecordOpenstackRequest (openstackRequest));
+
+	}
+
+	@Test
+    public final void testKeystoneErrorToMsoException () {
+		OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
+
+		OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1);
+
+		MsoException me = super.keystoneErrorToMsoException (openStackConnectException,"ContextError");
+
+		assertTrue(me instanceof MsoIOException);
+		assertTrue("connect".equals(me.getMessage()));
+
+
+		MsoException me2 = super.keystoneErrorToMsoException (openStackResponseException,"ContextError");
+		assertTrue(me2 instanceof MsoOpenstackException);
+		assertTrue("ContextError".equals(me2.getContext()));
+		assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+
+	}
+
+	@Test
+	public final void testHeatExceptionToMsoException () {
+		OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
+
+		OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1);
+
+		MsoException me = super.heatExceptionToMsoException (openStackConnectException,"ContextError");
+
+		assertTrue(me instanceof MsoIOException);
+		assertTrue("connect".equals(me.getMessage()));
+
+
+		MsoException me2 = super.heatExceptionToMsoException (openStackResponseException,"ContextError");
+		assertTrue(me2 instanceof MsoOpenstackException);
+		assertTrue("ContextError".equals(me2.getContext()));
+		assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+	}
+
+	@Test
+	public final void testNeutronExceptionToMsoException () {
+		OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect");
+
+		OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1);
+
+		MsoException me = super.neutronExceptionToMsoException (openStackConnectException,"ContextError");
+
+		assertTrue(me instanceof MsoIOException);
+		assertTrue("connect".equals(me.getMessage()));
+
+		MsoException me2 = super.neutronExceptionToMsoException (openStackResponseException,"ContextError");
+		assertTrue(me2 instanceof MsoOpenstackException);
+		assertTrue("ContextError".equals(me2.getContext()));
+		assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory()));
+	}
+
+	@Test
+	public final void testRuntimeExceptionToMsoException () {
+	    RuntimeException re = new RuntimeException ("runtime");
+	    MsoException me = super.runtimeExceptionToMsoException (re, "ContextError");
+
+	    assertTrue (me instanceof MsoAdapterException);
+	    assertTrue("ContextError".equals(me.getContext()));
+        assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory()));
+	}
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
new file mode 100644
index 0000000..6f8a6e9
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.adapter_utils.tests;
+
+import java.util.HashMap;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoIOException;
+import org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists;
+import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound;
+import org.openecomp.mso.openstack.utils.MsoCommonUtils;
+import org.openecomp.mso.openstack.utils.MsoHeatUtils;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+
+
+/**
+ * This class implements test methods of the MsoHeatUtils
+ *
+ *
+ */
+public class MsoHeatUtilsTest extends MsoCommonUtils {
+	public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+	public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+	public static MsoHeatUtils msoHeatUtils;
+	
+	@BeforeClass
+	public static final void loadClasses() {
+		ClassLoader classLoader = CloudConfigTest.class.getClassLoader();
+		String config = classLoader.getResource("cloud_config.json").toString().substring(5);
+		cloudConfigFactory.initializeCloudConfig(config, 1);
+		msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory); 
+	}
+	
+	@Test
+    public final void testCreateStackBadCloudConfig ()  {
+		try {
+			msoHeatUtils.createStack ("DOESNOTEXIST", "test", "stackName", "test",  new HashMap<String,Object> (), Boolean.TRUE, 10);
+        } catch (MsoException e) {
+
+        }
+		
+	}
+	
+	@Test
+    public final void testCreateStackFailedConnectionHeatClient () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+		try {
+			msoHeatUtils.createStack ("MT", "test", "stackName", "test",  new HashMap<String,Object> (), Boolean.TRUE, 10);
+		} catch (MsoIOException e) {
+			 
+		}
+		
+	}
+	
+	@Test
+    public final void testCreateStackFailedConnection () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound {
+		try {
+			msoHeatUtils.createStack ("MT", "test", "stackName", "test",  new HashMap<String,Object> (), Boolean.TRUE, 10);
+		} catch (MsoIOException e) {
+			 
+		}
+		
+	}
+	
+	
+	
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
new file mode 100644
index 0000000..a5d46da
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.adapter_utils.tests;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+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 org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoIOException;
+import org.openecomp.mso.openstack.utils.MsoHeatUtilsWithUpdate;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class MsoHeatUtilsWithUpdateTest {
+
+	public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+	public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+	
+    @Mock
+    CloudConfig cloudConfig;
+    @InjectMocks
+    MsoHeatUtilsWithUpdate util=new MsoHeatUtilsWithUpdate("NO_PROP",msoPropertiesFactory,cloudConfigFactory);
+
+    private CloudSite cloudSite;
+
+    @Before
+    public void init () {
+        cloudSite = new CloudSite ();
+        cloudSite.setId ("cloud");
+        CloudIdentity cloudIdentity = new CloudIdentity ();
+        cloudSite.setIdentityService (cloudIdentity);
+        cloudIdentity.setKeystoneUrl ("toto");
+        cloudIdentity.setMsoPass (CloudIdentity.encryptPassword ("mockId"));
+
+        when (cloudConfig.getCloudSite ("cloud")).thenReturn (cloudSite);
+        when (cloudConfig.getCloudSite ("none")).thenReturn (null);
+    }
+
+    @Test
+    public void testUpdateStack () {
+        // Heat heat = Mockito.mock (Heat.class);
+        Map <String, Object> stackInputs = new HashMap <> ();
+        try {
+            util.updateStack ("none", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1);
+        } catch (MsoException e) {
+            if (e instanceof MsoCloudSiteNotFound) {
+                // Ok
+            } else {
+                e.printStackTrace ();
+                fail ("Exception caught");
+            }
+        }
+        try {
+            util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1);
+        } catch (MsoException e) {
+            if (e instanceof MsoIOException && e.getCause () != null
+                && e.getCause () instanceof OpenStackConnectException) {
+                // Ok, we were able to go up to the connection to OpenStack
+            } else {
+                e.printStackTrace ();
+                fail ("Exception caught");
+            }
+        }
+        try {
+            util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment");
+        } catch (MsoException e) {
+            if (e instanceof MsoIOException && e.getCause () != null
+                && e.getCause () instanceof OpenStackConnectException) {
+                // Ok, we were able to go up to the connection to OpenStack
+            } else {
+                e.printStackTrace ();
+                fail ("Exception caught");
+            }
+        }
+        try {
+            util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null);
+        } catch (MsoException e) {
+            if (e instanceof MsoIOException && e.getCause () != null
+                && e.getCause () instanceof OpenStackConnectException) {
+                // Ok, we were able to go up to the connection to OpenStack
+            } else {
+                e.printStackTrace ();
+                fail ("Exception caught");
+            }
+        }
+        try {
+            util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null, null);
+        } catch (MsoException e) {
+            if (e instanceof MsoIOException && e.getCause () != null
+                && e.getCause () instanceof OpenStackConnectException) {
+                // Ok, we were able to go up to the connection to OpenStack
+            } else {
+                e.printStackTrace ();
+                fail ("Exception caught");
+            }
+        }
+    }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java
new file mode 100644
index 0000000..69fbb26
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityESTest.java
@@ -0,0 +1,400 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:37:20 GMT 2016
+ */
+
+package org.openecomp.mso.cloud;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class CloudIdentityESTest {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMsoId("ga-cj*/");
+      cloudIdentity0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setTenantMetadata(true);
+      boolean boolean0 = cloudIdentity0.hasTenantMetadata();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMsoPass("");
+      String string0 = cloudIdentity0.getMsoPass();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMsoId("hz4IjQ&in.t^IC|");
+      String string0 = cloudIdentity0.getMsoId();
+      assertEquals("hz4IjQ&in.t^IC|", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMemberRole("Exception in encryptPassword");
+      String string0 = cloudIdentity0.getMemberRole();
+      assertEquals("Exception in encryptPassword", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setIdentityUrl("ASDC_ARTIFACT_ALREADY_DEPLOYED");
+      String string0 = cloudIdentity0.getIdentityUrl();
+      assertEquals("ASDC_ARTIFACT_ALREADY_DEPLOYED", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      CloudIdentity.IdentityServerType cloudIdentity_IdentityServerType0 = CloudIdentity.IdentityServerType.KEYSTONE;
+      PrivateAccess.setVariable((Class<CloudIdentity>) CloudIdentity.class, cloudIdentity0, "identityServerType", (Object) cloudIdentity_IdentityServerType0);
+      String string0 = cloudIdentity0.getIdentityServerTypeAsString();
+      assertEquals("KEYSTONE", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setId("");
+      String string0 = cloudIdentity0.getId();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setAdminTenant("0hh5nz?kd3N,FTKBX");
+      String string0 = cloudIdentity0.getAdminTenant();
+      assertEquals("0hh5nz?kd3N,FTKBX", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setTenantMetadata(true);
+      CloudIdentity cloudIdentity1 = cloudIdentity0.clone();
+      assertTrue(cloudIdentity1.equals((Object)cloudIdentity0));
+      assertTrue(cloudIdentity1.hasTenantMetadata());
+      assertNotSame(cloudIdentity1, cloudIdentity0);
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setTenantMetadata(false);
+      CloudIdentity cloudIdentity1 = cloudIdentity0.clone();
+      assertFalse(cloudIdentity1.hasTenantMetadata());
+      assertTrue(cloudIdentity1.equals((Object)cloudIdentity0));
+      assertNotSame(cloudIdentity1, cloudIdentity0);
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMsoPass("0LAxuQ0#K,Ma");
+      // Undeclared exception!
+      try {
+        cloudIdentity0.getMsoPass();
+        fail("Expecting exception: NumberFormatException");
+
+      } catch(NumberFormatException e) {
+         //
+         // For input string: \"0L\"
+         //
+         verifyException("java.lang.NumberFormatException", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      // Undeclared exception!
+      try {
+        cloudIdentity0.getKeystoneUrl();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.cloud.CloudIdentity", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      // Undeclared exception!
+      try {
+        CloudIdentity.encryptPassword((String) null);
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.utils.CryptoUtils", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      CloudIdentity cloudIdentity1 = cloudIdentity0.clone();
+      assertTrue(cloudIdentity1.equals((Object)cloudIdentity0));
+
+      PrivateAccess.setVariable((Class<CloudIdentity>) CloudIdentity.class, cloudIdentity1, "msoPass", (Object) "0~=?Wm,~42b4:K");
+      boolean boolean0 = cloudIdentity0.equals(cloudIdentity1);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMemberRole("r");
+      CloudIdentity cloudIdentity1 = new CloudIdentity();
+      boolean boolean0 = cloudIdentity0.equals(cloudIdentity1);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      CloudIdentity cloudIdentity1 = cloudIdentity0.clone();
+      assertTrue(cloudIdentity1.equals((Object)cloudIdentity0));
+
+      cloudIdentity1.setMemberRole("RA_SET_CALLBACK_AUTH_EXC");
+      boolean boolean0 = cloudIdentity0.equals(cloudIdentity1);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMemberRole("r");
+      CloudIdentity cloudIdentity1 = cloudIdentity0.clone();
+      boolean boolean0 = cloudIdentity0.equals(cloudIdentity1);
+      assertNotSame(cloudIdentity1, cloudIdentity0);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      Object object0 = new Object();
+      boolean boolean0 = cloudIdentity0.equals(object0);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test19()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      boolean boolean0 = cloudIdentity0.equals((Object) null);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test20()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      boolean boolean0 = cloudIdentity0.equals(cloudIdentity0);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test22()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMsoPass("9Y#4-v1Fu27keLW");
+      cloudIdentity0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test23()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setMemberRole("ASDC_GENERAL_METRICS");
+      cloudIdentity0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test24()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setIdentityUrl("g9+j0@{H}S|");
+      cloudIdentity0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test25()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setId("FSmZDF:2*!OtMq!i");
+      cloudIdentity0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test26()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setKeystoneUrl("VdON&(o*x/W!");
+      assertNull(cloudIdentity0.getMemberRole());
+  }
+
+  @Test(timeout = 4000)
+  public void test27()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      String string0 = cloudIdentity0.getKeystoneUrl("A9Z Ol `I1^y]F[EC0", "");
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test28()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      String string0 = cloudIdentity0.getMemberRole();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test29()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      // Undeclared exception!
+      try {
+        cloudIdentity0.getIdentityServerTypeAsString();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.cloud.CloudIdentity", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test30()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setIdentityUrl("com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES");
+      CloudIdentity cloudIdentity1 = new CloudIdentity();
+      boolean boolean0 = cloudIdentity0.equals(cloudIdentity1);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test31()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      String string0 = cloudIdentity0.getId();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test32()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setTenantMetadata(false);
+      cloudIdentity0.hashCode();
+      assertFalse(cloudIdentity0.hasTenantMetadata());
+  }
+
+  @Test(timeout = 4000)
+  public void test34()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.setAdminTenant("0hh5nz?kd3N,FTKBX");
+      cloudIdentity0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test35()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      String string0 = cloudIdentity0.getAdminTenant();
+      assertNull(string0);
+
+  }
+
+  @Test(timeout = 4000)
+  public void test37()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      String string0 = cloudIdentity0.getMsoId();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test38()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudIdentity0.getIdentityServerType();
+  }
+
+  @Test(timeout = 4000)
+  public void test39()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      // Undeclared exception!
+      try {
+        cloudIdentity0.getMsoPass();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.utils.CryptoUtils", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test40()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      // Undeclared exception!
+      try {
+        cloudIdentity0.toString();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.cloud.CloudIdentity", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test41()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      // Undeclared exception!
+      try {
+        cloudIdentity0.hasTenantMetadata();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.cloud.CloudIdentity", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test42()  throws Throwable  {
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      String string0 = cloudIdentity0.getIdentityUrl();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test43()  throws Throwable  {
+      String string0 = CloudIdentity.encryptPassword("jaR\"aJmqpa>(&");
+      assertEquals("718A16EDF9EA61E9350A07703082D5B5", string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java
new file mode 100644
index 0000000..377a724
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.cloud;
+
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+
+public class CloudIdentityTest {
+
+    @Test
+    public final void testCloudIdentity () {
+        CloudIdentity id = new CloudIdentity ();
+        id.setAdminTenant ("AdminTenant");
+        id.setId ("id");
+//        id.setKeystoneUrl ("keystone");
+        id.setIdentityUrl ("keystone");
+        id.setMemberRole ("member");
+        id.setMsoId ("msoId");
+        id.setMsoPass (CloudIdentity.encryptPassword ("password"));
+        id.setTenantMetadata (true);
+
+        assertTrue (id.getAdminTenant ().equals ("AdminTenant"));
+        assertTrue (id.getId ().equals ("id"));
+//        assertTrue (id.getKeystoneUrl ().equals ("keystone"));
+        assertTrue (id.getMemberRole ().equals ("member"));
+        assertTrue (id.getMsoId ().equals ("msoId"));
+        assertTrue (id.getMsoPass ().equals ("password"));
+        assertTrue (id.hasTenantMetadata ());
+//        assertTrue (id.toString ().contains ("keystone"));
+    }
+
+    @Test
+    public final void testEncryption () {
+        String encrypted = CloudIdentity.encryptPassword ("password");
+        assertTrue (encrypted != null);
+        assertTrue (!encrypted.equals ("password"));
+    }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java
new file mode 100644
index 0000000..68bccfc
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTest.java
@@ -0,0 +1,315 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:42:36 GMT 2016
+ */
+
+package org.openecomp.mso.cloud;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class CloudSiteESTest extends CloudSiteESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setAic_version("-t");
+      cloudSite0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setRegionId("CloudSite: id=");
+      String string0 = cloudSite0.getRegionId();
+      assertEquals("CloudSite: id=", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setRegionId("");
+      String string0 = cloudSite0.getRegionId();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      PrivateAccess.setVariable((Class<CloudSite>) CloudSite.class, cloudSite0, "identityServiceId", (Object) "PUBLIC");
+      String string0 = cloudSite0.getIdentityServiceId();
+      assertEquals("PUBLIC", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudSite0.setIdentityService(cloudIdentity0);
+      cloudIdentity0.setTenantMetadata(false);
+      CloudIdentity cloudIdentity1 = cloudSite0.getIdentityService();
+      assertNull(cloudIdentity1.getAdminTenant());
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setId("");
+      String string0 = cloudSite0.getId();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setClli("N;w7*-)9\"t|T/jCa");
+      String string0 = cloudSite0.getClli();
+      assertEquals("N;w7*-)9\"t|T/jCa", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setClli("");
+      String string0 = cloudSite0.getClli();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setAic_version("v&K[by0");
+      String string0 = cloudSite0.getAic_version();
+      assertEquals("v&K[by0", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setAic_version("");
+      String string0 = cloudSite0.getAic_version();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = mock(CloudIdentity.class, new ViolatedAssumptionAnswer());
+      doReturn((CloudIdentity) null).when(cloudIdentity0).clone();
+      cloudSite0.setIdentityService(cloudIdentity0);
+      CloudSite cloudSite1 = cloudSite0.clone();
+      boolean boolean0 = cloudSite0.equals(cloudSite1);
+      assertFalse(boolean0);
+      assertFalse(cloudSite1.equals((Object)cloudSite0));
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudSite cloudSite1 = new CloudSite();
+      assertTrue(cloudSite1.equals((Object)cloudSite0));
+      
+      cloudSite1.setClli("CloudSite: id=null, regionId=null, identityServiceId=null, aic_version=null, clli=null");
+      boolean boolean0 = cloudSite0.equals(cloudSite1);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudSite0.setIdentityService(cloudIdentity0);
+      CloudSite cloudSite1 = cloudSite0.clone();
+      assertTrue(cloudSite1.equals((Object)cloudSite0));
+      
+      cloudSite1.setAic_version("");
+      boolean boolean0 = cloudSite0.equals(cloudSite1);
+      assertFalse(cloudSite1.equals((Object)cloudSite0));
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudSite0.setIdentityService(cloudIdentity0);
+      CloudSite cloudSite1 = cloudSite0.clone();
+      boolean boolean0 = cloudSite0.equals(cloudSite1);
+      assertNotSame(cloudSite1, cloudSite0);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setRegionId("CloudSite: id=null, regionId=null, identityServiceId=null, aic_version=null, clli=null");
+      CloudSite cloudSite1 = new CloudSite();
+      boolean boolean0 = cloudSite0.equals(cloudSite1);
+      assertFalse(cloudSite1.equals((Object)cloudSite0));
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudSite0.setIdentityService(cloudIdentity0);
+      CloudSite cloudSite1 = cloudSite0.clone();
+      assertTrue(cloudSite1.equals((Object)cloudSite0));
+      
+      cloudSite1.setId("Tx;$hjj");
+      boolean boolean0 = cloudSite1.equals(cloudSite0);
+      assertFalse(boolean0);
+      assertFalse(cloudSite1.equals((Object)cloudSite0));
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      Object object0 = new Object();
+      boolean boolean0 = cloudSite0.equals(object0);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      boolean boolean0 = cloudSite0.equals((Object) null);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      boolean boolean0 = cloudSite0.equals(cloudSite0);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test19()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      PrivateAccess.setVariable((Class<CloudSite>) CloudSite.class, cloudSite0, "identityServiceId", (Object) "");
+      CloudSite cloudSite1 = new CloudSite();
+      boolean boolean0 = cloudSite0.equals(cloudSite1);
+      assertFalse(boolean0);
+      assertFalse(cloudSite1.equals((Object)cloudSite0));
+  }
+
+  @Test(timeout = 4000)
+  public void test20()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      PrivateAccess.setVariable((Class<CloudSite>) CloudSite.class, cloudSite0, "clli", (Object) "AgBkO0S\"V'R'");
+      cloudSite0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test21()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      PrivateAccess.setVariable((Class<CloudSite>) CloudSite.class, cloudSite0, "regionId", (Object) "`V+.b PU'3:EbS");
+      cloudSite0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test22()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      PrivateAccess.setVariable((Class<CloudSite>) CloudSite.class, cloudSite0, "identityServiceId", (Object) "PUBLIC");
+      cloudSite0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test23()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      PrivateAccess.setVariable((Class<CloudSite>) CloudSite.class, cloudSite0, "id", (Object) "PUBLIC");
+      cloudSite0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test24()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      String string0 = cloudSite0.getIdentityServiceId();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test25()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      String string0 = cloudSite0.toString();
+      assertEquals("CloudSite: id=null, regionId=null, identityServiceId=null, aic_version=null, clli=null", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test26()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      String string0 = cloudSite0.getAic_version();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test27()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = new CloudIdentity();
+      cloudSite0.setIdentityService(cloudIdentity0);
+      cloudSite0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test28()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      String string0 = cloudSite0.getClli();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test29()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      String string0 = cloudSite0.getId();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test30()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      String string0 = cloudSite0.getRegionId();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test31()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      cloudSite0.setId("Tx;$hjj");
+      String string0 = cloudSite0.getId();
+      assertEquals("Tx;$hjj", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test32()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      CloudIdentity cloudIdentity0 = cloudSite0.getIdentityService();
+      assertNull(cloudIdentity0);
+  }
+
+  @Test(timeout = 4000)
+  public void test33()  throws Throwable  {
+      CloudSite cloudSite0 = new CloudSite();
+      // Undeclared exception!
+      try { 
+        cloudSite0.clone();
+        fail("Expecting exception: NullPointerException");
+      
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.cloud.CloudSite", e);
+      }
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java
new file mode 100644
index 0000000..48e800f
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteESTestscaffolding.java
@@ -0,0 +1,150 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:42:36 GMT 2016
+ */
+
+package org.openecomp.mso.cloud;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class CloudSiteESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.cloud.CloudSite"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(CloudSiteESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.logger.MsoLogger",
+      "org.openecomp.mso.logger.MessageEnum",
+      "com.att.eelf.i18n.EELFResolvableErrorEnum",
+      "org.openecomp.mso.logger.MsoLogger$ResponseCode",
+      "org.openecomp.mso.entity.MsoRequest",
+      "org.openecomp.mso.cloud.CloudSite",
+      "org.openecomp.mso.logger.MsoLogger$StatusCode",
+      "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES",
+      "com.att.eelf.configuration.EELFManager",
+      "org.openecomp.mso.cloud.CloudIdentity$IdentityServerType",
+      "org.openecomp.mso.logger.MsoLogger$ErrorCode",
+      "com.att.eelf.configuration.EELFLogger",
+      "com.att.eelf.i18n.EELFMsgs",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "com.att.eelf.configuration.EELFLogger$Level",
+      "org.openecomp.mso.logger.MsoLogger$Catalog",
+      "com.att.eelf.configuration.SLF4jWrapper",
+      "com.att.eelf.i18n.EELFResourceManager",
+      "org.openecomp.mso.cloud.CloudIdentity"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(CloudSiteESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.logger.MsoLogger$Catalog",
+      "org.openecomp.mso.logger.MsoLogger",
+      "com.att.eelf.i18n.EELFResourceManager",
+      "com.att.eelf.i18n.EELFMsgs",
+      "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES",
+      "org.apache.xerces.jaxp.SAXParserFactoryImpl",
+      "org.apache.xerces.jaxp.SAXParserImpl",
+      "org.apache.xerces.parsers.XMLParser",
+      "org.apache.xerces.parsers.AbstractSAXParser",
+      "org.apache.xerces.parsers.SAXParser",
+      "org.apache.xerces.parsers.ObjectFactory",
+      "org.apache.xerces.util.ParserConfigurationSettings",
+      "org.apache.xerces.parsers.XML11Configuration",
+      "org.apache.xerces.parsers.XIncludeAwareParserConfiguration",
+      "org.apache.xerces.util.SymbolTable",
+      "org.apache.xerces.impl.XMLEntityManager",
+      "org.apache.xerces.util.AugmentationsImpl$SmallContainer",
+      "org.apache.xerces.impl.XMLEntityManager$ByteBufferPool",
+      "org.apache.xerces.impl.XMLEntityManager$CharacterBufferPool",
+      "org.apache.xerces.impl.XMLEntityScanner$1",
+      "org.apache.xerces.impl.XMLEntityScanner",
+      "org.apache.xerces.impl.XMLErrorReporter",
+      "org.apache.xerces.impl.XMLScanner",
+      "org.apache.xerces.impl.XMLDocumentFragmentScannerImpl",
+      "org.apache.xerces.impl.XMLDocumentScannerImpl",
+      "org.apache.xerces.util.XMLStringBuffer",
+      "org.apache.xerces.util.XMLAttributesImpl",
+      "org.apache.xerces.impl.XMLDTDScannerImpl",
+      "org.apache.xerces.impl.dtd.XMLDTDProcessor",
+      "org.apache.xerces.impl.dtd.XMLDTDValidator",
+      "org.apache.xerces.impl.validation.ValidationState",
+      "org.apache.xerces.impl.dtd.XMLElementDecl",
+      "org.apache.xerces.impl.dtd.XMLSimpleType",
+      "org.apache.xerces.impl.dv.DTDDVFactory",
+      "org.apache.xerces.impl.dv.ObjectFactory",
+      "org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl",
+      "org.apache.xerces.impl.XMLVersionDetector",
+      "org.apache.xerces.impl.msg.XMLMessageFormatter",
+      "org.apache.xerces.impl.io.UTF8Reader",
+      "org.apache.xerces.util.XMLSymbols",
+      "org.apache.xerces.xni.NamespaceContext",
+      "org.apache.xerces.util.XMLChar",
+      "org.apache.xerces.impl.Constants",
+      "com.att.eelf.configuration.EELFLogger$Level",
+      "com.att.eelf.configuration.EELFManager",
+      "org.openecomp.mso.logger.MessageEnum",
+      "org.openecomp.mso.cloud.CloudIdentity",
+      "org.openecomp.mso.utils.CryptoUtils",
+      "org.openecomp.mso.logger.MsoAlarmLogger",
+      "org.openecomp.mso.openstack.utils.MsoCommonUtils"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java
new file mode 100644
index 0000000..241ca88
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTest.java
@@ -0,0 +1,83 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:56:50 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import java.util.Map;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoTenantESTest extends MsoTenantESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant("P<5j-:=G4zf", "P<5j-:=G4zf", (Map<String, String>) null);
+      String string0 = msoTenant0.getTenantName();
+      assertEquals("P<5j-:=G4zf", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test1()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant("", "", (Map<String, String>) null);
+      String string0 = msoTenant0.getTenantName();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test2()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant();
+      String string0 = msoTenant0.getTenantName();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test3()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant();
+      Map<String, String> map0 = msoTenant0.getMetadata();
+      assertNull(map0);
+  }
+
+  @Test(timeout = 4000)
+  public void test4()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant("", "SsK{%:", (Map<String, String>) null);
+      String string0 = msoTenant0.getTenantId();
+      assertEquals("", string0);
+      assertEquals("SsK{%:", msoTenant0.getTenantName());
+  }
+
+  @Test(timeout = 4000)
+  public void test5()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant();
+      msoTenant0.setTenantId("9A");
+      String string0 = msoTenant0.getTenantId();
+      assertEquals("9A", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test6()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant();
+      msoTenant0.setMetadata((Map<String, String>) null);
+      assertNull(msoTenant0.getTenantName());
+  }
+
+  @Test(timeout = 4000)
+  public void test7()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant();
+      msoTenant0.setTenantName("9A");
+      assertNull(msoTenant0.getTenantId());
+  }
+
+  @Test(timeout = 4000)
+  public void test8()  throws Throwable  {
+      MsoTenant msoTenant0 = new MsoTenant();
+      String string0 = msoTenant0.getTenantId();
+      assertNull(string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java
new file mode 100644
index 0000000..0ac4893
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:56:50 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoTenantESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.beans.MsoTenant"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoTenantESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.beans.MsoTenant"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java
new file mode 100644
index 0000000..9c15725
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTest.java
@@ -0,0 +1,247 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:44:14 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.MockitoExtension.*;
+
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Segment;
+import java.util.List;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class NetworkInfoESTest extends NetworkInfoESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setVlans((List<Integer>) null);
+      List<Integer> list0 = networkInfo0.getVlans();
+      assertNull(list0);
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      Network network0 = mock(Network.class, new ViolatedAssumptionAnswer());
+      doReturn((String) null).when(network0).getId();
+      doReturn((String) null).when(network0).getName();
+      doReturn((String) null).when(network0).getProviderPhysicalNetwork();
+      doReturn((List) null).when(network0).getSegments();
+      doReturn((String) null).when(network0).getStatus();
+      doReturn((List) null).when(network0).getSubnets();
+      NetworkInfo networkInfo0 = new NetworkInfo(network0);
+      List<String> list0 = networkInfo0.getSubnets();
+      assertNull(list0);
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setShared("Network [id=");
+      String string0 = networkInfo0.getShared();
+      assertEquals("Network [id=", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setProvider((String) null);
+      String string0 = networkInfo0.getProvider();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setProvider("ERROR");
+      String string0 = networkInfo0.getProvider();
+      assertEquals("ERROR", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setId((String) null);
+      String string0 = networkInfo0.getId();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      NetworkStatus networkStatus0 = NetworkStatus.DOWN;
+      NetworkInfo networkInfo0 = new NetworkInfo("IghhGdNW B*}", networkStatus0);
+      String string0 = networkInfo0.getId();
+      assertEquals("IghhGdNW B*}", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      Network network0 = mock(Network.class, new ViolatedAssumptionAnswer());
+      doReturn((String) null).when(network0).getId();
+      doReturn((String) null).when(network0).getName();
+      doReturn((String) null).when(network0).getProviderPhysicalNetwork();
+      doReturn((List) null).when(network0).getSegments();
+      doReturn((String) null).when(network0).getStatus();
+      doReturn((List) null).when(network0).getSubnets();
+      NetworkInfo networkInfo0 = new NetworkInfo(network0);
+      List<String> list0 = networkInfo0.getSubnets();
+      Network network1 = mock(Network.class, new ViolatedAssumptionAnswer());
+      doReturn((String) null).when(network1).getId();
+      doReturn((String) null).when(network1).getName();
+      doReturn((String) null).when(network1).getProviderPhysicalNetwork();
+      doReturn((List<Segment>) null).when(network1).getSegments();
+      doReturn("uxR^({\"", (String) null).when(network1).getStatus();
+      doReturn(list0).when(network1).getSubnets();
+      NetworkInfo networkInfo1 = new NetworkInfo(network1);
+      assertNull(networkInfo1.getName());
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      Network network0 = mock(Network.class, new ViolatedAssumptionAnswer());
+      doReturn(", segments: ").when(network0).getId();
+      doReturn("ACTIVE").when(network0).getName();
+      doReturn("l1~gC_#a'H,#*").when(network0).getProviderNetworkType();
+      doReturn("ACTIVE", "").when(network0).getProviderPhysicalNetwork();
+      doReturn("ERROR", "ERROR", "%<3T-").when(network0).getStatus();
+      doReturn((List) null).when(network0).getSubnets();
+      NetworkInfo networkInfo0 = new NetworkInfo(network0);
+      networkInfo0.getStatus();
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      Network network0 = mock(Network.class, new ViolatedAssumptionAnswer());
+      doReturn(", segments: ").when(network0).getId();
+      doReturn("ACTIVE").when(network0).getName();
+      doReturn((String) null).when(network0).getProviderNetworkType();
+      doReturn("ACTIVE", (String) null).when(network0).getProviderPhysicalNetwork();
+      doReturn("ERROR", (String) null).when(network0).getStatus();
+      NetworkInfo networkInfo0 = null;
+      try {
+        networkInfo0 = new NetworkInfo(network0);
+        fail("Expecting exception: NullPointerException");
+      
+      } catch(NullPointerException e) {
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo((Network) null);
+      assertEquals("", networkInfo0.getId());
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      String string0 = networkInfo0.toString();
+      assertEquals("Network: name=,id=,status=UNKNOWN,provider=,vlans=[],subnets=[],shared=", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      NetworkStatus networkStatus0 = NetworkStatus.NOTFOUND;
+      networkInfo0.setStatus(networkStatus0);
+      assertEquals("", networkInfo0.getShared());
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      NetworkStatus networkStatus0 = NetworkStatus.UNKNOWN;
+      NetworkInfo networkInfo0 = new NetworkInfo((String) null, networkStatus0);
+      String string0 = networkInfo0.getName();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setShared((String) null);
+      String string0 = networkInfo0.getShared();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      String string0 = networkInfo0.getShared();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      List<String> list0 = networkInfo0.getSubnets();
+      Network network0 = mock(Network.class, new ViolatedAssumptionAnswer());
+      doReturn("R65k@>rbu`lzb#").when(network0).getId();
+      doReturn("ERROR").when(network0).getName();
+      doReturn("DOWN").when(network0).getProviderNetworkType();
+      doReturn("u1Z(%z~k-ao5#y", "R65k@>rbu`lzb#").when(network0).getProviderPhysicalNetwork();
+      doReturn("R65k@>rbu`lzb#", "R65k@>rbu`lzb#").when(network0).getStatus();
+      doReturn(list0).when(network0).getSubnets();
+      NetworkInfo networkInfo1 = new NetworkInfo(network0);
+      networkInfo1.getName();
+      assertEquals("R65k@>rbu`lzb#", networkInfo1.getProvider());
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      List<Integer> list0 = networkInfo0.getVlans();
+      networkInfo0.setVlans(list0);
+      assertEquals("", networkInfo0.getProvider());
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setName("");
+      assertEquals(NetworkStatus.UNKNOWN, networkInfo0.getStatus());
+  }
+
+  @Test(timeout = 4000)
+  public void test19()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      networkInfo0.setSubnets((List<String>) null);
+      assertEquals("", networkInfo0.getShared());
+  }
+
+  @Test(timeout = 4000)
+  public void test20()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      NetworkStatus networkStatus0 = networkInfo0.getStatus();
+      assertEquals(NetworkStatus.UNKNOWN, networkStatus0);
+  }
+
+  @Test(timeout = 4000)
+  public void test21()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      String string0 = networkInfo0.getProvider();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test22()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      String string0 = networkInfo0.getId();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test23()  throws Throwable  {
+      NetworkInfo networkInfo0 = new NetworkInfo();
+      String string0 = networkInfo0.getName();
+      assertEquals("", string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java
new file mode 100644
index 0000000..0c87ca9
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoESTestscaffolding.java
@@ -0,0 +1,92 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:44:14 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class NetworkInfoESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.beans.NetworkInfo"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(NetworkInfoESTestscaffolding.class.getClassLoader() ,
+      "org.codehaus.jackson.annotate.JacksonAnnotation",
+      "com.woorea.openstack.quantum.model.Network",
+      "org.codehaus.jackson.annotate.JsonIgnoreProperties",
+      "com.woorea.openstack.quantum.model.Segment",
+      "org.openecomp.mso.openstack.beans.NetworkInfo",
+      "org.openecomp.mso.openstack.beans.NetworkStatus",
+      "com.woorea.openstack.quantum.model.Network$NetworkType",
+      "org.codehaus.jackson.map.annotate.JsonRootName"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(NetworkInfoESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.beans.NetworkStatus",
+      "org.openecomp.mso.openstack.beans.NetworkInfo",
+      "com.woorea.openstack.quantum.model.Network"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java
new file mode 100644
index 0000000..bad2bde
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTest.java
@@ -0,0 +1,303 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:55:12 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.MockitoExtension.*;
+import org.openecomp.mso.entity.MsoRequest;
+
+import java.util.List;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class NetworkRollbackESTest extends NetworkRollbackESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNetworkStackId("H/r!m+_NT$?ed$IPcLD");
+      networkRollback0.setNeutronNetworkId("H/r!m+_NT$?ed$IPcLD");
+      MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer());
+      doReturn((String) null, (String) null, (String) null).when(msoRequest0).toString();
+      networkRollback0.setNetworkStackId("");
+      networkRollback0.setMsoRequest((MsoRequest) null);
+      networkRollback0.setMsoRequest(msoRequest0);
+      networkRollback0.toString();
+      networkRollback0.setNeutronNetworkId("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]");
+      networkRollback0.getVlans();
+      networkRollback0.setCloudId("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]");
+      networkRollback0.setNetworkType("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]");
+      networkRollback0.toString();
+      networkRollback0.setCloudId("NetworkRollback [networkId=null, neutronNetworkId=H/r!m+_NT$?ed$IPcLD, networkStackId=, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]");
+      networkRollback0.setTenantId("80\u0002<]~y|x(#fl");
+      networkRollback0.setCloudId("=:U\"]");
+      networkRollback0.toString();
+      networkRollback0.getVlans();
+      networkRollback0.toString();
+      networkRollback0.getVlans();
+      networkRollback0.getVlans();
+      networkRollback0.getVlans();
+      networkRollback0.setVlans((List<Integer>) null);
+      networkRollback0.toString();
+      networkRollback0.getMsoRequest();
+      networkRollback0.getVlans();
+      networkRollback0.toString();
+      networkRollback0.getMsoRequest();
+      networkRollback0.getVlans();
+      networkRollback0.getMsoRequest();
+      networkRollback0.getVlans();
+      List<Integer> list0 = networkRollback0.getVlans();
+      assertNull(list0);
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNetworkType((String) null);
+      networkRollback0.getMsoRequest();
+      networkRollback0.setMsoRequest((MsoRequest) null);
+      networkRollback0.setNetworkId("");
+      networkRollback0.setTenantId("");
+      networkRollback0.getNetworkId();
+      networkRollback0.setNeutronNetworkId("");
+      networkRollback0.setCloudId("O;On");
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setCloudId("C5FS|V@CMBag");
+      networkRollback0.getVlans();
+      networkRollback0.setVlans((List<Integer>) null);
+      networkRollback0.getPhysicalNetwork();
+      networkRollback0.setVlans((List<Integer>) null);
+      networkRollback0.getNeutronNetworkId();
+      networkRollback0.setNetworkType("C5FS|V@CMBag");
+      networkRollback0.getNetworkType();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNetworkId(", networkName=");
+      networkRollback0.setNetworkStackId("u)");
+      networkRollback0.setNetworkId("u)");
+      networkRollback0.setNetworkId(", networkName=");
+      networkRollback0.getNetworkStackId();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNetworkType("V3$f~dKduUu0");
+      networkRollback0.setNetworkType("");
+      networkRollback0.setTenantId("");
+      networkRollback0.getPhysicalNetwork();
+      networkRollback0.getVlans();
+      networkRollback0.getNetworkType();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setTenantId("Lu#)!pt2p=<#T.");
+      networkRollback0.getTenantId();
+      networkRollback0.setNetworkStackId("Lu#)!pt2p=<#T.");
+      networkRollback0.getNeutronNetworkId();
+      networkRollback0.setTenantId("Lu#)!pt2p=<#T.");
+      networkRollback0.setNetworkStackId((String) null);
+      String string0 = networkRollback0.toString();
+      assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=Lu#)!pt2p=<#T., cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.getMsoRequest();
+      networkRollback0.setMsoRequest((MsoRequest) null);
+      String string0 = networkRollback0.toString();
+      assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0);
+      
+      networkRollback0.setNetworkName("");
+      networkRollback0.getNetworkName();
+      networkRollback0.setNetworkCreated(true);
+      networkRollback0.setNetworkName("");
+      networkRollback0.getPhysicalNetwork();
+      networkRollback0.setTenantId("");
+      networkRollback0.setNetworkId("");
+      assertTrue(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.getTenantId();
+      networkRollback0.setNetworkStackId((String) null);
+      networkRollback0.getVlans();
+      networkRollback0.setTenantId("");
+      networkRollback0.getTenantId();
+      networkRollback0.setVlans((List<Integer>) null);
+      String string0 = networkRollback0.toString();
+      assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0);
+      
+      NetworkRollback networkRollback1 = new NetworkRollback();
+      assertFalse(networkRollback1.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNeutronNetworkId("");
+      networkRollback0.setCloudId("");
+      networkRollback0.getTenantId();
+      networkRollback0.setTenantId("");
+      networkRollback0.setNetworkType("Y=x>wx'");
+      networkRollback0.getNeutronNetworkId();
+      networkRollback0.getVlans();
+      networkRollback0.setVlans((List<Integer>) null);
+      networkRollback0.setNetworkStackId("6P7@4aGo &Kd>V");
+      networkRollback0.getCloudId();
+      NetworkRollback networkRollback1 = new NetworkRollback();
+      assertFalse(networkRollback1.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      assertFalse(networkRollback0.getNetworkCreated());
+      
+      networkRollback0.setNetworkCreated(true);
+      networkRollback0.toString();
+      networkRollback0.setNeutronNetworkId("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=null, cloudId=null, networkType=null, networkCreated=true, networkName=null, physicalNetwork=null]");
+      networkRollback0.getPhysicalNetwork();
+      boolean boolean0 = networkRollback0.getNetworkCreated();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNetworkId(", tenantId=");
+      networkRollback0.setNetworkId("");
+      networkRollback0.setTenantId(", tenantId=");
+      networkRollback0.setNetworkName("+*");
+      networkRollback0.getNetworkName();
+      networkRollback0.setNetworkStackId(", tenantId=");
+      networkRollback0.setCloudId("+*");
+      networkRollback0.getCloudId();
+      NetworkRollback networkRollback1 = new NetworkRollback();
+      assertFalse(networkRollback1.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setPhysicalNetwork("!(>41heY7e");
+      networkRollback0.setTenantId("j");
+      networkRollback0.setNeutronNetworkId("j");
+      networkRollback0.getPhysicalNetwork();
+      networkRollback0.getVlans();
+      NetworkRollback networkRollback1 = new NetworkRollback();
+      networkRollback1.getMsoRequest();
+      networkRollback0.setMsoRequest((MsoRequest) null);
+      networkRollback0.setNetworkCreated(false);
+      networkRollback0.setNeutronNetworkId("j");
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setPhysicalNetwork("");
+      networkRollback0.setNetworkStackId("");
+      networkRollback0.setNeutronNetworkId("");
+      networkRollback0.getNetworkStackId();
+      networkRollback0.getMsoRequest();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setCloudId("7u@lc[l##+g`2V");
+      networkRollback0.getVlans();
+      networkRollback0.setVlans((List<Integer>) null);
+      networkRollback0.setNetworkType("");
+      networkRollback0.setCloudId(", physicalNetwork=");
+      networkRollback0.setPhysicalNetwork("");
+      networkRollback0.setNeutronNetworkId(", physicalNetwork=");
+      networkRollback0.getPhysicalNetwork();
+      networkRollback0.getNeutronNetworkId();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.getNetworkId();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.getMsoRequest();
+      networkRollback0.setMsoRequest((MsoRequest) null);
+      networkRollback0.getNetworkCreated();
+      networkRollback0.setNetworkId(", networkName=");
+      networkRollback0.getNeutronNetworkId();
+      networkRollback0.setPhysicalNetwork((String) null);
+      networkRollback0.getNetworkId();
+      NetworkRollback networkRollback1 = new NetworkRollback();
+      String string0 = networkRollback1.toString();
+      assertEquals("NetworkRollback [networkId=null, neutronNetworkId=null, networkStackId=null, tenantId=null, cloudId=null, networkType=null, networkCreated=false, networkName=null, physicalNetwork=null]", string0);
+      
+      networkRollback1.getVlans();
+      networkRollback0.setVlans((List<Integer>) null);
+      networkRollback0.getNetworkId();
+      networkRollback1.getPhysicalNetwork();
+      networkRollback1.setNetworkCreated(false);
+      assertFalse(networkRollback1.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.getNetworkType();
+      networkRollback0.setTenantId((String) null);
+      networkRollback0.setNetworkName(" networkStacId=");
+      networkRollback0.getCloudId();
+      networkRollback0.getTenantId();
+      networkRollback0.setNetworkStackId(" networkStacId=");
+      networkRollback0.setNeutronNetworkId((String) null);
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.getNetworkName();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      NetworkRollback networkRollback0 = new NetworkRollback();
+      networkRollback0.setNetworkType("uK+JCvyg\"J(C d.w[");
+      networkRollback0.setCloudId("uK+JCvyg\"J(C d.w[");
+      networkRollback0.getNetworkStackId();
+      assertFalse(networkRollback0.getNetworkCreated());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java
new file mode 100644
index 0000000..1665732
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackESTestscaffolding.java
@@ -0,0 +1,79 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:55:12 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class NetworkRollbackESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.beans.NetworkRollback"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(NetworkRollbackESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.entity.MsoRequest",
+      "org.openecomp.mso.openstack.beans.NetworkRollback"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java
new file mode 100644
index 0000000..0ec588d
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTest.java
@@ -0,0 +1,70 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:49:52 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class PoolESTest extends PoolESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      Pool pool0 = new Pool();
+      pool0.setStart("Allocation_pool [start=null, end=null]");
+      String string0 = pool0.getStart();
+      assertEquals("Allocation_pool [start=null, end=null]", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test1()  throws Throwable  {
+      Pool pool0 = new Pool();
+      pool0.setEnd("Allocation_pool [start=null, end=null]");
+      String string0 = pool0.getEnd();
+      assertEquals("Allocation_pool [start=null, end=null]", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test2()  throws Throwable  {
+      Pool pool0 = new Pool();
+      String string0 = pool0.getEnd();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test3()  throws Throwable  {
+      Pool pool0 = new Pool();
+      pool0.setStart("");
+      String string0 = pool0.getStart();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test4()  throws Throwable  {
+      Pool pool0 = new Pool();
+      String string0 = pool0.toString();
+      assertEquals("Allocation_pool [start=null, end=null]", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test5()  throws Throwable  {
+      Pool pool0 = new Pool();
+      pool0.setEnd("");
+      String string0 = pool0.getEnd();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test6()  throws Throwable  {
+      Pool pool0 = new Pool();
+      String string0 = pool0.getStart();
+      assertNull(string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java
new file mode 100644
index 0000000..8ce9cb8
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/PoolESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:49:52 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class PoolESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.beans.Pool"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(PoolESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.beans.Pool"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java
new file mode 100644
index 0000000..7be8339
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTest.java
@@ -0,0 +1,221 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:52:14 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import java.util.List;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class SubnetESTest extends SubnetESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setSubnetName("lu[c8x");
+      subnet0.getSubnetName();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setSubnetName("");
+      subnet0.getSubnetName();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setSubnetId("nL");
+      subnet0.getSubnetId();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setSubnetId("");
+      subnet0.getSubnetId();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setNeutronId("`jC)vXXeOG");
+      subnet0.getNeutronId();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setIpVersion("");
+      String string0 = subnet0.getIpVersion();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setGatewayIp((String) null);
+      subnet0.getGatewayIp();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setGatewayIp("Subnet [subnetName=null, neutronId=null, subnetId=null, cidr=null, gatewayIp=, ipVersion=4, enableDHCP=false, hostRoutes=null, allocationPools=null, dnsNameServers=null]");
+      subnet0.getGatewayIp();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setCidr("H3%q_*bOC2");
+      subnet0.getCidr();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setIpVersion((String) null);
+      String string0 = subnet0.getIpVersion();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setAllocationPools((List<Pool>) null);
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getNeutronId();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getHostRoutes();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      String string0 = subnet0.toString();
+      assertEquals("Subnet [subnetName=null, neutronId=null, subnetId=null, cidr=null, gatewayIp=, ipVersion=4, enableDHCP=false, hostRoutes=null, allocationPools=null, dnsNameServers=null]", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getSubnetName();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setNeutronId("");
+      subnet0.getNeutronId();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setCidr("");
+      subnet0.getCidr();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getDnsNameServers();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setHostRoutes((List<String>) null);
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test19()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      String string0 = subnet0.getIpVersion();
+      assertEquals("4", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test20()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getSubnetId();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test21()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setEnableDHCP((Boolean) null);
+      subnet0.getEnableDHCP();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test22()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getAllocationPools();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test23()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getCidr();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test24()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.getGatewayIp();
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test25()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      subnet0.setDnsNameServers((List<String>) null);
+      assertEquals("4", subnet0.getIpVersion());
+  }
+
+  @Test(timeout = 4000)
+  public void test26()  throws Throwable  {
+      Subnet subnet0 = new Subnet();
+      Boolean boolean0 = subnet0.getEnableDHCP();
+      assertFalse(boolean0);
+      assertEquals("4", subnet0.getIpVersion());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java
new file mode 100644
index 0000000..a9bf598
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/SubnetESTestscaffolding.java
@@ -0,0 +1,79 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:52:14 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class SubnetESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.beans.Subnet"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(SubnetESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.beans.Pool",
+      "org.openecomp.mso.openstack.beans.Subnet"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java
new file mode 100644
index 0000000..e76ce41
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java
@@ -0,0 +1,403 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:51:17 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+
+import org.openecomp.mso.entity.MsoRequest;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class VnfRollbackESTest extends VnfRollbackESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVolumeGroupName(", vnfCreated=");
+      vnfRollback0.getVolumeGroupName();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVolumeGroupId("}mvn2f6!r5FG1/_M~M");
+      vnfRollback0.getVolumeGroupId();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVolumeGroupId("");
+      vnfRollback0.getVolumeGroupId();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVolumeGroupHeatStackId("Z^t$4-eOKP9");
+      vnfRollback0.getVolumeGroupHeatStackId();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getVnfId();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVnfId("");
+      vnfRollback0.getVnfId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVfModuleStackId("8y*`!>A$@*l8#a>");
+      vnfRollback0.getVfModuleStackId();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVfModuleStackId("");
+      vnfRollback0.getVfModuleStackId();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant=");
+      String string0 = vnfRollback0.getTenantId();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertEquals(", tenant=", vnfRollback0.getCloudSiteId());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+      assertEquals(", tenant=", vnfRollback0.getRequestType());
+      assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId());
+      assertEquals(", tenant=", vnfRollback0.getVolumeGroupName());
+      assertEquals(", tenant=", vnfRollback0.getVnfId());
+      assertEquals(", tenant=", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setTenantId("");
+      vnfRollback0.getTenantId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      assertFalse(vnfRollback0.getTenantCreated());
+      
+      vnfRollback0.setTenantCreated(true);
+      boolean boolean0 = vnfRollback0.getTenantCreated();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer());
+      VnfRollback vnfRollback0 = new VnfRollback("", ", vnf=", "Jvr", false, false, msoRequest0, "", "f'D", "VnfRollback: cloud=");
+      String string0 = vnfRollback0.getRequestType();
+      assertFalse(vnfRollback0.isBase());
+      assertEquals("Jvr", vnfRollback0.getCloudSiteId());
+      assertEquals("", vnfRollback0.getVnfId());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertEquals("f'D", vnfRollback0.getVolumeGroupId());
+      assertEquals(", vnf=", vnfRollback0.getTenantId());
+      assertEquals("VnfRollback: cloud=", string0);
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertEquals("", vnfRollback0.getVolumeGroupName());
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setRequestType("");
+      vnfRollback0.getRequestType();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer());
+      doReturn("Jvr").when(msoRequest0).toString();
+      VnfRollback vnfRollback0 = new VnfRollback("", ", vnf=", "Jvr", false, false, msoRequest0, "", "f'D", "VnfRollback: cloud=");
+      vnfRollback0.getMsoRequest();
+      assertEquals("Jvr", vnfRollback0.getCloudSiteId());
+      assertEquals("", vnfRollback0.getVnfId());
+      assertFalse(vnfRollback0.isBase());
+      assertEquals(", vnf=", vnfRollback0.getTenantId());
+      assertEquals("", vnfRollback0.getVolumeGroupName());
+      assertEquals("f'D", vnfRollback0.getVolumeGroupId());
+      assertEquals("VnfRollback: cloud=", vnfRollback0.getRequestType());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant=");
+      String string0 = vnfRollback0.getCloudSiteId();
+      assertFalse(vnfRollback0.isBase());
+      assertEquals(", tenant=", string0);
+      assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertEquals(", tenant=", vnfRollback0.getVnfId());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertEquals(", tenant=", vnfRollback0.getVolumeGroupName());
+      assertEquals(", tenant=", vnfRollback0.getRequestType());
+      assertEquals(", tenant=", vnfRollback0.getTenantId());
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setCloudSiteId("");
+      vnfRollback0.getCloudSiteId();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setBaseGroupHeatStackId("3(6Q^)Ic kf:zj");
+      vnfRollback0.getBaseGroupHeatStackId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setBaseGroupHeatStackId("");
+      vnfRollback0.getBaseGroupHeatStackId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      assertFalse(vnfRollback0.isBase());
+      
+      vnfRollback0.setIsBase(true);
+      boolean boolean0 = vnfRollback0.isBase();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test19()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getVfModuleStackId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test20()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getVolumeGroupName();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test21()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVolumeGroupName("");
+      vnfRollback0.getVolumeGroupName();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test22()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      boolean boolean0 = vnfRollback0.getTenantCreated();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(boolean0);
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test23()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      boolean boolean0 = vnfRollback0.isBase();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test24()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      String string0 = vnfRollback0.toString();
+      assertFalse(vnfRollback0.isBase());
+      assertEquals("VnfRollback: cloud=null, tenant=null, vnf=null, tenantCreated=false, vnfCreated=false, requestType = null", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test25()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      boolean boolean0 = vnfRollback0.getVnfCreated();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(boolean0);
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test26()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getVolumeGroupHeatStackId();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test27()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getBaseGroupHeatStackId();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test28()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getCloudSiteId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test29()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getTenantId();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test30()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer());
+      vnfRollback0.setMsoRequest(msoRequest0);
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test31()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getMsoRequest();
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test32()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      assertFalse(vnfRollback0.getVnfCreated());
+      
+      vnfRollback0.setVnfCreated(true);
+      boolean boolean0 = vnfRollback0.getVnfCreated();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test33()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getVolumeGroupId();
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.isBase());
+  }
+
+  @Test(timeout = 4000)
+  public void test34()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.getRequestType();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test35()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback();
+      vnfRollback0.setVolumeGroupHeatStackId("");
+      vnfRollback0.getVolumeGroupHeatStackId();
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertFalse(vnfRollback0.getVnfCreated());
+  }
+
+  @Test(timeout = 4000)
+  public void test36()  throws Throwable  {
+      VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant=");
+      String string0 = vnfRollback0.getVnfId();
+      assertEquals(", tenant=", string0);
+      assertEquals(", tenant=", vnfRollback0.getTenantId());
+      assertFalse(vnfRollback0.getVnfCreated());
+      assertFalse(vnfRollback0.isBase());
+      assertFalse(vnfRollback0.getTenantCreated());
+      assertEquals(", tenant=", vnfRollback0.getCloudSiteId());
+      assertEquals(", tenant=", vnfRollback0.getVolumeGroupName());
+      assertEquals(", tenant=", vnfRollback0.getRequestType());
+      assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java
new file mode 100644
index 0000000..e07b2cf
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTestscaffolding.java
@@ -0,0 +1,79 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:51:17 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.beans;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class VnfRollbackESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.beans.VnfRollback"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(VnfRollbackESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.beans.VnfRollback",
+      "org.openecomp.mso.entity.MsoRequest"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java
new file mode 100644
index 0000000..ccc5a94
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTest.java
@@ -0,0 +1,24 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:51:02 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoAdapterExceptionESTest extends MsoAdapterExceptionESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoAdapterException msoAdapterException0 = new MsoAdapterException("");
+      MsoAdapterException msoAdapterException1 = new MsoAdapterException("", (Throwable) msoAdapterException0);
+      assertFalse(msoAdapterException1.equals((Object)msoAdapterException0));
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java
new file mode 100644
index 0000000..657b8b2
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionESTestscaffolding.java
@@ -0,0 +1,87 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:51:02 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoAdapterExceptionESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoAdapterException"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoAdapterExceptionESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoAdapterException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoAdapterExceptionESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoAdapterException"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java
new file mode 100644
index 0000000..f840c12
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTest.java
@@ -0,0 +1,30 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:56:48 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoCloudSiteNotFoundESTest extends MsoCloudSiteNotFoundESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound();
+      assertEquals(MsoExceptionCategory.USERDATA, msoCloudSiteNotFound0.getCategory());
+  }
+
+  @Test(timeout = 4000)
+  public void test1()  throws Throwable  {
+      MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound("NQz5T^");
+      String string0 = msoCloudSiteNotFound0.toString();
+      assertEquals("Cloud Site [NQz5T^] not found", string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java
new file mode 100644
index 0000000..ba28705
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundESTestscaffolding.java
@@ -0,0 +1,87 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:56:48 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoCloudSiteNotFoundESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoCloudSiteNotFoundESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoCloudSiteNotFoundESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java
new file mode 100644
index 0000000..2bd71fb
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTest.java
@@ -0,0 +1,77 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:48:01 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoExceptionESTest extends MsoExceptionESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoTenantNotFound msoTenantNotFound0 = new MsoTenantNotFound("T&~q", "Cloud Site [");
+      MsoIOException msoIOException0 = new MsoIOException("", (Throwable) msoTenantNotFound0);
+      String string0 = msoIOException0.getContextMessage();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test1()  throws Throwable  {
+      MsoNetworkNotFound msoNetworkNotFound0 = new MsoNetworkNotFound("", "", "");
+      msoNetworkNotFound0.addContext("");
+      String string0 = msoNetworkNotFound0.getContext();
+      assertEquals("", string0);
+      assertNotNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test2()  throws Throwable  {
+      MsoAdapterException msoAdapterException0 = new MsoAdapterException(" ");
+      msoAdapterException0.setContext(" ");
+      String string0 = msoAdapterException0.getContextMessage();
+      assertEquals("[ ]  ", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test3()  throws Throwable  {
+      MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound();
+      MsoAdapterException msoAdapterException0 = new MsoAdapterException("", (Throwable) msoCloudSiteNotFound0);
+      msoAdapterException0.addContext("");
+      msoAdapterException0.addContext("");
+      String string0 = msoAdapterException0.getContext();
+      assertEquals(":", msoAdapterException0.getContext());
+      assertNotNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test4()  throws Throwable  {
+      MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound((String) null);
+      MsoExceptionCategory msoExceptionCategory0 = msoCloudSiteNotFound0.getCategory();
+      MsoAdapterException msoAdapterException0 = new MsoAdapterException((String) null, (Throwable) msoCloudSiteNotFound0);
+      msoAdapterException0.setCategory(msoExceptionCategory0);
+      assertNull(msoAdapterException0.getContext());
+  }
+
+  @Test(timeout = 4000)
+  public void test5()  throws Throwable  {
+      MsoNetworkNotFound msoNetworkNotFound0 = new MsoNetworkNotFound("", "", "");
+      String string0 = msoNetworkNotFound0.getContext();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test6()  throws Throwable  {
+      MsoCloudSiteNotFound msoCloudSiteNotFound0 = new MsoCloudSiteNotFound((String) null);
+      MsoAdapterException msoAdapterException0 = new MsoAdapterException((String) null, (Throwable) msoCloudSiteNotFound0);
+      String string0 = msoAdapterException0.getContextMessage();
+      assertNull(string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java
new file mode 100644
index 0000000..8ce85b7
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoExceptionESTestscaffolding.java
@@ -0,0 +1,101 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:48:01 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoExceptionESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoException"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoExceptionESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoIOException",
+      "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoAdapterException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoExceptionESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoIOException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists",
+      "org.openecomp.mso.openstack.exceptions.MsoStackNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoAdapterException",
+      "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists",
+      "org.openecomp.mso.openstack.exceptions.MsoException"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java
new file mode 100644
index 0000000..ec2699c
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTest.java
@@ -0,0 +1,24 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:50:20 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoIOExceptionESTest extends MsoIOExceptionESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoIOException msoIOException0 = new MsoIOException("");
+      MsoIOException msoIOException1 = new MsoIOException("", (Throwable) msoIOException0);
+      assertNull(msoIOException1.getContext());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java
new file mode 100644
index 0000000..e657718
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionESTestscaffolding.java
@@ -0,0 +1,87 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:50:20 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoIOExceptionESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoIOException"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoIOExceptionESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoIOException",
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoIOExceptionESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoIOException"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java
new file mode 100644
index 0000000..2c423b7
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTest.java
@@ -0,0 +1,23 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:52:37 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoNetworkAlreadyExistsESTest extends MsoNetworkAlreadyExistsESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoNetworkAlreadyExists msoNetworkAlreadyExists0 = new MsoNetworkAlreadyExists((String) null, (String) null, (String) null);
+      assertNull(msoNetworkAlreadyExists0.getContext());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java
new file mode 100644
index 0000000..1c00ba9
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsESTestscaffolding.java
@@ -0,0 +1,89 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:52:37 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoNetworkAlreadyExistsESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoNetworkAlreadyExistsESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoNetworkAlreadyExistsESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java
new file mode 100644
index 0000000..4185450
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTest.java
@@ -0,0 +1,23 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:54:45 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoNetworkNotFoundESTest extends MsoNetworkNotFoundESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoNetworkNotFound msoNetworkNotFound0 = new MsoNetworkNotFound("6", "6", "yX9(}I;;7<c%.4HYX");
+      assertNull(msoNetworkNotFound0.getContext());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTestscaffolding.java
new file mode 100644
index 0000000..1506836
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundESTestscaffolding.java
@@ -0,0 +1,89 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:54:45 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoNetworkNotFoundESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoNetworkNotFoundESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoNetworkNotFoundESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTest.java
new file mode 100644
index 0000000..00d7035
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTest.java
@@ -0,0 +1,32 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:51:53 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoOpenstackExceptionESTest extends MsoOpenstackExceptionESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoOpenstackException msoOpenstackException0 = new MsoOpenstackException((-20), "zOT*@]B@O~zuv2", "zOT*@]B@O~zuv2");
+      MsoOpenstackException msoOpenstackException1 = new MsoOpenstackException((-20), "zOT*@]B@O~zuv2", "zOT*@]B@O~zuv2", (Exception) msoOpenstackException0);
+      assertEquals(MsoExceptionCategory.OPENSTACK, msoOpenstackException1.getCategory());
+  }
+
+  @Test(timeout = 4000)
+  public void test1()  throws Throwable  {
+      MsoOpenstackException msoOpenstackException0 = new MsoOpenstackException((-20), "zOT*@]B@O~zuv2", "zOT*@]B@O~zuv2");
+      String string0 = msoOpenstackException0.toString();
+      assertNotNull(string0);
+      assertEquals("-20 zOT*@]B@O~zuv2: zOT*@]B@O~zuv2", string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTestscaffolding.java
new file mode 100644
index 0000000..78a71cc
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionESTestscaffolding.java
@@ -0,0 +1,87 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:51:53 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoOpenstackExceptionESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoOpenstackExceptionESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoOpenstackExceptionESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTest.java
new file mode 100644
index 0000000..289b2a6
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTest.java
@@ -0,0 +1,23 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:55:08 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoStackAlreadyExistsESTest extends MsoStackAlreadyExistsESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoStackAlreadyExists msoStackAlreadyExists0 = new MsoStackAlreadyExists("", "", "");
+      assertEquals(MsoExceptionCategory.OPENSTACK, msoStackAlreadyExists0.getCategory());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTestscaffolding.java
new file mode 100644
index 0000000..c7b8c85
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsESTestscaffolding.java
@@ -0,0 +1,89 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:55:08 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoStackAlreadyExistsESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoStackAlreadyExistsESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists",
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoStackAlreadyExistsESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTest.java
new file mode 100644
index 0000000..e8b6e85
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTest.java
@@ -0,0 +1,23 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:55:36 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoStackNotFoundESTest extends MsoStackNotFoundESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoStackNotFound msoStackNotFound0 = new MsoStackNotFound("", (String) null, (String) null);
+      assertEquals(MsoExceptionCategory.OPENSTACK, msoStackNotFound0.getCategory());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTestscaffolding.java
new file mode 100644
index 0000000..3ce0916
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundESTestscaffolding.java
@@ -0,0 +1,89 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:55:36 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoStackNotFoundESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoStackNotFound"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoStackNotFoundESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoStackNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoStackNotFoundESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoStackNotFound"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTest.java
new file mode 100644
index 0000000..a47f778
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTest.java
@@ -0,0 +1,23 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:56:00 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoTenantAlreadyExistsESTest extends MsoTenantAlreadyExistsESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoTenantAlreadyExists msoTenantAlreadyExists0 = new MsoTenantAlreadyExists("Q]>\u00018.eW8", "Q]>\u00018.eW8");
+      assertEquals(MsoExceptionCategory.OPENSTACK, msoTenantAlreadyExists0.getCategory());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java
new file mode 100644
index 0000000..11700e6
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsESTestscaffolding.java
@@ -0,0 +1,89 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:56:00 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoTenantAlreadyExistsESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoTenantAlreadyExistsESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoTenantAlreadyExistsESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java
new file mode 100644
index 0000000..b65bd1f
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTest.java
@@ -0,0 +1,23 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:52:17 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoTenantNotFoundESTest extends MsoTenantNotFoundESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoTenantNotFound msoTenantNotFound0 = new MsoTenantNotFound("", "");
+      assertEquals(MsoExceptionCategory.OPENSTACK, msoTenantNotFound0.getCategory());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java
new file mode 100644
index 0000000..bd45ba6
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundESTestscaffolding.java
@@ -0,0 +1,89 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:52:17 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.exceptions;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoTenantNotFoundESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoTenantNotFoundESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound",
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoTenantNotFoundESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.openstack.exceptions.MsoExceptionCategory",
+      "org.openecomp.mso.openstack.exceptions.MsoException",
+      "org.openecomp.mso.openstack.exceptions.MsoOpenstackException",
+      "org.openecomp.mso.openstack.exceptions.MsoTenantNotFound"
+    );
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java
new file mode 100644
index 0000000..6eaac45
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryESTest.java
@@ -0,0 +1,562 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:40:12 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.utils;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.evosuite.shaded.org.mockito.Mockito.*;
+import static org.evosuite.runtime.EvoAssertions.*;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.evosuite.runtime.PrivateAccess;
+import org.evosuite.runtime.ViolatedAssumptionAnswer;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true)
+public class MsoHeatEnvironmentEntryESTest {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      Set<MsoHeatEnvironmentResource> set0 = (Set<MsoHeatEnvironmentResource>) mock(Set.class, new ViolatedAssumptionAnswer());
+      doReturn((-237540137)).when(set0).size();
+      msoHeatEnvironmentEntry0.setResources(set0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.hasResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      PrivateAccess.setVariable((Class<MsoHeatEnvironmentEntry>) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "valid", (Object) false);
+      boolean boolean0 = msoHeatEnvironmentEntry0.isValid();
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentResource> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentResource>();
+      msoHeatEnvironmentEntry0.setResources(linkedHashSet0);
+      msoHeatEnvironmentEntry0.getResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("9>KEckx", "8&T!e[SABZ");
+      msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0);
+      msoHeatEnvironmentEntry0.getResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      StringBuilder stringBuilder0 = msoHeatEnvironmentEntry0.toFullString();
+      PrivateAccess.setVariable((Class<MsoHeatEnvironmentEntry>) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "rawEntry", (Object) stringBuilder0);
+      StringBuilder stringBuilder1 = msoHeatEnvironmentEntry0.getRawEntry();
+      assertEquals("\nnull", stringBuilder1.toString());
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      msoHeatEnvironmentEntry0.getParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.getParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentResource> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentResource>();
+      msoHeatEnvironmentEntry0.setResources(linkedHashSet0);
+      msoHeatEnvironmentEntry0.getNumberOfResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0);
+      msoHeatEnvironmentEntry0.getNumberOfResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      Set<MsoHeatEnvironmentResource> set0 = (Set<MsoHeatEnvironmentResource>) mock(Set.class, new ViolatedAssumptionAnswer());
+      doReturn(0).when(set0).size();
+      msoHeatEnvironmentEntry0.setResources(set0);
+      msoHeatEnvironmentEntry0.getNumberOfResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      msoHeatEnvironmentEntry0.getNumberOfParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.getNumberOfParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      PrivateAccess.setVariable((Class<MsoHeatEnvironmentEntry>) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "errorString", (Object) "Param=");
+      msoHeatEnvironmentEntry0.getErrorString();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      Set<HeatTemplateParam> set0 = (Set<HeatTemplateParam>) mock(Set.class, new ViolatedAssumptionAnswer());
+      doReturn((-2945)).when(set0).size();
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(set0);
+        fail("Expecting exception: IllegalArgumentException");
+
+      } catch(IllegalArgumentException e) {
+         //
+         // Illegal Capacity: -2945
+         //
+         verifyException("java.util.ArrayList", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      linkedHashSet0.add((MsoHeatEnvironmentParameter) null);
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.toFullString();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test15()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.containsParameter((String) null, "");
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test16()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      linkedHashSet0.add(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.containsParameter((String) null);
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test17()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0);
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource();
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource1);
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentResource", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test18()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter();
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter1);
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test19()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("", "");
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("");
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test20()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.hasParameters();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test21()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.hasParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test22()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.hasParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test23()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      PrivateAccess.callMethod((Class<MsoHeatEnvironmentEntry>) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "getResourceRegistryRawEntry");
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test24()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentParameter0.setValue("_BAD");
+      HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam();
+      linkedHashSet0.add(heatTemplateParam0);
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0);
+      assertTrue(msoHeatEnvironmentEntry0.hasParameters());
+  }
+
+  @Test(timeout = 4000)
+  public void test25()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentParameter0.setValue("t'N`.KI:L9");
+      HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam();
+      linkedHashSet0.add(heatTemplateParam0);
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0);
+      assertTrue(msoHeatEnvironmentEntry0.hasParameters());
+  }
+
+  @Test(timeout = 4000)
+  public void test26()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam();
+      linkedHashSet0.add(heatTemplateParam0);
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0);
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test27()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
+      msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0);
+      assertTrue(msoHeatEnvironmentEntry0.hasParameters());
+  }
+
+  @Test(timeout = 4000)
+  public void test28()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
+      HeatTemplateParam heatTemplateParam0 = new HeatTemplateParam();
+      linkedHashSet0.add(heatTemplateParam0);
+      msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test29()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      assertFalse(msoHeatEnvironmentEntry0.hasParameters());
+
+      LinkedHashSet<HeatTemplateParam> linkedHashSet0 = new LinkedHashSet<HeatTemplateParam>();
+      StringBuilder stringBuilder0 = msoHeatEnvironmentEntry0.toFullStringExcludeNonParams(linkedHashSet0);
+      PrivateAccess.setVariable((Class<MsoHeatEnvironmentEntry>) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "rawEntry", (Object) stringBuilder0);
+      StringBuilder stringBuilder1 = (StringBuilder)PrivateAccess.callMethod((Class<MsoHeatEnvironmentEntry>) MsoHeatEnvironmentEntry.class, msoHeatEnvironmentEntry0, "getResourceRegistryRawEntry");
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+      assertNull(stringBuilder1);
+  }
+
+  @Test(timeout = 4000)
+  public void test30()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("9MTP2Qt0FH.^", "");
+      assertTrue(boolean0);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test31()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("dP:* hj", "dP:* hj");
+      assertFalse(boolean0);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test32()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      msoHeatEnvironmentEntry0.addParameter(msoHeatEnvironmentParameter0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("", "");
+      assertTrue(boolean0);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test33()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = mock(MsoHeatEnvironmentParameter.class, new ViolatedAssumptionAnswer());
+      linkedHashSet0.add(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("kz`LZx");
+      assertTrue(msoHeatEnvironmentEntry0.hasParameters());
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test34()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter("kz`LZx");
+      assertFalse(boolean0);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test35()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      boolean boolean0 = msoHeatEnvironmentEntry0.containsParameter(",=?%4z");
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test36()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      LinkedHashSet<MsoHeatEnvironmentParameter> linkedHashSet0 = new LinkedHashSet<MsoHeatEnvironmentParameter>();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = mock(MsoHeatEnvironmentParameter.class, new ViolatedAssumptionAnswer());
+      doReturn((String) null).when(msoHeatEnvironmentParameter0).getName();
+      doReturn((String) null).when(msoHeatEnvironmentParameter0).getValue();
+      linkedHashSet0.add(msoHeatEnvironmentParameter0);
+      msoHeatEnvironmentEntry0.setParameters(linkedHashSet0);
+      msoHeatEnvironmentEntry0.toFullString();
+      assertTrue(msoHeatEnvironmentEntry0.hasParameters());
+  }
+
+  @Test(timeout = 4000)
+  public void test37()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("");
+      msoHeatEnvironmentEntry0.addResource(msoHeatEnvironmentResource0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.hasResources();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test38()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      Set<MsoHeatEnvironmentResource> set0 = (Set<MsoHeatEnvironmentResource>) mock(Set.class, new ViolatedAssumptionAnswer());
+      doReturn(0).when(set0).size();
+      msoHeatEnvironmentEntry0.setResources(set0);
+      boolean boolean0 = msoHeatEnvironmentEntry0.hasResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test39()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      boolean boolean0 = msoHeatEnvironmentEntry0.hasResources();
+      assertFalse(boolean0);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test40()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.setResources((Set<MsoHeatEnvironmentResource>) null);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test41()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.setParameters((Set<MsoHeatEnvironmentParameter>) null);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+
+  @Test(timeout = 4000)
+  public void test43()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.getNumberOfResources();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test44()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      boolean boolean0 = msoHeatEnvironmentEntry0.isValid();
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test45()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry((StringBuilder) null);
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test46()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      // Undeclared exception!
+      try {
+        msoHeatEnvironmentEntry0.getNumberOfParameters();
+        fail("Expecting exception: NullPointerException");
+
+      } catch(NullPointerException e) {
+         //
+         // no message in exception (getMessage() returned null)
+         //
+         verifyException("org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry", e);
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test47()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.getRawEntry();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test48()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.getParameters();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test49()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.getResources();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+
+  @Test(timeout = 4000)
+  public void test50()  throws Throwable  {
+      MsoHeatEnvironmentEntry msoHeatEnvironmentEntry0 = new MsoHeatEnvironmentEntry();
+      msoHeatEnvironmentEntry0.getErrorString();
+      assertTrue(msoHeatEnvironmentEntry0.isValid());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java
new file mode 100644
index 0000000..6ec389b
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTest.java
@@ -0,0 +1,129 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:45:40 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.utils;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoHeatEnvironmentParameterESTest extends MsoHeatEnvironmentParameterESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      msoHeatEnvironmentParameter0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      boolean boolean0 = msoHeatEnvironmentParameter0.equals(msoHeatEnvironmentParameter0);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      msoHeatEnvironmentParameter0.setValue("");
+      String string0 = msoHeatEnvironmentParameter0.getValue();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      String string0 = msoHeatEnvironmentParameter0.getName();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("<*+ogA@v;MO4'8{1");
+      String string0 = msoHeatEnvironmentParameter0.getName();
+      assertEquals("<*+ogA@v;MO4'8{1", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      String string0 = msoHeatEnvironmentParameter0.getName();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("", "-3Y=_MqzpVL7|^$8");
+      String string0 = msoHeatEnvironmentParameter0.getValue();
+      assertEquals("-3Y=_MqzpVL7|^$8", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter("{Ox?zu\"*");
+      boolean boolean0 = msoHeatEnvironmentParameter1.equals(msoHeatEnvironmentParameter0);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("?.@!au:}y7xGSg|}8");
+      boolean boolean0 = msoHeatEnvironmentParameter0.equals("?.@!au:}y7xGSg|}8");
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      msoHeatEnvironmentParameter0.setName("");
+      assertEquals("", msoHeatEnvironmentParameter0.getName());
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter("");
+      boolean boolean0 = msoHeatEnvironmentParameter0.equals(msoHeatEnvironmentParameter1);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      String string0 = msoHeatEnvironmentParameter0.getValue();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      msoHeatEnvironmentParameter0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter();
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter1 = new MsoHeatEnvironmentParameter();
+      // Undeclared exception!
+      try { 
+        msoHeatEnvironmentParameter0.equals(msoHeatEnvironmentParameter1);
+        fail("Expecting exception: NullPointerException");
+      
+      } catch(NullPointerException e) {
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      MsoHeatEnvironmentParameter msoHeatEnvironmentParameter0 = new MsoHeatEnvironmentParameter("");
+      String string0 = msoHeatEnvironmentParameter0.toString();
+      assertEquals(": null", string0);
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java
new file mode 100644
index 0000000..f7e33bb
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:45:40 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.utils;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoHeatEnvironmentParameterESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoHeatEnvironmentParameterESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.utils.MsoHeatEnvironmentParameter"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java
new file mode 100644
index 0000000..d3e7d29
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTest.java
@@ -0,0 +1,129 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:45:54 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.utils;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.evosuite.runtime.EvoRunner;
+import org.evosuite.runtime.EvoRunnerParameters;
+import org.junit.runner.RunWith;
+
+@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) 
+public class MsoHeatEnvironmentResourceESTest extends MsoHeatEnvironmentResourceESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test00()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("", "");
+      msoHeatEnvironmentResource0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test01()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("8{,8]8v", "8{,8]8v");
+      String string0 = msoHeatEnvironmentResource0.getValue();
+      assertEquals("8{,8]8v", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test02()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("", "");
+      String string0 = msoHeatEnvironmentResource0.getValue();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test03()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("\"(_{*)._$D2+w8wk");
+      String string0 = msoHeatEnvironmentResource0.getName();
+      assertEquals("\"(_{*)._$D2+w8wk", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test04()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource();
+      // Undeclared exception!
+      try { 
+        msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource1);
+        fail("Expecting exception: NullPointerException");
+      
+      } catch(NullPointerException e) {
+      }
+  }
+
+  @Test(timeout = 4000)
+  public void test05()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("", "");
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource("", "");
+      boolean boolean0 = msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource1);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test06()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("m");
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource1 = new MsoHeatEnvironmentResource("l", "l");
+      boolean boolean0 = msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource1);
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test07()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      boolean boolean0 = msoHeatEnvironmentResource0.equals("1Z^#74OJV(OBf<=#r");
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test08()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      boolean boolean0 = msoHeatEnvironmentResource0.equals(msoHeatEnvironmentResource0);
+      assertTrue(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test09()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      String string0 = msoHeatEnvironmentResource0.getName();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test10()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      msoHeatEnvironmentResource0.setName("");
+      String string0 = msoHeatEnvironmentResource0.getName();
+      assertEquals("", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test11()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource("");
+      String string0 = msoHeatEnvironmentResource0.getValue();
+      assertNull(string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test12()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      msoHeatEnvironmentResource0.hashCode();
+  }
+
+  @Test(timeout = 4000)
+  public void test13()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      String string0 = msoHeatEnvironmentResource0.toString();
+      assertEquals("\"null\": null", string0);
+  }
+
+  @Test(timeout = 4000)
+  public void test14()  throws Throwable  {
+      MsoHeatEnvironmentResource msoHeatEnvironmentResource0 = new MsoHeatEnvironmentResource();
+      msoHeatEnvironmentResource0.setValue("");
+      assertNull(msoHeatEnvironmentResource0.getName());
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java
new file mode 100644
index 0000000..3917b89
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceESTestscaffolding.java
@@ -0,0 +1,78 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:45:54 GMT 2016
+ */
+
+package org.openecomp.mso.openstack.utils;
+
+import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
+import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.evosuite.runtime.sandbox.Sandbox;
+
+@EvoSuiteClassExclude
+public class MsoHeatEnvironmentResourceESTestscaffolding {
+
+  @org.junit.Rule 
+  public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
+
+  private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); 
+
+  private org.evosuite.runtime.thread.ThreadStopper threadStopper =  new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
+
+  @BeforeClass 
+  public static void initEvoSuiteFramework() { 
+    org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.openstack.utils.MsoHeatEnvironmentResource"; 
+    org.evosuite.runtime.GuiSupport.initialize(); 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; 
+    org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; 
+    org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; 
+    org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; 
+    org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.init(); 
+    initializeClasses();
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+  } 
+
+  @AfterClass 
+  public static void clearEvoSuiteFramework(){ 
+    Sandbox.resetDefaultSecurityManager(); 
+    java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); 
+  } 
+
+  @Before 
+  public void initTestCase(){ 
+    threadStopper.storeCurrentThreads();
+    threadStopper.startRecordingTime();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); 
+    org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); 
+     
+    org.evosuite.runtime.GuiSupport.setHeadless(); 
+    org.evosuite.runtime.Runtime.getInstance().resetRuntime(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.activate(); 
+  } 
+
+  @After 
+  public void doneWithTestCase(){ 
+    threadStopper.killAndJoinClientThreads();
+    org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); 
+    org.evosuite.runtime.classhandling.JDKClassResetter.reset(); 
+    resetClasses(); 
+    org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); 
+    org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); 
+    org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); 
+  } 
+
+
+  private static void initializeClasses() {
+    org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MsoHeatEnvironmentResourceESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.openstack.utils.MsoHeatEnvironmentResource"
+    );
+  } 
+
+  private static void resetClasses() {
+  }
+}
diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json
new file mode 100644
index 0000000..0230a7d
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json
@@ -0,0 +1,80 @@
+{ "cloud_config": {
+	"identity_services":
+	{
+		"MT_KEYSTONE":
+		{
+			"identity_url": "http://localhost:5000/v2.0",
+			"mso_id": "john",
+			"mso_pass": "FD205490A48D48475607C36B9AD902BF",
+			"admin_tenant": "admin",
+			"member_role": "_member_",
+			"tenant_metadata": false,
+			"identity_server_type": "KEYSTONE",
+			"identity_authentication_type": "RACKSPACE_APIKEY"
+		},
+		"DAN_KEYSTONE":
+		{
+			"identity_url": "http://localhost:5000/v2.0",
+			"mso_id": "mockId",
+			"mso_pass": "BC59F80E38208A42ABB81ECCDD4FB3E4",
+			"admin_tenant": "service",
+			"member_role": "_member_",
+			"tenant_metadata": false,
+			"identity_server_type": "KEYSTONE",
+			"identity_authentication_type": "USERNAME_PASSWORD"
+		},
+		"MTINJVCC101_DCP":
+		{
+			"identity_url": "http://localhost:5000/v2.0",
+			"mso_id": "mockIdToo",
+			"mso_pass": "95604B9EAAC4D77D74786FAE54177206",
+			"admin_tenant": "service",
+			"member_role": "admin",
+			"tenant_metadata": true,
+			"identity_server_type": "KEYSTONE",
+			"identity_authentication_type": "USERNAME_PASSWORD"
+		},
+		"MTSNJA3DCP1":
+		{
+			"identity_url": "https://localhost:5000/v2.0",
+			"mso_id": "mockIdToo",
+			"mso_pass": "1491DE07AC9D716A7966BB8C2848F031",
+			"admin_tenant": "service",
+			"member_role": "admin",
+			"tenant_metadata": true,
+			"identity_server_type": "KEYSTONE",
+			"identity_authentication_type": "USERNAME_PASSWORD"
+		}
+		
+	},
+	"cloud_sites":
+	{
+		"MT":
+		{
+			"region_id": "regionOne",
+			"clli": "MT",
+			"aic_version": "2.5",
+			"identity_service_id": "MT_KEYSTONE"
+		},
+		"DAN":
+		{
+			"region_id": "RegionOne",
+			"clli": "DAN",
+			"aic_version": "2.5",
+			"identity_service_id": "DAN_KEYSTONE"
+		},
+		"MTINJVCC101":
+		{
+			"region_id": "regionTwo",
+			"clli": "MTINJVCC101",
+			"aic_version": "2.5",
+			"identity_service_id": "MTINJVCC101_DCP"
+		}
+		
+	}
+}
+}
+	
+
+
+		
diff --git a/adapters/mso-adapter-utils/src/test/resources/logback-test.xml b/adapters/mso-adapter-utils/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..d2c1719
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/logback-test.xml
@@ -0,0 +1,48 @@
+<!--
+  ============LICENSE_START=======================================================
+  ECOMP MSO
+  ================================================================================
+  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=========================================================
+  -->
+
+<configuration >
+  
+  
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
+    </encoder>
+  </appender>
+
+
+  <logger name="com.att.eelf.audit" level="info" additivity="false">
+    <appender-ref ref="STDOUT" />
+  </logger>
+  
+  <logger name="com.att.eelf.metrics" level="info" additivity="false">
+        <appender-ref ref="STDOUT" />
+  </logger>
+
+  <logger name="com.att.eelf.error" level="trace" additivity="false">
+    <appender-ref ref="STDOUT" />
+  </logger> 
+
+  <root level="info">
+    <appender-ref ref="STDOUT" />
+  </root>
+ 
+
+</configuration>
diff --git a/adapters/mso-adapter-utils/src/test/resources/mso.properties b/adapters/mso-adapter-utils/src/test/resources/mso.properties
new file mode 100644
index 0000000..d58521f
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/mso.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP MSO
+# ================================================================================
+# 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=========================================================
+###
+
+ecomp.mso.cloud.1.cloudId=MT
+ecomp.mso.cloud.1.keystoneUrl=http://localhost:5000/v2.0
+ecomp.mso.cloud.1.msoId=John
+ecomp.mso.cloud.1.publicNetId=FD205490A48D48475607C36B9AD902BF
+ecomp.mso.cloud.1.test=1234
+ecomp.mso.cloud.1.boolean=true
+ecomp.mso.cloud.1.enum=enum1
diff --git a/adapters/mso-adapter-utils/src/test/resources/mso2.properties b/adapters/mso-adapter-utils/src/test/resources/mso2.properties
new file mode 100644
index 0000000..a47ce77
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/test/resources/mso2.properties
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ECOMP MSO
+# ================================================================================
+# 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=========================================================
+###
+
+ecomp.mso.cloud.1.cloudId=MT2
