use of com.emc.hpux.HpuxSystem in project coprhd-controller by CoprHD.
the class HpuxHostDiscoveryAdapter method discoverIpInterfaces.
@Override
protected void discoverIpInterfaces(Host host, List<IpInterface> oldIpInterfaces) {
HpuxSystem hpux = getCli(host);
for (IPInterface nic : hpux.listIPInterfaces()) {
if (StringUtils.isNotBlank(nic.getIpAddress())) {
IpInterface ipInterface = getOrCreateIpInterface(oldIpInterfaces, nic.getIpAddress());
discoverIp4Interface(host, ipInterface, nic);
}
}
}
use of com.emc.hpux.HpuxSystem in project coprhd-controller by CoprHD.
the class HpuxHostDiscoveryAdapter method getVersion.
protected HpuxVersion getVersion(Host host) {
HpuxSystem cli = getCli(host);
HpuxVersion version = cli.getVersion();
if (version == null) {
error("Could not determine version of HPUX host %s", host.getLabel());
return new HpuxVersion("");
} else {
return version;
}
}
use of com.emc.hpux.HpuxSystem 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.hpux.HpuxSystem in project coprhd-controller by CoprHD.
the class HpuxService method convertHost.
public static HpuxSystem convertHost(Host host) {
HpuxSystem cli = new HpuxSystem();
cli.setHost(host.getHostName());
cli.setPort(host.getPortNumber());
cli.setUsername(host.getUsername());
cli.setPassword(host.getPassword());
cli.setHostId(host.getId());
return cli;
}
use of com.emc.hpux.HpuxSystem in project coprhd-controller by CoprHD.
the class HostRescanDeviceController method getRescanAdapter.
private HostRescanAdapter getRescanAdapter(Host host) {
if (HostType.Linux.name().equalsIgnoreCase(host.getType())) {
return new LinuxSystemCLI(host.getHostName(), host.getPortNumber(), host.getUsername(), host.getPassword());
} else if (HostType.AIX.name().equalsIgnoreCase(host.getType())) {
return new AixSystem(host.getHostName(), host.getPortNumber(), host.getUsername(), host.getPassword());
} else if (HostType.HPUX.name().equalsIgnoreCase(host.getType())) {
return new HpuxSystem(host.getHostName(), host.getPortNumber(), host.getUsername(), host.getPassword());
} else if (HostType.Windows.name().equalsIgnoreCase(host.getType())) {
List<AuthnProvider> authProviders = new ArrayList<AuthnProvider>();
for (URI authProviderId : getDbClient().queryByType(AuthnProvider.class, true)) {
AuthnProvider authProvider = getDbClient().queryObject(AuthnProvider.class, authProviderId);
authProviders.add(authProvider);
}
KerberosUtil.initializeKerberos(authProviders);
return WindowsHostDiscoveryAdapter.createWindowsSystem(host);
} else if (HostType.Esx.name().equalsIgnoreCase(host.getType())) {
if (host.getUsername() != null && host.getPassword() != null) {
VCenterAPI vcenterAPI = EsxHostDiscoveryAdapter.createVCenterAPI(host);
List<HostSystem> hostSystems = vcenterAPI.listAllHostSystems();
if (hostSystems != null && !hostSystems.isEmpty()) {
return new HostStorageAPI(hostSystems.get(0));
} else {
return null;
}
} else if (host.getVcenterDataCenter() != null) {
// Lookup the vcenter datacenter and vcenter to retreive the HostSystem
VcenterDataCenter dataCenter = dbClient.queryObject(VcenterDataCenter.class, host.getVcenterDataCenter());
if (dataCenter == null || dataCenter.getInactive()) {
throw DeviceControllerException.exceptions.objectNotFound(host.getVcenterDataCenter());
}
Vcenter vcenter = dbClient.queryObject(Vcenter.class, dataCenter.getVcenter());
if (vcenter == null || vcenter.getInactive()) {
throw DeviceControllerException.exceptions.objectNotFound(dataCenter.getVcenter());
}
VCenterAPI vCenterAPI = VcenterDiscoveryAdapter.createVCenterAPI(vcenter);
String datacenterName = dataCenter.getLabel();
HostSystem hostSystem = vCenterAPI.findHostSystem(datacenterName, host.getHostName());
if (hostSystem != null) {
return new HostStorageAPI(hostSystem);
} else {
return null;
}
}
} else {
// Unanticipated host type
return null;
}
return null;
}
Aggregations