use of com.emc.vipr.client.ViPRSystemClient in project coprhd-controller by CoprHD.
the class PasswordUtil method getPasswordValidPromptRules.
public static String getPasswordValidPromptRules(String[][] PASSWORD_VALID_PROMPT) {
// NOSONAR
// ("Suppressing Sonar violation of Field name should comply with naming convention")
ViPRSystemClient client = BourneUtil.getSysClient();
List<String> promptRules = new ArrayList<String>();
StringBuilder promptString = new StringBuilder();
Map<String, String> properties = client.config().getProperties().getProperties();
for (int i = 0; i < PASSWORD_VALID_PROMPT.length; i++) {
String key = PASSWORD_VALID_PROMPT[i][0];
String value = properties.get(key);
if (NumberUtils.toInt(value) != 0) {
promptRules.add(MessageFormat.format(PASSWORD_VALID_PROMPT[i][1], value));
}
}
promptString.append("<p>Password Validation Rules:</p>");
promptString.append("<ul>");
for (String item : promptRules) {
promptString.append("<li>").append(item).append("</li>");
}
promptString.append("</ul>");
return promptString.toString();
}
use of com.emc.vipr.client.ViPRSystemClient in project coprhd-controller by CoprHD.
the class SystemHealth method nodeRecoveryVapp.
public static void nodeRecoveryVapp() {
ViPRSystemClient client = BourneUtil.getSysClient();
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
if (recoveryStatus.getStartTime() != null) {
DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
renderArgs.put("startTime", startTime);
}
if (recoveryStatus.getEndTime() != null) {
DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
renderArgs.put("endTime", endTime);
}
RecoveryPrecheckStatus recoveryPrecheckStatus = client.control().getRecoveryPrecheckStatus();
String precheckMsg = "";
switch(recoveryPrecheckStatus.getStatus()) {
case RECOVERY_NEEDED:
precheckMsg = Messages.get("nodeRecovery.precheck.success", recoveryPrecheckStatus.getRecoverables().toString());
break;
case ALL_GOOD:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.allgood");
break;
case VAPP_IN_DR_OR_GEO:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.drorgeo");
break;
case NODE_UNREACHABLE:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.unreachable");
break;
case CORRUPTED_NODE_COUNT_MORE_THAN_QUORUM:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.quorum");
break;
case CORRUPTED_NODE_FOR_OTHER_REASON:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.other");
break;
}
renderArgs.put("precheckMsg", precheckMsg);
renderArgs.put("precheckStatus", recoveryPrecheckStatus.getStatus().name());
String recoveringMsg = Messages.get("nodeRecovery.recovering.status", recoveryPrecheckStatus.getRecoverables().toString());
renderArgs.put("recoveringMsg", recoveringMsg);
ClusterInfo clusterInfo = AdminDashboardUtils.getClusterInfo();
render(recoveryStatus, clusterInfo);
}
use of com.emc.vipr.client.ViPRSystemClient in project coprhd-controller by CoprHD.
the class SystemHealth method getRecoveryStatus.
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void getRecoveryStatus() {
ViPRSystemClient client = BourneUtil.getSysClient();
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
JsonElement jsonElement = new Gson().toJsonTree(recoveryStatus);
JsonObject jsonObj = jsonElement.getAsJsonObject();
if (recoveryStatus.getStartTime() != null) {
DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
jsonObj.addProperty("startTime", startTime.toString());
}
if (recoveryStatus.getEndTime() != null) {
DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
jsonObj.addProperty("endTime", endTime.toString());
}
renderJSON(jsonObj.toString());
}
use of com.emc.vipr.client.ViPRSystemClient in project coprhd-controller by CoprHD.
the class SystemHealth method nodeRecovery.
public static void nodeRecovery() {
ViPRSystemClient client = BourneUtil.getSysClient();
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
if (recoveryStatus.getStartTime() != null) {
DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
renderArgs.put("startTime", startTime);
}
if (recoveryStatus.getEndTime() != null) {
DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
renderArgs.put("endTime", endTime);
}
ClusterInfo clusterInfo = AdminDashboardUtils.getClusterInfo();
render(recoveryStatus, clusterInfo);
}
use of com.emc.vipr.client.ViPRSystemClient in project coprhd-controller by CoprHD.
the class LocalUserMode method setupLocalUserModeBaseClass.
@BeforeClass
public static synchronized void setupLocalUserModeBaseClass() 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];
}
}
Aggregations