Search in sources :

Example 6 with CiscoNexusVSMDeviceVO

use of com.cloud.network.CiscoNexusVSMDeviceVO in project cloudstack by apache.

the class VmwareManagerImpl method getNexusVSMCredentialsByClusterId.

@Override
public Map<String, String> getNexusVSMCredentialsByClusterId(Long clusterId) {
    CiscoNexusVSMDeviceVO nexusVSM = null;
    ClusterVSMMapVO vsmMapVO = null;
    vsmMapVO = _vsmMapDao.findByClusterId(clusterId);
    long vsmId = 0;
    if (vsmMapVO != null) {
        vsmId = vsmMapVO.getVsmId();
        s_logger.info("vsmId is " + vsmId);
        nexusVSM = _nexusDao.findById(vsmId);
        s_logger.info("Fetching nexus vsm credentials from database.");
    } else {
        s_logger.info("Found empty vsmMapVO.");
        return null;
    }
    Map<String, String> nexusVSMCredentials = new HashMap<String, String>();
    if (nexusVSM != null) {
        nexusVSMCredentials.put("vsmip", nexusVSM.getipaddr());
        nexusVSMCredentials.put("vsmusername", nexusVSM.getUserName());
        nexusVSMCredentials.put("vsmpassword", nexusVSM.getPassword());
        s_logger.info("Successfully fetched the credentials of Nexus VSM.");
    }
    return nexusVSMCredentials;
}
Also used : CiscoNexusVSMDeviceVO(com.cloud.network.CiscoNexusVSMDeviceVO) ClusterVSMMapVO(com.cloud.dc.ClusterVSMMapVO) HashMap(java.util.HashMap)

Example 7 with CiscoNexusVSMDeviceVO

use of com.cloud.network.CiscoNexusVSMDeviceVO in project cloudstack by apache.

the class CiscoNexusVSMElement method getCiscoNexusVSMs.

@Override
public List<CiscoNexusVSMDeviceVO> getCiscoNexusVSMs(ListCiscoNexusVSMsCmd cmd) {
    // If clusterId is defined, then it takes precedence, and we will return
    // the VSM associated with this cluster.
    Long clusterId = cmd.getClusterId();
    Long zoneId = cmd.getZoneId();
    List<CiscoNexusVSMDeviceVO> result = new ArrayList<CiscoNexusVSMDeviceVO>();
    if (clusterId != null && clusterId.longValue() != 0) {
        // Find the VSM associated with this clusterId and return a list.
        CiscoNexusVSMDeviceVO vsm = getCiscoVSMbyClusId(cmd.getClusterId());
        if (vsm == null) {
            throw new CloudRuntimeException("No Cisco VSM associated with specified Cluster Id");
        }
        // Else, add it to a list and return the list.
        result.add(vsm);
        return result;
    }
    // in the zone, and then for each cluster, pull the VSM and prepare a list.
    if (zoneId != null && zoneId.longValue() != 0) {
        ManagementService ref = _mgr;
        ;
        List<? extends Cluster> clusterList = ref.searchForClusters(zoneId, cmd.getStartIndex(), cmd.getPageSizeVal(), "VMware");
        if (clusterList.size() == 0) {
            throw new CloudRuntimeException("No VMWare clusters found in the specified zone!");
        }
        // Else, iterate through each vmware cluster, pull its VSM if it has one, and add to the list.
        for (Cluster clus : clusterList) {
            CiscoNexusVSMDeviceVO vsm = getCiscoVSMbyClusId(clus.getId());
            if (vsm != null)
                result.add(vsm);
        }
        return result;
    }
    // If neither is defined, we will simply return the entire list of VSMs
    // configured in the management server.
    // TODO: Is this a safe thing to do? Only ROOT admin can invoke this call.
    result = _vsmDao.listAllVSMs();
    return result;
}
Also used : ManagementService(com.cloud.server.ManagementService) CiscoNexusVSMDeviceVO(com.cloud.network.CiscoNexusVSMDeviceVO) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) ArrayList(java.util.ArrayList) Cluster(com.cloud.org.Cluster)

Aggregations

CiscoNexusVSMDeviceVO (com.cloud.network.CiscoNexusVSMDeviceVO)7 ClusterVSMMapVO (com.cloud.dc.ClusterVSMMapVO)4 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)3 ArrayList (java.util.ArrayList)3 ClusterVO (com.cloud.dc.ClusterVO)2 DataCenter (com.cloud.dc.DataCenter)2 VlanVO (com.cloud.dc.VlanVO)2 ActionEvent (com.cloud.event.ActionEvent)2 HostVO (com.cloud.host.HostVO)2 PublicIp (com.cloud.network.addr.PublicIp)2 CiscoAsa1000vDeviceVO (com.cloud.network.cisco.CiscoAsa1000vDeviceVO)2 CiscoVnmcControllerVO (com.cloud.network.cisco.CiscoVnmcControllerVO)2 NetworkAsa1000vMapVO (com.cloud.network.cisco.NetworkAsa1000vMapVO)2 Account (com.cloud.user.Account)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 SetSourceNatCommand (com.cloud.agent.api.routing.SetSourceNatCommand)1 DeployDestination (com.cloud.deploy.DeployDestination)1