use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToValidBondNewBondValid.
@Test
public void labelBeingAttachedToValidBondNewBondValid() {
CreateOrUpdateBond createOrUpdateBond = new CreateOrUpdateBond();
createOrUpdateBond.setName("bond");
createOrUpdateBond.setSlaves(new HashSet<>(Arrays.asList("slave1", "slave2")));
HostSetupNetworksParameters params = createHostSetupNetworksParams();
params.getCreateOrUpdateBonds().add(createOrUpdateBond);
NicLabel nicLabel = new NicLabel(createOrUpdateBond.getId(), createOrUpdateBond.getName(), "lbl1");
assertThat(createNicLabelValidator(params, new ArrayList<>()).labelBeingAttachedToValidBond(nicLabel), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel 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.NicLabel 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.NicLabel 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.NicLabel in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method validateSlaveHasNoLabelsHasNewLabel.
@Test
public void validateSlaveHasNoLabelsHasNewLabel() {
VdsNetworkInterface slave = createNic("slave");
NicLabel nicLabel = new NicLabel(slave.getId(), slave.getName(), "lbl1");
HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(new ParametersBuilder().addLabels(nicLabel)).addExistingInterfaces(slave).build();
assertValidateSlaveHasNoLabelsFailed(validator, slave.getName());
}
Aggregations