use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method createVlanNic.
public VdsNetworkInterface createVlanNic(VdsNetworkInterface baseNic, String nicName, Integer vlanId) {
VdsNetworkInterface existingNic = new VdsNetworkInterface();
existingNic.setId(Guid.newGuid());
existingNic.setName(nicName);
existingNic.setVlanId(vlanId);
existingNic.setBaseInterface(baseNic.getName());
return existingNic;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface 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());
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method createNic.
public VdsNetworkInterface createNic(String nicName) {
VdsNetworkInterface existingNic = new VdsNetworkInterface();
existingNic.setId(Guid.newGuid());
existingNic.setName(nicName);
return existingNic;
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method testNotRemovingLabeledNetworksLabelRemovedFromNicValid.
@Test
public void testNotRemovingLabeledNetworksLabelRemovedFromNicValid() {
VdsNetworkInterface nicWithLabel = createNic("nicWithLabel");
final String labelName = "lbl1";
nicWithLabel.setLabels(Collections.singleton(labelName));
Network network = createNetworkWithNameAndLabel("net", labelName);
NetworkAttachment removedAttachment = createNetworkAttachment(network, nicWithLabel);
assertTestNotRemovingLabeledNetworksValid(nicWithLabel, removedAttachment, new ParametersBuilder().addRemovedLabels(labelName).build(), network);
}
use of org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method testAddNetworkToNicAlongWithAddingItIntoBond.
// TODO MM: same test for vlan.
@Test
public void testAddNetworkToNicAlongWithAddingItIntoBond() {
Network networkA = createNetworkWithName("networkA");
VdsNetworkInterface nicA = createNic("nicA");
VdsNetworkInterface nicB = createNic("nicB");
NetworkAttachment networkAttachment = createNetworkAttachment(networkA, (Guid) null);
networkAttachment.setNicId(nicA.getId());
networkAttachment.setNicName(nicA.getName());
networkAttachment.setNetworkId(networkA.getId());
networkAttachment.setNetworkName(networkA.getName());
CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBond(Guid.newGuid(), "bond1", nicA.getName(), nicB.getName());
addNetworkIdToNetworkDaoMock(networkA);
addNetworkToClusterDaoMock(networkA.getId());
HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(new ParametersBuilder().addNetworkAttachments(networkAttachment).addBonds(createOrUpdateBond).build()).addExistingInterfaces(nicA, nicB).addNetworks(networkA).build();
ValidationResult validate = validator.validate();
assertThat(validate, not(isValid()));
EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_ADDED_TO_BOND_AND_NETWORK_IS_ATTACHED_TO_IT_AT_THE_SAME_TIME;
assertThat(validate, failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, nicA.getName()), ReplacementUtils.createSetVariableString(HostSetupNetworksValidator.VAR_NETWORK_NAME, networkA.getName())));
}
Aggregations