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:44 UTC
[50/50] git commit: CS-9919 Support for Nexus Swiches (Cisco
Vswitches)
CS-9919 Support for Nexus Swiches (Cisco Vswitches)
Description:
1. Removed CiscoNexusVSM.java.
2. Put in invocation of Netconfhelper's
connect method to a VSM, in
CiscoNexusVSMDeviceManagerImpl.java.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7e845cfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7e845cfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7e845cfa
Branch: refs/heads/master
Commit: 7e845cfa622d3aee6f115fb25f0b30ac7d39b85d
Parents: 8ba1d62
Author: Vijayendra Bhamidipati <vi...@citrix.com>
Authored: Wed May 9 19:39:26 2012 -0700
Committer: Vijayendra Bhamidipati <vi...@citrix.com>
Committed: Fri May 25 17:29:35 2012 -0700
----------------------------------------------------------------------
.../com/cloud/network/resource/CiscoNexusVSM.java | 96 ---------------
.../network/CiscoNexusVSMDeviceManagerImpl.java | 17 ++-
2 files changed, 10 insertions(+), 103 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7e845cfa/core/src/com/cloud/network/resource/CiscoNexusVSM.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/resource/CiscoNexusVSM.java b/core/src/com/cloud/network/resource/CiscoNexusVSM.java
deleted file mode 100644
index dc14906..0000000
--- a/core/src/com/cloud/network/resource/CiscoNexusVSM.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// 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.resource;
-
-import com.cloud.utils.cisco.n1kv.vsm.NetconfHelper;
-
-import com.cloud.utils.ssh.*;
-import com.cloud.utils.cisco.n1kv.vsm.CiscoNexusVSMService;
-
-import org.apache.log4j.Logger;
-
-class VSMError {
- static final int VSM_RESOURCE_EXISTS = 89901;
- static final int VSM_RESOURCE_NOT_EXISTS= 89902;
- static final int VSM_NO_SERIVCE = 89903;
- static final int VSM_OPERATION_NOT_PERMITTED = 89904;
-}
-
-public class CiscoNexusVSM {
-
- // deployment configuration
- private String vsmIpaddr;
- private String vsmUsername;
- private String vsmPassword;
- private String vsmSubsystem;
- com.trilead.ssh2.Connection sshConnection;
-
- private static final Logger s_logger = Logger.getLogger(CiscoNexusVSM.class);
-
- // interface to interact with Cisco Nexus VSM devices
- CiscoNexusVSMService _vsmService;
-
- Long _timeout = new Long(100000);
-
- // We need to store the result of the XML-RPC command sent to
- // the VSM. For now it's a string. We should make this the appropriate XSD object.
- String xml_rpc_response;
-
- public void setVsmIpaddr(String ipaddr) {
- this.vsmIpaddr = ipaddr;
- }
-
- public void setVsmUsername(String username) {
- this.vsmUsername = username;
- }
-
- public void setVsmPassword(String password) {
- this.vsmPassword = password;
- }
-
- public void setVsmSubsystem(String subsystem) {
- this.vsmSubsystem = subsystem;
- }
-
- public CiscoNexusVSM() {
- this.vsmSubsystem = "xmlagent";
- }
-
- public String getVsmIpaddr() {
- return vsmIpaddr;
- }
-
- public String getVsmUsername() {
- return vsmUsername;
- }
-
- public String getVsmPassword() {
- return vsmPassword;
- }
-
- public String getVsmSubsystem() {
- return vsmSubsystem;
- }
-
- public CiscoNexusVSM(String username, String ipaddr, String password) {
-
- }
-
- public boolean connectToVSM() {
- sshConnection = SSHCmdHelper.acquireAuthorizedConnection(this.vsmIpaddr, this.vsmUsername, this.vsmPassword);
- if (sshConnection == null) {
- return false;
- }
- return true;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7e845cfa/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
index fd9aea1..63512aa 100644
--- a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
@@ -13,6 +13,7 @@
package com.cloud.network;
import java.util.HashMap;
+
import java.util.List;
import java.util.Map;
@@ -38,13 +39,10 @@ import com.cloud.utils.component.Inject;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.network.PortProfileVO.BindingType;
-import com.cloud.network.PortProfileVO.PortType;
import com.cloud.network.dao.CiscoNexusVSMDeviceDao;
import com.cloud.network.dao.PortProfileDao;
-import com.cloud.network.resource.CiscoNexusVSM;
import com.cloud.exception.ResourceInUseException;
-import com.cloud.network.PortProfileManagerImpl;
+import com.cloud.utils.cisco.n1kv.vsm.NetconfHelper;
public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase {
@@ -102,11 +100,16 @@ public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase {
// the VSM.
//NetconfHelper (String ip, String username, String password)
- CiscoNexusVSM vsmObj = new CiscoNexusVSM(ipaddress, username, password);
- if (!vsmObj.connectToVSM()) {
- throw new CloudRuntimeException("Couldn't login to the specified VSM");
+ NetconfHelper netconfClient;
+ try {
+ netconfClient = new NetconfHelper(ipaddress, username, password);
+ } catch(CloudRuntimeException e) {
+ String msg = "Failed to connect to Nexus VSM " + ipaddress + " with credentials of user " + username;
+ s_logger.error(msg);
+ throw new CloudRuntimeException(msg);
}
+
// Now, go ahead and associate the cluster with this VSM.
// First, check if VSM already exists in the table "virtual_supervisor_module".
// If it's not there already, create it.