use of org.ovirt.engine.core.common.businessentities.network.Nic in project ovirt-engine by oVirt.
the class UnmanagedNetworkValidatorTest method testValidateAttachements.
@Test
public void testValidateAttachements() {
String unmanagedNicName = "eth0";
NetworkAttachment attachement1 = new NetworkAttachment();
attachement1.setNetworkName("network1");
attachement1.setNicName(unmanagedNicName);
NetworkAttachment attachement2 = new NetworkAttachment();
attachement2.setNetworkName("any2");
attachement2.setNicName("eth1");
List<NetworkAttachment> attachementList = Arrays.asList(attachement1, attachement2);
Nic unmgmtNic = createNicWithNetworkImplementationDetails(unmanagedNicName, false);
List<VdsNetworkInterface> existingInterfaces = Collections.singletonList(unmgmtNic);
Set<String> nicsWithUnmanagedNetworks = validator.filterNicsWithUnmanagedNetworks(existingInterfaces, Collections.emptySet());
assertEquals(1, nicsWithUnmanagedNetworks.size());
String filteredNicName = nicsWithUnmanagedNetworks.iterator().next();
assertEquals(unmanagedNicName, filteredNicName);
ValidationResult result = validator.validateAttachements(filteredNicName, attachementList);
assertThat(result, failsWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_ATTACHEMENT_ON_UNMANAGED_NETWORK, ReplacementUtils.createSetVariableString(NETWORK, "network1"), ReplacementUtils.createSetVariableString(NIC, "eth0")));
result = validator.validateAttachements("eth7", attachementList);
assertTrue(result.isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.Nic in project ovirt-engine by oVirt.
the class GetTlvsByHostNicIdQueryTest method createNic.
private VdsNetworkInterface createNic(ExpectedError expectedError, Guid vdsId) {
switch(expectedError) {
case NIC_ID_NIC:
VdsNetworkInterface vdsIface = new VdsNetworkInterface();
vdsIface.setVdsId(vdsId);
return vdsIface;
case NIC_ID_NETWORK_INTERFACE:
return null;
default:
Nic nic = new Nic();
nic.setName(NIC_NAME);
nic.setVdsId(vdsId);
return nic;
}
}
use of org.ovirt.engine.core.common.businessentities.network.Nic in project ovirt-engine by oVirt.
the class NetworkUtilsTest method createNic.
private VdsNetworkInterface createNic(String ifaceName) {
VdsNetworkInterface iface = new Nic();
iface.setName(ifaceName);
return iface;
}
Aggregations