use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkMtuValidatorTest method createNetworkAttachment.
private NetworkAttachment createNetworkAttachment(Network networkA, String nicAName) {
NetworkAttachment networkAttachmentA = new NetworkAttachment();
networkAttachmentA.setId(Guid.newGuid());
networkAttachmentA.setNicName(nicAName);
networkAttachmentA.setNetworkId(networkA.getId());
return networkAttachmentA;
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class HostSetupNetworksValidatorTest method validateBondModeForLabeledVmNetwork.
private void validateBondModeForLabeledVmNetwork(BondMode bondMode) {
String bondName = "bondName";
String networkName = "vmNetwork";
String label = "label";
Bond bond = createBond(bondName, networkName, null);
bond.setLabels(new HashSet<>(Collections.singletonList(label)));
bond.setBondOptions(bondMode.getConfigurationValue());
Network vmNetwork = createNetworkWithName(networkName);
vmNetwork.setVmNetwork(true);
vmNetwork.setLabel(label);
NetworkAttachment vmNetworkNetworkAttachment = createNetworkAttachment(vmNetwork, bond);
HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder().setParams(new ParametersBuilder().addBonds(CreateOrUpdateBond.fromBond(bond))).addNetworks(vmNetwork).addExistingInterfaces(bond).build();
List<NetworkAttachment> attachmentsToConfigure = Collections.singletonList(vmNetworkNetworkAttachment);
ValidationResult result = validator.validateBondModeVsNetworksAttachedToIt(attachmentsToConfigure);
if (bondMode.isBondModeValidForVmNetwork()) {
collector.checkThat(result, isValid());
} else {
collector.checkThat(result, failsWith(EngineMessage.INVALID_BOND_MODE_FOR_BOND_WITH_LABELED_VM_NETWORK, ReplacementUtils.createSetVariableString(HostSetupNetworksValidator.VAR_BOND_NAME, bondName), ReplacementUtils.createSetVariableString(HostSetupNetworksValidator.VAR_NETWORK_NAME, networkName), ReplacementUtils.createSetVariableString(HostSetupNetworksValidator.VAR_LABEL, label)));
}
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentDaoImplTest method testGetWithNonExistingId.
/**
* Ensures null is returned.
*/
@Test
public void testGetWithNonExistingId() {
NetworkAttachment result = dao.get(Guid.newGuid());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentDaoImplTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
dao = dbFacade.getNetworkAttachmentDao();
dnsResolverConfigurationDao = dbFacade.getDnsResolverConfigurationDao();
networkAttachment = new NetworkAttachment();
networkAttachment.setNicId(FixturesTool.VDS_NETWORK_INTERFACE);
networkAttachment.setProperties(new HashMap<>());
networkAttachment.setId(Guid.newGuid());
networkAttachment.setNetworkId(FixturesTool.NETWORK_ENGINE);
networkAttachment.setIpConfiguration(createIpConfiguration(Ipv4BootProtocol.DHCP, Ipv6BootProtocol.AUTOCONF));
networkAttachment.setDnsResolverConfiguration(new DnsResolverConfiguration());
networkAttachment.getDnsResolverConfiguration().setNameServers(new ArrayList<>(Arrays.asList(new NameServer("1.1.1.1"))));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentDaoImplTest method testGetNetworkAttachmentByNicIdAndNetworkId.
@Test
public void testGetNetworkAttachmentByNicIdAndNetworkId() {
final Guid nicId = FixturesTool.VDS_NETWORK_INTERFACE2;
final Guid networkId = FixturesTool.NETWORK_ENGINE_2;
final NetworkAttachment networkAttachmentByNicIdAndNetworkId = dao.getNetworkAttachmentByNicIdAndNetworkId(nicId, networkId);
assertNotNull(networkAttachmentByNicIdAndNetworkId);
assertNetworkAttachmentEquals(networkAttachmentFromFixtures(), networkAttachmentByNicIdAndNetworkId);
}
Aggregations