use of com.emc.storageos.db.client.model.Host.HostType in project coprhd-controller by CoprHD.
the class HostConnectionValidator method isHostConnectionValid.
public static boolean isHostConnectionValid(HostParam hostParam, Host existingHost) {
HostType hostType = HostType.valueOf(hostParam.getType());
HostConnectionValidator hostConnectionValidator = validators.get(hostType);
if (hostConnectionValidator != null) {
return hostConnectionValidator.validateConnection(hostParam, existingHost);
}
return true;
}
use of com.emc.storageos.db.client.model.Host.HostType in project coprhd-controller by CoprHD.
the class HpuxHostConnectionValidator method validateConnection.
@Override
public boolean validateConnection(HostParam hostParam, Host existingHost) {
HostType hostType = HostType.valueOf(hostParam.getType());
if (getType().equals(hostType) == false) {
throw new IllegalStateException(String.format("Invalid HostType [%s]", hostParam.getType()));
}
String password = hostParam.getPassword();
if (password == null && existingHost != null) {
password = existingHost.getPassword();
}
HpuxSystem cli = new HpuxSystem(hostParam.getHostName(), hostParam.getPortNumber(), hostParam.getUserName(), password);
try {
cli.listIPInterfaces();
return true;
} catch (Exception e) {
log.error(String.format("Error Validating Host %s", hostParam.getName()), e);
}
return false;
}
use of com.emc.storageos.db.client.model.Host.HostType in project coprhd-controller by CoprHD.
the class WindowsHostConnectionValidator method validateConnection.
@Override
public boolean validateConnection(HostParam hostParam, Host existingHost) {
HostType hostType = HostType.valueOf(hostParam.getType());
if (getType().equals(hostType) == false) {
throw new IllegalStateException(String.format("Invalid HostType [%s]", hostParam.getType()));
}
String password = hostParam.getPassword();
if (password == null && existingHost != null) {
password = existingHost.getPassword();
}
List<URI> authProviderIds = dbClient.queryByType(AuthnProvider.class, true);
List<AuthnProvider> authProviders = dbClient.queryObject(AuthnProvider.class, authProviderIds);
KerberosUtil.initializeKerberos(authProviders);
WinRMTarget target = new WinRMTarget(hostParam.getHostName(), hostParam.getPortNumber(), hostParam.getUseSsl(), hostParam.getUserName(), password);
WindowsSystemWinRM cli = new WindowsSystemWinRM(target);
try {
cli.listDiskDrives();
return true;
} catch (Exception e) {
log.error(String.format("Error Validating Host %s", hostParam.getName()), e);
}
return false;
}
use of com.emc.storageos.db.client.model.Host.HostType in project coprhd-controller by CoprHD.
the class LinuxHostConnectionValidator method validateConnection.
@Override
public boolean validateConnection(HostParam hostParam, Host existingHost) {
HostType hostType = HostType.valueOf(hostParam.getType());
if (getType().equals(hostType) == false) {
throw new IllegalStateException(String.format("Invalid HostType [%s]", hostParam.getType()));
}
String password = hostParam.getPassword();
if (password == null && existingHost != null) {
password = existingHost.getPassword();
}
LinuxSystemCLI cli = new LinuxSystemCLI(hostParam.getHostName(), hostParam.getPortNumber(), hostParam.getUserName(), password);
try {
cli.listMountPoints();
return true;
} catch (Exception e) {
log.error(String.format("Error Validating Host %s", hostParam.getName()), e);
}
return false;
}
Aggregations