Search in sources :

Example 26 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method testValidModifiedBondsFailsWhenBondNotHaveNameAndId.

@Test
public void testValidModifiedBondsFailsWhenBondNotHaveNameAndId() throws Exception {
    CreateOrUpdateBond createOrUpdateBond = new CreateOrUpdateBond();
    doTestValidModifiedBonds(createOrUpdateBond, ValidationResult.VALID, new ValidationResult(EngineMessage.BOND_DOES_NOT_HAVE_NEITHER_ID_NOR_NAME_SPECIFIED), ValidationResult.VALID);
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 27 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist.

@Test
public void testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist() throws Exception {
    CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBond(Guid.newGuid(), "bond1", "slaveA", "slaveB");
    HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(new ParametersBuilder().addBonds(createOrUpdateBond)).build();
    doTestValidateModifiedBondSlaves(spy(validator), new ValidationResult(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST), ValidationResult.VALID, failsWith(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST));
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 28 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method testValidateModifiedBondSlavesWhenSlaveIsNotValid.

@Test
public void testValidateModifiedBondSlavesWhenSlaveIsNotValid() throws Exception {
    CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBond(Guid.newGuid(), "bond1", "slaveA", "slaveB");
    ValidationResult cannotBeSlaveValidationResult = new ValidationResult(EngineMessage.NETWORK_INTERFACE_BOND_OR_VLAN_CANNOT_BE_SLAVE, ReplacementUtils.createSetVariableString(HostInterfaceValidator.VAR_NIC_NAME, createOrUpdateBond.getName()));
    HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(new ParametersBuilder().addBonds(createOrUpdateBond)).build();
    doTestValidateModifiedBondSlaves(spy(validator), ValidationResult.VALID, cannotBeSlaveValidationResult, failsWith(cannotBeSlaveValidationResult));
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 29 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method createNewCreateOrUpdateBond.

private CreateOrUpdateBond createNewCreateOrUpdateBond(Guid bondId, String bondName, String... slaveNames) {
    CreateOrUpdateBond createOrUpdateBond = new CreateOrUpdateBond();
    createOrUpdateBond.setId(bondId);
    createOrUpdateBond.setName(bondName);
    createOrUpdateBond.setSlaves(Stream.of(slaveNames).collect(toSet()));
    return createOrUpdateBond;
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond)

Example 30 with CreateOrUpdateBond

use of org.ovirt.engine.core.common.action.CreateOrUpdateBond in project ovirt-engine by oVirt.

the class HostSetupNetworksValidatorTest method testValidModifiedBondsWhenAllOk.

@Test
public void testValidModifiedBondsWhenAllOk() throws Exception {
    CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBond(null, "bond1", "slaveA", "slaveB");
    doTestValidModifiedBonds(createOrUpdateBond, ValidationResult.VALID, ValidationResult.VALID, ValidationResult.VALID);
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Test(org.junit.Test)

Aggregations

CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)38 Test (org.junit.Test)18 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)14 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)10 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)8 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)8 Guid (org.ovirt.engine.core.compat.Guid)6 HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)5 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)4 BondNetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Network (org.ovirt.engine.core.common.businessentities.network.Network)3 LogicalNetworkModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel)3 NetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel)3 List (java.util.List)2 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)2 NicLabel (org.ovirt.engine.core.common.businessentities.network.NicLabel)2 BaseCommandTarget (org.ovirt.engine.ui.uicommonweb.BaseCommandTarget)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2