Added lifecycle APIs for Cisco Asa 1000v appliance.
Added corresponding Dao and VO classes.
Also added mapping Dao and VO for guest netwok and asa appliance


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

Branch: refs/heads/cisco-vnmc-api-integration
Commit: d08e2a1fafdc68ea1c7d6327829aee5aa4c2c38d
Parents: 6b999ec
Author: Koushik Das <[email protected]>
Authored: Wed Feb 13 11:40:58 2013 +0530
Committer: Koushik Das <[email protected]>
Committed: Wed Feb 13 11:40:58 2013 +0530

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java    |    3 +-
 .../api/commands/AddCiscoAsa1000vResourceCmd.java  |  107 ++++++++++++++
 .../commands/DeleteCiscoAsa1000vResourceCmd.java   |   91 ++++++++++++
 .../commands/ListCiscoAsa1000vResourcesCmd.java    |  110 ++++++++++++++
 .../response/CiscoAsa1000vResourceResponse.java    |   76 ++++++++++
 .../cloud/network/cisco/CiscoAsa1000vDevice.java   |   38 +++++
 .../cloud/network/cisco/CiscoAsa1000vDeviceVO.java |  111 +++++++++++++++
 .../cloud/network/cisco/NetworkAsa1000vMap.java    |   31 ++++
 .../cloud/network/cisco/NetworkAsa1000vMapVO.java  |   73 ++++++++++
 .../com/cloud/network/dao/CiscoAsa1000vDao.java    |   33 +++++
 .../cloud/network/dao/CiscoAsa1000vDaoImpl.java    |   60 ++++++++
 .../cloud/network/dao/NetworkAsa1000vMapDao.java   |   28 ++++
 .../network/dao/NetworkAsa1000vMapDaoImpl.java     |   58 ++++++++
 .../network/element/CiscoAsa1000vService.java      |   43 ++++++
 14 files changed, 861 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java 
b/api/src/org/apache/cloudstack/api/ApiConstants.java
index d3bfcd6..a4cb869 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -426,7 +426,8 @@ public class ApiConstants {
     public static final String CONDITION_IDS = "conditionids";
     public static final String COUNTERPARAM_LIST = "counterparam";
     public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
-
+    public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
+    
     public enum HostDetails {
         all, capacity, events, stats, min;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java
new file mode 100755
index 0000000..686d7d4
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/AddCiscoAsa1000vResourceCmd.java
@@ -0,0 +1,107 @@
+// 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.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.response.CiscoAsa1000vResourceResponse;
+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.CiscoAsa1000vDevice;
+import com.cloud.network.element.CiscoAsa1000vService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name="addCiscoAsa1000vResource", 
responseObject=CiscoAsa1000vResourceResponse.class, description="Adds a Cisco 
Asa 1000v appliance")
+public class AddCiscoAsa1000vResourceCmd extends BaseCmd {
+    private static final Logger s_logger = 
Logger.getLogger(AddCiscoAsa1000vResourceCmd.class.getName());
+    private static final String s_name = "addCiscoAsa1000vResource";
+    @PlugService CiscoAsa1000vService _ciscoAsa1000vService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @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 or ip address of the Cisco ASA 1000v appliance.")
+    private String host;
+
+    @Parameter(name=ApiConstants.ASA_INSIDE_PORT_PROFILE, 
type=CommandType.STRING, required = true, description="Nexus port profile 
associated with inside interface of ASA 1000v")
+    private String inPortProfile;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getManagementIp() {
+        return host;
+    }
+
+    public String getInPortProfile() {
+        return inPortProfile;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, 
InsufficientCapacityException, ServerApiException, 
ConcurrentOperationException, ResourceAllocationException {
+        try {
+            CiscoAsa1000vDevice ciscoAsa1000v = 
_ciscoAsa1000vService.addCiscoAsa1000vResource(this);
+            if (ciscoAsa1000v != null) {
+                CiscoAsa1000vResourceResponse response = 
_ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000v);
+                response.setObjectName("CiscoAsa1000vResource");
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, 
"Failed to add Cisco ASA 1000v appliance due to internal error.");
+            }
+        }  catch (InvalidParameterValueException invalidParamExcp) {
+            throw new ServerApiException(BaseCmd.PARAM_ERROR, 
invalidParamExcp.getMessage());
+        } catch (CloudRuntimeException runtimeExcp) {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, 
runtimeExcp.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return UserContext.current().getCaller().getId();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java
new file mode 100755
index 0000000..85cb905
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/DeleteCiscoAsa1000vResourceCmd.java
@@ -0,0 +1,91 @@
+// 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.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.response.CiscoAsa1000vResourceResponse;
+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.element.CiscoAsa1000vService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name="deleteCiscoAsa1000vResource", 
responseObject=SuccessResponse.class, description="Deletes a Cisco ASA 1000v 
appliance")
+public class DeleteCiscoAsa1000vResourceCmd extends BaseCmd {
+    private static final Logger s_logger = 
Logger.getLogger(DeleteCiscoAsa1000vResourceCmd.class.getName());
+    private static final String s_name = "deleteCiscoAsa1000vResource";
+    @PlugService CiscoAsa1000vService _ciscoAsa1000vService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.UUID, 
required=true, entityType=CiscoAsa1000vResourceResponse.class, 
description="Cisco ASA 1000v resource ID")
+    private Long ciscoAsa1000vResourceId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getCiscoAsa1000vResourceId() {
+        return ciscoAsa1000vResourceId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, 
InsufficientCapacityException, ServerApiException, 
ConcurrentOperationException, ResourceAllocationException {
+        try {
+            boolean result = 
_ciscoAsa1000vService.deleteCiscoAsa1000vResource(this);
+            if (result) {
+                SuccessResponse response = new 
SuccessResponse(getCommandName());
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed 
to delete Cisco ASA 1000v appliance.");
+            }
+        }  catch (InvalidParameterValueException invalidParamExcp) {
+            throw new ServerApiException(BaseCmd.PARAM_ERROR, 
invalidParamExcp.getMessage());
+        } catch (CloudRuntimeException runtimeExcp) {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, 
runtimeExcp.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return UserContext.current().getCaller().getId();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
new file mode 100755
index 0000000..3b8812f
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
@@ -0,0 +1,110 @@
+// 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.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.BaseCmd.CommandType;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.api.response.CiscoAsa1000vResourceResponse;
+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.CiscoAsa1000vDevice;
+import com.cloud.network.cisco.CiscoAsa1000vDeviceVO;
+import com.cloud.network.element.CiscoAsa1000vService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name="listCiscoAsa1000vResources", 
responseObject=CiscoAsa1000vResourceResponse.class, description="Lists Cisco 
ASA 1000v appliances")
+public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd {
+    private static final Logger s_logger = 
Logger.getLogger(ListCiscoAsa1000vResourcesCmd.class.getName());
+    private static final String s_name = "listCiscoAsa1000vResources";
+    @PlugService CiscoAsa1000vService _ciscoAsa1000vService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, 
entityType = PhysicalNetworkResponse.class, description="the Physical Network 
ID")
+    private Long physicalNetworkId;
+
+    @Parameter(name=ApiConstants.RESOURCE_ID, type=CommandType.UUID, 
entityType=CiscoAsa1000vResourceResponse.class, description="Cisco ASA 1000v 
resource ID")
+    private Long ciscoAsa1000vResourceId;
+
+    @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, 
description="Hostname or ip address of the Cisco ASA 1000v appliance.")
+    private String host;
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getCiscoAsa1000vResourceId() {
+        return ciscoAsa1000vResourceId;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getManagementIp() {
+        return host;
+    }
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, 
InsufficientCapacityException, ServerApiException, 
ConcurrentOperationException, ResourceAllocationException {
+        try {
+            List<CiscoAsa1000vDeviceVO> ciscoAsa1000vDevices = 
_ciscoAsa1000vService.listCiscoAsa1000vResources(this);
+            ListResponse<CiscoAsa1000vResourceResponse> response = new 
ListResponse<CiscoAsa1000vResourceResponse>();
+            List<CiscoAsa1000vResourceResponse> ciscoAsa1000vResourcesResponse 
= new ArrayList<CiscoAsa1000vResourceResponse>();
+
+            if (ciscoAsa1000vDevices != null && 
!ciscoAsa1000vDevices.isEmpty()) {
+                for (CiscoAsa1000vDevice ciscoAsa1000vDeviceVO : 
ciscoAsa1000vDevices) {
+                    CiscoAsa1000vResourceResponse 
ciscoAsa1000vResourceResponse = 
_ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000vDeviceVO);
+                    
ciscoAsa1000vResourcesResponse.add(ciscoAsa1000vResourceResponse);
+                }
+            }
+
+            response.setResponses(ciscoAsa1000vResourcesResponse);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        }  catch (InvalidParameterValueException invalidParamExcp) {
+            throw new ServerApiException(BaseCmd.PARAM_ERROR, 
invalidParamExcp.getMessage());
+        } catch (CloudRuntimeException runtimeExcp) {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, 
runtimeExcp.getMessage());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
new file mode 100755
index 0000000..5425bf9
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
@@ -0,0 +1,76 @@
+// 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.api.response;
+
+
+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.CiscoAsa1000vDevice;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value = CiscoAsa1000vDevice.class)
+public class CiscoAsa1000vResourceResponse extends BaseResponse {
+    public static final String RESOURCE_NAME = "resourcename";
+
+    @SerializedName(ApiConstants.RESOURCE_ID) @Parameter(description="resource 
id of the Cisco ASA 1000v appliance")
+    private String id;
+
+    @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) 
+    @Parameter(description="the physical network to which this VNMC belongs 
to", entityType = PhysicalNetworkResponse.class)
+    private Long physicalNetworkId ;
+
+    public Long getPhysicalNetworkId() {
+               return physicalNetworkId;
+       }
+
+       @SerializedName(ApiConstants.HOST_NAME)
+       @Parameter(description="management ip address of ASA 1000v")
+    private String managementIp;
+
+       public String getManagementIp() {
+               return managementIp;
+       }
+
+       @SerializedName(ApiConstants.ASA_INSIDE_PORT_PROFILE)
+       @Parameter(description="management ip address of ASA 1000v")
+    private String inPortProfile;
+
+       public String getInPortProfile() {
+               return inPortProfile;
+       }
+
+    public void setId(String ciscoAsa1000vResourceId) {
+        this.id = ciscoAsa1000vResourceId;
+    }
+
+    public void setPhysicalNetworkId(Long physicalNetworkId) {
+        this.physicalNetworkId = physicalNetworkId;
+    }
+
+    public void setManagementIp(String managementIp) {
+        this.managementIp = managementIp;
+    }
+
+    public void setInPortProfile(String inPortProfile) {
+        this.inPortProfile = inPortProfile;
+    }     
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDevice.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDevice.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDevice.java
new file mode 100755
index 0000000..b433da6
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDevice.java
@@ -0,0 +1,38 @@
+// 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 org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.org.Grouping;
+
+public interface CiscoAsa1000vDevice extends Grouping, InternalIdentity, 
Identity {
+
+        long getId();
+
+        String getUuid();
+
+        void setUuid(String uuid);
+
+        long getPhysicalNetworkId();
+
+        String getManagementIp();
+
+        String getInPortProfile();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDeviceVO.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDeviceVO.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDeviceVO.java
new file mode 100755
index 0000000..5871dff
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoAsa1000vDeviceVO.java
@@ -0,0 +1,111 @@
+// 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_asa1000v_devices")
+public class CiscoAsa1000vDeviceVO implements CiscoAsa1000vDevice {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="physical_network_id")
+    private long physicalNetworkId;
+    
+    @Column(name="management_ip")
+    private String managementIp;
+    
+    @Column(name="in_Port_profile")
+    private String inPortProfile;
+
+    
+    public CiscoAsa1000vDeviceVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public CiscoAsa1000vDeviceVO(long physicalNetworkId,
+            String managementIp, String inPortProfile) {
+        super();
+        this.physicalNetworkId = physicalNetworkId;
+        this.managementIp = managementIp;
+        this.inPortProfile = inPortProfile;
+        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#getProviderName()
+        */
+    @Override
+       public String getManagementIp() {
+        return managementIp;
+    }
+
+    /* (non-Javadoc)
+        * @see com.cloud.network.cisco.CiscoVnmcController#getDeviceName()
+        */
+    @Override
+       public String getInPortProfile() {
+        return inPortProfile;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMap.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMap.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMap.java
new file mode 100755
index 0000000..6c8647a
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMap.java
@@ -0,0 +1,31 @@
+// 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 org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.org.Grouping;
+
+public interface NetworkAsa1000vMap extends Grouping, InternalIdentity {
+
+        long getId();
+
+        long getNetworkId();
+
+        long getAsa1000vId();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMapVO.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMapVO.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMapVO.java
new file mode 100755
index 0000000..9638b6f
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/NetworkAsa1000vMapVO.java
@@ -0,0 +1,73 @@
+// 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 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="network_asa1000v_map")
+public class NetworkAsa1000vMapVO implements NetworkAsa1000vMap {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="network_id")
+    private long networkId;
+
+    @Column(name="asa1000v_id")
+    private long asa1000vId;
+    
+    public NetworkAsa1000vMapVO() {
+    }
+
+    public NetworkAsa1000vMapVO(long networkId, long asa1000vId) {
+        super();
+        this.networkId = networkId;
+        this.asa1000vId = asa1000vId;
+    }
+
+       @Override
+       public long getId() {
+               return id;
+       }
+
+       @Override
+       public long getAsa1000vId() {
+               return asa1000vId;
+       }
+
+       public void setAsa1000vId(long asa1000vId) {
+               this.asa1000vId = asa1000vId;
+       }
+
+       @Override
+       public long getNetworkId() {
+               return networkId;
+       }
+
+       public void setNetworkId(long networkId) {
+               this.networkId = networkId;
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDao.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDao.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDao.java
new file mode 100755
index 0000000..1a380b1
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDao.java
@@ -0,0 +1,33 @@
+// 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.dao;
+
+import java.util.List;
+
+import com.cloud.network.cisco.CiscoAsa1000vDeviceVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface CiscoAsa1000vDao extends GenericDao<CiscoAsa1000vDeviceVO, 
Long>{
+    /**
+     * list all the Cisco Asa 1000v devices added in to this physical network
+     * @param physicalNetworkId physical Network Id
+     * @return list of CiscoAsa1000vDeviceVO for this physical network.
+     */
+    List<CiscoAsa1000vDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
+
+    CiscoAsa1000vDeviceVO findByManagementIp(String managementIp);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDaoImpl.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDaoImpl.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDaoImpl.java
new file mode 100755
index 0000000..3046045
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/CiscoAsa1000vDaoImpl.java
@@ -0,0 +1,60 @@
+// 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.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import com.cloud.network.cisco.CiscoAsa1000vDeviceVO;
+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=CiscoAsa1000vDao.class)
+public class CiscoAsa1000vDaoImpl extends 
GenericDaoBase<CiscoAsa1000vDeviceVO, Long>
+        implements CiscoAsa1000vDao {
+
+    protected final SearchBuilder<CiscoAsa1000vDeviceVO> 
physicalNetworkIdSearch;
+    protected final SearchBuilder<CiscoAsa1000vDeviceVO> managementIpSearch;
+
+    public CiscoAsa1000vDaoImpl() {
+        physicalNetworkIdSearch = createSearchBuilder();
+        physicalNetworkIdSearch.and("physicalNetworkId", 
physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkIdSearch.done();
+
+        managementIpSearch = createSearchBuilder();
+        managementIpSearch.and("managementIp", 
managementIpSearch.entity().getManagementIp(), Op.EQ);
+        managementIpSearch.done();
+    }
+
+    @Override
+    public List<CiscoAsa1000vDeviceVO> listByPhysicalNetwork(long 
physicalNetworkId) {
+        SearchCriteria<CiscoAsa1000vDeviceVO> sc = 
physicalNetworkIdSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return search(sc, null);
+    }
+
+    @Override
+    public CiscoAsa1000vDeviceVO findByManagementIp(String managementIp) {
+        SearchCriteria<CiscoAsa1000vDeviceVO> sc = managementIpSearch.create();
+        sc.setParameters("managementIp", managementIp);
+        return findOneBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDao.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDao.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDao.java
new file mode 100755
index 0000000..053f4af
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDao.java
@@ -0,0 +1,28 @@
+// 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.dao;
+
+import com.cloud.network.cisco.NetworkAsa1000vMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkAsa1000vMapDao extends 
GenericDao<NetworkAsa1000vMapVO, Long>{
+
+    NetworkAsa1000vMapVO findByNetworkId(long networkId);
+
+    NetworkAsa1000vMapVO findByAsa1000vId(long asa1000vId);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDaoImpl.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDaoImpl.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDaoImpl.java
new file mode 100755
index 0000000..95d9286
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/dao/NetworkAsa1000vMapDaoImpl.java
@@ -0,0 +1,58 @@
+// 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.dao;
+
+import javax.ejb.Local;
+
+import com.cloud.network.cisco.NetworkAsa1000vMapVO;
+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=NetworkAsa1000vMapDao.class)
+public class NetworkAsa1000vMapDaoImpl extends 
GenericDaoBase<NetworkAsa1000vMapVO, Long>
+        implements NetworkAsa1000vMapDao {
+
+    protected final SearchBuilder<NetworkAsa1000vMapVO> networkSearch;
+    protected final SearchBuilder<NetworkAsa1000vMapVO> asa1000vSearch;
+
+    public NetworkAsa1000vMapDaoImpl() {
+       networkSearch = createSearchBuilder();
+       networkSearch.and("networkId", networkSearch.entity().getNetworkId(), 
Op.EQ);
+       networkSearch.done();
+
+       asa1000vSearch = createSearchBuilder();
+       asa1000vSearch.and("asa1000vId", 
asa1000vSearch.entity().getAsa1000vId(), Op.EQ);
+       asa1000vSearch.done();
+    }
+
+       @Override
+       public NetworkAsa1000vMapVO findByNetworkId(long networkId) {
+        SearchCriteria<NetworkAsa1000vMapVO> sc = networkSearch.create();
+        sc.setParameters("networkId", networkId);
+        return findOneBy(sc);
+       }
+
+       @Override
+       public NetworkAsa1000vMapVO findByAsa1000vId(long asa1000vId) {
+        SearchCriteria<NetworkAsa1000vMapVO> sc = asa1000vSearch.create();
+        sc.setParameters("asa1000vId", asa1000vId);
+        return findOneBy(sc);
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d08e2a1f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoAsa1000vService.java
----------------------------------------------------------------------
diff --git 
a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoAsa1000vService.java
 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoAsa1000vService.java
new file mode 100755
index 0000000..c42ab3a
--- /dev/null
+++ 
b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoAsa1000vService.java
@@ -0,0 +1,43 @@
+// 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.element;
+
+import java.util.List;
+
+import com.cloud.api.commands.AddCiscoAsa1000vResourceCmd;
+import com.cloud.api.commands.DeleteCiscoAsa1000vResourceCmd;
+import com.cloud.api.commands.ListCiscoAsa1000vResourcesCmd;
+import com.cloud.api.response.CiscoAsa1000vResourceResponse;
+import com.cloud.network.Network;
+import com.cloud.network.cisco.CiscoAsa1000vDevice;
+import com.cloud.network.cisco.CiscoAsa1000vDeviceVO;
+import com.cloud.utils.component.PluggableService;
+
+public interface CiscoAsa1000vService extends PluggableService {
+
+       public CiscoAsa1000vDevice 
addCiscoAsa1000vResource(AddCiscoAsa1000vResourceCmd cmd);
+
+    public CiscoAsa1000vResourceResponse createCiscoAsa1000vResourceResponse(
+            CiscoAsa1000vDevice ciscoAsa1000vDeviceVO);
+
+    boolean deleteCiscoAsa1000vResource(DeleteCiscoAsa1000vResourceCmd cmd);
+
+    List<CiscoAsa1000vDeviceVO> 
listCiscoAsa1000vResources(ListCiscoAsa1000vResourcesCmd cmd);
+
+    CiscoAsa1000vDevice assignAsa1000vToNetwork(Network network);
+
+}

Reply via email to