use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkValidatorTest method networkNameTakenByVdsmName.
@Test
public void networkNameTakenByVdsmName() {
when(network.getName()).thenReturn("vdsm-name");
when(network.getId()).thenReturn(DEFAULT_GUID);
Network network2 = new Network();
network2.setVdsmName("vdsm-name");
network2.setName("vdsm-name");
network2.setId(OTHER_GUID);
when(networkDao.getAllForDataCenter(any())).thenReturn(Arrays.asList(network, network2));
assertThat(validator.networkNameNotUsedAsVdsmName(), failsWith(EngineMessage.NETWORK_NAME_USED_AS_VDSM_NETWORK_NAME));
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkValidatorTest method networkNameNotTakenByVdsmName.
@Test
public void networkNameNotTakenByVdsmName() {
when(network.getName()).thenReturn(DEFAULT_NETWORK_NAME);
when(network.getId()).thenReturn(DEFAULT_GUID);
Network network2 = new Network();
network2.setVdsmName("vdsm-name");
network2.setId(OTHER_GUID);
when(networkDao.getAllForDataCenter(any())).thenReturn(Arrays.asList(network, network2));
assertThat(validator.networkNameNotUsedAsVdsmName(), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Network 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.Network in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testLabeledNetworkAttachedToThisInterface.
@Test
public void testLabeledNetworkAttachedToThisInterface() throws Exception {
String networkName = "networkA";
Network network = new Network();
network.setName(networkName);
VdsNetworkInterface nicToWhichLabeledNetworkShouldBeAttached = createVdsNetworkInterfaceWithName("nicA");
nicToWhichLabeledNetworkShouldBeAttached.setNetworkName(networkName);
List<VdsNetworkInterface> hostInterfaces = Arrays.asList(nicToWhichLabeledNetworkShouldBeAttached, createVdsNetworkInterfaceWithName("nicB"));
HostInterfaceValidator validator = new HostInterfaceValidator(nicToWhichLabeledNetworkShouldBeAttached);
List<Network> clusterNetworksWithLabel = Collections.singletonList(network);
assertThat(validator.networksAreAttachedToThisInterface(hostInterfaces, clusterNetworksWithLabel), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class UpdateStoragePoolCommandTest method createNetwork.
private Network createNetwork(Guid networkId) {
Network network = new Network();
network.setId(networkId);
return network;
}
Aggregations