use of com.intel.mtwilson.datatypes.TxtHost in project OpenAttestation by OpenAttestation.
the class HostBOTest method testAddHost.
@Test
public void testAddHost() {
TxtHost host = mockHost();
when(hostsJpaController.findByName(anyString())).thenReturn(null);
when(hostsJpaController.findByIPAddress(anyString())).thenReturn(null);
TblMle biosMle = new TblMle(1, "DELL", "A08", "PCR", "BIOS", "0");
TblMle vmmMle = new TblMle(2, "XEN", "4.3", "PCR", "VMM", "18");
when(mleJpaController.findBiosMle(anyString(), anyString(), anyString())).thenReturn(biosMle);
when(mleJpaController.findVmmMle(anyString(), anyString(), anyString(), anyString())).thenReturn(vmmMle);
String response = hostBO.addHost(host);
assertTrue(response.equalsIgnoreCase("true"));
}
use of com.intel.mtwilson.datatypes.TxtHost 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.TxtHost 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