use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method nicActuallyExistsOrReferencesNewBondTrue.
@Test
public void nicActuallyExistsOrReferencesNewBondTrue() {
NicLabelValidator validator = spy(createNicLabelValidator());
mockIsNicActuallyExistsOrReferencesNewBond(validator, true);
NicLabel nicLabel = new NicLabel();
nicLabel.setNicName("anyName");
assertThat(validator.nicActuallyExistsOrReferencesNewBond(nicLabel), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method nicActuallyExistsOrReferencesNewBondFalse.
@Test
public void nicActuallyExistsOrReferencesNewBondFalse() {
NicLabelValidator validator = spy(createNicLabelValidator());
mockIsNicActuallyExistsOrReferencesNewBond(validator, false);
NicLabel nicLabel = new NicLabel();
assertThatNicActuallyExistsOrReferencesNewBondFailed(validator, nicLabel);
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class NicLabelValidatorTest method labelBeingAttachedToValidBondNotBond.
@Test
public void labelBeingAttachedToValidBondNotBond() {
VdsNetworkInterface nic = createNic();
List<VdsNetworkInterface> nics = Collections.singletonList(nic);
NicLabel nicLabel = new NicLabel(nic.getId(), nic.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 UnmanagedNetworkValidatorTest method testValidateLabelsForVlan.
@Test
public void testValidateLabelsForVlan() {
Nic nic = createNic("eth0");
NicLabel label = new NicLabel(null, "eth1", "label1");
NicLabel labelWithUnmanagedNetwork = new NicLabel(null, "eth0", "labelOnUnmanaged");
Collection<NicLabel> labels = Arrays.asList(label, labelWithUnmanagedNetwork);
VdsNetworkInterface vlanNic = createVlanNic(nic, "eth0.100", 100, false);
List<VdsNetworkInterface> existingInterfaces = Collections.singletonList(vlanNic);
Set<String> nicsWithUnmanagedNetworks = validator.filterNicsWithUnmanagedNetworks(existingInterfaces, Collections.emptySet());
assertEquals(1, nicsWithUnmanagedNetworks.size());
String vlanNicName = nicsWithUnmanagedNetworks.iterator().next();
ValidationResult result = validator.validateLabels(vlanNicName, labels);
assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_LABEL_ON_UNMANAGED_NETWORK, ReplacementUtils.createSetVariableString(LABEL, "labelOnUnmanaged"), ReplacementUtils.createSetVariableString(NIC, "eth0")));
NicLabel labelWithoutUnmanaged = new NicLabel(null, "eth_other", "label1");
Collection<NicLabel> labelsNotOnUnmanagedNetwork = Collections.singletonList(labelWithoutUnmanaged);
result = validator.validateLabels(vlanNicName, labelsNotOnUnmanagedNetwork);
assertTrue(result.isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.NicLabel in project ovirt-engine by oVirt.
the class UnmanagedNetworkValidatorTest method testValidateLabels.
@Test
public void testValidateLabels() {
String nicWithUnmanagedNetwork = "eth_unmanaged";
NicLabel label = new NicLabel(null, "eth1", "label1");
NicLabel labelWithUnmanagedNetwork = new NicLabel(null, nicWithUnmanagedNetwork, "labelOnUnmanaged");
Collection<NicLabel> labels = Arrays.asList(label, labelWithUnmanagedNetwork);
ValidationResult result = validator.validateLabels(nicWithUnmanagedNetwork, labels);
assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_LABEL_ON_UNMANAGED_NETWORK, ReplacementUtils.createSetVariableString(LABEL, "labelOnUnmanaged"), ReplacementUtils.createSetVariableString(NIC, "eth_unmanaged")));
NicLabel labelWithoutUnmanaged = new NicLabel(null, "eth_other", "label1");
Collection<NicLabel> labelsNotOnUnmanagedNetwork = Collections.singletonList(labelWithoutUnmanaged);
result = validator.validateLabels(nicWithUnmanagedNetwork, labelsNotOnUnmanagedNetwork);
assertTrue(result.isValid());
}
Aggregations