Search in sources :

Example 61 with VmNetworkInterface

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

the class MatchUserMappingToOvfVnicTest method testFindMappingEntryEmptyInput.

@Test
public void testFindMappingEntryEmptyInput() {
    VmNetworkInterface vnic = new VmNetworkInterface();
    MapVnicsContext ctx = new MapVnicsContext();
    ctx.setUserMappings(emptyList());
    ctx.setOvfVnics(singletonList(vnic));
    underTest.handle(ctx);
    assertEquals(1, ctx.getMatched().size());
    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 62 with VmNetworkInterface

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

the class MapVnicFlowTestUtils method vnicOf.

static VmNetworkInterface vnicOf(Guid profileId, String profileName, String networkName) {
    VmNetworkInterface vnic = vnicOf(profileName, networkName);
    vnic.setVnicProfileId(profileId);
    return vnic;
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 63 with VmNetworkInterface

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

the class MapVnicFlowTestUtils method vnicOf.

static VmNetworkInterface vnicOf(String profileName, String networkName) {
    VmNetworkInterface vnic = new VmNetworkInterface();
    vnic.setVnicProfileName(profileName);
    vnic.setNetworkName(networkName);
    return vnic;
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

Example 64 with VmNetworkInterface

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

the class ResourceManager method storeVm.

private void storeVm(VM vm) {
    vmDynamicDao.update(vm.getDynamicData());
    getVmManager(vm.getId()).update(vm.getStatisticsData());
    List<VmNetworkInterface> interfaces = vm.getInterfaces();
    if (interfaces != null) {
        for (VmNetworkInterface ifc : interfaces) {
            VmNetworkStatistics stats = ifc.getStatistics();
            vmNetworkStatisticsDao.update(stats);
        }
    }
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VmNetworkStatistics(org.ovirt.engine.core.common.businessentities.network.VmNetworkStatistics)

Example 65 with VmNetworkInterface

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

the class NicActivateStatusColumn method getTooltip.

@Override
public SafeHtml getTooltip(T object) {
    VmNetworkInterface vnic = null;
    if (object instanceof VmNetworkInterface) {
        vnic = (VmNetworkInterface) object;
    } else if (object instanceof PairQueryable && ((PairQueryable) object).getFirst() instanceof VmNetworkInterface) {
        vnic = ((PairQueryable<VmNetworkInterface, VM>) object).getFirst();
    }
    // $NON-NLS-1$
    StringBuilder tooltip = new StringBuilder("");
    boolean vnicExist = vnic != null;
    if (vnicExist && vnic.isPlugged()) {
        tooltip = tooltip.append(templates.cardStatus(constants.pluggedNetworkInterface()).asString());
    } else {
        tooltip = tooltip.append(templates.cardStatus(constants.unpluggedNetworkInterface()).asString());
    }
    // $NON-NLS-1$
    tooltip = tooltip.append("<BR>");
    if (vnicExist && vnic.isLinked()) {
        tooltip = tooltip.append(templates.linkState(constants.linkedNetworkInterface()).asString());
    } else {
        tooltip = tooltip.append(templates.linkState(constants.unlinkedNetworkInterface()).asString());
    }
    return SafeHtmlUtils.fromTrustedString(tooltip.toString());
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)

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