use of com.intel.mtwilson.datatypes.TxtHostRecord in project OpenAttestation by OpenAttestation.
the class DemoPortalServicesImpl method getSingleHostTrust.
/**
* This Method is used to get Trust Status for Single Host.
*
* @param hostName
* @param apiClientServices
* @param trustedCertificates
* @return
* @throws DemoPortalException
*/
@Override
public TrustedHostVO getSingleHostTrust(String hostName, AttestationService apiClientServices, X509Certificate[] trustedCertificates, boolean forceVerify) throws DemoPortalException {
TrustedHostVO hostVO = null;
HostDetailsEntityVO hostDetailsEntityVO = new HostDetailsEntityVO();
hostDetailsEntityVO.setHostName(hostName);
String xmloutput = null;
HostTrustResponse hostTrustResponse = null;
try {
log.info("Getting trust Information for Host " + hostName);
//xmloutput = apiClientServices.getSamlForHost(new Hostname(hostName), false);
// forceVerify=false when loading dashboard, it is true when refreshing host (Refresh button)
xmloutput = apiClientServices.getSamlForHost(new Hostname(hostName), forceVerify);
TrustAssertion trustAssertion = new TrustAssertion(trustedCertificates, xmloutput);
HostTrustAssertion hostTrustAssertion = trustAssertion.getTrustAssertion(hostName);
//Set<Hostname> hostnames = new HashSet<Hostname>();
//hostnames.add(new Hostname(hostName));
//xmloutput = ConverterUtil.formateXMLString(apiClientServices.getSamlForMultipleHosts(hostnames, false));
hostTrustResponse = apiClientServices.getHostTrust(new Hostname(hostDetailsEntityVO.getHostName()));
List<TxtHostRecord> hosts = apiClientServices.queryForHosts(hostDetailsEntityVO.getHostName());
TxtHostRecord txtHostRecord = null;
for (TxtHostRecord record : hosts) {
if (record.HostName.equals(hostDetailsEntityVO.getHostName())) {
txtHostRecord = record;
}
}
hostVO = ConverterUtil.getTrustedHostVoFromHostTrustResponseAndTxtHostRecord(hostTrustResponse, txtHostRecord, hostTrustAssertion);
} catch (Exception e) {
hostVO = ConverterUtil.getTrustedHostVoFromHostTrustResponseAndErrorMessage(hostName, e.getMessage());
}
return hostVO;
}
use of com.intel.mtwilson.datatypes.TxtHostRecord in project OpenAttestation by OpenAttestation.
the class ConverterUtil method getTxtHostFromHostVO.
public static TxtHost getTxtHostFromHostVO(HostDetailsEntityVO dataVO) {
TxtHostRecord hostRecord = new TxtHostRecord();
hostRecord.AddOn_Connection_String = dataVO.getvCenterDetails();
hostRecord.BIOS_Name = dataVO.getBiosName();
hostRecord.BIOS_Oem = dataVO.getOemName();
hostRecord.BIOS_Version = dataVO.getBiosBuildNo();
hostRecord.Description = dataVO.getHostDescription();
hostRecord.Email = dataVO.getEmailAddress();
hostRecord.HostName = dataVO.getHostName();
hostRecord.IPAddress = dataVO.getHostIPAddress();
hostRecord.Port = Integer.parseInt(dataVO.getHostPort());
String[] osVMMInfo = dataVO.getVmmName().split(Pattern.quote(HelperConstant.OS_VMM_INFORMATION_SEPERATOR));
String osNameWithVer = osVMMInfo[0];
String[] s = osNameWithVer.split(HelperConstant.OS_VERSION_INFORMATION_SEPERATOR);
String osName = s[0];
String osVer = "";
if (s.length == 2) {
osVer = s[1];
} else {
for (int i = 1; i < s.length; i++) {
osVer += s[i] + " ";
}
}
String hypervisor = osVMMInfo[1];
hostRecord.VMM_Name = hypervisor;
hostRecord.VMM_OSName = osName;
hostRecord.VMM_OSVersion = osVer;
hostRecord.VMM_Version = dataVO.getVmmBuildNo();
return new TxtHost(hostRecord);
}
use of com.intel.mtwilson.datatypes.TxtHostRecord in project OpenAttestation by OpenAttestation.
the class HostBOTest method mockHost.
public TxtHost mockHost() {
TxtHostRecord hostRecord = new TxtHostRecord();
HostTrustStatus trustStatus = new HostTrustStatus();
hostRecord.HostName = SERVER_NAME;
hostRecord.IPAddress = SERVER_NAME;
hostRecord.BIOS_Name = "DELL";
hostRecord.BIOS_Version = "A08";
hostRecord.BIOS_Oem = "DELL";
hostRecord.VMM_Name = "XENESX";
hostRecord.VMM_Version = "4.3";
hostRecord.VMM_OSName = "Fedora";
hostRecord.VMM_OSVersion = "20";
hostRecord.AddOn_Connection_String = "intel:https://" + SERVER_NAME + ":9999";
hostRecord.Port = Integer.valueOf(9999);
trustStatus.bios = true;
trustStatus.vmm = true;
TxtHost host = new TxtHost(hostRecord, trustStatus);
return host;
}
Aggregations