Search in sources :

Example 1 with JuniperSrxResource

use of com.cloud.network.resource.JuniperSrxResource in project cloudstack by apache.

the class JuniperSRXExternalFirewallElement method addExternalFirewall.

@Override
@Deprecated
public Host addExternalFirewall(AddExternalFirewallCmd cmd) {
    Long zoneId = cmd.getZoneId();
    DataCenterVO zone = null;
    PhysicalNetworkVO pNetwork = null;
    HostVO fwHost = null;
    zone = _dcDao.findById(zoneId);
    if (zone == null) {
        throw new InvalidParameterValueException("Could not find zone with ID: " + zoneId);
    }
    List<PhysicalNetworkVO> physicalNetworks = _physicalNetworkDao.listByZone(zoneId);
    if ((physicalNetworks == null) || (physicalNetworks.size() > 1)) {
        throw new InvalidParameterValueException("There are no physical networks or multiple physical networks configured in zone with ID: " + zoneId + " to add this device.");
    }
    pNetwork = physicalNetworks.get(0);
    String deviceType = NetworkDevice.JuniperSRXFirewall.getName();
    ExternalFirewallDeviceVO fwDeviceVO = addExternalFirewall(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, new JuniperSrxResource());
    if (fwDeviceVO != null) {
        fwHost = _hostDao.findById(fwDeviceVO.getHostId());
    }
    return fwHost;
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) ExternalFirewallDeviceVO(com.cloud.network.dao.ExternalFirewallDeviceVO) JuniperSrxResource(com.cloud.network.resource.JuniperSrxResource) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) HostVO(com.cloud.host.HostVO)

Aggregations

DataCenterVO (com.cloud.dc.DataCenterVO)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 HostVO (com.cloud.host.HostVO)1 ExternalFirewallDeviceVO (com.cloud.network.dao.ExternalFirewallDeviceVO)1 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)1 JuniperSrxResource (com.cloud.network.resource.JuniperSrxResource)1