use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method assertLabelBeingAttachedToNonVlanNonSlaveInterfaceFailed.
private void assertLabelBeingAttachedToNonVlanNonSlaveInterfaceFailed(HostSetupNetworksParameters params, VdsNetworkInterface attachLabelToNic) {
List<VdsNetworkInterface> nics = new ArrayList<>();
nics.add(attachLabelToNic);
if (attachLabelToNic.getBondName() != null) {
Bond bond = new Bond(attachLabelToNic.getBondName());
bond.setId(Guid.newGuid());
nics.add(bond);
}
NicLabel nicLabel = new NicLabel(attachLabelToNic.getId(), attachLabelToNic.getName(), "lbl1");
assertThat(createNicLabelValidator(params, nics).labelBeingAttachedToNonVlanNonSlaveInterface(nicLabel), failsWith(EngineMessage.LABEL_ATTACH_TO_IMPROPER_INTERFACE, ReplacementUtils.createSetVariableString("LABEL_ATTACH_TO_IMPROPER_INTERFACE_ENTITY", attachLabelToNic.getName())));
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method nicActuallyExistsOrReferencesNoNicName.
@Test
public void nicActuallyExistsOrReferencesNoNicName() {
NicLabelValidator validator = spy(createNicLabelValidator());
mockIsNicActuallyExistsOrReferencesNewBond(validator, true);
assertThatNicActuallyExistsOrReferencesNewBondFailed(validator, new NicLabel());
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method nicActuallyExistsOrReferencesNewBondTrueButBondIsRemoved.
@Test
public void nicActuallyExistsOrReferencesNewBondTrueButBondIsRemoved() {
HostSetupNetworksParameters params = createHostSetupNetworksParams();
Guid removedBondId = Guid.newGuid();
params.getRemovedBonds().add(removedBondId);
NicLabelValidator validator = spy(createNicLabelValidator(params));
mockIsNicActuallyExistsOrReferencesNewBond(validator, true);
NicLabel nicLabel = new NicLabel();
nicLabel.setNicId(removedBondId);
nicLabel.setNicName("anyName");
assertThatNicActuallyExistsOrReferencesNewBondFailed(validator, nicLabel);
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method validateCoherentNicIdentificationTest.
@Test
public void validateCoherentNicIdentificationTest() {
NicLabelValidator validator = spy(createNicLabelValidator());
ValidationResult validationReuslt = new ValidationResult(EngineMessage.Unassigned);
doReturn(validationReuslt).when(validator).validateCoherentIdentification(any(), any(), any(), any(), any());
assertEquals(validationReuslt, validator.validateCoherentNicIdentification(new NicLabel()));
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToNonVlanNonSlaveInterfaceValid.
@Test
public void labelBeingAttachedToNonVlanNonSlaveInterfaceValid() {
VdsNetworkInterface nic = createNic();
List<VdsNetworkInterface> nics = Collections.singletonList(nic);
NicLabel nicLabel = new NicLabel(nic.getId(), nic.getName(), "lbl1");
assertThat(createNicLabelValidator(nics).labelBeingAttachedToNonVlanNonSlaveInterface(nicLabel), isValid());
}
Aggregations