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 dc149068524..00000000000 --- 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 diff --git a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java index fd9aea1ada9..63512aa0f96 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.