You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2013/01/17 01:38:51 UTC
[15/15] git commit: cisco-vnmc: Fix api to use new conventions
Updated Branches:
refs/heads/cisco-vnmc-api-integration [created] 392cd8ed6
cisco-vnmc: Fix api to use new conventions
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/392cd8ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/392cd8ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/392cd8ed
Branch: refs/heads/cisco-vnmc-api-integration
Commit: 392cd8ed631009590c0001e88a82b17294af2c3e
Parents: 6b142bb
Author: Chiradeep Vittal <ch...@apache.org>
Authored: Wed Jan 16 16:38:19 2013 -0800
Committer: Chiradeep Vittal <ch...@apache.org>
Committed: Wed Jan 16 16:38:19 2013 -0800
----------------------------------------------------------------------
plugins/network-elements/cisco-vnmc/build.xml | 129 -------
plugins/network-elements/cisco-vnmc/pom.xml | 2 +-
.../api/commands/AddCiscoVnmcResourceCmd.java | 26 +-
.../api/commands/DeleteCiscoVnmcResourceCmd.java | 21 +-
.../api/commands/ListCiscoVnmcResourcesCmd.java | 34 +-
.../api/response/CiscoVnmcResourceResponse.java | 36 ++-
.../cloud/network/cisco/CiscoVnmcController.java | 24 ++
.../cloud/network/cisco/CiscoVnmcControllerVO.java | 123 +++++++
.../com/cloud/network/cisco/CiscoVnmcManager.java | 31 +-
.../cloud/network/cisco/CiscoVnmcResourceVO.java | 95 ------
.../cisco/test/CiscoVnmcConnectionTest.java | 258 ---------------
.../src/com/cloud/network/dao/CiscoVnmcDao.java | 6 +-
.../com/cloud/network/dao/CiscoVnmcDaoImpl.java | 10 +-
.../cloud/network/element/CiscoVnmcElement.java | 13 +-
.../network/element/CiscoVnmcElementService.java | 9 +-
.../network/cisco/CiscoVnmcConnectionTest.java | 258 +++++++++++++++
plugins/pom.xml | 1 +
17 files changed, 505 insertions(+), 571 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/build.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/build.xml b/plugins/network-elements/cisco-vnmc/build.xml
deleted file mode 100755
index c9eca5d..0000000
--- a/plugins/network-elements/cisco-vnmc/build.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- 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.
--->
-
-
-<project name="Cloud Stack VNMC network element" default="help" basedir=".">
- <description>
- Cloud Stack ant build file
- </description>
-
- <dirname property="vnmc.base.dir" file="${ant.file.Cloud Stack VNMC network element}/"/>
- <!-- This directory must be set -->
- <property name="top.dir" location="${vnmc.base.dir}/../../.."/>
- <property name="build.dir" location="${top.dir}/build"/>
-
- <echo message="build.dir=${build.dir}; top.dir=${top.dir}; vnmc.base.dir=${vnmc.base.dir}"/>
-
- <!-- Import anything that the user wants to set-->
- <!-- Import properties files and environment variables here -->
-
- <property environment="env" />
-
- <condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
- <available file="${build.dir}/override/build-cloud.properties" />
- </condition>
-
- <condition property="cloud.properties.file" value="${build.dir}/override/cloud.properties" else="${build.dir}/cloud.properties">
- <available file="${build.dir}/override/cloud.properties" />
- </condition>
-
- <condition property="override.file" value="${build.dir}/override/replace.properties" else="${build.dir}/replace.properties">
- <available file="${build.dir}/override/replace.properties" />
- </condition>
-
- <echo message="Using build parameters from ${build-cloud.properties.file}" />
- <property file="${build-cloud.properties.file}" />
-
- <echo message="Using company info from ${cloud.properties.file}" />
- <property file="${cloud.properties.file}" />
-
- <echo message="Using override file from ${override.file}" />
- <property file="${override.file}" />
-
- <property file="${build.dir}/build.number" />
-
- <!-- In case these didn't get defined in the build-cloud.properties -->
- <property name="branding.name" value="default" />
- <property name="deprecation" value="off" />
- <property name="target.compat.version" value="1.6" />
- <property name="source.compat.version" value="1.6" />
- <property name="debug" value="true" />
- <property name="debuglevel" value="lines,source"/>
-
- <echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
- <!-- directories for build and distribution -->
- <property name="target.dir" location="${top.dir}/target" />
- <property name="classes.dir" location="${target.dir}/classes" />
- <property name="jar.dir" location="${target.dir}/jar" />
- <property name="dep.cache.dir" location="${target.dir}/dep-cache" />
- <property name="build.log" location="${target.dir}/ant_verbose.txt" />
-
- <property name="deps.dir" location="${top.dir}/deps" />
-
- <property name="cloud-plugin-vnmc.jar" value="cloud-plugin-vnmc.jar" />
-
- <import file="${build.dir}/build-common.xml"/>
-
- <echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
-
- <!-- This section needs to be replaced by some kind of dependency library-->
- <path id="deps.classpath">
- <!--filelist files="${deps.classpath}" /-->
- <fileset dir="${deps.dir}" erroronmissingdir="false">
- <include name="*.jar" />
- </fileset>
- </path>
-
- <path id="cloudstack.classpath">
- <fileset dir="${jar.dir}">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <path id="vnmc.classpath">
- <path refid="deps.classpath"/>
- <path refid="cloudstack.classpath"/>
- </path>
-
- <!-- This section needs to be replaced by some kind of dependency library-->
-
- <target name="deploy-vnmc" >
- </target>
-
- <target name="init" description="Initialize binaries directory">
- <mkdir dir="${classes.dir}/${cloud-plugin-vnmc.jar}"/>
- <mkdir dir="${jar.dir}"/>
- </target>
-
- <target name="compile-vnmc" depends="init" description="Compile Cisco VNMC">
- <compile-java jar.name="${cloud-plugin-vnmc.jar}" top.dir="${vnmc.base.dir}" classpath="vnmc.classpath" />
- </target>
-
- <target name="clean-vnmc">
- <delete dir="${classes.dir}/${cloud-plugin-vnmc.jar}"/>
- </target>
-
- <target name="build" depends="compile-vnmc"/>
- <target name="clean" depends="clean-vnmc"/>
-
- <target name="help" description="help">
- <echo level="info" message="This is the build file for Cisco VNMC element plugin"/>
- <echo level="info" message="You can do a build by doing ant build or clean by doing ant clean" />
- </target>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/pom.xml b/plugins/network-elements/cisco-vnmc/pom.xml
index d69cd64..0a8d242 100644
--- a/plugins/network-elements/cisco-vnmc/pom.xml
+++ b/plugins/network-elements/cisco-vnmc/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java
index aa41611..b20eed9 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoVnmcResourceCmd.java
@@ -16,28 +16,29 @@
// under the License.
package com.cloud.api.commands;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.PlugService;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
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.CiscoVnmcResourceResponse;
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.cisco.CiscoVnmcResourceVO;
+import com.cloud.network.cisco.CiscoVnmcController;
import com.cloud.network.element.CiscoVnmcElementService;
import com.cloud.user.UserContext;
import com.cloud.utils.exception.CloudRuntimeException;
-@Implementation(responseObject=CiscoVnmcResourceResponse.class, description="Adds a Cisco Vnmc Controller")
+@APICommand(responseObject=CiscoVnmcResourceResponse.class, description="Adds a Cisco Vnmc Controller")
public class AddCiscoVnmcResourceCmd extends BaseCmd {
private static final Logger s_logger = Logger.getLogger(AddCiscoVnmcResourceCmd.class.getName());
private static final String s_name = "addCiscoVnmcResource";
@@ -47,8 +48,7 @@ public class AddCiscoVnmcResourceCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, required=true, description="the Physical Network ID")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class, required=true, description="the Physical Network ID")
private Long physicalNetworkId;
@Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required = true, description="Hostname of ip address of the Cisco VNMC Controller.")
@@ -89,7 +89,7 @@ public class AddCiscoVnmcResourceCmd extends BaseCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
- CiscoVnmcResourceVO CiscoVnmcResourceVO = _ciscoVnmcElementService.addCiscoVnmcResource(this);
+ CiscoVnmcController CiscoVnmcResourceVO = _ciscoVnmcElementService.addCiscoVnmcResource(this);
if (CiscoVnmcResourceVO != null) {
CiscoVnmcResourceResponse response = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(CiscoVnmcResourceVO);
response.setObjectName("CiscoVnmcResource");
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java
index 71b221d..895a7b3 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoVnmcResourceCmd.java
@@ -16,16 +16,16 @@
// under the License.
package com.cloud.api.commands;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.PlugService;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import com.cloud.api.ApiConstants;
-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.SuccessResponse;
+import com.cloud.api.response.CiscoVnmcResourceResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
@@ -35,7 +35,7 @@ import com.cloud.network.element.CiscoVnmcElementService;
import com.cloud.user.UserContext;
import com.cloud.utils.exception.CloudRuntimeException;
-@Implementation(responseObject=SuccessResponse.class, description=" delete a Cisco Vnmc Resource")
+@APICommand(responseObject=SuccessResponse.class, description=" delete a Cisco Vnmc Resource")
public class DeleteCiscoVnmcResourceCmd extends BaseCmd {
private static final Logger s_logger = Logger.getLogger(DeleteCiscoVnmcResourceCmd.class.getName());
private static final String s_name = "addCiscoVnmcResource";
@@ -45,8 +45,7 @@ public class DeleteCiscoVnmcResourceCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="external_cisco_vnmc_resources")
- @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.LONG, required=true, description="Cisco Vnmc resource ID")
+ @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.UUID, required=true, entityType=CiscoVnmcResourceResponse.class, description="Cisco Vnmc resource ID")
private Long CiscoVnmcResourceId;
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
index 577a170..118feb0 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
@@ -19,28 +19,30 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.PlugService;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
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.CiscoVnmcResourceResponse;
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.cisco.CiscoVnmcResourceVO;
+import com.cloud.network.cisco.CiscoVnmcController;
+import com.cloud.network.cisco.CiscoVnmcControllerVO;
import com.cloud.network.element.CiscoVnmcElementService;
import com.cloud.utils.exception.CloudRuntimeException;
-@Implementation(responseObject=CiscoVnmcResourceResponse.class, description="Lists Cisco VNMC controllers")
+@APICommand(responseObject=CiscoVnmcResourceResponse.class, description="Lists Cisco VNMC controllers")
public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
private static final Logger s_logger = Logger.getLogger(ListCiscoVnmcResourcesCmd.class.getName());
private static final String s_name = "listCiscoVnmcResources";
@@ -50,12 +52,10 @@ public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @IdentityMapper(entityTableName="physical_network")
- @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID")
+ @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class, description="the Physical Network ID")
private Long physicalNetworkId;
- @IdentityMapper(entityTableName="external_cisco_vnmc_resources")
- @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.LONG, description="Cisco VNMC resource ID")
+ @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.UUID, entityType=CiscoVnmcResourceResponse.class, description="Cisco VNMC resource ID")
private Long ciscoVnmcResourceId;
/////////////////////////////////////////////////////
@@ -77,12 +77,12 @@ public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
- List<CiscoVnmcResourceVO> CiscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
+ List<CiscoVnmcControllerVO> CiscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
ListResponse<CiscoVnmcResourceResponse> response = new ListResponse<CiscoVnmcResourceResponse>();
List<CiscoVnmcResourceResponse> CiscoVnmcResourcesResponse = new ArrayList<CiscoVnmcResourceResponse>();
if (CiscoVnmcResources != null && !CiscoVnmcResources.isEmpty()) {
- for (CiscoVnmcResourceVO CiscoVnmcResourceVO : CiscoVnmcResources) {
+ for (CiscoVnmcController CiscoVnmcResourceVO : CiscoVnmcResources) {
CiscoVnmcResourceResponse CiscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(CiscoVnmcResourceVO);
CiscoVnmcResourcesResponse.add(CiscoVnmcResourceResponse);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
index b3774c5..91b6b8a 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
@@ -16,21 +16,27 @@
// under the License.
package com.cloud.api.response;
-import com.cloud.api.ApiConstants;
-import com.cloud.serializer.Param;
-import com.cloud.utils.IdentityProxy;
-import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+
+import com.cloud.network.cisco.CiscoVnmcController;
+import com.google.gson.annotations.SerializedName;
+@EntityReference(value = CiscoVnmcController.class)
public class CiscoVnmcResourceResponse extends BaseResponse {
public static final String RESOURCE_NAME = "resourcename";
- @SerializedName(ApiConstants.RESOURCE_ID) @Param(description="resource id of the Cisco VNMC controller")
- private IdentityProxy id = new IdentityProxy("external_cisco_vnmc_resources");
+ @SerializedName(ApiConstants.RESOURCE_ID) @Parameter(description="resource id of the Cisco VNMC controller")
+ private String id;
- @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network to which this VNMC belongs to")
- private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
+ @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
+ @Parameter(description="the physical network to which this VNMC belongs to", entityType = PhysicalNetworkResponse.class)
+ private Long physicalNetworkId ;
- public IdentityProxy getPhysicalNetworkId() {
+ public Long getPhysicalNetworkId() {
return physicalNetworkId;
}
@@ -42,19 +48,19 @@ public class CiscoVnmcResourceResponse extends BaseResponse {
return resourceName;
}
- @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider")
+ @SerializedName(ApiConstants.PROVIDER) @Parameter(description="name of the provider")
private String providerName;
@SerializedName(RESOURCE_NAME)
- @Param(description="Cisco VNMC resource name")
+ @Parameter(description="Cisco VNMC resource name")
private String resourceName;
- public void setId(long ciscoVnmcResourceId) {
- this.id.setValue(ciscoVnmcResourceId);
+ public void setId(String ciscoVnmcResourceId) {
+ this.id = ciscoVnmcResourceId;
}
- public void setPhysicalNetworkId(long physicalNetworkId) {
- this.physicalNetworkId.setValue(physicalNetworkId);
+ public void setPhysicalNetworkId(Long physicalNetworkId) {
+ this.physicalNetworkId = physicalNetworkId;
}
public void setProviderName(String providerName) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcController.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcController.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcController.java
new file mode 100644
index 0000000..0db743c
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcController.java
@@ -0,0 +1,24 @@
+package com.cloud.network.cisco;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.org.Grouping;
+
+public interface CiscoVnmcController extends Grouping, InternalIdentity, Identity {
+
+ long getId();
+
+ String getUuid();
+
+ void setUuid(String uuid);
+
+ long getPhysicalNetworkId();
+
+ long getHostId();
+
+ String getProviderName();
+
+ String getDeviceName();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcControllerVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcControllerVO.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcControllerVO.java
new file mode 100644
index 0000000..69ac135
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcControllerVO.java
@@ -0,0 +1,123 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with 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.cisco;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="external_cisco_vnmc_devices")
+public class CiscoVnmcControllerVO implements CiscoVnmcController {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="uuid")
+ private String uuid;
+
+ @Column(name="host_id")
+ private long hostId;
+
+ @Column(name="physical_network_id")
+ private long physicalNetworkId;
+
+ @Column(name="provider_name")
+ private String providerName;
+
+ @Column(name="device_name")
+ private String deviceName;
+
+
+ public CiscoVnmcControllerVO() {
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public CiscoVnmcControllerVO(long hostId, long physicalNetworkId,
+ String providerName, String deviceName) {
+ super();
+ this.hostId = hostId;
+ this.physicalNetworkId = physicalNetworkId;
+ this.providerName = providerName;
+ this.deviceName = deviceName;
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#getId()
+ */
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#getUuid()
+ */
+ @Override
+ public String getUuid() {
+ return uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#setUuid(java.lang.String)
+ */
+ @Override
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#getPhysicalNetworkId()
+ */
+ @Override
+ public long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#getHostId()
+ */
+ @Override
+ public long getHostId() {
+ return hostId;
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#getProviderName()
+ */
+ @Override
+ public String getProviderName() {
+ return providerName;
+ }
+
+ /* (non-Javadoc)
+ * @see com.cloud.network.cisco.CiscoVnmcController#getDeviceName()
+ */
+ @Override
+ public String getDeviceName() {
+ return deviceName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcManager.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcManager.java
index 5a60a7a..6fd2401 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcManager.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcManager.java
@@ -8,6 +8,8 @@ import java.util.UUID;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
+
import com.cloud.agent.AgentManager;
import com.cloud.api.commands.AddCiscoVnmcResourceCmd;
import com.cloud.api.commands.DeleteCiscoVnmcResourceCmd;
@@ -18,7 +20,6 @@ import com.cloud.host.DetailVO;
import com.cloud.host.Host;
import com.cloud.host.dao.HostDao;
import com.cloud.host.dao.HostDetailsDao;
-import com.cloud.network.ExternalNetworkDeviceManager.NetworkDevice;
import com.cloud.network.Network;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkVO;
@@ -56,17 +57,13 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
CiscoVnmcConnection _vnmcConnection;
- @Override
- public String getPropertiesFile() {
- return null;
- }
-
+
@Override
- public CiscoVnmcResourceVO addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd) {
+ public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd) {
String deviceName = CiscoVnmc.getName();
NetworkDevice networkDevice = NetworkDevice.getNetworkDevice(deviceName);
Long physicalNetworkId = cmd.getPhysicalNetworkId();
- CiscoVnmcResourceVO CiscoVnmcResource = null;
+ CiscoVnmcController CiscoVnmcResource = null;
PhysicalNetworkVO physicalNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (physicalNetwork == null) {
@@ -110,8 +107,8 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
if (host != null) {
txn.start();
- CiscoVnmcResource = new CiscoVnmcResourceVO(host.getId(), physicalNetworkId, ntwkSvcProvider.getProviderName(), deviceName);
- _ciscoVnmcDao.persist(CiscoVnmcResource);
+ CiscoVnmcResource = new CiscoVnmcControllerVO(host.getId(), physicalNetworkId, ntwkSvcProvider.getProviderName(), deviceName);
+ _ciscoVnmcDao.persist((CiscoVnmcControllerVO) CiscoVnmcResource);
DetailVO detail = new DetailVO(host.getId(), "deviceid", String.valueOf(CiscoVnmcResource.getId()));
_hostDetailsDao.persist(detail);
@@ -129,7 +126,7 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
@Override
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(
- CiscoVnmcResourceVO CiscoVnmcResourceVO) {
+ CiscoVnmcController CiscoVnmcResourceVO) {
// TODO Auto-generated method stub
return null;
}
@@ -143,18 +140,18 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
@Override
- public List<CiscoVnmcResourceVO> listCiscoVnmcResources(
+ public List<CiscoVnmcControllerVO> listCiscoVnmcResources(
ListCiscoVnmcResourcesCmd cmd) {
Long physicalNetworkId = cmd.getPhysicalNetworkId();
Long CiscoVnmcResourceId = cmd.getCiscoVnmcResourceId();
- List<CiscoVnmcResourceVO> responseList = new ArrayList<CiscoVnmcResourceVO>();
+ List<CiscoVnmcControllerVO> responseList = new ArrayList<CiscoVnmcControllerVO>();
if (physicalNetworkId == null && CiscoVnmcResourceId == null) {
throw new InvalidParameterValueException("Either physical network Id or vnmc device Id must be specified");
}
if (CiscoVnmcResourceId != null) {
- CiscoVnmcResourceVO CiscoVnmcResource = _ciscoVnmcDao.findById(CiscoVnmcResourceId);
+ CiscoVnmcControllerVO CiscoVnmcResource = _ciscoVnmcDao.findById(CiscoVnmcResourceId);
if (CiscoVnmcResource == null) {
throw new InvalidParameterValueException("Could not find Cisco Vnmc device with id: " + CiscoVnmcResource);
}
@@ -202,4 +199,10 @@ public class CiscoVnmcManager implements Manager, CiscoVnmcElementService {
}
+ @Override
+ public List<Class<?>> getCommands() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcResourceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcResourceVO.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcResourceVO.java
deleted file mode 100644
index f57c6f5..0000000
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcResourceVO.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with 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.cisco;
-
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="external_cisco_vnmc_devices")
-public class CiscoVnmcResourceVO {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name="id")
- private long id;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name="host_id")
- private long hostId;
-
- @Column(name="physical_network_id")
- private long physicalNetworkId;
-
- @Column(name="provider_name")
- private String providerName;
-
- @Column(name="device_name")
- private String deviceName;
-
-
- public CiscoVnmcResourceVO() {
- this.uuid = UUID.randomUUID().toString();
- }
-
- public CiscoVnmcResourceVO(long hostId, long physicalNetworkId,
- String providerName, String deviceName) {
- super();
- this.hostId = hostId;
- this.physicalNetworkId = physicalNetworkId;
- this.providerName = providerName;
- this.deviceName = deviceName;
- this.uuid = UUID.randomUUID().toString();
- }
-
- public long getId() {
- return id;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public long getHostId() {
- return hostId;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public String getDeviceName() {
- return deviceName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/test/CiscoVnmcConnectionTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/test/CiscoVnmcConnectionTest.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/test/CiscoVnmcConnectionTest.java
deleted file mode 100644
index 2407063..0000000
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/test/CiscoVnmcConnectionTest.java
+++ /dev/null
@@ -1,258 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with 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.cisco.test;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.cloud.network.cisco.CiscoVnmcConnectionImpl;
-import com.cloud.utils.exception.ExecutionException;
-
-
-
-public class CiscoVnmcConnectionTest {
- static CiscoVnmcConnectionImpl connection;
- static String tenantName = "TenantE";
- static List<String> fwDns = null;
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- connection = new CiscoVnmcConnectionImpl("10.223.56.5", "admin", "C1sco123");
- try {
- boolean response = connection.login();
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testLogin() {
- //fail("Not yet implemented");
- try {
- boolean response = connection.login();
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenant() {
- //fail("Not yet implemented");
- try {
- boolean response = connection.createTenant(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDC() {
- //fail("Not yet implemented");
- try {
- boolean response = connection.createTenantVDC(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCEdgeDeviceProfile() {
- //fail("Not yet implemented");
- try {
- boolean response = connection.createTenantVDCEdgeDeviceProfile(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCEdgeDeviceRoutePolicy() {
- try {
- boolean response = connection.createTenantVDCEdgeStaticRoutePolicy(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCEdgeDeviceRoute() {
- try {
- boolean response = connection.createTenantVDCEdgeStaticRoute(tenantName,
- "10.223.136.1", "Edge_Outside", "0.0.0.0", "0.0.0.0");
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testAssociateRoutePolicyWithEdgeProfile() {
- try {
- boolean response = connection.associateTenantVDCEdgeStaticRoutePolicy(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testAssociateTenantVDCEdgeDhcpPolicy() {
- try {
- boolean response = connection.associateTenantVDCEdgeDhcpPolicy(tenantName, "Edge_Inside");
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCEdgeDhcpPolicy() {
- try {
- boolean response = connection.createTenantVDCEdgeDhcpPolicy(tenantName,
- "10.1.1.2", "10.1.1.254", "255.255.255.0","4.4.4.4", tenantName+ ".net");
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCEdgeSecurityProfile() {
- try {
- boolean response = connection.createTenantVDCEdgeSecurityProfile(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCSourceNATPool() {
- try {
- boolean response = connection.createTenantVDCSourceNATPool(tenantName, "10.223.136.10");
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCSourceNATPolicy() {
- try {
- boolean response = connection.createTenantVDCSourceNATPolicy(tenantName, "10.1.1.2", "10.1.1.254");
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateTenantVDCNatPolicySet() {
- try {
- boolean response = connection.createTenantVDCNatPolicySet(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testAssociateNatPolicySet() {
- try {
- boolean response = connection.associateNatPolicySet(tenantName);
- assertTrue(response);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void testCreateEdgeFirewall() {
- try {
- boolean response = connection.createEdgeFirewall(tenantName,
- "44.44.44.44", "192.168.1.1", "255.255.255.0", "255.255.255.192");
- assertTrue(response);
- } catch (ExecutionException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testListUnassocAsa1000v() {
- try {
- List<String> response = connection.listUnAssocAsa1000v();
- assertTrue(response.size() >=0);
- fwDns = response;
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Ignore
- @Test
- public void assocAsa1000v() {
- try {
- boolean result = connection.assocAsa1000v(tenantName, fwDns.get(0));
- assertTrue(result);
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDao.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDao.java
index 1b425bb..f0b3948 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDao.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDao.java
@@ -18,15 +18,15 @@ package com.cloud.network.dao;
import java.util.List;
-import com.cloud.network.cisco.CiscoVnmcResourceVO;
+import com.cloud.network.cisco.CiscoVnmcControllerVO;
import com.cloud.utils.db.GenericDao;
-public interface CiscoVnmcDao extends GenericDao<CiscoVnmcResourceVO, Long>{
+public interface CiscoVnmcDao extends GenericDao<CiscoVnmcControllerVO, Long>{
/**
* list all the Cisco VNMC devices added in to this physical network
* @param physicalNetworkId physical Network Id
* @return list of CiscoVnmcDeviceVO for this physical network.
*/
- List<CiscoVnmcResourceVO> listByPhysicalNetwork(long physicalNetworkId);
+ List<CiscoVnmcControllerVO> listByPhysicalNetwork(long physicalNetworkId);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDaoImpl.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDaoImpl.java
index b259552..1bd686f 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDaoImpl.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoVnmcDaoImpl.java
@@ -20,17 +20,17 @@ import java.util.List;
import javax.ejb.Local;
-import com.cloud.network.cisco.CiscoVnmcResourceVO;
+import com.cloud.network.cisco.CiscoVnmcControllerVO;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.SearchCriteria.Op;
@Local(value=CiscoVnmcDao.class)
-public class CiscoVnmcDaoImpl extends GenericDaoBase<CiscoVnmcResourceVO, Long>
+public class CiscoVnmcDaoImpl extends GenericDaoBase<CiscoVnmcControllerVO, Long>
implements CiscoVnmcDao {
- protected final SearchBuilder<CiscoVnmcResourceVO> physicalNetworkIdSearch;
+ protected final SearchBuilder<CiscoVnmcControllerVO> physicalNetworkIdSearch;
public CiscoVnmcDaoImpl() {
physicalNetworkIdSearch = createSearchBuilder();
@@ -39,8 +39,8 @@ public class CiscoVnmcDaoImpl extends GenericDaoBase<CiscoVnmcResourceVO, Long>
}
@Override
- public List<CiscoVnmcResourceVO> listByPhysicalNetwork(long physicalNetworkId) {
- SearchCriteria<CiscoVnmcResourceVO> sc = physicalNetworkIdSearch.create();
+ public List<CiscoVnmcControllerVO> listByPhysicalNetwork(long physicalNetworkId) {
+ SearchCriteria<CiscoVnmcControllerVO> sc = physicalNetworkIdSearch.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
return search(sc, null);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
index 5aa61f7..15c78b6 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
@@ -139,12 +139,6 @@ public class CiscoVnmcElement implements DhcpServiceProvider,
return false;
}
- @Override
- public boolean destroy(Network network)
- throws ConcurrentOperationException, ResourceUnavailableException {
- // TODO Auto-generated method stub
- return false;
- }
@Override
public boolean isReady(PhysicalNetworkServiceProvider provider) {
@@ -190,4 +184,11 @@ public class CiscoVnmcElement implements DhcpServiceProvider,
return false;
}
+ @Override
+ public boolean destroy(Network network, ReservationContext context)
+ throws ConcurrentOperationException, ResourceUnavailableException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElementService.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElementService.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElementService.java
index 4c60055..3e2f093 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElementService.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElementService.java
@@ -24,21 +24,22 @@ import com.cloud.api.commands.ListCiscoVnmcResourcesCmd;
import com.cloud.api.response.CiscoVnmcResourceResponse;
import com.cloud.network.Network;
import com.cloud.network.Network.Provider;
-import com.cloud.network.cisco.CiscoVnmcResourceVO;
+import com.cloud.network.cisco.CiscoVnmcController;
+import com.cloud.network.cisco.CiscoVnmcControllerVO;
import com.cloud.utils.component.PluggableService;
public interface CiscoVnmcElementService extends PluggableService {
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
- public CiscoVnmcResourceVO addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd);
+ public CiscoVnmcController addCiscoVnmcResource(AddCiscoVnmcResourceCmd cmd);
public CiscoVnmcResourceResponse createCiscoVnmcResourceResponse(
- CiscoVnmcResourceVO CiscoVnmcResourceVO);
+ CiscoVnmcController CiscoVnmcResourceVO);
boolean deleteCiscoVnmcResource(DeleteCiscoVnmcResourceCmd cmd);
- List<CiscoVnmcResourceVO> listCiscoVnmcResources(ListCiscoVnmcResourcesCmd cmd);
+ List<CiscoVnmcControllerVO> listCiscoVnmcResources(ListCiscoVnmcResourcesCmd cmd);
void assignAsa1000vToNetwork(Network network);
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
new file mode 100644
index 0000000..45b9609
--- /dev/null
+++ b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/cisco/CiscoVnmcConnectionTest.java
@@ -0,0 +1,258 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with 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.cisco;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.cloud.network.cisco.CiscoVnmcConnectionImpl;
+import com.cloud.utils.exception.ExecutionException;
+
+
+@Ignore("Requires actual VNMC to connect to")
+public class CiscoVnmcConnectionTest {
+ static CiscoVnmcConnectionImpl connection;
+ static String tenantName = "TenantE";
+ static List<String> fwDns = null;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ connection = new CiscoVnmcConnectionImpl("10.223.56.5", "admin", "C1sco123");
+ try {
+ boolean response = connection.login();
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testLogin() {
+ //fail("Not yet implemented");
+ try {
+ boolean response = connection.login();
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenant() {
+ //fail("Not yet implemented");
+ try {
+ boolean response = connection.createTenant(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDC() {
+ //fail("Not yet implemented");
+ try {
+ boolean response = connection.createTenantVDC(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCEdgeDeviceProfile() {
+ //fail("Not yet implemented");
+ try {
+ boolean response = connection.createTenantVDCEdgeDeviceProfile(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCEdgeDeviceRoutePolicy() {
+ try {
+ boolean response = connection.createTenantVDCEdgeStaticRoutePolicy(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCEdgeDeviceRoute() {
+ try {
+ boolean response = connection.createTenantVDCEdgeStaticRoute(tenantName,
+ "10.223.136.1", "Edge_Outside", "0.0.0.0", "0.0.0.0");
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testAssociateRoutePolicyWithEdgeProfile() {
+ try {
+ boolean response = connection.associateTenantVDCEdgeStaticRoutePolicy(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testAssociateTenantVDCEdgeDhcpPolicy() {
+ try {
+ boolean response = connection.associateTenantVDCEdgeDhcpPolicy(tenantName, "Edge_Inside");
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCEdgeDhcpPolicy() {
+ try {
+ boolean response = connection.createTenantVDCEdgeDhcpPolicy(tenantName,
+ "10.1.1.2", "10.1.1.254", "255.255.255.0","4.4.4.4", tenantName+ ".net");
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCEdgeSecurityProfile() {
+ try {
+ boolean response = connection.createTenantVDCEdgeSecurityProfile(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCSourceNATPool() {
+ try {
+ boolean response = connection.createTenantVDCSourceNATPool(tenantName, "10.223.136.10");
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCSourceNATPolicy() {
+ try {
+ boolean response = connection.createTenantVDCSourceNATPolicy(tenantName, "10.1.1.2", "10.1.1.254");
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateTenantVDCNatPolicySet() {
+ try {
+ boolean response = connection.createTenantVDCNatPolicySet(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testAssociateNatPolicySet() {
+ try {
+ boolean response = connection.associateNatPolicySet(tenantName);
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void testCreateEdgeFirewall() {
+ try {
+ boolean response = connection.createEdgeFirewall(tenantName,
+ "44.44.44.44", "192.168.1.1", "255.255.255.0", "255.255.255.192");
+ assertTrue(response);
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testListUnassocAsa1000v() {
+ try {
+ List<String> response = connection.listUnAssocAsa1000v();
+ assertTrue(response.size() >=0);
+ fwDns = response;
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+
+ @Test
+ public void assocAsa1000v() {
+ try {
+ boolean result = connection.assocAsa1000v(tenantName, fwDns.get(0));
+ assertTrue(result);
+ } catch (ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/392cd8ed/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index a42ae29..113d5f2 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -44,6 +44,7 @@
<module>network-elements/elastic-loadbalancer</module>
<module>network-elements/ovs</module>
<module>network-elements/nicira-nvp</module>
+ <module>network-elements/cisco-vnmc</module>
<module>storage-allocators/random</module>
<module>user-authenticators/ldap</module>
<module>user-authenticators/md5</module>