From 02d95e2b97151a976c1620ebe598b98b6e29eff4 Mon Sep 17 00:00:00 2001 From: Vijayendra Bhamidipati Date: Mon, 21 May 2012 16:49:11 -0700 Subject: [PATCH] CS-9919: Support for Nexus Swiches (Cisco Vswitches) Description: Removing two unexposed APIs that we never use: ConfigureCiscoNexusVSMCmd ListCiscoNexusVSMCmd More changes to follow. --- .../commands/ConfigureCiscoNexusVSMCmd.java | 117 ------------------ .../api/commands/ListCiscoNexusVSMCmd.java | 99 --------------- .../network/element/CiscoNexusVSMElement.java | 8 -- .../element/CiscoNexusVSMElementService.java | 9 -- 4 files changed, 233 deletions(-) delete mode 100644 server/src/com/cloud/api/commands/ConfigureCiscoNexusVSMCmd.java delete mode 100644 server/src/com/cloud/api/commands/ListCiscoNexusVSMCmd.java diff --git a/server/src/com/cloud/api/commands/ConfigureCiscoNexusVSMCmd.java b/server/src/com/cloud/api/commands/ConfigureCiscoNexusVSMCmd.java deleted file mode 100644 index f210996b91c..00000000000 --- a/server/src/com/cloud/api/commands/ConfigureCiscoNexusVSMCmd.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -package com.cloud.api.commands; - -import org.apache.log4j.Logger; - -import com.cloud.api.ApiConstants; -import com.cloud.api.BaseAsyncCmd; -import com.cloud.api.BaseCmd; -import com.cloud.api.IdentityMapper; -import com.cloud.api.Implementation; -import com.cloud.api.Parameter; -import com.cloud.api.PlugService; -import com.cloud.api.ServerApiException; -//import com.cloud.api.response.NetscalerLoadBalancerResponse; -import com.cloud.api.response.CiscoNexusVSMResponse; -import com.cloud.event.EventTypes; -import com.cloud.exception.ConcurrentOperationException; -import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.ResourceAllocationException; -import com.cloud.exception.ResourceUnavailableException; -//import com.cloud.network.ExternalLoadBalancerDeviceVO; -import com.cloud.network.CiscoNexusVSMDeviceVO; -//import com.cloud.network.element.NetscalerLoadBalancerElementService; -import com.cloud.network.element.CiscoNexusVSMElementService; -import com.cloud.user.UserContext; -import com.cloud.utils.exception.CloudRuntimeException; - -@Implementation(responseObject=CiscoNexusVSMResponse.class, description="configures a netscaler load balancer device") -public class ConfigureCiscoNexusVSMCmd extends BaseAsyncCmd { - - public static final Logger s_logger = Logger.getLogger(ConfigureCiscoNexusVSMCmd.class.getName()); - private static final String s_name = "configurecisconexusvsmresponse"; - @PlugService CiscoNexusVSMElementService _ciscoNexusVSMService; - - ///////////////////////////////////////////////////// - //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// - - @IdentityMapper(entityTableName="virtual_supervisor_module") - @Parameter(name=ApiConstants.EXTERNAL_SWITCH_MGMT_DEVICE_ID, type=CommandType.LONG, required=true, description="Cisco Nexus 1000v VSM device ID") - private Long vsmDeviceId; - - // As of now, not sure what to configure the n1kv VSM device with! So we'll just place a note here to pass in the parameters we'd like to - // configure. - - ///////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// - - public Long getCiscoNexusVSMDeviceId() { - return vsmDeviceId; - } - - // We'll define more accessor methods in case we add more parameters above. - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - /** - try { - CiscoNexusVSMDeviceVO ciscoNexusVSMDeviceVO = _ciscoNexusVSMService.configureCiscoNexusVSM(this); - if (ciscoNexusVSMDeviceVO != null) { - CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMResponse(ciscoNexusVSMDeviceVO); - response.setObjectName("cisconexusvsm"); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to configure netscaler load balancer due to internal error."); - } - } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); - } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); - } **/ - } - - @Override - public String getEventDescription() { - return "Configuring a Cisco Nexus VSM device"; - } - - @Override - public String getEventType() { - return EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_CONFIGURE; - } - - @Override - public String getCommandName() { - return s_name; - } - - @Override - public long getEntityOwnerId() { - return UserContext.current().getCaller().getId(); - } -} diff --git a/server/src/com/cloud/api/commands/ListCiscoNexusVSMCmd.java b/server/src/com/cloud/api/commands/ListCiscoNexusVSMCmd.java deleted file mode 100644 index 2f45e96c630..00000000000 --- a/server/src/com/cloud/api/commands/ListCiscoNexusVSMCmd.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -package com.cloud.api.commands; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import com.cloud.api.ApiConstants; -import com.cloud.api.BaseCmd; -import com.cloud.api.BaseListCmd; -import com.cloud.api.IdentityMapper; -import com.cloud.api.Implementation; -import com.cloud.api.Parameter; -import com.cloud.api.PlugService; -import com.cloud.api.ServerApiException; -import com.cloud.api.response.ListResponse; -import com.cloud.api.response.CiscoNexusVSMResponse; -import com.cloud.exception.ConcurrentOperationException; -import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.ResourceAllocationException; -import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.CiscoNexusVSMDeviceVO; -import com.cloud.network.element.CiscoNexusVSMElementService; -import com.cloud.utils.exception.CloudRuntimeException; - -@Implementation(responseObject=CiscoNexusVSMResponse.class, description="lists Cisco Nexus 1000v VSM devices") -public class ListCiscoNexusVSMCmd extends BaseListCmd { - - public static final Logger s_logger = Logger.getLogger(ListCiscoNexusVSMCmd.class.getName()); - private static final String s_name = "listcisconexusvsmresponse"; - @PlugService CiscoNexusVSMElementService _ciscoNexusVSMService; - - ///////////////////////////////////////////////////// - //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// - - @IdentityMapper(entityTableName="external_switch_management_devices") - @Parameter(name=ApiConstants.EXTERNAL_SWITCH_MGMT_DEVICE_ID, type=CommandType.LONG, description="Cisco Nexus 1000v VSM device ID") - private Long vsmDeviceId; - - ///////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// - - public Long getCiscoNexusVSMDeviceId() { - return vsmDeviceId; - } - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - try { - List vsmDevices = _ciscoNexusVSMService.listCiscoNexusVSMs(this); - ListResponse response = new ListResponse(); - List vsmDevicesResponse = new ArrayList(); - - if (vsmDevices != null && !vsmDevices.isEmpty()) { - for (CiscoNexusVSMDeviceVO vsmDeviceVO : vsmDevices) { - CiscoNexusVSMResponse vsmdeviceResponse = _ciscoNexusVSMService.createCiscoNexusVSMResponse(vsmDeviceVO); - vsmDevicesResponse.add(vsmdeviceResponse); - } - } - response.setResponses(vsmDevicesResponse); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); - } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); - } - } - - @Override - public String getCommandName() { - return s_name; - } -} diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java index 5bcbb7b5846..570c82fa4a6 100644 --- a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java +++ b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java @@ -21,7 +21,6 @@ import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.api.commands.DeleteCiscoNexusVSMCmd; -import com.cloud.api.commands.ListCiscoNexusVSMCmd; import com.cloud.api.commands.EnableCiscoNexusVSMCmd; import com.cloud.api.commands.DisableCiscoNexusVSMCmd; import com.cloud.api.commands.GetCiscoVSMByClusterIdCmd; @@ -37,7 +36,6 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.network.CiscoNexusVSMDeviceVO; -import com.cloud.dc.ClusterVSMMapVO; import com.cloud.network.CiscoNexusVSMDeviceManagerImpl; import com.cloud.network.Network; import com.cloud.network.NetworkManager; @@ -206,12 +204,6 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme return result; } - @Override - public List listCiscoNexusVSMs(ListCiscoNexusVSMCmd cmd) { - return null; - - } - @Override public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDeviceVO vsmDeviceVO) { CiscoNexusVSMResponse response = new CiscoNexusVSMResponse(); diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java index 1810c3e6ca6..735464a2cf8 100644 --- a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java +++ b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java @@ -18,13 +18,11 @@ package com.cloud.network.element; -import java.util.List; import com.cloud.api.commands.DeleteCiscoNexusVSMCmd; import com.cloud.api.commands.EnableCiscoNexusVSMCmd; import com.cloud.api.commands.DisableCiscoNexusVSMCmd; import com.cloud.api.commands.GetCiscoVSMByClusterIdCmd; import com.cloud.api.commands.GetCiscoVSMDetailsCmd; -import com.cloud.api.commands.ListCiscoNexusVSMCmd; import com.cloud.api.response.CiscoNexusVSMResponse; import com.cloud.network.CiscoNexusVSMDeviceVO; import com.cloud.utils.component.PluggableService; @@ -37,13 +35,6 @@ public interface CiscoNexusVSMElementService extends PluggableService { */ public boolean deleteCiscoNexusVSM(DeleteCiscoNexusVSMCmd cmd); - /** - * lists all the VSMs the Mgmt Server knows of. - * @param ListCiscoNexusVSMCmd - * @return list of CiscoNexusVSMDeviceVO for the VSMs the mgmt server knows of. - */ - public List listCiscoNexusVSMs(ListCiscoNexusVSMCmd cmd); - /** * Enables a Cisco Nexus VSM. */