use of com.cloud.api.response.CiscoNexusVSMResponse in project cloudstack by apache.
the class CiscoNexusVSMElement method createCiscoNexusVSMResponse.
@Override
public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDevice vsmDeviceVO) {
CiscoNexusVSMResponse response = new CiscoNexusVSMResponse();
response.setId(vsmDeviceVO.getUuid());
response.setMgmtIpAddress(vsmDeviceVO.getipaddr());
return response;
}
use of com.cloud.api.response.CiscoNexusVSMResponse in project cloudstack by apache.
the class EnableCiscoNexusVSMCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
CiscoNexusVSMDevice result = _ciscoNexusVSMService.enableCiscoNexusVSM(this);
if (result != null) {
CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable Cisco Nexus VSM device");
}
}
use of com.cloud.api.response.CiscoNexusVSMResponse in project cloudstack by apache.
the class ListCiscoNexusVSMsCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
// NOTE- The uuid that is sent in during the invocation of the API AddCiscoNexusVSM()
// automagically gets translated to the corresponding db id before this execute() method
// is invoked. That's the reason why we don't have any uuid-dbid translation code here.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
List<? extends CiscoNexusVSMDevice> vsmDeviceList = _ciscoNexusVSMService.getCiscoNexusVSMs(this);
if (vsmDeviceList.size() > 0) {
ListResponse<CiscoNexusVSMResponse> response = new ListResponse<CiscoNexusVSMResponse>();
List<CiscoNexusVSMResponse> vsmResponses = new ArrayList<CiscoNexusVSMResponse>();
for (CiscoNexusVSMDevice vsmDevice : vsmDeviceList) {
CiscoNexusVSMResponse vsmresponse = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(vsmDevice);
vsmresponse.setObjectName("cisconexusvsm");
response.setResponseName(getCommandName());
vsmResponses.add(vsmresponse);
}
response.setResponses(vsmResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "No VSM found.");
}
}
use of com.cloud.api.response.CiscoNexusVSMResponse in project cloudstack by apache.
the class DisableCiscoNexusVSMCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
CiscoNexusVSMDevice result = _ciscoNexusVSMService.disableCiscoNexusVSM(this);
if (result != null) {
CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable Cisco Nexus VSM device");
}
}
use of com.cloud.api.response.CiscoNexusVSMResponse in project cloudstack by apache.
the class CiscoNexusVSMElement method createCiscoNexusVSMDetailedResponse.
@Override
public CiscoNexusVSMResponse createCiscoNexusVSMDetailedResponse(CiscoNexusVSMDevice vsmDeviceVO) {
CiscoNexusVSMResponse response = new CiscoNexusVSMResponse();
response.setId(vsmDeviceVO.getUuid());
response.setDeviceName(vsmDeviceVO.getvsmName());
response.setDeviceState(vsmDeviceVO.getvsmDeviceState().toString());
response.setMgmtIpAddress(vsmDeviceVO.getipaddr());
// The following values can be null, so check for that.
if (vsmDeviceVO.getvsmConfigMode() != null)
response.setVSMConfigMode(vsmDeviceVO.getvsmConfigMode().toString());
if (vsmDeviceVO.getvsmConfigState() != null)
response.setVSMConfigState(vsmDeviceVO.getvsmConfigState().toString());
if (vsmDeviceVO.getvsmDeviceState() != null)
response.setVSMDeviceState(vsmDeviceVO.getvsmDeviceState().toString());
response.setVSMCtrlVlanId(vsmDeviceVO.getManagementVlan());
response.setVSMPktVlanId(vsmDeviceVO.getPacketVlan());
response.setVSMStorageVlanId(vsmDeviceVO.getStorageVlan());
return response;
}
Aggregations