use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceIsBondWhenInterfaceIsNotBonded.
@Test
public void testInterfaceIsBondWhenInterfaceIsNotBonded() throws Exception {
VdsNetworkInterface iface = createVdsNetworkInterfaceWithName();
iface.setBonded(false);
final EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_IS_NOT_BOND;
Matcher<ValidationResult> matcher = failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, iface.getName()));
assertThat(new HostInterfaceValidator(iface).interfaceIsBondOrNull(), matcher);
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testLabeledNetworkAttachedToThisInterfaceWhenNetworkIsAssignedToWrongInterface.
@Test
public void testLabeledNetworkAttachedToThisInterfaceWhenNetworkIsAssignedToWrongInterface() throws Exception {
String networkName = "networkA";
Network network = new Network();
network.setName(networkName);
VdsNetworkInterface nicToWhichLabeledNetworkShouldBeAttached = createVdsNetworkInterfaceWithName("nicA");
VdsNetworkInterface nicImproperlyAssignedToNetwork = createVdsNetworkInterfaceWithName("nicB");
nicImproperlyAssignedToNetwork.setNetworkName(networkName);
List<VdsNetworkInterface> hostInterfaces = Arrays.asList(nicToWhichLabeledNetworkShouldBeAttached, nicImproperlyAssignedToNetwork);
HostInterfaceValidator validator = new HostInterfaceValidator(nicToWhichLabeledNetworkShouldBeAttached);
assertThat(validator.networksAreAttachedToThisInterface(hostInterfaces, Collections.singletonList(network)), failsWith(EngineMessage.LABELED_NETWORK_ATTACHED_TO_WRONG_INTERFACE, ReplacementUtils.replaceWith(HostInterfaceValidator.VAR_ASSIGNED_NETWORKS, Collections.singletonList(networkName))));
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceAlreadyLabeledWithWhenInterfaceIsNotLabeled.
@Test
public void testInterfaceAlreadyLabeledWithWhenInterfaceIsNotLabeled() throws Exception {
VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName();
vdsNetworkInterface.setLabels(new HashSet<>());
assertThat(new HostInterfaceValidator(vdsNetworkInterface).interfaceAlreadyLabeledWith("labelA"), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceIsBondWhenInterfaceIsBonded.
@Test
public void testInterfaceIsBondWhenInterfaceIsBonded() throws Exception {
VdsNetworkInterface iface = createVdsNetworkInterfaceWithName();
iface.setBonded(true);
assertThat(new HostInterfaceValidator(iface).interfaceIsBondOrNull(), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testValidBond.
@Test
public void testValidBond() throws Exception {
VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName();
vdsNetworkInterface.setBonded(false);
HostInterfaceValidator validator = new HostInterfaceValidator(vdsNetworkInterface);
assertThat(validator.validBond(Collections.emptyList()), isValid());
}
Aggregations