Search in sources :

Example 11 with VnicProfile

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

the class NetworkCommon method removeVnicProfiles.

protected void removeVnicProfiles() {
    List<VnicProfile> profiles = vnicProfileDao.getAllForNetwork(getNetwork().getId());
    for (VnicProfile vnicProfile : profiles) {
        getCompensationContext().snapshotEntity(vnicProfile);
        vnicProfileDao.remove(vnicProfile.getId());
    }
}
Also used : VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile)

Example 12 with VnicProfile

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

the class NetworkCommon method updateDefaultVnicProfileName.

protected void updateDefaultVnicProfileName(String oldVnicProfileName) {
    Optional<VnicProfile> defaultVnicProfileOption = vnicProfileDao.getAllForNetwork(getNetwork().getId()).stream().filter(profile -> profile.getName().equals(oldVnicProfileName)).findFirst();
    if (defaultVnicProfileOption.isPresent()) {
        VnicProfile defaultVnicProfile = defaultVnicProfileOption.get();
        defaultVnicProfile.setName(getNetworkName());
        vnicProfileDao.update(defaultVnicProfile);
    }
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) CommandBase(org.ovirt.engine.core.bll.CommandBase) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) Inject(javax.inject.Inject) CommandContext(org.ovirt.engine.core.bll.context.CommandContext) List(java.util.List) NetworkHelper(org.ovirt.engine.core.bll.network.cluster.NetworkHelper) PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) VnicProfileDao(org.ovirt.engine.core.dao.network.VnicProfileDao) Optional(java.util.Optional) VdcObjectType(org.ovirt.engine.core.common.VdcObjectType) Network(org.ovirt.engine.core.common.businessentities.network.Network) Collections(java.util.Collections) VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile)

Example 13 with VnicProfile

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

the class VnicProfileDaoTest method testGetWithPassthrough.

/**
 * Ensures that the network interface profile is returned.
 */
@Test
public void testGetWithPassthrough() {
    VnicProfile result = dao.get(FixturesTool.VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE);
    assertNotNull(result);
    assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE, result.getId());
    assertTrue(result.isPassthrough());
    assertFalse(result.isMigratable());
}
Also used : VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) Test(org.junit.Test)

Example 14 with VnicProfile

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

the class VnicProfileDaoTest method generateNewEntity.

@Override
protected VnicProfile generateNewEntity() {
    VnicProfile vnicProfile = new VnicProfile();
    vnicProfile.setId(Guid.newGuid());
    vnicProfile.setName("new_profile");
    vnicProfile.setNetworkId(FixturesTool.NETWORK_ENGINE);
    vnicProfile.setNetworkQosId(FixturesTool.NETWORK_QOS);
    vnicProfile.setPortMirroring(false);
    vnicProfile.setPassthrough(false);
    vnicProfile.setNetworkFilterId(FixturesTool.VNIC_PROFILE_NETWORK_FILTER);
    vnicProfile.setMigratable(true);
    vnicProfile.setCustomProperties(Collections.emptyMap());
    return vnicProfile;
}
Also used : VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile)

Example 15 with VnicProfile

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

the class VnicProfileDaoTest method testGetWithPm.

/**
 * Ensures that the network interface profile is returned.
 */
@Test
public void testGetWithPm() {
    VnicProfile result = dao.get(FixturesTool.VM_NETWORK_INTERFACE_PM_PROFILE);
    assertNotNull(result);
    assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PM_PROFILE, result.getId());
    assertTrue(result.isPortMirroring());
}
Also used : VnicProfile(org.ovirt.engine.core.common.businessentities.network.VnicProfile) Test(org.junit.Test)

Aggregations

VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)31 Network (org.ovirt.engine.core.common.businessentities.network.Network)12 NetworkFilter (org.ovirt.engine.core.common.businessentities.network.NetworkFilter)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Test (org.junit.Test)3 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)3 Guid (org.ovirt.engine.core.compat.Guid)3 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 AddVnicProfileParameters (org.ovirt.engine.core.common.action.AddVnicProfileParameters)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 NewVnicProfileModel (org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel)2 Collections (java.util.Collections)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Inject (javax.inject.Inject)1