mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
CS-9919: Support for Nexus Swiches (Cisco Vswitches)
Description: Putting in code changes as per Alena's reviews: Replaced references to CiscoNexusVSMDeviceVO in GetCiscoVSMByClusterIdCmd to work with an interface that CiscoNexusVSMDeviceVO instead, since VO objects should not be directly accessed in APIs. Made associated changes in other files. More commits incorporating Alena's review comments will follow.
This commit is contained in:
parent
78d40da1bf
commit
e7246847ac
71
api/src/com/cloud/network/CiscoNexusVSMDevice.java
Normal file
71
api/src/com/cloud/network/CiscoNexusVSMDevice.java
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
// reserves all rights not expressly granted by the License.
|
||||
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
package com.cloud.network;
|
||||
|
||||
public interface CiscoNexusVSMDevice {
|
||||
|
||||
// This tells us whether the VSM is currently enabled or disabled. We may
|
||||
// need this if we would like to carry out any sort of maintenance on the
|
||||
// VSM or CS.
|
||||
public enum VSMDeviceState {
|
||||
Enabled,
|
||||
Disabled
|
||||
}
|
||||
|
||||
// This tells us whether the VSM is currently configured with a standby (HA)
|
||||
// or does not have any standby (Standalone).
|
||||
public enum VSMConfigMode {
|
||||
Standalone,
|
||||
HA
|
||||
}
|
||||
|
||||
// This tells us whether the VSM is currently a primary or a standby VSM.
|
||||
public enum VSMConfigState {
|
||||
Primary,
|
||||
Standby
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
public String getvsmName();
|
||||
|
||||
public long getHostId();
|
||||
|
||||
public String getUserName();
|
||||
|
||||
public String getPassword();
|
||||
|
||||
public String getipaddr();
|
||||
|
||||
public String getvCenterIPAddr();
|
||||
|
||||
public String getvCenterDCName();
|
||||
|
||||
public int getManagementVlan();
|
||||
|
||||
public int getControlVlan();
|
||||
|
||||
public int getPacketVlan();
|
||||
|
||||
public int getStorageVlan();
|
||||
|
||||
public long getvsmDomainId();
|
||||
|
||||
public VSMConfigMode getvsmConfigMode();
|
||||
|
||||
public VSMConfigState getvsmConfigState();
|
||||
|
||||
public VSMDeviceState getvsmDeviceState();
|
||||
|
||||
public String getUuid();
|
||||
|
||||
}
|
||||
@ -33,7 +33,7 @@ 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.CiscoNexusVSMDevice;
|
||||
import com.cloud.network.element.CiscoNexusVSMElementService;
|
||||
import com.cloud.user.UserContext;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@ -71,9 +71,9 @@ public class GetCiscoVSMByClusterIdCmd extends BaseCmd {
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
|
||||
try {
|
||||
CiscoNexusVSMDeviceVO vsmDeviceVO = _ciscoNexusVSMService.getCiscoNexusVSMByClusId(this);
|
||||
if (vsmDeviceVO != null) {
|
||||
CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMResponse(vsmDeviceVO);
|
||||
CiscoNexusVSMDevice vsmDevice = _ciscoNexusVSMService.getCiscoNexusVSMByClusId(this);
|
||||
if (vsmDevice != null) {
|
||||
CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMResponse(vsmDevice);
|
||||
response.setObjectName("cisconexusvsm");
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
@ -27,6 +27,8 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.api.Identity;
|
||||
|
||||
/**
|
||||
* CiscoNexusVSMDeviceVO contains information on external Cisco Nexus 1000v VSM devices added into a deployment.
|
||||
* This should be probably made as a more generic class so that we can handle multiple versions of Nexus VSMs
|
||||
@ -35,7 +37,7 @@ import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name="virtual_supervisor_module")
|
||||
public class CiscoNexusVSMDeviceVO {
|
||||
public class CiscoNexusVSMDeviceVO implements CiscoNexusVSMDevice, Identity{
|
||||
|
||||
// We need to know what properties a VSM has. Put them here.
|
||||
|
||||
@ -91,28 +93,7 @@ public class CiscoNexusVSMDeviceVO {
|
||||
private VSMConfigState vsmConfigState;
|
||||
|
||||
@Column(name = "vsmDeviceState")
|
||||
private VSMDeviceState vsmDeviceState;
|
||||
|
||||
// This tells us whether the VSM is currently enabled or disabled. We may
|
||||
// need this if we would like to carry out any sort of maintenance on the
|
||||
// VSM or CS.
|
||||
public enum VSMDeviceState {
|
||||
Enabled,
|
||||
Disabled
|
||||
}
|
||||
|
||||
// This tells us whether the VSM is currently configured with a standby (HA)
|
||||
// or does not have any standby (Standalone).
|
||||
public enum VSMConfigMode {
|
||||
Standalone,
|
||||
HA
|
||||
}
|
||||
|
||||
// This tells us whether the VSM is currently a primary or a standby VSM.
|
||||
public enum VSMConfigState {
|
||||
Primary,
|
||||
Standby
|
||||
}
|
||||
private VSMDeviceState vsmDeviceState;
|
||||
|
||||
// Accessor methods
|
||||
public long getId() {
|
||||
|
||||
@ -14,7 +14,6 @@ package com.cloud.network.dao;
|
||||
|
||||
import java.util.List;
|
||||
import com.cloud.network.CiscoNexusVSMDeviceVO;
|
||||
import com.cloud.network.CiscoNexusVSMDeviceVO.VSMDeviceState;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface CiscoNexusVSMDeviceDao extends GenericDao<CiscoNexusVSMDeviceVO, Long> {
|
||||
|
||||
@ -36,6 +36,7 @@ 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.network.CiscoNexusVSMDevice;
|
||||
import com.cloud.network.CiscoNexusVSMDeviceManagerImpl;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.NetworkManager;
|
||||
@ -169,8 +170,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
|
||||
throw new CloudRuntimeException("Failed to delete specified VSM");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enableCiscoNexusVSM(EnableCiscoNexusVSMCmd cmd) {
|
||||
@ -205,14 +205,14 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDeviceVO vsmDeviceVO) {
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDevice vsmDeviceVO) {
|
||||
CiscoNexusVSMResponse response = new CiscoNexusVSMResponse();
|
||||
response.setId(vsmDeviceVO.getId());
|
||||
response.setId(vsmDeviceVO.getId());
|
||||
response.setMgmtIpAddress(vsmDeviceVO.getipaddr());
|
||||
return response;
|
||||
}
|
||||
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMDetailedResponse(CiscoNexusVSMDeviceVO vsmDeviceVO) {
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMDetailedResponse(CiscoNexusVSMDevice vsmDeviceVO) {
|
||||
CiscoNexusVSMResponse response = new CiscoNexusVSMResponse();
|
||||
response.setId(vsmDeviceVO.getId());
|
||||
response.setDeviceName(vsmDeviceVO.getvsmName());
|
||||
|
||||
@ -25,6 +25,7 @@ import com.cloud.api.commands.GetCiscoVSMByClusterIdCmd;
|
||||
import com.cloud.api.commands.GetCiscoVSMDetailsCmd;
|
||||
import com.cloud.api.response.CiscoNexusVSMResponse;
|
||||
import com.cloud.network.CiscoNexusVSMDeviceVO;
|
||||
import com.cloud.network.CiscoNexusVSMDevice;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
|
||||
public interface CiscoNexusVSMElementService extends PluggableService {
|
||||
@ -66,12 +67,12 @@ public interface CiscoNexusVSMElementService extends PluggableService {
|
||||
* @return CiscoNexusVSMResponse
|
||||
*/
|
||||
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDeviceVO vsmDeviceVO);
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDevice vsmDeviceVO);
|
||||
|
||||
/**
|
||||
* Creates a detailed API response object for Cisco Nexus VSMs
|
||||
* @param CiscoNexusVSMDeviceVO
|
||||
* @return CiscoNexusVSMResponse
|
||||
*/
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMDetailedResponse(CiscoNexusVSMDeviceVO vsmDeviceVO);
|
||||
public CiscoNexusVSMResponse createCiscoNexusVSMDetailedResponse(CiscoNexusVSMDevice vsmDeviceVO);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user