Search in sources :

Example 1 with NetworkClusterId

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

the class NetworkClusterHelperTest method setUp.

@Before
public void setUp() {
    networkCluster = createNetworkCluster(CLUSTER_ID, NETWORK_ID1);
    when(networkClusterDao.get(networkCluster.getId())).thenReturn(networkCluster);
    managementNetworkCluster = createNetworkCluster(CLUSTER_ID, MANAGEMENT_NETWORK_ID);
    managementNetwork = createNetwork(MANAGEMENT_NETWORK_ID, MANAGEMENT_NETWORK_NAME);
    when(managementNetworkUtil.getManagementNetwork(CLUSTER_ID)).thenReturn(managementNetwork);
    when(networkClusterDao.get(new NetworkClusterId(CLUSTER_ID, MANAGEMENT_NETWORK_ID))).thenReturn(managementNetworkCluster);
    when(vdsDynamicDao.checkIfExistsHostWithStatusInCluster(CLUSTER_ID, VDSStatus.Up)).thenReturn(true);
}
Also used : NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId) Before(org.junit.Before)

Example 2 with NetworkClusterId

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

the class GetClustersAndNetworksByNetworkIdQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    List<PairQueryable<Cluster, NetworkCluster>> networkClusterPairs = new ArrayList<>();
    Network network = networkDao.get(getParameters().getId());
    if (network != null && network.getDataCenterId() != null) {
        List<Cluster> clusters = clusterDao.getAllForStoragePool(network.getDataCenterId());
        List<NetworkCluster> networkClusters = networkClusterDao.getAllForNetwork(getParameters().getId());
        final Map<NetworkClusterId, NetworkCluster> networkClustersById = Entities.businessEntitiesById(networkClusters);
        for (Cluster cluster : clusters) {
            networkClusterPairs.add(new PairQueryable<>(cluster, networkClustersById.get(new NetworkClusterId(cluster.getId(), getParameters().getId()))));
        }
    }
    getQueryReturnValue().setReturnValue(networkClusterPairs);
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)

Example 3 with NetworkClusterId

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

the class MapVnicFlowTest method mock.

private void mock() {
    when(mockVnicProfileDao.get(P1_ID)).thenReturn(profileOf(P1_ID, P1, N1_ID));
    when(mockVnicProfileViewDao.getAllForCluster(CLUSTER)).thenReturn(singletonList(profileViewOf(P1_ID, P1, N1, N1_ID)));
    when(mockNetworkClusterDao.get(new NetworkClusterId(CLUSTER, N1_ID))).thenReturn(networkClusterOf(N1_ID));
    when(mockNetworkDao.get(N1_ID)).thenReturn(networkOf(N1_ID, N1));
}
Also used : NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)

Example 4 with NetworkClusterId

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

the class ClusterNetworkListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    super.syncSearch();
    Guid clusterId = getEntity().getId();
    IdQueryParameters tempVar = new IdQueryParameters(clusterId);
    tempVar.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetAllNetworksByClusterId, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
        final List<Network> newItems = returnValue.getReturnValue();
        Collections.sort(newItems, Comparator.comparing((Network n) -> n.getCluster().isManagement()).reversed().thenComparing(Network::getName, new LexoNumericComparator()));
        for (Network network : newItems) {
            network.getCluster().setId(new NetworkClusterId(clusterId, network.getId()));
        }
        setItems(newItems);
    }));
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) Network(org.ovirt.engine.core.common.businessentities.network.Network) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) Guid(org.ovirt.engine.core.compat.Guid) NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)

Example 5 with NetworkClusterId

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

the class NetworkClusterHelperTest method createNetworkCluster.

private NetworkCluster createNetworkCluster(Guid clusterId, Guid networkId) {
    NetworkCluster result = new NetworkCluster();
    result.setId(new NetworkClusterId(clusterId, networkId));
    return result;
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)

Aggregations

NetworkClusterId (org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)13 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)7 Network (org.ovirt.engine.core.common.businessentities.network.Network)5 Test (org.junit.Test)2 Guid (org.ovirt.engine.core.compat.Guid)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Before (org.junit.Before)1 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 LexoNumericComparator (org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator)1 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)1 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)1 AsyncCallback (org.ovirt.engine.ui.frontend.AsyncCallback)1