Search in sources :

Example 6 with BusinessEntityMap

use of org.ovirt.engine.core.common.businessentities.BusinessEntityMap in project ovirt-engine by oVirt.

the class ReportedConfigurationsFiller method fillReportedConfigurations.

public void fillReportedConfigurations(List<NetworkAttachment> networkAttachments, Guid hostId) {
    List<VdsNetworkInterface> allInterfacesForHost = interfaceDao.getAllInterfacesForVds(hostId);
    Guid clusterId = getClusterId(hostId);
    BusinessEntityMap<Network> networkMap = new BusinessEntityMap<>(networkDao.getAllForCluster(clusterId));
    fillReportedConfigurations(allInterfacesForHost, networkMap, networkAttachments, vdsDynamicDao.get(hostId).getReportedDnsResolverConfiguration(), clusterId);
}
Also used : BusinessEntityMap(org.ovirt.engine.core.common.businessentities.BusinessEntityMap) Network(org.ovirt.engine.core.common.businessentities.network.Network) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkInSyncWithVdsNetworkInterface(org.ovirt.engine.core.utils.NetworkInSyncWithVdsNetworkInterface) Guid(org.ovirt.engine.core.compat.Guid)

Example 7 with BusinessEntityMap

use of org.ovirt.engine.core.common.businessentities.BusinessEntityMap in project ovirt-engine by oVirt.

the class NetworkAttachmentsValidatorTest method testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenDuplicatesPresent.

@Test
public void testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenDuplicatesPresent() {
    Network duplicatelyReferencedNetwork = createNetworkWithId();
    duplicatelyReferencedNetwork.setName("networkName");
    NetworkAttachment networkAttachmentA = createNetworkAttachment(duplicatelyReferencedNetwork);
    NetworkAttachment networkAttachmentB = createNetworkAttachment(duplicatelyReferencedNetwork);
    List<NetworkAttachment> attachments = Arrays.asList(networkAttachmentA, networkAttachmentB);
    BusinessEntityMap<Network> networksMap = new BusinessEntityMap<>(Collections.singletonList(duplicatelyReferencedNetwork));
    NetworkAttachmentsValidator validator = new NetworkAttachmentsValidator(attachments, networksMap, networkExclusivenessValidator);
    List<String> replacements = new ArrayList<>();
    replacements.addAll(ReplacementUtils.replaceWith("ACTION_TYPE_FAILED_NETWORK_ATTACHMENTS_REFERENCES_SAME_NETWORK_DUPLICATELY_LIST", Arrays.asList(networkAttachmentA.getId(), networkAttachmentB.getId())));
    replacements.add(ReplacementUtils.createSetVariableString("ACTION_TYPE_FAILED_NETWORK_ATTACHMENTS_REFERENCES_SAME_NETWORK_DUPLICATELY_ENTITY", duplicatelyReferencedNetwork.getName()));
    assertThat(validator.verifyUserAttachmentsDoesNotReferenceSameNetworkDuplicately(), failsWith(EngineMessage.ACTION_TYPE_FAILED_NETWORK_ATTACHMENTS_REFERENCES_SAME_NETWORK_DUPLICATELY, replacements));
}
Also used : BusinessEntityMap(org.ovirt.engine.core.common.businessentities.BusinessEntityMap) Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Aggregations

BusinessEntityMap (org.ovirt.engine.core.common.businessentities.BusinessEntityMap)7 Network (org.ovirt.engine.core.common.businessentities.network.Network)7 Test (org.junit.Test)4 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)4 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)3 ArrayList (java.util.ArrayList)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 Guid (org.ovirt.engine.core.compat.Guid)2 List (java.util.List)1 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 UnmanagedNetwork (org.ovirt.engine.core.common.businessentities.UnmanagedNetwork)1 Nic (org.ovirt.engine.core.common.businessentities.network.Nic)1 NetworkInSyncWithVdsNetworkInterface (org.ovirt.engine.core.utils.NetworkInSyncWithVdsNetworkInterface)1