use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testBootProtocolSetForRoleNetworkWhenBootProtocolIsDhcp.
@Test
public void testBootProtocolSetForRoleNetworkWhenBootProtocolIsDhcp() {
Network network = createNetwork();
NetworkAttachment attachment = createNetworkAttachmentWithIpv4Configuration(Ipv4BootProtocol.DHCP);
attachment.setNetworkId(network.getId());
doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(true, false, false, isValid(), network, attachment);
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testNotExternalNetworkWhenExternalNetworkIsProvided.
@Test
public void testNotExternalNetworkWhenExternalNetworkIsProvided() {
Network externalNetwork = new Network();
externalNetwork.setId(Guid.newGuid());
externalNetwork.setProvidedBy(new ProviderNetwork(Guid.newGuid(), ""));
when(networkDaoMock.get(eq(externalNetwork.getId()))).thenReturn(externalNetwork);
NetworkAttachment attachment = new NetworkAttachment();
attachment.setNetworkId(externalNetwork.getId());
assertThat(createNetworkAttachmentValidator(attachment).notExternalNetwork(), failsWith(EngineMessage.EXTERNAL_NETWORK_HAVING_NAME_CANNOT_BE_PROVISIONED));
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testBootProtocolSetForRoleNetworkWhenIpConfigurationIsNull.
@Test
public void testBootProtocolSetForRoleNetworkWhenIpConfigurationIsNull() {
Network network = createNetwork();
NetworkAttachment attachment = createNetworkAttachmentWithIpv4Configuration(Ipv4BootProtocol.NONE);
attachment.setNetworkId(network.getId());
doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(true, true, false, failsWith(EngineMessage.ACTION_TYPE_FAILED_ROLE_NETWORK_HAS_NO_BOOT_PROTOCOL, ReplacementUtils.createSetVariableString(NetworkAttachmentValidator.VAR_ACTION_TYPE_FAILED_ROLE_NETWORK_HAS_NO_BOOT_PROTOCOL_ENTITY, network.getName())), network, attachment);
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkAttachmentsValidatorTest method createNetworkWithIdAndName.
private Network createNetworkWithIdAndName(String networkName) {
Network network = createNetworkWithId();
network.setName(networkName);
return network;
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkAttachmentsValidatorTest method testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenNoDuplicates.
@Test
public void testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenNoDuplicates() {
Network networkA = createNetworkWithIdAndName("networkA");
NetworkAttachment networkAttachmentA = createNetworkAttachment(networkA);
Network networkB = createNetworkWithIdAndName("networkB");
NetworkAttachment networkAttachmentB = createNetworkAttachment(networkB);
List<NetworkAttachment> attachments = Arrays.asList(networkAttachmentA, networkAttachmentB);
BusinessEntityMap<Network> networksMap = new BusinessEntityMap<>(Arrays.asList(networkA, networkB));
NetworkAttachmentsValidator validator = new NetworkAttachmentsValidator(attachments, networksMap, networkExclusivenessValidator);
assertThat(validator.verifyUserAttachmentsDoesNotReferenceSameNetworkDuplicately(), isValid());
}
Aggregations