Search in sources :

Example 1 with NetworkCluster

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

the class ClusterNetworkManageModel method createNetworkCluster.

private NetworkCluster createNetworkCluster(ClusterNetworkModel manageModel) {
    final NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setClusterId(manageModel.getCluster().getId());
    networkCluster.setNetworkId(manageModel.getEntity().getId());
    copyRoles(manageModel, networkCluster);
    return networkCluster;
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 2 with NetworkCluster

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

the class IscsiBondValidatorTest method addedRequiredLogicalNetworks.

@Test
public void addedRequiredLogicalNetworks() {
    IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
    List<Network> networks = new ArrayList<>();
    networks.add(createNetwork(iscsiBond.getStoragePoolId()));
    networks.add(createNetwork(iscsiBond.getStoragePoolId()));
    doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
    for (Network network : networks) {
        iscsiBond.getNetworkIds().add(network.getId());
    }
    List<NetworkCluster> networkClusters = new ArrayList<>();
    networkClusters.add(createNetworkCluster(true));
    doReturn(networkClusters).when(networkClusterDao).getAllForNetwork(any());
    ValidationResult res = validator.validateAddedLogicalNetworks(iscsiBond);
    assertThat(res, failsWith(EngineMessage.ACTION_TYPE_FAILED_ISCSI_BOND_NETWORK_CANNOT_BE_REQUIRED));
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 3 with NetworkCluster

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

the class IscsiBondValidatorTest method createNetworkCluster.

private NetworkCluster createNetworkCluster(boolean isRequired) {
    NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setRequired(isRequired);
    return networkCluster;
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 4 with NetworkCluster

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

the class IscsiBondValidatorTest method addedLogicalNetworkBelongToSameDatacenter.

@Test
public void addedLogicalNetworkBelongToSameDatacenter() {
    IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
    List<Network> networks = new ArrayList<>();
    networks.add(createNetwork(iscsiBond.getStoragePoolId()));
    networks.add(createNetwork(iscsiBond.getStoragePoolId()));
    doReturn(networks).when(networkDao).getAllForDataCenter(iscsiBond.getStoragePoolId());
    for (Network network : networks) {
        iscsiBond.getNetworkIds().add(network.getId());
    }
    List<NetworkCluster> networkClusters = new ArrayList<>();
    networkClusters.add(createNetworkCluster(false));
    doReturn(networkClusters).when(networkClusterDao).getAllForNetwork(any());
    assertEquals(ValidationResult.VALID, validator.validateAddedLogicalNetworks(iscsiBond));
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Test(org.junit.Test)

Example 5 with NetworkCluster

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

the class JsonImmutableSerializeDeserializeTest method serializeCollectionsSingletonList.

@Test
public void serializeCollectionsSingletonList() {
    ManageNetworkClustersParameters params = new ManageNetworkClustersParameters(Collections.singletonList(new NetworkCluster(Guid.newGuid(), Guid.newGuid(), NetworkStatus.NON_OPERATIONAL, false, false, false, false, false, false)));
    JsonObjectSerializer serializer = new JsonObjectSerializer();
    String json = serializer.serialize(params);
    assertTrue(json.length() > 0);
    ManageNetworkClustersParameters deserializedParams = new JsonObjectDeserializer().deserialize(json, ManageNetworkClustersParameters.class);
    assertEquals(params.getExecutionReason(), deserializedParams.getExecutionReason());
}
Also used : ManageNetworkClustersParameters(org.ovirt.engine.core.common.action.ManageNetworkClustersParameters) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Test(org.junit.Test)

Aggregations

NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)62 Test (org.junit.Test)19 Network (org.ovirt.engine.core.common.businessentities.network.Network)17 ArrayList (java.util.ArrayList)15 NetworkClusterId (org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 ManageNetworkClustersParameters (org.ovirt.engine.core.common.action.ManageNetworkClustersParameters)5 List (java.util.List)4 Map (java.util.Map)4 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)4 Guid (org.ovirt.engine.core.compat.Guid)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2