Search in sources :

Example 1 with HostTrustStatus

use of com.intel.mtwilson.datatypes.HostTrustStatus in project OpenAttestation by OpenAttestation.

the class HostTrustBOTest method testGetTrustStatus.

@Test
public void testGetTrustStatus() throws Exception {
    TblHosts tblHosts = mockGetHostByIpAddress();
    doReturn(tblHosts).when(hostTrustBO).getHostByIpAddress(SERVER_NAME);
    //get pcrMap 
    HashMap<String, IManifest> pcrManifestMap = new HashMap<String, IManifest>();
    pcrManifestMap.put("0", new PcrManifest(0, "31B97D97B4679917EC3C1D943635693FFBAB4143"));
    pcrManifestMap.put("18", new PcrManifest(18, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"));
    doReturn(pcrManifestMap).when(manifestStrategy).getManifest(tblHosts);
    //get gkv for given host
    HashMap<String, IManifest> gkvBiosPcrManifestMap = new HashMap<String, IManifest>();
    HashMap<String, IManifest> gkvVmmPcrManifestMap = new HashMap<String, IManifest>();
    gkvBiosPcrManifestMap.put("0", new PcrManifest(0, "31B97D97B4679917EC3C1D943635693FFBAB4143"));
    gkvVmmPcrManifestMap.put("18", new PcrManifest(18, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"));
    doReturn(gkvBiosPcrManifestMap).when(gkvStrategy).getBiosGoodKnownManifest(anyString(), anyString(), anyString());
    doReturn(gkvVmmPcrManifestMap).when(gkvStrategy).getVmmGoodKnownManifest(anyString(), anyString(), anyString(), anyString(), any(Integer.class));
    doNothing().when(taLogJpaController).create(any(TblTaLog.class));
    HostTrustStatus trustStatus = hostTrustBO.getTrustStatus(new Hostname(SERVER_NAME));
    assertNotNull(trustStatus);
    assertTrue(trustStatus.bios);
    assertTrue(trustStatus.vmm);
}
Also used : TblTaLog(com.intel.mtwilson.as.data.TblTaLog) HashMap(java.util.HashMap) PcrManifest(com.intel.mountwilson.manifest.data.PcrManifest) TblPcrManifest(com.intel.mtwilson.as.data.TblPcrManifest) TblHosts(com.intel.mtwilson.as.data.TblHosts) Hostname(com.intel.mtwilson.util.net.Hostname) Matchers.anyString(org.mockito.Matchers.anyString) IManifest(com.intel.mountwilson.manifest.data.IManifest) HostTrustStatus(com.intel.mtwilson.datatypes.HostTrustStatus) Test(org.junit.Test)

Example 2 with HostTrustStatus

use of com.intel.mtwilson.datatypes.HostTrustStatus 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;
}
Also used : TxtHostRecord(com.intel.mtwilson.datatypes.TxtHostRecord) TxtHost(com.intel.mtwilson.datatypes.TxtHost) HostTrustStatus(com.intel.mtwilson.datatypes.HostTrustStatus)

Aggregations

HostTrustStatus (com.intel.mtwilson.datatypes.HostTrustStatus)2 IManifest (com.intel.mountwilson.manifest.data.IManifest)1 PcrManifest (com.intel.mountwilson.manifest.data.PcrManifest)1 TblHosts (com.intel.mtwilson.as.data.TblHosts)1 TblPcrManifest (com.intel.mtwilson.as.data.TblPcrManifest)1 TblTaLog (com.intel.mtwilson.as.data.TblTaLog)1 TxtHost (com.intel.mtwilson.datatypes.TxtHost)1 TxtHostRecord (com.intel.mtwilson.datatypes.TxtHostRecord)1 Hostname (com.intel.mtwilson.util.net.Hostname)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1