mirror of https://github.com/apache/cloudstack.git
cisco-vnmc: Fix api to use new conventions
This commit is contained in:
parent
6b142bbaab
commit
392cd8ed63
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ import javax.persistence.Table;
|
|||
|
||||
@Entity
|
||||
@Table(name="external_cisco_vnmc_devices")
|
||||
public class CiscoVnmcResourceVO {
|
||||
public class CiscoVnmcControllerVO implements CiscoVnmcController {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
|
|
@ -50,11 +50,11 @@ public class CiscoVnmcResourceVO {
|
|||
private String deviceName;
|
||||
|
||||
|
||||
public CiscoVnmcResourceVO() {
|
||||
public CiscoVnmcControllerVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public CiscoVnmcResourceVO(long hostId, long physicalNetworkId,
|
||||
public CiscoVnmcControllerVO(long hostId, long physicalNetworkId,
|
||||
String providerName, String deviceName) {
|
||||
super();
|
||||
this.hostId = hostId;
|
||||
|
|
@ -64,31 +64,59 @@ public class CiscoVnmcResourceVO {
|
|||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#getId()
|
||||
*/
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#getUuid()
|
||||
*/
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#setUuid(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public long getPhysicalNetworkId() {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#getPhysicalNetworkId()
|
||||
*/
|
||||
@Override
|
||||
public long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
}
|
||||
|
||||
public long getHostId() {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#getHostId()
|
||||
*/
|
||||
@Override
|
||||
public long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#getProviderName()
|
||||
*/
|
||||
@Override
|
||||
public String getProviderName() {
|
||||
return providerName;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.cisco.CiscoVnmcController#getDeviceName()
|
||||
*/
|
||||
@Override
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// 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;
|
||||
package com.cloud.network.cisco;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ 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";
|
||||
|
|
@ -46,7 +46,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testLogin() {
|
||||
//fail("Not yet implemented");
|
||||
|
|
@ -59,7 +59,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenant() {
|
||||
//fail("Not yet implemented");
|
||||
|
|
@ -72,7 +72,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDC() {
|
||||
//fail("Not yet implemented");
|
||||
|
|
@ -85,7 +85,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCEdgeDeviceProfile() {
|
||||
//fail("Not yet implemented");
|
||||
|
|
@ -98,7 +98,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCEdgeDeviceRoutePolicy() {
|
||||
try {
|
||||
|
|
@ -110,7 +110,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCEdgeDeviceRoute() {
|
||||
try {
|
||||
|
|
@ -123,7 +123,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testAssociateRoutePolicyWithEdgeProfile() {
|
||||
try {
|
||||
|
|
@ -135,7 +135,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testAssociateTenantVDCEdgeDhcpPolicy() {
|
||||
try {
|
||||
|
|
@ -147,7 +147,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCEdgeDhcpPolicy() {
|
||||
try {
|
||||
|
|
@ -160,7 +160,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCEdgeSecurityProfile() {
|
||||
try {
|
||||
|
|
@ -172,7 +172,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCSourceNATPool() {
|
||||
try {
|
||||
|
|
@ -184,7 +184,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCSourceNATPolicy() {
|
||||
try {
|
||||
|
|
@ -196,7 +196,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateTenantVDCNatPolicySet() {
|
||||
try {
|
||||
|
|
@ -208,7 +208,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testAssociateNatPolicySet() {
|
||||
try {
|
||||
|
|
@ -220,7 +220,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void testCreateEdgeFirewall() {
|
||||
try {
|
||||
|
|
@ -244,7 +244,7 @@ public class CiscoVnmcConnectionTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
||||
@Test
|
||||
public void assocAsa1000v() {
|
||||
try {
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue