Search in sources :

Example 1 with AddNetworkWithSubnetParameters

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

the class NewNetworkModel method executeSave.

@Override
protected void executeSave() {
    final AddNetworkWithSubnetParameters parameters = new AddNetworkWithSubnetParameters(getSelectedDc().getId(), getNetwork());
    parameters.setVnicProfileRequired(false);
    parameters.setNetworkClusterList(createNetworkAttachments());
    // New network
    if (getExternal().getEntity()) {
        Provider<?> externalProvider = getExternalProviders().getSelectedItem();
        ProviderNetwork providerNetwork = new ProviderNetwork();
        providerNetwork.setProviderId(externalProvider.getId());
        getNetwork().setProvidedBy(providerNetwork);
        if (hasDefinedSubnet()) {
            getSubnetModel().flush();
            parameters.setExternalSubnet(getSubnetModel().getSubnet());
        }
        if (getConnectedToPhysicalNetwork().getEntity() && getUsePhysicalNetworkFromDatacenter().getEntity()) {
            Network network = getDatacenterPhysicalNetwork().getSelectedItem();
            providerNetwork.setPhysicalNetworkId(network.getId());
        }
        Frontend.getInstance().runAction(hasDefinedSubnet() ? ActionType.AddNetworkWithSubnetOnProvider : ActionType.AddNetworkOnProvider, parameters, addNetworkCallback(), null);
    } else {
        Frontend.getInstance().runAction(ActionType.AddNetwork, parameters, addNetworkCallback(), null);
    }
}
Also used : ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) AddNetworkWithSubnetParameters(org.ovirt.engine.core.common.action.AddNetworkWithSubnetParameters)

Aggregations

AddNetworkWithSubnetParameters (org.ovirt.engine.core.common.action.AddNetworkWithSubnetParameters)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)1