use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface 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.VdsNetworkInterface 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.VdsNetworkInterface 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.VdsNetworkInterface in project ovirt-engine by oVirt.
the class ReportedConfigurationsFillerTest method createNic.
private VdsNetworkInterface createNic(String name) {
VdsNetworkInterface nic = new VdsNetworkInterface();
nic.setId(Guid.newGuid());
nic.setName(name);
return nic;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class UnmanagedNetworkValidatorTest method testFilterNicsWithUnmanagedNetworksNetworkImplementationDetailsIsNull.
@Test
public void testFilterNicsWithUnmanagedNetworksNetworkImplementationDetailsIsNull() {
VdsNetworkInterface nicWithNetworkImplementationsDetailsNull = createNic("eth1");
List<VdsNetworkInterface> existingInterfaces = Collections.singletonList(nicWithNetworkImplementationsDetailsNull);
Set<String> unmanagedNicsSet = validator.filterNicsWithUnmanagedNetworks(existingInterfaces, Collections.emptySet());
assertTrue(unmanagedNicsSet.isEmpty());
}
Aggregations