diff --git a/status-control/pom.xml b/status-control/pom.xml
new file mode 100644
index 0000000..169c2ba
--- /dev/null
+++ b/status-control/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.openecomp</groupId>
+        <artifactId>mso</artifactId>
+        <version>0.0.4-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.openecomp.mso</groupId>
+    <artifactId>status-control</artifactId>
+    <name>MSO Status Control module</name>
+    <description>Contains classes to update and query the MSO status per site</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openecomp.mso</groupId>
+            <artifactId>common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.mso</groupId>
+            <artifactId>mso-catalog-db</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.mso</groupId>
+            <artifactId>mso-requests-db</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <version>3.0.19.Final</version>
+            <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.httpcomponents</groupId>
+                    <artifactId>httpclient</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.10.19</version>
+            <scope>test</scope>
+        </dependency>
+        
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpcore</artifactId>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpclient</artifactId>
+		</dependency>
+		
+    </dependencies>
+</project>
\ No newline at end of file
diff --git a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
new file mode 100644
index 0000000..03e807a
--- /dev/null
+++ b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java
@@ -0,0 +1,288 @@
+/*-
+ * ============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;
+
+
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoJsonProperties;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.openecomp.mso.utils.UUIDChecker;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+import javax.ws.rs.core.Response;
+
+public class HealthCheckUtils {
+
+    private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+    private final static String MSO_PROP_TOPOLOGY = "MSO_PROP_TOPOLOGY";
+    private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+    private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Health Check</title></head><body>Application ready</body></html>";
+    private static final String NOT_FOUND = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Started</title></head><body>Application not started. Properties file missing or invalid or database Connection failed</body></html>";
+    private static final String NOT_HEALTHY = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title>Application Not Started</title></head><body>Application not available or at least one of the sub-modules is not available.</body></html>";
+    public static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK)
+            .entity (CHECK_HTML)
+            .build ();
+    public static final Response HEALTH_CHECK_NOK_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
+            .entity (NOT_HEALTHY)
+            .  build ();
+    public static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE)
+            .entity (NOT_FOUND)
+            .build ();
+
+    public enum NodeType {APIH, RA};
+
+    public boolean catalogDBCheck (MsoLogger subMsoLogger, long startTime) {
+        try (CatalogDatabase catalogDB = new CatalogDatabase ()) {
+            catalogDB.healthCheck ();
+        } catch (Exception e) {
+            subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check catalog database", e);
+            subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception during healthcheck");
+            return false;
+        }
+        return true;
+    }
+
+    public boolean requestDBCheck (MsoLogger subMsoLogger, long startTime) {
+        try {
+            RequestsDatabase.healthCheck ();
+        } catch (Exception e) {
+            subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check request database", e);
+            subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exception during local healthcheck");
+            return false;
+        }
+        return true;
+    }
+
+    public boolean siteStatusCheck (MsoLogger subMsoLogger, long startTime) {
+        // Check the Site Status value in DB first, if set to false, return NOK
+        String site = getProperty("site-name");
+
+        MsoStatusUtil statusUtil = new MsoStatusUtil ();
+        if (!statusUtil.getSiteStatus (site)) {
+            subMsoLogger.debug("This site is currently disabled for maintenance.");
+            return false;
+        }
+        return true;
+    }
+
+    public boolean configFileCheck (MsoLogger subMsoLogger, long startTime, String propertiesFile) {
+        if (null != propertiesFile) {
+            MsoJavaProperties props = loadMsoProperties (propertiesFile);
+            if (props == null) {
+                subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Configuration file can not be loaded");
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+    private MsoJavaProperties loadMsoProperties (String fileName) {
+        MsoJavaProperties msoProperties;
+        try {
+            msoProperties = msoPropertiesFactory.getMsoJavaProperties(fileName);
+        } catch (Exception e) {
+            msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, fileName, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to load topology properties", e);
+            return null;
+        }
+        if (msoProperties !=null && msoProperties.size() > 0) {
+            return msoProperties;
+        } else {
+            msoLogger.error (MessageEnum.NO_PROPERTIES, fileName, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "No topology properties");
+            return  null;
+        }
+    }
+
+    protected boolean verifyLocalHealth(String ip, String apiPort, String url, String sslEnabled, String requestId) {
+        String finalUrl = getFinalUrl(ip, apiPort, url, sslEnabled);
+        long startTime = System.currentTimeMillis ();
+        if (null != requestId) {
+            finalUrl = finalUrl + "?requestId=" + requestId;
+        }
+        try (CloseableHttpClient client = getHttpClient()) {
+            HttpResponse response;
+            HttpGet get = new HttpGet(finalUrl);
+            msoLogger.debug("Get url is: " + finalUrl);
+            response = client.execute(get);
+            msoLogger.debug("Get response is: " + response);
+            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+                msoLogger.debug("verifyLocalHealth - Successfully communicate with APIH/BPMN/RA");
+                return true;
+            }
+            msoLogger.debug("verifyLocalHealth - Service not available");
+        } catch (Exception e) {
+            msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.UnknownError, "Error in local HealthCheck", e);
+            msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with APIH/BPMN/RA", url, "HealthCheck", null);
+            msoLogger.debug("Exception while triggering local health check api:" + finalUrl);
+        }
+        return false;
+    }
+
+    protected CloseableHttpClient getHttpClient () {
+        // set the connection timeout value to 30 seconds (30000 milliseconds)
+        RequestConfig.Builder requestBuilder = RequestConfig.custom();
+        requestBuilder = requestBuilder.setConnectTimeout(30000);
+        requestBuilder = requestBuilder.setConnectionRequestTimeout(30000);
+        HttpClientBuilder builder = HttpClientBuilder.create ();
+        builder.setDefaultRequestConfig (requestBuilder.build ());
+
+        return builder.build ();
+    }
+
+    public MsoJavaProperties loadTopologyProperties() {
+        MsoJavaProperties msoProperties;
+        try {
+            msoProperties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_TOPOLOGY);
+        } catch (Exception e) {
+            msoLogger.error(MessageEnum.LOAD_PROPERTIES_FAIL, MSO_PROP_TOPOLOGY, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to load topology properties", e);
+            return null;
+        }
+
+        if (msoProperties != null && msoProperties.size() > 0) {
+            return msoProperties;
+        } else {
+            msoLogger.error(MessageEnum.LOAD_PROPERTIES_FAIL, MSO_PROP_TOPOLOGY, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to load topology properties");
+            return null;
+        }
+    }
+
+    public boolean verifyNodeHealthCheck (HealthCheckUtils.NodeType type, String requestId) {
+        // Get info from topology properties file
+        MsoJavaProperties topologyProp = this.loadTopologyProperties();
+        if (null == topologyProp) {
+            return false;
+        }
+        String port = topologyProp.getProperty("server-port", null);
+        String ip = System.getProperty("jboss.qualified.host.name");
+        String sslEnabled = topologyProp.getProperty("ssl-enable", null);
+
+        if (null == port || null == ip || ip.isEmpty() || port.isEmpty()) {
+            msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Not able to get the IP or the Port value. IP:" + ip + "; Port:" + port, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to get the IP or the Port value. IP:" + ip + "; Port:" + port);
+            return false;
+        }
+
+        String[] apis;
+        if (NodeType.APIH.equals (type)) {
+            String apiList = topologyProp.getProperty("apih-healthcheck-urn", null);
+            if (null == apiList) {
+                msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Not able to get apih-healthcheck-urn parameter", "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to get apih-healthcheck-urn parameter");
+                return false;
+            }
+            apis = apiList.split(",");
+        } else if (NodeType.RA.equals (type)){
+            String apiList = topologyProp.getProperty("jra-healthcheck-urn", null);
+            if (null == apiList) {
+                msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Not able to get jra-healthcheck-urn parameter", "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to get jra-healthcheck-urn parameter");
+                return false;
+            }
+            apis = apiList.split(",");
+        } else {
+            msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Unknown NodeType:" + type, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Unknown NodeType:" + type);
+            return false;
+        }
+
+        // Verify health check on APIH servers
+        for (String url : apis) {
+            // if any of the parameters is null or empty, no need to establish the health check request, just go to the next iteration
+            if ((url == null)  || url.isEmpty()) {
+                continue;
+            }
+            // Exit the loop if local health check returns false from any of the sub component
+            if (!this.verifyLocalHealth(ip, port, url, sslEnabled, requestId)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public boolean verifyGlobalHealthCheck(boolean verifyBpmn, String requestId) {
+        // Get info from topology properties file
+        MsoJavaProperties topologyProp = this.loadTopologyProperties();
+        if (null == topologyProp) {
+            msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Not able to find the topology file", "", "HealthCheck", MsoLogger.ErrorCode.PermissionError, "Not able to find the topology file");
+            return false;
+        }
+
+        String apihLB = topologyProp.getProperty("apih-load-balancer", null);
+        String apihApi = topologyProp.getProperty("apih-nodehealthcheck-urn", null);
+        String bpmnLB= topologyProp.getProperty("camunda-load-balancer", null);
+        String bpmnApi = topologyProp.getProperty("camunda-healthcheck-urn", null);
+        String jraLB = topologyProp.getProperty("jra-load-balancer", null);
+        String jraApi = topologyProp.getProperty("jra-nodehealthcheck-urn", null);
+
+        if (null == apihLB || null == apihApi || null == bpmnLB || null == bpmnApi || null == jraLB || null == jraApi
+                || apihLB.isEmpty () || apihApi.isEmpty () || bpmnLB.isEmpty () || bpmnApi.isEmpty () || jraLB.isEmpty () || jraApi.isEmpty () ) {
+            msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Key parameters are missing from the topology file", "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Key parameters are missing from the topology file");
+            return false;
+        }
+
+        // Verify health check on APIH servers
+        if (!this.verifyLocalHealth (apihLB, null, apihApi, null, requestId)) {
+            return false;
+        }
+
+        // Verify health check on Camunda servers
+        if (verifyBpmn) {
+            if (!this.verifyLocalHealth (bpmnLB, null, bpmnApi, null, requestId)) {
+                return false;
+            }
+        }
+
+        // Verify health check on RA servers
+        if (!verifyLocalHealth (jraLB, null, jraApi, null, requestId)) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public String getProperty (String name) {
+        MsoJavaProperties prop = this.loadTopologyProperties();
+
+        return prop.getProperty(name, null);
+    }
+
+    protected String getFinalUrl (String ip, String port, String url, String sslEnabled) {
+        if (null == port && null == sslEnabled) {
+            int length = ip.length();
+            if (ip.substring(length - 1).equals ("/")) {
+                ip = ip.substring (0, length - 1);
+            }
+            return ip + url;
+        } else if (null != sslEnabled && "true".equals (sslEnabled.toLowerCase ())) {
+            return "https://" + ip + ":" + port + url;
+        } else {
+            return "http://" + ip + ":" + port + url;
+        }
+    }
+}
diff --git a/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java b/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java
new file mode 100644
index 0000000..f125cbb
--- /dev/null
+++ b/status-control/src/main/java/org/openecomp/mso/MsoStatusHandler.java
@@ -0,0 +1,64 @@
+/*-
+ * ============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;
+
+
+import org.openecomp.mso.utils.UUIDChecker;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.Response;
+
+@Path("/")
+public class MsoStatusHandler {
+    private MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
+
+    @POST
+    @Path("/setStatus/{siteName}")
+    @Produces("text/plain")
+    public Response setSiteStatus (@DefaultValue("true") @QueryParam("enable") Boolean enable,
+                                   @PathParam("siteName") String siteName) {
+        long startTime = System.currentTimeMillis();
+        // Set logger parameters
+        UUIDChecker.generateUUID (logger);
+        MsoLogger.setServiceName ("SetSiteStatus");
+
+
+        if (null == siteName) {
+            logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Not able to find the site name attribute in the config file");
+            return Response.status (Response.Status.INTERNAL_SERVER_ERROR).entity ("Exception: not able to find the site name attribute in the config file").build ();
+        }
+
+        // Query DB for the value
+        try {
+        	RequestsDatabase.updateSiteStatus(siteName, enable);
+
+        } catch (Exception e) {
+            logger.error (MessageEnum.GENERAL_EXCEPTION, "", "setSiteStatus", MsoLogger.ErrorCode.DataError, "Failed to set site status", e);
+            logger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while updating site status");
+            return Response.status (Response.Status.INTERNAL_SERVER_ERROR).entity ("Exception while updating site status").build ();
+        }
+        logger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
+        return Response.status (Response.Status.OK).entity ("Site status successfully updated to " + enable).build ();
+    }
+}
diff --git a/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java b/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java
new file mode 100644
index 0000000..2a86a4a
--- /dev/null
+++ b/status-control/src/main/java/org/openecomp/mso/MsoStatusUtil.java
@@ -0,0 +1,50 @@
+/*-
+ * ============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;
+
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.requestsdb.SiteStatus;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+public class MsoStatusUtil {
+
+    private MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
+
+    public boolean getSiteStatus (String siteName) {
+        // Query DB for the value
+       
+        try {
+            SiteStatus siteStatus = RequestsDatabase.getSiteStatus(siteName);
+            if (null != siteStatus) {
+                return siteStatus.getStatus();
+            } else {
+                // If status not present in the DB, by default the site is on, thus return true
+                return true;
+            }
+        } catch (Exception e) {
+            logger.error (MessageEnum.GENERAL_EXCEPTION, "", "getSiteStatus", MsoLogger.ErrorCode.DataError, "Exception in getting the site status", e);
+        }
+
+        return false;
+    }
+}
diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTest.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTest.java
new file mode 100644
index 0000000..3fa901c
--- /dev/null
+++ b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTest.java
@@ -0,0 +1,44 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:26:24 GMT 2016
+ */
+
+package org.openecomp.mso;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+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 HealthCheckUtilsESTest extends HealthCheckUtilsESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      HealthCheckUtils healthCheckUtils0 = new HealthCheckUtils();
+      MsoJavaProperties msoJavaProperties0 = healthCheckUtils0.loadTopologyProperties();
+      assertNull(msoJavaProperties0);
+  }
+
+  @Test(timeout = 4000)
+  public void test1()  throws Throwable  {
+      HealthCheckUtils healthCheckUtils0 = new HealthCheckUtils();
+      MsoLogger.Catalog msoLogger_Catalog0 = MsoLogger.Catalog.BPEL;
+      MsoLogger msoLogger0 = MsoLogger.getMsoLogger(msoLogger_Catalog0);
+      boolean boolean0 = healthCheckUtils0.configFileCheck(msoLogger0, 0L, "58zhaz/qbA");
+      assertFalse(boolean0);
+  }
+
+  @Test(timeout = 4000)
+  public void test2()  throws Throwable  {
+      HealthCheckUtils healthCheckUtils0 = new HealthCheckUtils();
+      MsoLogger.Catalog msoLogger_Catalog0 = MsoLogger.Catalog.BPEL;
+      MsoLogger msoLogger0 = MsoLogger.getMsoLogger(msoLogger_Catalog0);
+      boolean boolean0 = healthCheckUtils0.requestDBCheck(msoLogger0, 0L);
+      assertFalse(boolean0);
+  }
+}
diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTestscaffolding.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTestscaffolding.java
new file mode 100644
index 0000000..fdb925a
--- /dev/null
+++ b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsESTestscaffolding.java
@@ -0,0 +1,155 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:26:24 GMT 2016
+ */
+
+package org.openecomp.mso;
+
+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 HealthCheckUtilsESTestscaffolding {
+
+  @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.HealthCheckUtils"; 
+    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(HealthCheckUtilsESTestscaffolding.class.getClassLoader() ,
+      "org.openecomp.mso.properties.AbstractMsoProperties",
+      "org.openecomp.mso.properties.MsoPropertiesParameters",
+      "org.apache.http.client.config.RequestConfig",
+      "org.openecomp.mso.logger.MsoLogger$ErrorCode",
+      "org.jboss.resteasy.specimpl.MultivaluedTreeMap",
+      "org.hibernate.criterion.Order",
+      "com.att.eelf.configuration.SLF4jWrapper",
+      "org.apache.http.HttpMessage",
+      "org.hibernate.Query",
+      "org.openecomp.mso.properties.MsoPropertiesException",
+      "org.openecomp.mso.requestsdb.InfraActiveRequests",
+      "org.openecomp.mso.logger.MsoLogger",
+      "com.att.eelf.i18n.EELFResolvableErrorEnum",
+      "org.openecomp.mso.HealthCheckUtils",
+      "org.hibernate.SessionFactory",
+      "org.apache.http.HttpRequest",
+      "com.att.eelf.i18n.EELFMsgs",
+      "org.openecomp.mso.properties.MsoPropertiesFactory",
+      "org.openecomp.mso.requestsdb.RequestsDatabase",
+      "com.att.eelf.configuration.EELFLogger$Level",
+      "org.openecomp.mso.requestsdb.MockRequestsDatabase",
+      "org.openecomp.mso.logger.MsoLogger$Catalog",
+      "org.apache.http.client.config.RequestConfig$Builder",
+      "org.openecomp.mso.requestsdb.InfraRequests",
+      "org.openecomp.mso.requestsdb.SiteStatus",
+      "org.openecomp.mso.properties.MsoPropertiesParameters$MsoPropertiesType",
+      "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES",
+      "org.apache.http.client.methods.HttpUriRequest",
+      "org.openecomp.mso.HealthCheckUtils$NodeType",
+      "com.att.eelf.configuration.EELFLogger",
+      "org.hibernate.engine.spi.Mapping",
+      "org.openecomp.mso.properties.MsoJavaProperties",
+      "org.apache.http.client.HttpClient",
+      "com.att.eelf.i18n.EELFResourceManager",
+      "org.jboss.resteasy.util.CaseInsensitiveMap$CaseInsensitiveComparator",
+      "org.hibernate.criterion.Criterion",
+      "org.openecomp.mso.logger.MessageEnum",
+      "org.apache.http.impl.client.CloseableHttpClient",
+      "org.openecomp.mso.logger.MsoLogger$ResponseCode",
+      "org.openecomp.mso.entity.MsoRequest",
+      "org.openecomp.mso.properties.MsoJsonProperties",
+      "org.openecomp.mso.logger.MsoLogger$StatusCode",
+      "com.att.eelf.configuration.EELFManager",
+      "org.jboss.resteasy.util.CaseInsensitiveMap$1",
+      "org.jboss.resteasy.core.Headers",
+      "org.hibernate.BasicQueryContract",
+      "org.jboss.resteasy.util.CaseInsensitiveMap",
+      "com.att.eelf.i18n.EELFResourceManager$1",
+      "org.apache.http.HttpResponse",
+      "org.openecomp.mso.requestsdb.HibernateUtil",
+      "org.apache.http.HttpHost"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(HealthCheckUtilsESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "org.openecomp.mso.HealthCheckUtils$NodeType",
+      "com.att.eelf.i18n.EELFResourceManager",
+      "org.openecomp.mso.logger.MessageEnum",
+      "org.openecomp.mso.logger.MsoLogger$Catalog",
+      "org.openecomp.mso.logger.MsoLogger$ResponseCode",
+      "org.openecomp.mso.logger.MsoLogger",
+      "com.att.eelf.i18n.EELFMsgs",
+      "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES",
+      "com.att.eelf.configuration.EELFLogger$Level",
+      "com.att.eelf.configuration.EELFManager",
+      "org.openecomp.mso.properties.MsoPropertiesFactory",
+      "org.openecomp.mso.HealthCheckUtils",
+      "org.openecomp.mso.logger.MsoLogger$StatusCode",
+      "org.openecomp.mso.logger.MsoLogger$ErrorCode",
+      "org.openecomp.mso.requestsdb.HibernateUtil",
+      "org.apache.http.client.config.RequestConfig",
+      "org.jboss.resteasy.specimpl.MultivaluedTreeMap",
+      "org.jboss.resteasy.util.CaseInsensitiveMap$CaseInsensitiveComparator",
+      "org.jboss.resteasy.util.CaseInsensitiveMap",
+      "org.jboss.resteasy.core.Headers",
+      "org.openecomp.mso.requestsdb.RequestsDatabase",
+      "org.openecomp.mso.properties.MsoPropertiesParameters$MsoPropertiesType",
+      "org.openecomp.mso.properties.MsoPropertiesException"
+    );
+  }
+}
diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java
new file mode 100644
index 0000000..712cdb2
--- /dev/null
+++ b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java
@@ -0,0 +1,300 @@
+/*-
+ * ============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;
+
+
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+import org.apache.http.HttpStatus;
+import org.apache.http.HttpVersion;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.message.BasicStatusLine;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+
+/**
+ */
+public class HealthCheckUtilsTest {
+
+    private static HealthCheckUtils utils;
+    private static String port = "8080";
+    private static String ip1 = "localhost";
+    private static String ip2 = "192.3.2.1";
+    private static String iptest = "test/";
+    private static String apihUrl1 = "/api/healthcheck";
+    private static String apihUrl2 = "/api/healthcheck2";
+    private static String bpmnUrl1 = "/bpmn/healthcheck";
+    private static String raUrl1 = "/tenants/healthcheck";
+    private static String raUrl2 = "/vnf/healthcheck";
+    private static String raUrl3 = "/sdnc/healthcheck";
+    private static MsoJavaProperties properties;
+    private static String sslEnable = "false";
+    private static CloseableHttpClient client;
+    private static CloseableHttpResponse nokRes, okRes;
+
+    @BeforeClass
+    public static final void prepareMockvalues() {
+        utils = Mockito.mock(HealthCheckUtils.class);
+        client = Mockito.mock(CloseableHttpClient.class);
+        nokRes = Mockito.mock(CloseableHttpResponse.class);
+        okRes = Mockito.mock(CloseableHttpResponse.class);
+        Mockito.when(nokRes.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_SERVICE_UNAVAILABLE, "FINE!"));;
+        Mockito.when(okRes.getStatusLine()).thenReturn(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "FINE!"));
+
+        properties = new MsoJavaProperties();
+        properties.setProperty("server-port", port);
+        properties.setProperty("ssl-enable", sslEnable);
+        properties.setProperty("apih-load-balancer", ip1);
+        properties.setProperty("apih-healthcheck-urn",apihUrl1 + "," + apihUrl2);
+        properties.setProperty("camunda-load-balancer",ip1);
+        properties.setProperty("camunda-healthcheck-urn",bpmnUrl1);
+        properties.setProperty("jra-load-balancer",ip1);
+        properties.setProperty("jra-healthcheck-urn",raUrl1 + "," + raUrl2 + "," + raUrl3);
+        properties.setProperty("apih-nodehealthcheck-urn", apihUrl1);
+        properties.setProperty("camunda-nodehealthcheck-urn", bpmnUrl1);
+        properties.setProperty("jra-nodehealthcheck-urn", raUrl1);
+
+        Mockito.when(utils.loadTopologyProperties()).thenReturn(properties);
+        Mockito.when(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.APIH, null)).thenCallRealMethod();
+        Mockito.when(utils.verifyNodeHealthCheck(HealthCheckUtils.NodeType.RA, null)).thenCallRealMethod();
+        Mockito.when(utils.verifyGlobalHealthCheck(true, null)).thenCallRealMethod();
+        Mockito.when(utils.verifyGlobalHealthCheck(false, null)).thenCallRealMethod();
+
+        Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, sslEnable)).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, null)).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "true")).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "otherValue")).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "True")).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (ip1, port, raUrl1, "TRUE")).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (ip1, null, raUrl1, null)).thenCallRealMethod();
+        Mockito.when(utils.getFinalUrl (iptest, null, raUrl1, null)).thenCallRealMethod();
+
+        System.setProperty("jboss.qualified.host.name", ip1);
+    }
+
+    @Test
+    public final void testVerifyNodeHealthCheck () {
+        Mockito.when (utils.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenReturn(true);
+        Mockito.when (utils.verifyLocalHealth(ip1, port, apihUrl2, sslEnable, null)).thenReturn(true);
+        Mockito.when (utils.verifyLocalHealth(ip2, port, apihUrl2, sslEnable, null)).thenReturn(true);
+        Mockito.when (utils.verifyLocalHealth(ip2, port, apihUrl1, sslEnable, null)).thenReturn(false);
+        Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl1, sslEnable, null)).thenReturn(true);
+        Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl2, sslEnable, null)).thenReturn(false);
+        Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl3, sslEnable, null)).thenReturn(true);
+
+        assertTrue (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.APIH, null));
+        assertFalse (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.RA, null));
+
+        Mockito.when (utils.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenReturn(false);
+        Mockito.when (utils.verifyLocalHealth(ip1, port, raUrl2, sslEnable, null)).thenReturn(true);
+        assertFalse (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.APIH, null));
+        assertTrue (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.RA, null));
+
+        Mockito.when (utils.verifyLocalHealth(ip2, port, apihUrl1, sslEnable, null)).thenReturn(true);
+        assertFalse (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.APIH, null));
+        assertTrue (utils.verifyNodeHealthCheck (HealthCheckUtils.NodeType.RA, null));
+
+    }
+
+    @Test
+    public final void testVerifyGlobalHealthCheckBPMN () {
+
+        // healthcheck of bpmn returns false
+        Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(false);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
+
+        // verify BPMN healthcheck
+        assertFalse(utils.verifyGlobalHealthCheck (true, null));
+
+        // do not verify BPMN healthcheck
+        assertTrue(utils.verifyGlobalHealthCheck (false, null));
+
+        Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
+        assertTrue(utils.verifyGlobalHealthCheck (true, null));
+    }
+
+    @Test
+    public final void testVerifyGlobalHealthCheckAPIH () {
+
+        Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
+        assertTrue(utils.verifyGlobalHealthCheck (true, null));
+
+        Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(false);
+        assertFalse(utils.verifyGlobalHealthCheck (true, null));
+    }
+
+    @Test
+    public final void testVerifyGlobalHealthCheckRA () {
+        // all health check apis returns true
+        Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
+        assertTrue(utils.verifyGlobalHealthCheck (true, null));
+
+
+        // 3rd ra api return false; others return true
+        Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(false);
+        assertFalse(utils.verifyGlobalHealthCheck (true, null));
+    }
+
+    @Test
+    public final void testGetFinalUrl () {
+        String finalUrl1 = utils.getFinalUrl (ip1, port, raUrl1, sslEnable);
+        assertTrue (finalUrl1.equals ("http://" + ip1 + ":" + port + raUrl1));
+
+        String finalUrl2 = utils.getFinalUrl (ip1, port, raUrl1, "true");
+        assertTrue (finalUrl2.equals ("https://" + ip1 + ":" + port + raUrl1));
+
+        String finalUrl3 = utils.getFinalUrl (ip1, port, raUrl1, null);
+        assertTrue (finalUrl3.equals ("http://" + ip1 + ":" + port + raUrl1));
+
+        String finalUrl4 = utils.getFinalUrl (ip1, port, raUrl1, "otherValue");
+        assertTrue (finalUrl4.equals ("http://" + ip1 + ":" + port + raUrl1));
+
+        String finalUrl5 = utils.getFinalUrl (ip1, port, raUrl1, "True");
+        assertTrue (finalUrl5.equals ("https://" + ip1 + ":" + port + raUrl1));
+
+        String finalUrl6 = utils.getFinalUrl (ip1, port, raUrl1, "TRUE");
+        assertTrue (finalUrl6.equals ("https://" + ip1 + ":" + port + raUrl1));
+
+        String finalUrl7 = utils.getFinalUrl (ip1, null, raUrl1, null);
+        assertTrue (finalUrl7.equals (ip1 + raUrl1));
+
+        String finalUrl8 = utils.getFinalUrl (iptest, null, raUrl1, null);
+        assertTrue (finalUrl8.equals ("test" + raUrl1));
+    }
+
+    @Test
+    public final void testVerifyLocalHealth() {
+        HealthCheckUtils tempUtil = Mockito.mock(HealthCheckUtils.class);
+
+        Mockito.when(tempUtil.verifyLocalHealth(ip1, port, apihUrl1, sslEnable, null)).thenCallRealMethod ();
+        Mockito.when(tempUtil.getFinalUrl (ip1, port, apihUrl1, sslEnable)).thenCallRealMethod ();
+        Mockito.when(tempUtil.getHttpClient()).thenReturn (client);
+
+        try {
+            Mockito.when (client.execute (any(HttpUriRequest.class))).thenReturn (okRes);
+            Boolean res1 = (Boolean)invokeProtectedMethod(tempUtil, "verifyLocalHealth", ip1, port, apihUrl1, sslEnable, null);
+            assertTrue(res1);
+
+            Mockito.when (client.execute (any(HttpUriRequest.class))).thenReturn (nokRes);
+            Boolean res2 = (Boolean)invokeProtectedMethod(tempUtil, "verifyLocalHealth", ip1, port, apihUrl1, sslEnable, null);
+            assertFalse(res2);
+
+        } catch (Exception e) {
+            e.printStackTrace ();
+        }
+
+    }
+
+
+    @Test
+    public final void NullityCheck () {
+        Mockito.when(utils.verifyLocalHealth(ip1, null, bpmnUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, apihUrl1, null, null)).thenReturn(true);
+        Mockito.when(utils.verifyLocalHealth(ip1, null, raUrl1, null, null)).thenReturn(true);
+
+        assertTrue (utils.verifyGlobalHealthCheck (true, null));
+
+        // mising server-port parameter
+        MsoJavaProperties newProperties1 = new MsoJavaProperties();
+        Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties1);
+
+        newProperties1.setProperty("apih-load-balancer", ip1);
+        newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1);
+        newProperties1.setProperty("camunda-load-balancer",ip1);
+        newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1);
+        newProperties1.setProperty("jra-load-balancer",ip1);
+        newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1);
+
+        assertFalse (utils.verifyGlobalHealthCheck (true, null));
+
+        // mising apih-server-list parameter
+        MsoJavaProperties newProperties2 = new MsoJavaProperties();
+        Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties2);
+
+        newProperties2.setProperty("server-port", port);
+        newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1);
+        newProperties1.setProperty("camunda-load-balancer",ip1);
+        newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1);
+        newProperties1.setProperty("jra-load-balancer",ip1);
+        newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1);
+
+        assertFalse (utils.verifyGlobalHealthCheck (true, null));
+
+        // mising jra-healthcheck-urn parameter
+        MsoJavaProperties newProperties3 = new MsoJavaProperties();
+        Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties3);
+
+        newProperties3.setProperty("server-port", port);
+        newProperties1.setProperty("apih-load-balancer", ip1);
+        newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1);
+        newProperties1.setProperty("camunda-load-balancer",ip1);
+        newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1);
+        newProperties1.setProperty("jra-load-balancer",ip1);
+        newProperties3.setProperty("jra-server-list",ip1);
+
+        assertFalse (utils.verifyGlobalHealthCheck (true, null));
+
+        Mockito.when(utils.loadTopologyProperties()).thenReturn(properties);
+    }
+
+    // User reflection to invoke to avoid change the publicity of the method
+    private static Object invokeProtectedMethod (HealthCheckUtils tempUtil, String methodName, String arg1, String arg2, String arg3, String arg4, String arg5) {
+        Method method;
+        try {
+            method = HealthCheckUtils.class.getDeclaredMethod(methodName, String.class, String.class, String.class, String.class, String.class);
+            method.setAccessible(true);
+            return  method.invoke(tempUtil, arg1, arg2, arg3, arg4, arg5);
+        } catch (NoSuchMethodException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (SecurityException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (IllegalArgumentException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } catch (InvocationTargetException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return null;
+    }
+}
diff --git a/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTest.java b/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTest.java
new file mode 100644
index 0000000..3a05a77
--- /dev/null
+++ b/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTest.java
@@ -0,0 +1,24 @@
+/*
+ * This file was automatically generated by EvoSuite
+ * Mon Nov 14 08:26:39 GMT 2016
+ */
+
+package org.openecomp.mso;
+
+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 MsoStatusUtilESTest extends MsoStatusUtilESTestscaffolding {
+
+  @Test(timeout = 4000)
+  public void test0()  throws Throwable  {
+      MsoStatusUtil msoStatusUtil0 = new MsoStatusUtil();
+      boolean boolean0 = msoStatusUtil0.getSiteStatus("getSiteStatus");
+      assertFalse(boolean0);
+  }
+}
diff --git a/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTestscaffolding.java b/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTestscaffolding.java
new file mode 100644
index 0000000..bd9141a
--- /dev/null
+++ b/status-control/src/test/java/org/openecomp/mso/MsoStatusUtilESTestscaffolding.java
@@ -0,0 +1,121 @@
+/**
+ * Scaffolding file used to store all the setups needed to run 
+ * tests automatically generated by EvoSuite
+ * Mon Nov 14 08:26:39 GMT 2016
+ */
+
+package org.openecomp.mso;
+
+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 MsoStatusUtilESTestscaffolding {
+
+  @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.MsoStatusUtil"; 
+    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(MsoStatusUtilESTestscaffolding.class.getClassLoader() ,
+      "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES",
+      "org.openecomp.mso.logger.MsoLogger$ErrorCode",
+      "com.att.eelf.configuration.EELFLogger",
+      "org.hibernate.engine.spi.Mapping",
+      "org.hibernate.criterion.Order",
+      "com.att.eelf.configuration.SLF4jWrapper",
+      "org.hibernate.Query",
+      "com.att.eelf.i18n.EELFResourceManager",
+      "org.openecomp.mso.requestsdb.InfraActiveRequests",
+      "org.hibernate.criterion.Criterion",
+      "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.hibernate.SessionFactory",
+      "org.openecomp.mso.logger.MsoLogger$StatusCode",
+      "com.att.eelf.configuration.EELFManager",
+      "org.openecomp.mso.MsoStatusUtil",
+      "com.att.eelf.i18n.EELFMsgs",
+      "org.openecomp.mso.requestsdb.RequestsDatabase",
+      "com.att.eelf.configuration.EELFLogger$Level",
+      "org.openecomp.mso.requestsdb.MockRequestsDatabase",
+      "org.openecomp.mso.logger.MsoLogger$Catalog",
+      "org.hibernate.BasicQueryContract",
+      "com.att.eelf.i18n.EELFResourceManager$1",
+      "org.openecomp.mso.requestsdb.HibernateUtil",
+      "org.openecomp.mso.requestsdb.InfraRequests",
+      "org.openecomp.mso.requestsdb.SiteStatus"
+    );
+  } 
+
+  private static void resetClasses() {
+    org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MsoStatusUtilESTestscaffolding.class.getClassLoader());
+
+    org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
+      "com.att.eelf.i18n.EELFResourceManager",
+      "org.openecomp.mso.logger.MessageEnum",
+      "org.openecomp.mso.logger.MsoLogger$Catalog",
+      "org.openecomp.mso.logger.MsoLogger$ErrorCode",
+      "org.openecomp.mso.logger.MsoLogger",
+      "com.att.eelf.i18n.EELFMsgs",
+      "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES",
+      "com.att.eelf.configuration.EELFLogger$Level",
+      "com.att.eelf.configuration.EELFManager",
+      "org.openecomp.mso.requestsdb.HibernateUtil",
+      "org.openecomp.mso.requestsdb.RequestsDatabase"
+    );
+  }
+}
