Search in sources :

Example 26 with ExternalFirewallDeviceVO

use of com.cloud.network.dao.ExternalFirewallDeviceVO in project cloudstack by apache.

the class ExternalFirewallDeviceManagerImpl method listExternalFirewalls.

@Override
public List<Host> listExternalFirewalls(long physicalNetworkId, String deviceName) {
    List<Host> firewallHosts = new ArrayList<Host>();
    NetworkDevice fwNetworkDevice = NetworkDevice.getNetworkDevice(deviceName);
    PhysicalNetworkVO pNetwork = null;
    pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
    if (pNetwork == null) {
        throw new InvalidParameterValueException("Could not find phyical network with ID: " + physicalNetworkId);
    }
    if ((pNetwork == null) || (fwNetworkDevice == null)) {
        throw new InvalidParameterValueException("Atleast one of ther required parameter physical networkId, device name is missing or invalid.");
    }
    PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), fwNetworkDevice.getNetworkServiceProvder());
    if (ntwkSvcProvider == null) {
        return null;
    }
    List<ExternalFirewallDeviceVO> fwDevices = _externalFirewallDeviceDao.listByPhysicalNetworkAndProvider(physicalNetworkId, ntwkSvcProvider.getProviderName());
    for (ExternalFirewallDeviceVO fwDevice : fwDevices) {
        firewallHosts.add(_hostDao.findById(fwDevice.getHostId()));
    }
    return firewallHosts;
}
Also used : ExternalFirewallDeviceVO(com.cloud.network.dao.ExternalFirewallDeviceVO) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) PhysicalNetworkServiceProviderVO(com.cloud.network.dao.PhysicalNetworkServiceProviderVO) NetworkDevice(org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice) ArrayList(java.util.ArrayList) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) Host(com.cloud.host.Host)

Aggregations

ExternalFirewallDeviceVO (com.cloud.network.dao.ExternalFirewallDeviceVO)26 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)17 ArrayList (java.util.ArrayList)11 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)9 NetworkExternalFirewallVO (com.cloud.network.dao.NetworkExternalFirewallVO)8 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)8 DataCenterVO (com.cloud.dc.DataCenterVO)7 HostVO (com.cloud.host.HostVO)7 ServerApiException (org.apache.cloudstack.api.ServerApiException)6 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)4 Answer (com.cloud.agent.api.Answer)3 PaloAltoFirewallResponse (com.cloud.api.response.PaloAltoFirewallResponse)3 SrxFirewallResponse (com.cloud.api.response.SrxFirewallResponse)3 Vlan (com.cloud.dc.Vlan)3 NetworkVO (com.cloud.network.dao.NetworkVO)3 InsufficientNetworkCapacityException (com.cloud.exception.InsufficientNetworkCapacityException)2 Host (com.cloud.host.Host)2 PhysicalNetworkServiceProviderVO (com.cloud.network.dao.PhysicalNetworkServiceProviderVO)2 NetworkDevice (org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice)2 IpAssocCommand (com.cloud.agent.api.routing.IpAssocCommand)1