Search in sources :

Example 11 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class NicLabelValidatorTest method labelBeingAttachedToNonVlanNonSlaveInterfaceAttachToNewSlave.

@Test
public void labelBeingAttachedToNonVlanNonSlaveInterfaceAttachToNewSlave() {
    HostSetupNetworksParameters params = createHostSetupNetworksParams();
    VdsNetworkInterface slave = createNic();
    CreateOrUpdateBond createOrUpdateBond = new CreateOrUpdateBond();
    createOrUpdateBond.setName("bond");
    createOrUpdateBond.setSlaves(Collections.singleton(slave.getName()));
    params.setCreateOrUpdateBonds(Collections.singletonList(createOrUpdateBond));
    assertLabelBeingAttachedToNonVlanNonSlaveInterfaceFailed(params, slave);
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) Test(org.junit.Test)

Example 12 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class NicLabelValidatorTest method labelBeingAttachedToValidBondAttachedBondBecomingNotValid.

@Test
public void labelBeingAttachedToValidBondAttachedBondBecomingNotValid() {
    Bond existingBond = new Bond("bond");
    existingBond.setSlaves(Arrays.asList("slave1", "slave2"));
    HostSetupNetworksParameters params = createHostSetupNetworksParams();
    CreateOrUpdateBond updatedBond = new CreateOrUpdateBond();
    updatedBond.setName(existingBond.getName());
    updatedBond.setSlaves(new HashSet<>());
    params.getCreateOrUpdateBonds().add(updatedBond);
    assertLabelBeingAttachedToValidBondFailed(params, existingBond);
}
Also used : CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Bond(org.ovirt.engine.core.common.businessentities.network.Bond) Test(org.junit.Test)

Example 13 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class NicLabelValidatorTest method labelAppearsOnlyOnceInParamsTwiceInLabels.

@Test
public void labelAppearsOnlyOnceInParamsTwiceInLabels() {
    HostSetupNetworksParameters params = setLabelsOnParams(createSet(createNicLabel("lbl1"), createNicLabel("lbl1")), createSet("lbl2"));
    asserThatLabelAppearsOnlyOnceInParamsFailed(createNicLabelValidator(params), new HashSet<>(Collections.singletonList("lbl1")));
}
Also used : HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) Test(org.junit.Test)

Example 14 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class NicLabelValidatorTest method labelAppearsOnlyOnceInParamsInBothLabelsAndRemoveLabels.

@Test
public void labelAppearsOnlyOnceInParamsInBothLabelsAndRemoveLabels() {
    HostSetupNetworksParameters params = setLabelsOnParams(createSet(createNicLabel("lbl1")), createSet("lbl1"));
    asserThatLabelAppearsOnlyOnceInParamsFailed(createNicLabelValidator(params), new HashSet<>(Collections.singletonList("lbl1")));
}
Also used : HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) Test(org.junit.Test)

Example 15 with HostSetupNetworksParameters

use of org.ovirt.engine.core.common.action.HostSetupNetworksParameters in project ovirt-engine by oVirt.

the class NetworkConfiguratorTest method createSetupNetworkParamsTest.

private IpConfiguration createSetupNetworkParamsTest(Version clusterVersion, Matcher<Collection<? extends IpV6Address>> ipv6AddressMatcher) {
    setIpDetails(nic);
    host.setClusterCompatibilityVersion(clusterVersion);
    final HostSetupNetworksParameters actual = underTest.createSetupNetworkParams(nic);
    assertThat(actual.getNetworkAttachments(), hasSize(1));
    final IpConfiguration ipConfiguration = actual.getNetworkAttachments().get(0).getIpConfiguration();
    assertIpv4Details(ipConfiguration);
    assertThat(ipConfiguration.getIpV6Addresses(), ipv6AddressMatcher);
    return ipConfiguration;
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters)

Aggregations

HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)24 Test (org.junit.Test)11 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)7 NicLabel (org.ovirt.engine.core.common.businessentities.network.NicLabel)7 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)5 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)4 Guid (org.ovirt.engine.core.compat.Guid)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)2 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)2 HostNic (org.ovirt.engine.api.model.HostNic)1 NetworkLabel (org.ovirt.engine.api.model.NetworkLabel)1 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 NicToIpv4AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction)1 NicToIpv6AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction)1