Search in sources :

Example 96 with VmNetworkInterface

use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.

the class MatchUserMappingToOvfVnicTest method testFindMappingEntryEmptySourceVnicProfile.

@Test
public void testFindMappingEntryEmptySourceVnicProfile() {
    VmNetworkInterface vnic = new VmNetworkInterface();
    vnic.setNetworkName(null);
    vnic.setVnicProfileName(null);
    MapVnicsContext ctx = new MapVnicsContext();
    ctx.setUserMappings(singletonList(emptySourceMapping));
    ctx.setOvfVnics(singletonList(vnic));
    underTest.handle(ctx);
    assertThat(ctx.getMatched().get(vnic), sameInstance(emptySourceMapping));
}
Also used : MapVnicsContext(org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

Example 97 with VmNetworkInterface

use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.

the class MatchUserMappingToOvfVnicTest method testFindMappingEntryNotFound.

@Test
public void testFindMappingEntryNotFound() {
    VmNetworkInterface vnic = new VmNetworkInterface();
    vnic.setNetworkName("not" + NETWORK_NAME);
    vnic.setVnicProfileName(VNIC_PROFILE2_NAME);
    MapVnicsContext ctx = new MapVnicsContext();
    ctx.setUserMappings(externalVnicProfileMappings);
    ctx.setOvfVnics(singletonList(vnic));
    underTest.handle(ctx);
    assertEquals(null, ctx.getMatched().get(vnic));
}
Also used : MapVnicsContext(org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

Example 98 with VmNetworkInterface

use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.

the class VmNetworkInterfaceDaoImpl method getAllForVm.

@Override
public List<VmNetworkInterface> getAllForVm(Guid id, Guid userId, boolean filtered) {
    MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", id).addValue("user_id", userId).addValue("is_filtered", filtered);
    List<VmNetworkInterface> results = getCallsHandler().executeReadList("GetVmNetworkInterfaceViewByVmId", VmNetworkInterfaceRowMapper.INSTANCE, parameterSource);
    Collections.sort(results, Comparator.comparing(VmNetworkInterface::getMacAddress));
    return results;
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 99 with VmNetworkInterface

use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.

the class VmNetworkInterfaceDaoTest method testGetWithNonExistingId.

/**
 * Ensures null is returned.
 */
@Test
public void testGetWithNonExistingId() {
    VmNetworkInterface result = dao.get(Guid.newGuid());
    assertNull(result);
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

Example 100 with VmNetworkInterface

use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.

the class VmNetworkInterfaceDaoTest method testGetAllInterfacesForVm.

/**
 * Ensures that a collection of interfaces related the specified VM are returned.
 */
@Test
public void testGetAllInterfacesForVm() {
    List<VmNetworkInterface> result = dao.getAllForVm(VM_ID);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (VmNetworkInterface iface : result) {
        assertEquals(VM_ID, iface.getVmId());
    }
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) Test(org.junit.Test)

Aggregations

VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)115 Test (org.junit.Test)27 ArrayList (java.util.ArrayList)25 Guid (org.ovirt.engine.core.compat.Guid)19 VM (org.ovirt.engine.core.common.businessentities.VM)16 HashMap (java.util.HashMap)11 List (java.util.List)9 Map (java.util.Map)9 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)6 MapVnicsContext (org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsContext)5 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)5 HostNicVfsConfig (org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)5 VmNetworkStatistics (org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics)5 Nic (org.ovirt.engine.api.model.Nic)4 VnicProfileHelper (org.ovirt.engine.core.bll.network.vm.VnicProfileHelper)4 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)4 Collection (java.util.Collection)3