protected static void waitForClusterStable() throws Exception {
    Long timeout = 1200L;
    String state = systemClient.upgrade().getClusterState();

    Long startTime = System.currentTimeMillis();
    Long timeoutInMilliSeconds = timeout * 1000;

    while (true) {
      if (systemClient.upgrade().getClusterState().contains("STABLE")) {

        // Wait an extra 10 seconds before returning...
        // Thread.sleep(10000);
        logger.info("Cluster is STABLE");
        return;
      }

      // retry after 10 seconds...
      logger.info("Cluster is " + state + ", retry after 10 seconds");
      Thread.sleep(10000);

      //  No need to try further...
      if ((System.currentTimeMillis() - startTime) > timeoutInMilliSeconds) {
        logger.info("Cluster is still not stable after waiting for " + timeout + " seconds");
        break;
      }
    }
  }
  @BeforeClass
  public static synchronized void setup_LocalUserModeBaseClass() throws Exception {
    // get the Bourne IP from parameter
    String param_IP = System.getProperty("APP_HOST_NAMES");
    if (param_IP != null) {
      controllerNodeEndpoint = param_IP;
    } else {
      Properties properties = new Properties();
      properties.load(ClassLoader.class.getResourceAsStream("/test-env.conf"));
      controllerNodeEndpoint = properties.getProperty("APP_HOST_NAMES");
    }
    logger.info("Controller node endpoint: " + controllerNodeEndpoint);

    systemClient =
        new ViPRSystemClient(controllerNodeEndpoint, true).withLogin("root", rootPassword);
    coreClient = new ViPRCoreClient(controllerNodeEndpoint, true).withLogin("root", rootPassword);

    waitForClusterStable();

    PropertyInfoRestRep propertyInfoRestRep = systemClient.config().getProperties();
    String viprDataIps = propertyInfoRestRep.getProperty("system_datanode_ipaddrs");
    if (viprDataIps != null) {
      dataNodeEndpoint = viprDataIps.split(",")[0];
    }
  }
  @AfterClass
  public static void teardown_LocalUserModeBaseClass() throws Exception {
    if (systemClient != null) {
      systemClient.auth().logout();
    }

    if (coreClient != null) {
      coreClient.auth().logout();
    }
  }
 public static List<NodeDiagnostics> getNodeDiagnotics(ViPRSystemClient client) {
   return client.health().getDiagnostics(null, null).getNodeDiagnosticsList();
 }
 public static StorageStats getStorageStats(ViPRSystemClient client) {
   return client.health().getStorageStats();
 }
 public static List<NodeHealth> getNodeHealth(ViPRSystemClient client) {
   return client.health().getHealth().getNodeHealthList();
 }
 public static List<NodeStats> getNodeStats(ViPRSystemClient client) {
   return client.health().getStats().getNodeStatsList();
 }