mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
add support for multiple provider instanes per physical network
refactor NetworkDevicemanager and ExternalnetworkdeviceManager in to one single manager
This commit is contained in:
parent
809f9d965e
commit
a48ee9c568
@ -238,8 +238,6 @@ public class ApiConstants {
|
||||
public static final String PING_CIFS_PASSWORD = "pingcifspassword";
|
||||
public static final String CHECKSUM="checksum";
|
||||
public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";
|
||||
public static final String EXTERNAL_LB_TYPE = "externallbtype";
|
||||
public static final String EXTERNAL_FIREWALL_TYPE = "externalfirewalltype";
|
||||
public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist";
|
||||
public static final String ZONE_TOKEN = "zonetoken";
|
||||
public static final String DHCP_PROVIDER = "dhcpprovider";
|
||||
|
||||
@ -113,7 +113,7 @@ public interface Network extends ControlledEntity {
|
||||
public static final Provider DhcpServer = new Provider("DhcpServer", false);
|
||||
public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
|
||||
public static final Provider F5BigIp = new Provider("F5BigIp", true);
|
||||
public static final Provider NetscalerMPX = new Provider("NetscalerMPX", true);
|
||||
public static final Provider Netscaler = new Provider("Netscaler", true);
|
||||
public static final Provider ExternalDhcpServer = new Provider("ExternalDhcpServer", true);
|
||||
public static final Provider ExternalGateWay = new Provider("ExternalGateWay", true);
|
||||
public static final Provider ElasticLoadBalancerVm = new Provider("ElasticLoadBalancerVm", false);
|
||||
|
||||
@ -74,7 +74,7 @@ class NitroError {
|
||||
static final int NS_NO_SERIVCE = 344;
|
||||
}
|
||||
|
||||
public class NetscalerMPXResource implements ServerResource {
|
||||
public class NetscalerResource implements ServerResource {
|
||||
|
||||
// deployment configuration
|
||||
private String _name;
|
||||
@ -88,7 +88,7 @@ public class NetscalerMPXResource implements ServerResource {
|
||||
private String _guid;
|
||||
private boolean _inline;
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(NetscalerMPXResource.class);
|
||||
private static final Logger s_logger = Logger.getLogger(NetscalerResource.class);
|
||||
protected Gson _gson;
|
||||
private String _objectNamePathSep = "-";
|
||||
|
||||
@ -96,7 +96,7 @@ public class NetscalerMPXResource implements ServerResource {
|
||||
Long timeout = new Long(100000);
|
||||
base_response apiCallResult;
|
||||
|
||||
public NetscalerMPXResource () {
|
||||
public NetscalerResource () {
|
||||
_gson = GsonHelper.getGsonLogger();
|
||||
}
|
||||
|
||||
@ -48,9 +48,6 @@ public class AddExternalFirewallCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external firewall appliance.")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, required = false, description="Pyshical network in the zone to which external firewall appliance will be added.")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the external firewall appliance.")
|
||||
private String url;
|
||||
|
||||
@ -60,8 +57,6 @@ public class AddExternalFirewallCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Password of the external firewall appliance.")
|
||||
private String password;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_DEVICE_TYPE, type=CommandType.STRING, required = false, description="External firewall type. Now supports JuniperSRXFirewall.")
|
||||
private String type;
|
||||
///////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -70,10 +65,6 @@ public class AddExternalFirewallCmd extends BaseCmd {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
@ -86,9 +77,6 @@ public class AddExternalFirewallCmd extends BaseCmd {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
||||
@ -47,9 +47,6 @@ public class AddExternalLoadBalancerCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="Zone in which to add the external load balancer appliance.")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, required = false, description="Pyshical network in the zone to which external load balancer appliance will be added.")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the external load balancer appliance.")
|
||||
private String url;
|
||||
|
||||
@ -59,9 +56,6 @@ public class AddExternalLoadBalancerCmd extends BaseCmd {
|
||||
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Password of the external load balancer appliance.")
|
||||
private String password;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_DEVICE_TYPE, type=CommandType.STRING, required = false, description="External load balancer type. Now supports NetscalerLoadBalancer, F5BigIpLoadBalancer.")
|
||||
private String type;
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -70,10 +64,6 @@ public class AddExternalLoadBalancerCmd extends BaseCmd {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
@ -86,10 +76,6 @@ public class AddExternalLoadBalancerCmd extends BaseCmd {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -15,7 +15,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.network.NetworkDeviceManager;
|
||||
import com.cloud.network.ExternalNetworkDeviceManager;
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.server.api.response.NetworkDeviceResponse;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
@ -49,9 +49,9 @@ public class AddNetworkDeviceCmd extends BaseCmd {
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||
ResourceAllocationException {
|
||||
try {
|
||||
NetworkDeviceManager nwDeviceMgr;
|
||||
ExternalNetworkDeviceManager nwDeviceMgr;
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
nwDeviceMgr = locator.getManager(NetworkDeviceManager.class);
|
||||
nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
|
||||
Host device = nwDeviceMgr.addNetworkDevice(this);
|
||||
NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device);
|
||||
response.setObjectName("networkdevice");
|
||||
|
||||
@ -13,7 +13,7 @@ import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.NetworkDeviceManager;
|
||||
import com.cloud.network.ExternalNetworkDeviceManager;
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@ -39,9 +39,9 @@ public class DeleteNetworkDeviceCmd extends BaseCmd {
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||
ResourceAllocationException {
|
||||
try {
|
||||
NetworkDeviceManager nwDeviceMgr;
|
||||
ExternalNetworkDeviceManager nwDeviceMgr;
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
nwDeviceMgr = locator.getManager(NetworkDeviceManager.class);
|
||||
nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
|
||||
boolean result = nwDeviceMgr.deleteNetworkDevice(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
|
||||
@ -48,12 +48,6 @@ public class ListExternalFirewallsCmd extends BaseListCmd {
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, required = true, description="zone Id")
|
||||
private long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="Pyshical network in the zone from which which external load balancer appliance will be listed.")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_DEVICE_TYPE, type=CommandType.STRING, description="External firewall type. Now supports only JuniperSRXFirewall.")
|
||||
private String type;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -62,14 +56,6 @@ public class ListExternalFirewallsCmd extends BaseListCmd {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -49,12 +49,6 @@ public class ListExternalLoadBalancersCmd extends BaseListCmd {
|
||||
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="zone Id")
|
||||
private long zoneId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="Pyshical network in the zone from which which external load balancer appliance will be listed.")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name=ApiConstants.NETWORK_DEVICE_TYPE, type=CommandType.STRING, description="External load balancer type. Now supports NetscalerLoadBalancer, F5BigIpLoadBalancer.")
|
||||
private String type;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@ -63,14 +57,6 @@ public class ListExternalLoadBalancersCmd extends BaseListCmd {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ -19,7 +19,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.network.NetworkDeviceManager;
|
||||
import com.cloud.network.ExternalNetworkDeviceManager;
|
||||
import com.cloud.server.ManagementService;
|
||||
import com.cloud.server.api.response.NetworkDeviceResponse;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
@ -52,9 +52,9 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||
ResourceAllocationException {
|
||||
try {
|
||||
NetworkDeviceManager nwDeviceMgr;
|
||||
ExternalNetworkDeviceManager nwDeviceMgr;
|
||||
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
|
||||
nwDeviceMgr = locator.getManager(NetworkDeviceManager.class);
|
||||
nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
|
||||
List<Host> devices = nwDeviceMgr.listNetworkDevice(this);
|
||||
List<NetworkDeviceResponse> nwdeviceResponses = new ArrayList<NetworkDeviceResponse>();
|
||||
ListResponse<NetworkDeviceResponse> listResponse = new ListResponse<NetworkDeviceResponse>();
|
||||
|
||||
@ -35,7 +35,6 @@ import com.cloud.netapp.dao.LunDaoImpl;
|
||||
import com.cloud.netapp.dao.PoolDaoImpl;
|
||||
import com.cloud.netapp.dao.VolumeDaoImpl;
|
||||
import com.cloud.network.ExternalNetworkDeviceManagerImpl;
|
||||
import com.cloud.network.NetworkDeviceManagerImpl;
|
||||
import com.cloud.network.NetworkUsageManagerImpl;
|
||||
import com.cloud.secstorage.CommandExecLogDaoImpl;
|
||||
import com.cloud.secstorage.PremiumSecondaryStorageManagerImpl;
|
||||
@ -70,7 +69,6 @@ public class PremiumComponentLibrary extends DefaultComponentLibrary {
|
||||
addManager("BareMetalVmManager", BareMetalVmManagerImpl.class);
|
||||
addManager("ExternalDhcpManager", ExternalDhcpManagerImpl.class);
|
||||
addManager("PxeServerManager", PxeServerManagerImpl.class);
|
||||
addManager("NetworkDeviceManager", NetworkDeviceManagerImpl.class);
|
||||
addManager("NetworkUsageManager", NetworkUsageManagerImpl.class);
|
||||
addManager("NetappManager", NetappManagerImpl.class);
|
||||
}
|
||||
|
||||
@ -19,76 +19,108 @@
|
||||
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.api.commands.AddExternalFirewallCmd;
|
||||
import com.cloud.api.commands.AddExternalLoadBalancerCmd;
|
||||
import com.cloud.api.commands.AddNetworkDeviceCmd;
|
||||
import com.cloud.api.commands.DeleteExternalFirewallCmd;
|
||||
import com.cloud.api.commands.DeleteExternalLoadBalancerCmd;
|
||||
import com.cloud.api.commands.DeleteNetworkDeviceCmd;
|
||||
import com.cloud.api.commands.ListExternalFirewallsCmd;
|
||||
import com.cloud.api.commands.ListExternalLoadBalancersCmd;
|
||||
import com.cloud.api.commands.ListNetworkDeviceCmd;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.network.NetworkDeviceManager.NetworkDeviceType;
|
||||
import com.cloud.network.rules.FirewallRule;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.server.api.response.ExternalFirewallResponse;
|
||||
import com.cloud.server.api.response.ExternalLoadBalancerResponse;
|
||||
import com.cloud.server.api.response.NetworkDeviceResponse;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
public interface ExternalNetworkDeviceManager extends Manager {
|
||||
|
||||
// External Firewall methods
|
||||
|
||||
public static class NetworkDevice {
|
||||
private String _name;
|
||||
private String _provider;
|
||||
private static List<NetworkDevice> supportedNetworkDevices = new ArrayList<NetworkDevice>();
|
||||
|
||||
public Host addExternalFirewall(AddExternalFirewallCmd cmd);
|
||||
public static final NetworkDevice ExternalDhcp = new NetworkDevice("ExternalDhcp", null);
|
||||
public static final NetworkDevice PxeServer = new NetworkDevice("PxeServer", null);
|
||||
public static final NetworkDevice NetscalerLoadBalancer = new NetworkDevice("NetscalerLoadBalancer", Network.Provider.Netscaler.getName());
|
||||
public static final NetworkDevice F5BigIpLoadBalancer = new NetworkDevice("F5BigIpLoadBalancer", Network.Provider.F5BigIp.getName());
|
||||
public static final NetworkDevice JuniperSRXFirewall = new NetworkDevice("JuniperSRXFirewall", Network.Provider.JuniperSRX.getName());
|
||||
|
||||
public NetworkDevice(String deviceName, String ntwkServiceprovider) {
|
||||
_name = deviceName;
|
||||
_provider = ntwkServiceprovider;
|
||||
supportedNetworkDevices.add(this);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
public Host addExternalFirewall(Long zoneId, Long physicalNetworkId, String deviceType, Map deviceParamList);
|
||||
public String getNetworkServiceProvder() {
|
||||
return _provider;
|
||||
}
|
||||
|
||||
public boolean deleteExternalFirewall(DeleteExternalFirewallCmd cmd);
|
||||
|
||||
public boolean deleteExternalFirewall(Long hostId);
|
||||
|
||||
public List<Host> listExternalFirewalls(ListExternalFirewallsCmd cmd);
|
||||
|
||||
public List<Host> listExternalFirewalls(Long zoneId, Long networkId, String deviceType);
|
||||
public static NetworkDevice getNetworkDevice(String devicerName) {
|
||||
for (NetworkDevice device : supportedNetworkDevices) {
|
||||
if (device.getName().equalsIgnoreCase(devicerName)) {
|
||||
return device;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ExternalFirewallResponse createExternalFirewallResponse(Host externalFirewall);
|
||||
|
||||
public boolean manageGuestNetworkWithExternalFirewall(boolean add, Network network, NetworkOffering offering) throws ResourceUnavailableException;
|
||||
|
||||
public boolean applyFirewallRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
|
||||
public Host addNetworkDevice(AddNetworkDeviceCmd cmd);
|
||||
|
||||
public NetworkDeviceResponse getApiResponse(Host device);
|
||||
|
||||
public List<Host> listNetworkDevice(ListNetworkDeviceCmd cmd);
|
||||
|
||||
public boolean deleteNetworkDevice(DeleteNetworkDeviceCmd cmd);
|
||||
|
||||
// External Firewall methods
|
||||
|
||||
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddresses) throws ResourceUnavailableException;
|
||||
public Host addExternalFirewall(AddExternalFirewallCmd cmd);
|
||||
|
||||
public boolean manageRemoteAccessVpn(boolean create, Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
|
||||
|
||||
public boolean manageRemoteAccessVpnUsers(Network network, RemoteAccessVpn vpn, List<? extends VpnUser> users) throws ResourceUnavailableException;
|
||||
public boolean deleteExternalFirewall(DeleteExternalFirewallCmd cmd);
|
||||
|
||||
public List<Host> listExternalFirewalls(ListExternalFirewallsCmd cmd);
|
||||
|
||||
// External Load balancer methods
|
||||
|
||||
public Host addExternalLoadBalancer(AddExternalLoadBalancerCmd cmd);
|
||||
public ExternalFirewallResponse createExternalFirewallResponse(Host externalFirewall);
|
||||
|
||||
public boolean manageGuestNetworkWithExternalFirewall(boolean add, Network network, NetworkOffering offering) throws ResourceUnavailableException;
|
||||
|
||||
public boolean applyFirewallRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
|
||||
|
||||
public Host addExternalLoadBalancer(Long zoneId, Long physicalNetworkId, String deviceType, Map deviceParamList);
|
||||
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddresses) throws ResourceUnavailableException;
|
||||
|
||||
public boolean deleteExternalLoadBalancer(DeleteExternalLoadBalancerCmd cmd);
|
||||
public boolean manageRemoteAccessVpn(boolean create, Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
|
||||
|
||||
public boolean manageRemoteAccessVpnUsers(Network network, RemoteAccessVpn vpn, List<? extends VpnUser> users) throws ResourceUnavailableException;
|
||||
|
||||
public boolean deleteExternalLoadBalancer(Long hostId);
|
||||
|
||||
public List<Host> listExternalLoadBalancers(ListExternalLoadBalancersCmd cmd);
|
||||
|
||||
public List<Host> listExternalLoadBalancers(Long zoneId, Long networkId, String deviceType);
|
||||
|
||||
public ExternalLoadBalancerResponse createExternalLoadBalancerResponse(Host externalLoadBalancer);
|
||||
|
||||
public boolean manageGuestNetworkWithExternalLoadBalancer(boolean add, Network guestConfig) throws ResourceUnavailableException;
|
||||
|
||||
public boolean applyLoadBalancerRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
|
||||
|
||||
// General methods
|
||||
|
||||
public int getVlanOffset(long physicalNetworkId, int vlanTag);
|
||||
|
||||
public int getGloballyConfiguredCidrSize();
|
||||
// External Load balancer methods
|
||||
|
||||
public Host addExternalLoadBalancer(AddExternalLoadBalancerCmd cmd);
|
||||
|
||||
public boolean deleteExternalLoadBalancer(DeleteExternalLoadBalancerCmd cmd);
|
||||
|
||||
public List<Host> listExternalLoadBalancers(ListExternalLoadBalancersCmd cmd);
|
||||
|
||||
public ExternalLoadBalancerResponse createExternalLoadBalancerResponse(Host externalLoadBalancer);
|
||||
|
||||
public boolean manageGuestNetworkWithExternalLoadBalancer(boolean add, Network guestConfig) throws ResourceUnavailableException;
|
||||
|
||||
public boolean applyLoadBalancerRules(Network network, List<? extends FirewallRule> rules) throws ResourceUnavailableException;
|
||||
|
||||
// General methods
|
||||
|
||||
public int getVlanOffset(long physicalNetworkId, int vlanTag);
|
||||
|
||||
public int getGloballyConfiguredCidrSize();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,38 +0,0 @@
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.api.commands.AddNetworkDeviceCmd;
|
||||
import com.cloud.api.commands.DeleteNetworkDeviceCmd;
|
||||
import com.cloud.api.commands.ListNetworkDeviceCmd;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.server.api.response.NetworkDeviceResponse;
|
||||
import com.cloud.utils.component.Manager;
|
||||
|
||||
public interface NetworkDeviceManager extends Manager {
|
||||
public static class NetworkDeviceType {
|
||||
private String _name;
|
||||
|
||||
public static final NetworkDeviceType ExternalDhcp = new NetworkDeviceType("ExternalDhcp");
|
||||
public static final NetworkDeviceType PxeServer = new NetworkDeviceType("PxeServer");
|
||||
public static final NetworkDeviceType NetscalerLoadBalancer = new NetworkDeviceType("NetscalerLoadBalancer");
|
||||
public static final NetworkDeviceType F5BigIpLoadBalancer = new NetworkDeviceType("F5BigIpLoadBalancer");
|
||||
public static final NetworkDeviceType JuniperSRXFirewall = new NetworkDeviceType("JuniperSRXFirewall");
|
||||
|
||||
public NetworkDeviceType(String name) {
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
||||
public Host addNetworkDevice(AddNetworkDeviceCmd cmd);
|
||||
|
||||
public NetworkDeviceResponse getApiResponse(Host device);
|
||||
|
||||
public List<Host> listNetworkDevice(ListNetworkDeviceCmd cmd);
|
||||
|
||||
public boolean deleteNetworkDevice(DeleteNetworkDeviceCmd cmd);
|
||||
}
|
||||
@ -1,224 +0,0 @@
|
||||
package com.cloud.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiConstants;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.commands.AddNetworkDeviceCmd;
|
||||
import com.cloud.api.commands.DeleteNetworkDeviceCmd;
|
||||
import com.cloud.api.commands.ListNetworkDeviceCmd;
|
||||
import com.cloud.baremetal.ExternalDhcpManager;
|
||||
import com.cloud.baremetal.PxeServerManager;
|
||||
import com.cloud.baremetal.PxeServerManager.PxeServerType;
|
||||
import com.cloud.baremetal.PxeServerProfile;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.server.api.response.NetworkDeviceResponse;
|
||||
import com.cloud.server.api.response.NwDeviceDhcpResponse;
|
||||
import com.cloud.server.api.response.PxePingResponse;
|
||||
import com.cloud.utils.component.Inject;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Local(value={NetworkDeviceManager.class})
|
||||
public class NetworkDeviceManagerImpl implements NetworkDeviceManager {
|
||||
public static final Logger s_logger = Logger.getLogger(NetworkDeviceManagerImpl.class);
|
||||
String _name;
|
||||
@Inject ExternalDhcpManager _dhcpMgr;
|
||||
@Inject PxeServerManager _pxeMgr;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject ExternalNetworkDeviceManager _externalNetworkDeviceMgr;
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
_name = name;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean start() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Host addNetworkDevice(AddNetworkDeviceCmd cmd) {
|
||||
Map paramList = cmd.getParamList();
|
||||
if (paramList == null) {
|
||||
throw new CloudRuntimeException("Parameter list is null");
|
||||
}
|
||||
|
||||
Collection paramsCollection = paramList.values();
|
||||
HashMap params = (HashMap) (paramsCollection.toArray())[0];
|
||||
if (cmd.getType().equalsIgnoreCase(NetworkDeviceType.ExternalDhcp.getName())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long podId = Long.parseLong((String)params.get(ApiConstants.POD_ID));
|
||||
String type = (String) params.get(ApiConstants.DHCP_SERVER_TYPE);
|
||||
String url = (String) params.get(ApiConstants.URL);
|
||||
String username = (String) params.get(ApiConstants.USERNAME);
|
||||
String password = (String) params.get(ApiConstants.PASSWORD);
|
||||
|
||||
return _dhcpMgr.addDhcpServer(zoneId, podId, type, url, username, password);
|
||||
} else if (cmd.getType().equalsIgnoreCase(NetworkDeviceType.PxeServer.getName())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long podId = Long.parseLong((String)params.get(ApiConstants.POD_ID));
|
||||
String type = (String) params.get(ApiConstants.PXE_SERVER_TYPE);
|
||||
String url = (String) params.get(ApiConstants.URL);
|
||||
String username = (String) params.get(ApiConstants.USERNAME);
|
||||
String password = (String) params.get(ApiConstants.PASSWORD);
|
||||
String pingStorageServerIp = (String) params.get(ApiConstants.PING_STORAGE_SERVER_IP);
|
||||
String pingDir = (String) params.get(ApiConstants.PING_DIR);
|
||||
String tftpDir = (String) params.get(ApiConstants.TFTP_DIR);
|
||||
String pingCifsUsername = (String) params.get(ApiConstants.PING_CIFS_USERNAME);
|
||||
String pingCifsPassword = (String) params.get(ApiConstants.PING_CIFS_PASSWORD);
|
||||
PxeServerProfile profile = new PxeServerProfile(zoneId, podId, url, username, password, type, pingStorageServerIp, pingDir, tftpDir,
|
||||
pingCifsUsername, pingCifsPassword);
|
||||
return _pxeMgr.addPxeServer(profile);
|
||||
} else if (cmd.getType().equalsIgnoreCase(NetworkDeviceType.JuniperSRXFirewall.getName())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long networkId = (params.get(ApiConstants.NETWORK_ID)==null)?Long.parseLong((String)params.get(ApiConstants.NETWORK_ID)):null;
|
||||
return _externalNetworkDeviceMgr.addExternalFirewall(zoneId, networkId, NetworkDeviceType.JuniperSRXFirewall.getName(), cmd.getParamList());
|
||||
} else if (cmd.getType().equalsIgnoreCase(NetworkDeviceType.NetscalerLoadBalancer.getName())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
return _externalNetworkDeviceMgr.addExternalLoadBalancer(zoneId, null, NetworkDeviceType.NetscalerLoadBalancer.getName(), cmd.getParamList());
|
||||
} else if (cmd.getType().equalsIgnoreCase(NetworkDeviceType.F5BigIpLoadBalancer.getName())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
return _externalNetworkDeviceMgr.addExternalLoadBalancer(zoneId, null, NetworkDeviceType.F5BigIpLoadBalancer.getName(), cmd.getParamList());
|
||||
} else {
|
||||
throw new CloudRuntimeException("Unsupported network device type:" + cmd.getType());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkDeviceResponse getApiResponse(Host device) {
|
||||
NetworkDeviceResponse response;
|
||||
HostVO host = (HostVO)device;
|
||||
_hostDao.loadDetails(host);
|
||||
if (host.getType() == Host.Type.ExternalDhcp) {
|
||||
NwDeviceDhcpResponse r = new NwDeviceDhcpResponse();
|
||||
r.setZoneId(host.getDataCenterId());
|
||||
r.setPodId(host.getPodId());
|
||||
r.setUrl(host.getPrivateIpAddress());
|
||||
r.setType(host.getDetail("type"));
|
||||
response = r;
|
||||
} else if (host.getType() == Host.Type.PxeServer) {
|
||||
String pxeType = host.getDetail("type");
|
||||
if (pxeType.equalsIgnoreCase(PxeServerType.PING.getName())) {
|
||||
PxePingResponse r = new PxePingResponse();
|
||||
r.setZoneId(host.getDataCenterId());
|
||||
r.setPodId(host.getPodId());
|
||||
r.setUrl(host.getPrivateIpAddress());
|
||||
r.setType(pxeType);
|
||||
r.setStorageServerIp(host.getDetail("storageServer"));
|
||||
r.setPingDir(host.getDetail("pingDir"));
|
||||
r.setTftpDir(host.getDetail("tftpDir"));
|
||||
response = r;
|
||||
} else {
|
||||
throw new CloudRuntimeException("Unsupported PXE server type:" + pxeType);
|
||||
}
|
||||
} else {
|
||||
throw new CloudRuntimeException("Unsupported network device type:" + host.getType());
|
||||
}
|
||||
|
||||
response.setId(device.getId());
|
||||
return response;
|
||||
}
|
||||
|
||||
private List<Host> listNetworkDevice(Long zoneId, Long podId, Host.Type type) {
|
||||
List<Host> res = new ArrayList<Host>();
|
||||
if (podId != null) {
|
||||
List<HostVO> devs = _hostDao.listBy(type, null, podId, zoneId);
|
||||
if (devs.size() == 1) {
|
||||
res.add(devs.get(0));
|
||||
} else {
|
||||
s_logger.debug("List " + type + ": " + devs.size() + " found");
|
||||
}
|
||||
} else {
|
||||
List<HostVO> devs = _hostDao.listBy(type, zoneId);
|
||||
res.addAll(devs);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Host> listNetworkDevice(ListNetworkDeviceCmd cmd) {
|
||||
Map paramList = cmd.getParamList();
|
||||
if (paramList == null) {
|
||||
throw new CloudRuntimeException("Parameter list is null");
|
||||
}
|
||||
|
||||
List<Host> res;
|
||||
Collection paramsCollection = paramList.values();
|
||||
HashMap params = (HashMap) (paramsCollection.toArray())[0];
|
||||
if (NetworkDeviceType.ExternalDhcp.getName().equalsIgnoreCase(cmd.getType())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long podId = Long.parseLong((String)params.get(ApiConstants.POD_ID));
|
||||
res = listNetworkDevice(zoneId, podId, Host.Type.ExternalDhcp);
|
||||
} else if (NetworkDeviceType.PxeServer.getName().equalsIgnoreCase(cmd.getType())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long podId = Long.parseLong((String)params.get(ApiConstants.POD_ID));
|
||||
res = listNetworkDevice(zoneId, podId, Host.Type.PxeServer);
|
||||
} else if (NetworkDeviceType.F5BigIpLoadBalancer.getName().equalsIgnoreCase(cmd.getType())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long networkId = Long.parseLong((String) params.get(ApiConstants.NETWORK_ID));
|
||||
return _externalNetworkDeviceMgr.listExternalLoadBalancers(zoneId, networkId, NetworkDeviceType.F5BigIpLoadBalancer.getName());
|
||||
} else if (NetworkDeviceType.NetscalerLoadBalancer.getName().equalsIgnoreCase(cmd.getType())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long networkId = Long.parseLong((String) params.get(ApiConstants.NETWORK_ID));
|
||||
return _externalNetworkDeviceMgr.listExternalLoadBalancers(zoneId, networkId, NetworkDeviceType.NetscalerLoadBalancer.getName());
|
||||
} else if (NetworkDeviceType.JuniperSRXFirewall.getName().equalsIgnoreCase(cmd.getType())) {
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long networkId = Long.parseLong((String) params.get(ApiConstants.NETWORK_ID));
|
||||
return _externalNetworkDeviceMgr.listExternalFirewalls(zoneId, networkId, NetworkDeviceType.JuniperSRXFirewall.getName());
|
||||
} else if (cmd.getType() == null){
|
||||
Long zoneId = Long.parseLong((String) params.get(ApiConstants.ZONE_ID));
|
||||
Long podId = Long.parseLong((String)params.get(ApiConstants.POD_ID));
|
||||
List<Host> res1 = listNetworkDevice(zoneId, podId, Host.Type.PxeServer);
|
||||
List<Host> res2 = listNetworkDevice(zoneId, podId, Host.Type.ExternalDhcp);
|
||||
List<Host> res3 = listNetworkDevice(zoneId, podId, Host.Type.ExternalLoadBalancer);
|
||||
List<Host> res4 = listNetworkDevice(zoneId, podId, Host.Type.ExternalFirewall);
|
||||
List<Host> deviceAll = new ArrayList<Host>();
|
||||
deviceAll.addAll(res1);
|
||||
deviceAll.addAll(res2);
|
||||
deviceAll.addAll(res3);
|
||||
deviceAll.addAll(res4);
|
||||
res = deviceAll;
|
||||
} else {
|
||||
throw new CloudRuntimeException("Unknown network device type:" + cmd.getType());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteNetworkDevice(DeleteNetworkDeviceCmd cmd) {
|
||||
HostVO device = _hostDao.findById(cmd.getId());
|
||||
if (device.getType() == Type.ExternalLoadBalancer) {
|
||||
return _externalNetworkDeviceMgr.deleteExternalLoadBalancer(cmd.getId());
|
||||
} else if (device.getType() == Type.ExternalLoadBalancer) {
|
||||
return _externalNetworkDeviceMgr.deleteExternalFirewall(cmd.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -2902,7 +2902,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
if (zone.getGatewayProvider() != null && zone.getGatewayProvider().equals(Network.Provider.JuniperSRX.getName()) &&
|
||||
zone.getFirewallProvider() != null && zone.getFirewallProvider().equals(Network.Provider.JuniperSRX.getName())) {
|
||||
return true;
|
||||
} else if (zone.getGatewayProvider() != null && zone.getLoadBalancerProvider() != null && zone.getLoadBalancerProvider().equals(Network.Provider.NetscalerMPX.getName())) {
|
||||
} else if (zone.getGatewayProvider() != null && zone.getLoadBalancerProvider() != null && zone.getLoadBalancerProvider().equals(Network.Provider.Netscaler.getName())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -2919,12 +2919,13 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
|
||||
boolean usesJuniperForGatewayService = _ntwkOfferingSrvcDao.isProviderSupported(networkOfferingId, Service.Gateway, Network.Provider.JuniperSRX);
|
||||
boolean usesJuniperForFirewallService = _ntwkOfferingSrvcDao.isProviderSupported(networkOfferingId, Service.Firewall, Network.Provider.JuniperSRX);
|
||||
boolean usesNetscalarForLBService = _ntwkOfferingSrvcDao.isProviderSupported(networkOfferingId, Service.Lb, Network.Provider.NetscalerMPX);
|
||||
boolean usesNetscalarForLBService = _ntwkOfferingSrvcDao.isProviderSupported(networkOfferingId, Service.Lb, Network.Provider.Netscaler);
|
||||
boolean usesF5ForLBService = _ntwkOfferingSrvcDao.isProviderSupported(networkOfferingId, Service.Lb, Network.Provider.F5BigIp);
|
||||
|
||||
if (zone.getNetworkType() == NetworkType.Advanced) {
|
||||
if (usesJuniperForGatewayService && usesJuniperForFirewallService) {
|
||||
return true;
|
||||
} else if (_ntwkOfferingSrvcDao.isServiceSupported(networkOfferingId, Service.Gateway) && usesNetscalarForLBService) {
|
||||
} else if (_ntwkOfferingSrvcDao.isServiceSupported(networkOfferingId, Service.Gateway) && (usesF5ForLBService || usesNetscalarForLBService)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.cloud.network;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* PhysicalNetworkExternalDeviceVO contains information about a external network devices (Network service provider instances)
|
||||
* added in to a physical network.
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="physical_network_external_devices")
|
||||
public class PhysicalNetworkExternalDeviceVO {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private long id;
|
||||
|
||||
@Column(name = "physical_network_service_provider_id")
|
||||
private long networkServiceProviderId;
|
||||
|
||||
@Column(name = "host_id")
|
||||
private long hostId;
|
||||
|
||||
public PhysicalNetworkExternalDeviceVO(long networkServiceProviderId, long hostId) {
|
||||
this.networkServiceProviderId = networkServiceProviderId;
|
||||
this.hostId = hostId;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getNetworkServiceProviderId() {
|
||||
return networkServiceProviderId;
|
||||
}
|
||||
|
||||
public long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.cloud.network.dao;
|
||||
|
||||
import java.util.List;
|
||||
import com.cloud.network.PhysicalNetworkExternalDeviceVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface PhysicalNetworkExternalDeviceDao extends GenericDao<PhysicalNetworkExternalDeviceVO, Long> {
|
||||
|
||||
List<PhysicalNetworkExternalDeviceVO> listByNetworkServiceProviderId(long networkServiceProviderId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.cloud.network.dao;
|
||||
|
||||
import java.util.List;
|
||||
import javax.ejb.Local;
|
||||
import com.cloud.network.PhysicalNetworkExternalDeviceVO;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
|
||||
@Local(value=PhysicalNetworkExternalDeviceDao.class) @DB(txn=false)
|
||||
public class PhysicalNetworkExternalDeviceDaoImpl extends GenericDaoBase<PhysicalNetworkExternalDeviceVO, Long> implements PhysicalNetworkExternalDeviceDao {
|
||||
final SearchBuilder<PhysicalNetworkExternalDeviceVO> physicalNetworkServiceProviderSearch;
|
||||
|
||||
protected PhysicalNetworkExternalDeviceDaoImpl() {
|
||||
super();
|
||||
physicalNetworkServiceProviderSearch = createSearchBuilder();
|
||||
physicalNetworkServiceProviderSearch.and("networkServiceProviderId", physicalNetworkServiceProviderSearch.entity().getNetworkServiceProviderId(), Op.EQ);
|
||||
physicalNetworkServiceProviderSearch.done();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PhysicalNetworkExternalDeviceVO> listByNetworkServiceProviderId(long networkServiceProviderId) {
|
||||
SearchCriteria<PhysicalNetworkExternalDeviceVO> sc = physicalNetworkServiceProviderSearch.create();
|
||||
sc.setParameters("networkServiceProviderId", networkServiceProviderId);
|
||||
return search(sc, null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -23,6 +23,6 @@ import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface PhysicalNetworkServiceProviderDao extends GenericDao<PhysicalNetworkServiceProviderVO, Long> {
|
||||
List<PhysicalNetworkServiceProviderVO> listBy(long physicalNetworkId);
|
||||
|
||||
PhysicalNetworkServiceProviderVO findByServiceProvider(long physicalNetworkId, String providerType);
|
||||
void deleteProviders(long physicalNetworkId);
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
|
||||
@Local(value=PhysicalNetworkServiceProviderDao.class) @DB(txn=false)
|
||||
public class PhysicalNetworkServiceProviderDaoImpl extends GenericDaoBase<PhysicalNetworkServiceProviderVO, Long> implements PhysicalNetworkServiceProviderDao {
|
||||
final SearchBuilder<PhysicalNetworkServiceProviderVO> physicalNetworkSearch;
|
||||
final SearchBuilder<PhysicalNetworkServiceProviderVO> physicalNetworkServiceProviderSearch;
|
||||
|
||||
protected PhysicalNetworkServiceProviderDaoImpl() {
|
||||
super();
|
||||
@ -37,6 +38,10 @@ public class PhysicalNetworkServiceProviderDaoImpl extends GenericDaoBase<Physic
|
||||
physicalNetworkSearch.and("physicalNetworkId", physicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
physicalNetworkSearch.done();
|
||||
|
||||
physicalNetworkServiceProviderSearch = createSearchBuilder();
|
||||
physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
physicalNetworkServiceProviderSearch.and("serviceProvderType", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ);
|
||||
physicalNetworkServiceProviderSearch.done();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,6 +51,14 @@ public class PhysicalNetworkServiceProviderDaoImpl extends GenericDaoBase<Physic
|
||||
return search(sc, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PhysicalNetworkServiceProviderVO findByServiceProvider(long physicalNetworkId, String providerType) {
|
||||
SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkServiceProviderSearch.create();
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
sc.setParameters("serviceProvderType", providerType);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteProviders(long physicalNetworkId) {
|
||||
SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkSearch.create();
|
||||
|
||||
@ -68,7 +68,7 @@ public class NetscalerExternalLoadBalancerElement extends AdapterBase implements
|
||||
}
|
||||
|
||||
return (_networkManager.networkIsConfiguredForExternalNetworking(zone.getId(), config.getNetworkOfferingId()) &&
|
||||
_ntwkOfferingSrvcDao.isProviderSupported(config.getNetworkOfferingId(), Service.Lb, Network.Provider.NetscalerMPX));
|
||||
_ntwkOfferingSrvcDao.isProviderSupported(config.getNetworkOfferingId(), Service.Lb, Network.Provider.Netscaler));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -140,6 +140,6 @@ public class NetscalerExternalLoadBalancerElement extends AdapterBase implements
|
||||
|
||||
@Override
|
||||
public Provider getProvider() {
|
||||
return Provider.NetscalerMPX;
|
||||
return Provider.Netscaler;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1825,4 +1825,13 @@ CREATE TABLE `cloud`.`physical_network_service_providers` (
|
||||
CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`physical_network_external_devices` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`physical_network_service_provider_id` bigint unsigned NOT NULL COMMENT 'id of physical network to service provider mapping',
|
||||
`host_id` bigint unsigned NOT NULL COMMENT 'host id',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_physical_network_external_devices_network_service_provider_id` FOREIGN KEY (`physical_network_service_provider_id`) REFERENCES `physical_network_service_providers`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_physical_network_external_devices_host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user