use of org.ovirt.engine.core.common.businessentities.network.Bond in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToValidBondExistingBondValid.
@Test
public void labelBeingAttachedToValidBondExistingBondValid() {
Bond bond = new Bond("bond");
bond.setSlaves(Arrays.asList("slave1", "slave2"));
List<VdsNetworkInterface> nics = new ArrayList<>(Collections.singletonList(bond));
NicLabel nicLabel = new NicLabel(bond.getId(), bond.getName(), "lbl1");
assertThat(createNicLabelValidator(nics).labelBeingAttachedToValidBond(nicLabel), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Bond in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToNonVlanNonSlaveInterfaceAttachToSlaveOnRemovedBond.
@Test
public void labelBeingAttachedToNonVlanNonSlaveInterfaceAttachToSlaveOnRemovedBond() {
HostSetupNetworksParameters params = createHostSetupNetworksParams();
VdsNetworkInterface slave = createNic();
Bond bondWithSlave = new Bond("bond");
bondWithSlave.setId(Guid.newGuid());
bondWithSlave.setSlaves(Collections.singletonList(slave.getName()));
params.getRemovedBonds().add(bondWithSlave.getId());
NicLabel nicLabel = new NicLabel();
nicLabel.setNicName(slave.getName());
assertThat(createNicLabelValidator(params, Arrays.asList(bondWithSlave, slave)).labelBeingAttachedToNonVlanNonSlaveInterface(nicLabel), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Bond in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToNonVlanNonSlaveInterfaceAttachToRemovedSlave.
@Test
public void labelBeingAttachedToNonVlanNonSlaveInterfaceAttachToRemovedSlave() {
HostSetupNetworksParameters params = createHostSetupNetworksParams();
VdsNetworkInterface slave = createNic();
Bond bondWithSlave = new Bond("bond");
bondWithSlave.setSlaves(Collections.singletonList(slave.getName()));
CreateOrUpdateBond updatedBond = new CreateOrUpdateBond();
updatedBond.setName(bondWithSlave.getName());
updatedBond.setSlaves(new HashSet<>());
params.setCreateOrUpdateBonds(Collections.singletonList(updatedBond));
NicLabel nicLabel = new NicLabel();
nicLabel.setNicName(slave.getName());
NicLabelValidator nicLabelValidator = createNicLabelValidator(params, Arrays.asList(bondWithSlave, slave));
assertThat(nicLabelValidator.labelBeingAttachedToNonVlanNonSlaveInterface(nicLabel), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Bond in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method testValidateModifiedBondSlavesWhenSlaveAlreadySlavesForDifferentBondWhichGetsRemoved.
@Test
public void testValidateModifiedBondSlavesWhenSlaveAlreadySlavesForDifferentBondWhichGetsRemoved() throws Exception {
Bond bond = createBond("bondName");
Bond differentBond = createBond("differentBond");
VdsNetworkInterface slaveA = createBondSlave(bond, "slaveA");
VdsNetworkInterface slaveB = createBondSlave(differentBond, "slaveB");
setBondSlaves(bond, slaveA, slaveB);
HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(new ParametersBuilder().addRemovedBonds(differentBond.getId())).addExistingInterfaces(bond, differentBond, slaveA, slaveB).build();
doTestValidateModifiedBondSlaves(spy(validator), ValidationResult.VALID, ValidationResult.VALID, isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Bond in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method setUp.
@Before
public void setUp() throws Exception {
host = new VDS();
host.setId(Guid.newGuid());
final VdsDynamic vdsDynamic = new VdsDynamic();
host.setDynamicData(vdsDynamic);
bond = new Bond();
bond.setId(Guid.newGuid());
when(mockNetworkExclusivenessValidatorResolver.resolveNetworkExclusivenessValidator()).thenReturn(mockNetworkExclusivenessValidator);
}
Aggregations