You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2012/05/28 00:30:43 UTC

[20/50] git commit: CS-9919: Support for Nexus Swiches (Cisco Vswitches)

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.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e7246847
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e7246847
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e7246847

Branch: refs/heads/master
Commit: e7246847ac166a5d88b071641204a2639bb33183
Parents: 78d40da
Author: Vijayendra Bhamidipati <vi...@citrix.com>
Authored: Mon May 21 19:00:25 2012 -0700
Committer: Vijayendra Bhamidipati <vi...@citrix.com>
Committed: Fri May 25 18:23:40 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/network/CiscoNexusVSMDevice.java |   71 +++++++++++++++
 .../api/commands/GetCiscoVSMByClusterIdCmd.java    |    8 +-
 .../com/cloud/network/CiscoNexusVSMDeviceVO.java   |   27 +-----
 .../cloud/network/dao/CiscoNexusVSMDeviceDao.java  |    1 -
 .../network/element/CiscoNexusVSMElement.java      |   10 +-
 .../element/CiscoNexusVSMElementService.java       |    5 +-
 6 files changed, 87 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e7246847/api/src/com/cloud/network/CiscoNexusVSMDevice.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/CiscoNexusVSMDevice.java b/api/src/com/cloud/network/CiscoNexusVSMDevice.java
new file mode 100644
index 0000000..66315da
--- /dev/null
+++ b/api/src/com/cloud/network/CiscoNexusVSMDevice.java
@@ -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();
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e7246847/server/src/com/cloud/api/commands/GetCiscoVSMByClusterIdCmd.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/commands/GetCiscoVSMByClusterIdCmd.java b/server/src/com/cloud/api/commands/GetCiscoVSMByClusterIdCmd.java
index 0212a8d..e46cd7e 100755
--- a/server/src/com/cloud/api/commands/GetCiscoVSMByClusterIdCmd.java
+++ b/server/src/com/cloud/api/commands/GetCiscoVSMByClusterIdCmd.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e7246847/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java b/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
index d05f548..945b033 100644
--- a/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
+++ b/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
@@ -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() {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e7246847/server/src/com/cloud/network/dao/CiscoNexusVSMDeviceDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/CiscoNexusVSMDeviceDao.java b/server/src/com/cloud/network/dao/CiscoNexusVSMDeviceDao.java
index 1023b1e..5c659b3 100644
--- a/server/src/com/cloud/network/dao/CiscoNexusVSMDeviceDao.java
+++ b/server/src/com/cloud/network/dao/CiscoNexusVSMDeviceDao.java
@@ -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> {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e7246847/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
index 570c82f..bc89caf 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
@@ -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());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e7246847/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
index 735464a..45a6263 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
@@ -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);
 }