Search in sources :

Example 1 with ManageNetworkClustersParameters

use of org.ovirt.engine.core.common.action.ManageNetworkClustersParameters 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)

Example 2 with ManageNetworkClustersParameters

use of org.ovirt.engine.core.common.action.ManageNetworkClustersParameters in project ovirt-engine by oVirt.

the class JsonImmutableSerializeDeserializeTest method serializeCollectionsSingleton.

@Test
public void serializeCollectionsSingleton() {
    ManageNetworkClustersParameters params = new ManageNetworkClustersParameters(Collections.singleton(new NetworkCluster(Guid.createGuidFromString("f455686a-79cc-11e6-8c65-54ee755c6cc7"), Guid.createGuidFromString("f970c5f6-79cc-11e6-bc8f-54ee755c6cc7"), 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)

Example 3 with ManageNetworkClustersParameters

use of org.ovirt.engine.core.common.action.ManageNetworkClustersParameters in project ovirt-engine by oVirt.

the class PropagateNetworksToClusterHostsCommand method executeCommand.

@Override
protected void executeCommand() {
    final Map<Guid, ManageNetworkClustersParameters> paramsByClusterId = mapParametersByClusterId();
    for (ManageNetworkClustersParameters param : paramsByClusterId.values()) {
        processSingleClusterChanges(param);
    }
    setSucceeded(true);
}
Also used : ManageNetworkClustersParameters(org.ovirt.engine.core.common.action.ManageNetworkClustersParameters) Guid(org.ovirt.engine.core.compat.Guid)

Example 4 with ManageNetworkClustersParameters

use of org.ovirt.engine.core.common.action.ManageNetworkClustersParameters in project ovirt-engine by oVirt.

the class AttachNetworkToClusterCommand method attachLabeledNetwork.

private void attachLabeledNetwork() {
    final AttachNetworkToClusterParameter attachNetworkToClusterParameter = getParameters();
    runInternalAction(ActionType.PropagateNetworksToClusterHosts, new ManageNetworkClustersParameters(new ArrayList<>(Collections.singleton(attachNetworkToClusterParameter.getNetworkCluster()))));
}
Also used : ManageNetworkClustersParameters(org.ovirt.engine.core.common.action.ManageNetworkClustersParameters) AttachNetworkToClusterParameter(org.ovirt.engine.core.common.action.AttachNetworkToClusterParameter) ArrayList(java.util.ArrayList)

Example 5 with ManageNetworkClustersParameters

use of org.ovirt.engine.core.common.action.ManageNetworkClustersParameters in project ovirt-engine by oVirt.

the class DetachNetworkToClusterCommand method detachLabeledNetworksFromClusterHosts.

private void detachLabeledNetworksFromClusterHosts() {
    final AttachNetworkToClusterParameter attachNetworkToClusterParameter = getParameters();
    runInternalAction(ActionType.PropagateNetworksToClusterHosts, new ManageNetworkClustersParameters(Collections.emptyList(), new ArrayList<>(Collections.singleton(attachNetworkToClusterParameter.getNetworkCluster()))));
}
Also used : ManageNetworkClustersParameters(org.ovirt.engine.core.common.action.ManageNetworkClustersParameters) AttachNetworkToClusterParameter(org.ovirt.engine.core.common.action.AttachNetworkToClusterParameter) ArrayList(java.util.ArrayList)

Aggregations

ManageNetworkClustersParameters (org.ovirt.engine.core.common.action.ManageNetworkClustersParameters)9 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)2 AttachNetworkToClusterParameter (org.ovirt.engine.core.common.action.AttachNetworkToClusterParameter)2 Guid (org.ovirt.engine.core.compat.Guid)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 Inject (javax.inject.Inject)1 CommandBase (org.ovirt.engine.core.bll.CommandBase)1 InternalCommandAttribute (org.ovirt.engine.core.bll.InternalCommandAttribute)1 NonTransactiveCommandAttribute (org.ovirt.engine.core.bll.NonTransactiveCommandAttribute)1 CommandContext (org.ovirt.engine.core.bll.context.CommandContext)1 HostSetupNetworksParametersBuilder (org.ovirt.engine.core.bll.network.HostSetupNetworksParametersBuilder)1