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);
}
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));
}
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));
}
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;
}
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);
}
Aggregations