Search in sources :

Example 6 with CiscoAsa1000vDeviceVO

use of com.cloud.network.cisco.CiscoAsa1000vDeviceVO in project cloudstack by apache.

the class CiscoVnmcElement method listCiscoAsa1000vResources.

@Override
public List<CiscoAsa1000vDeviceVO> listCiscoAsa1000vResources(ListCiscoAsa1000vResourcesCmd cmd) {
    Long physicalNetworkId = cmd.getPhysicalNetworkId();
    Long ciscoAsa1000vResourceId = cmd.getCiscoAsa1000vResourceId();
    List<CiscoAsa1000vDeviceVO> responseList = new ArrayList<CiscoAsa1000vDeviceVO>();
    if (physicalNetworkId == null && ciscoAsa1000vResourceId == null) {
        throw new InvalidParameterValueException("Either physical network Id or Asa 1000v device Id must be specified");
    }
    if (ciscoAsa1000vResourceId != null) {
        CiscoAsa1000vDeviceVO ciscoAsa1000vResource = _ciscoAsa1000vDao.findById(ciscoAsa1000vResourceId);
        if (ciscoAsa1000vResource == null) {
            throw new InvalidParameterValueException("Could not find Cisco Asa 1000v device with id: " + ciscoAsa1000vResourceId);
        }
        responseList.add(ciscoAsa1000vResource);
    } else {
        PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
        if (physicalNetwork == null) {
            throw new InvalidParameterValueException("Could not find a physical network with id: " + physicalNetworkId);
        }
        responseList = _ciscoAsa1000vDao.listByPhysicalNetwork(physicalNetworkId);
    }
    return responseList;
}
Also used : CiscoAsa1000vDeviceVO(com.cloud.network.cisco.CiscoAsa1000vDeviceVO) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) ArrayList(java.util.ArrayList) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO)

Example 7 with CiscoAsa1000vDeviceVO

use of com.cloud.network.cisco.CiscoAsa1000vDeviceVO in project cloudstack by apache.

the class CiscoVnmcElement method deleteCiscoAsa1000vResource.

@Override
public boolean deleteCiscoAsa1000vResource(DeleteCiscoAsa1000vResourceCmd cmd) {
    Long asaResourceId = cmd.getCiscoAsa1000vResourceId();
    CiscoAsa1000vDeviceVO asaResource = _ciscoAsa1000vDao.findById(asaResourceId);
    if (asaResource == null) {
        throw new InvalidParameterValueException("Could not find a Cisco ASA 1000v appliance with id " + asaResourceId);
    }
    NetworkAsa1000vMapVO networkAsaMap = _networkAsa1000vMapDao.findByAsa1000vId(asaResource.getId());
    if (networkAsaMap != null) {
        throw new CloudRuntimeException("Cisco ASA 1000v appliance with id " + asaResourceId + " cannot be deleted as it is associated with guest network");
    }
    _ciscoAsa1000vDao.remove(asaResourceId);
    return true;
}
Also used : CiscoAsa1000vDeviceVO(com.cloud.network.cisco.CiscoAsa1000vDeviceVO) InvalidParameterValueException(com.cloud.exception.InvalidParameterValueException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) NetworkAsa1000vMapVO(com.cloud.network.cisco.NetworkAsa1000vMapVO)

Example 8 with CiscoAsa1000vDeviceVO

use of com.cloud.network.cisco.CiscoAsa1000vDeviceVO in project cloudstack by apache.

the class CiscoVnmcElement method assignAsa1000vToNetwork.

@Override
public CiscoAsa1000vDevice assignAsa1000vToNetwork(Network network) {
    List<CiscoAsa1000vDeviceVO> asaList = _ciscoAsa1000vDao.listByPhysicalNetwork(network.getPhysicalNetworkId());
    for (CiscoAsa1000vDeviceVO asa : asaList) {
        NetworkAsa1000vMapVO assignedToNetwork = _networkAsa1000vMapDao.findByAsa1000vId(asa.getId());
        if (assignedToNetwork == null) {
            NetworkAsa1000vMapVO networkAsaMap = new NetworkAsa1000vMapVO(network.getId(), asa.getId());
            _networkAsa1000vMapDao.persist(networkAsaMap);
            return asa;
        }
    }
    return null;
}
Also used : CiscoAsa1000vDeviceVO(com.cloud.network.cisco.CiscoAsa1000vDeviceVO) NetworkAsa1000vMapVO(com.cloud.network.cisco.NetworkAsa1000vMapVO)

Aggregations

CiscoAsa1000vDeviceVO (com.cloud.network.cisco.CiscoAsa1000vDeviceVO)8 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)6 NetworkAsa1000vMapVO (com.cloud.network.cisco.NetworkAsa1000vMapVO)4 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)4 ArrayList (java.util.ArrayList)4 HostVO (com.cloud.host.HostVO)3 CiscoAsa1000vDevice (com.cloud.network.cisco.CiscoAsa1000vDevice)3 CiscoVnmcControllerVO (com.cloud.network.cisco.CiscoVnmcControllerVO)3 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)3 ClusterVSMMapVO (com.cloud.dc.ClusterVSMMapVO)2 DataCenter (com.cloud.dc.DataCenter)2 VlanVO (com.cloud.dc.VlanVO)2 CiscoNexusVSMDeviceVO (com.cloud.network.CiscoNexusVSMDeviceVO)2 PublicIp (com.cloud.network.addr.PublicIp)2 Account (com.cloud.user.Account)2 EntityExistsException (javax.persistence.EntityExistsException)2 Answer (com.cloud.agent.api.Answer)1 AssociateAsaWithLogicalEdgeFirewallCommand (com.cloud.agent.api.AssociateAsaWithLogicalEdgeFirewallCommand)1 ConfigureNexusVsmForAsaCommand (com.cloud.agent.api.ConfigureNexusVsmForAsaCommand)1 CreateLogicalEdgeFirewallCommand (com.cloud.agent.api.CreateLogicalEdgeFirewallCommand)1