use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategy method getPcrManifestMap.
private HashMap<String, ? extends IManifest> getPcrManifestMap(TblMle mle) {
HashMap<String, IManifest> pcrManifests = new HashMap<String, IManifest>();
for (TblPcrManifest pcrMf : mle.getTblPcrManifestCollection()) {
// Call query method to avoid the objects from the cache
pcrMf = getPcrManifestJpaController().findPcrManifestById(pcrMf.getId());
pcrManifests.put(pcrMf.getName().trim(), new PcrManifest(Integer.valueOf(pcrMf.getName()), pcrMf.getValue().trim()));
log.info("{} - {}", new Object[] { pcrMf.getName(), pcrMf.getValue() });
}
return pcrManifests;
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class HostTrustBOTest method mockGetHostByIpAddress.
public TblHosts mockGetHostByIpAddress() {
TblHosts tblHosts = new TblHosts();
tblHosts.setId(1);
tblHosts.setName(SERVER_NAME);
tblHosts.setIPAddress(SERVER_NAME);
String biosName = "DELL";
String biosVersion = "A08";
String oemName = "DELL";
TblMle biosMle = new TblMle();
biosMle.setId(1);
biosMle.setName(biosName);
biosMle.setVersion(biosVersion);
TblOem oem = new TblOem();
oem.setId(1);
oem.setName(oemName);
biosMle.setOemId(oem);
Collection<TblPcrManifest> tblPcrManifestCollection = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifest = new TblPcrManifest();
tblPcrManifest.setId(1);
tblPcrManifest.setName("0");
tblPcrManifest.setValue("31B97D97B4679917EC3C1D943635693FFBAB4143");
tblPcrManifestCollection.add(tblPcrManifest);
biosMle.setTblPcrManifestCollection(tblPcrManifestCollection);
tblHosts.setBiosMleId(biosMle);
String vmmName = "XEN";
String vmmVersion = "4.3";
String osName = "Fedora";
String osVersion = "20";
TblMle vmmMle = new TblMle();
vmmMle.setId(1);
vmmMle.setName(vmmName);
vmmMle.setVersion(vmmVersion);
TblOs os = new TblOs();
os.setId(1);
os.setName(osName);
os.setVersion(osVersion);
vmmMle.setOsId(os);
Collection<TblPcrManifest> tblPcrManifestCollectionVMM = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifestVMM = new TblPcrManifest();
tblPcrManifestVMM.setId(2);
tblPcrManifestVMM.setName("18");
tblPcrManifestVMM.setValue("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
tblPcrManifestCollection.add(tblPcrManifestVMM);
vmmMle.setTblPcrManifestCollection(tblPcrManifestCollectionVMM);
tblHosts.setVmmMleId(vmmMle);
return tblHosts;
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategyTest method testGetBiosGoodKnownManifest.
@Test
public void testGetBiosGoodKnownManifest() {
when(mleJpaController.findBiosMle(anyString(), anyString(), anyString())).thenReturn(mockFindBiosMle());
TblPcrManifest pcr = new TblPcrManifest(1, "0", "31B97D97B4679917EC3C1D943635693FFBAB4143");
when(pcrManifestJpaController.findPcrManifestById(any(Integer.class))).thenReturn(pcr);
HashMap<String, IManifest> pcrManifests = (HashMap<String, IManifest>) gkvstrategy.getBiosGoodKnownManifest("DELL", "A08", "DELL");
assertNotNull(pcrManifests);
assertEquals(pcrManifests.size(), 1);
PcrManifest pcrMf = (PcrManifest) pcrManifests.get("0");
assertNotNull(pcrMf);
assertEquals(pcrMf.getPcrNumber(), 0);
assertEquals(pcrMf.getPcrValue(), "31B97D97B4679917EC3C1D943635693FFBAB4143");
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategyTest method testGetVmmGoodKnownManifest.
@Test
public void testGetVmmGoodKnownManifest() {
when(mleJpaController.findVmmMle(anyString(), anyString(), anyString(), anyString())).thenReturn(mockFindVmmMle());
TblPcrManifest pcr = new TblPcrManifest(1, "18", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
when(pcrManifestJpaController.findPcrManifestById(any(Integer.class))).thenReturn(pcr);
HashMap<String, IManifest> pcrManifests = (HashMap<String, IManifest>) gkvstrategy.getVmmGoodKnownManifest("XEN", "4.3", "Fedora", "20", 1);
assertNotNull(pcrManifests);
assertEquals(pcrManifests.size(), 1);
PcrManifest pcrMf = (PcrManifest) pcrManifests.get("18");
assertNotNull(pcrMf);
assertEquals(pcrMf.getPcrNumber(), 18);
assertEquals(pcrMf.getPcrValue(), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
}
use of com.intel.mtwilson.as.data.TblPcrManifest in project OpenAttestation by OpenAttestation.
the class PcrGKVStrategyTest method mockFindVmmMle.
public TblMle mockFindVmmMle() {
String vmmName = "XEN";
String vmmVersion = "4.3";
String osName = "Fedora";
String osVersion = "20";
TblMle vmmMle = new TblMle();
vmmMle.setId(1);
vmmMle.setName(vmmName);
vmmMle.setVersion(vmmVersion);
TblOs os = new TblOs();
os.setId(1);
os.setName(osName);
os.setVersion(osVersion);
vmmMle.setOsId(os);
Collection<TblPcrManifest> tblPcrManifestCollection = new ArrayList<TblPcrManifest>();
TblPcrManifest tblPcrManifest = new TblPcrManifest();
tblPcrManifest.setId(2);
tblPcrManifest.setName("18");
tblPcrManifestCollection.add(tblPcrManifest);
vmmMle.setTblPcrManifestCollection(tblPcrManifestCollection);
return vmmMle;
}
Aggregations