incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From muralire...@apache.org
Subject [1/3] git commit: Phase 1 of Nicira integration
Date Thu, 12 Jul 2012 00:15:14 GMT
Updated Branches:
  refs/heads/master 8b7b838c8 -> 79c7da07a


Phase 1 of Nicira integration


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

Branch: refs/heads/master
Commit: 79c7da07abd4294f150851aa0c2d06a28564c5a9
Parents: 8b7b838
Author: Hugo Trippaers <htrippaers@schubergphilis.com>
Authored: Wed Jul 11 16:14:28 2012 -0700
Committer: Murali Reddy <Murali.Reddy@citrix.com>
Committed: Wed Jul 11 17:16:06 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/NicTO.java          |   11 +
 .../com/cloud/agent/api/to/VirtualMachineTO.java   |   11 +
 api/src/com/cloud/api/ApiConstants.java            |    4 +
 api/src/com/cloud/host/Host.java                   |    3 +-
 api/src/com/cloud/network/Network.java             |    2 +
 api/src/com/cloud/network/Networks.java            |    1 +
 api/src/com/cloud/network/PhysicalNetwork.java     |    3 +-
 build/build-cloud-plugins.xml                      |   10 +-
 build/package.xml                                  |    1 +
 client/tomcatconf/components.xml.in                |    7 +-
 .../tomcatconf/nicira-nvp_commands.properties.in   |   12 +
 cloud.spec                                         |    1 +
 .../xen/resource/CitrixResourceBase.java           |   12 +-
 plugins/network-elements/nicira-nvp/.classpath     |   12 +
 plugins/network-elements/nicira-nvp/.project       |   17 +
 .../nicira-nvp/README.NiciraIntegration            |   68 ++
 plugins/network-elements/nicira-nvp/build.xml      |  129 ++++
 .../cloud/agent/api/CreateLogicalSwitchAnswer.java |   20 +
 .../agent/api/CreateLogicalSwitchCommand.java      |   38 ++
 .../agent/api/CreateLogicalSwitchPortAnswer.java   |   20 +
 .../agent/api/CreateLogicalSwitchPortCommand.java  |   42 ++
 .../cloud/agent/api/DeleteLogicalSwitchAnswer.java |   14 +
 .../agent/api/DeleteLogicalSwitchCommand.java      |   19 +
 .../agent/api/DeleteLogicalSwitchPortAnswer.java   |   14 +
 .../agent/api/DeleteLogicalSwitchPortCommand.java  |   25 +
 .../cloud/agent/api/StartupNiciraNvpCommand.java   |   11 +
 .../cloud/api/commands/AddNiciraNvpDeviceCmd.java  |  110 ++++
 .../api/commands/DeleteNiciraNvpDeviceCmd.java     |   76 +++
 .../commands/ListNiciraNvpDeviceNetworksCmd.java   |   85 +++
 .../api/commands/ListNiciraNvpDevicesCmd.java      |   90 +++
 .../api/response/NiciraNvpDeviceResponse.java      |   37 ++
 .../src/com/cloud/network/NiciraNvpDeviceVO.java   |   79 +++
 .../com/cloud/network/NiciraNvpNicMappingVO.java   |   65 ++
 .../src/com/cloud/network/dao/NiciraNvpDao.java    |   16 +
 .../com/cloud/network/dao/NiciraNvpDaoImpl.java    |   32 +
 .../cloud/network/dao/NiciraNvpNicMappingDao.java  |   13 +
 .../network/dao/NiciraNvpNicMappingDaoImpl.java    |   30 +
 .../cloud/network/element/NiciraNvpElement.java    |  502 +++++++++++++++
 .../network/element/NiciraNvpElementService.java   |   28 +
 .../network/guru/NiciraNvpGuestNetworkGuru.java    |  257 ++++++++
 .../src/com/cloud/network/nicira/Attachment.java   |   22 +
 .../com/cloud/network/nicira/LogicalSwitch.java    |   99 +++
 .../cloud/network/nicira/LogicalSwitchPort.java    |  118 ++++
 .../src/com/cloud/network/nicira/NiciraNvpApi.java |  413 ++++++++++++
 .../network/nicira/NiciraNvpApiException.java      |   20 +
 .../com/cloud/network/nicira/NiciraNvpList.java    |   25 +
 .../src/com/cloud/network/nicira/NiciraNvpTag.java |   47 ++
 .../cloud/network/nicira/TransportZoneBinding.java |   47 ++
 .../com/cloud/network/nicira/VifAttachment.java    |   43 ++
 .../cloud/network/resource/NiciraNvpResource.java  |  240 +++++++
 .../cloud/network/guru/OvsGuestNetworkGuru.java    |   28 +
 server/src/com/cloud/host/dao/HostDaoImpl.java     |    4 +-
 .../com/cloud/hypervisor/HypervisorGuruBase.java   |   15 +
 .../network/ExternalNetworkDeviceManager.java      |    2 +
 .../src/com/cloud/network/NetworkManagerImpl.java  |    5 +-
 .../network/guru/ExternalGuestNetworkGuru.java     |   30 +-
 .../com/cloud/network/guru/GuestNetworkGuru.java   |   53 ++-
 server/src/com/cloud/server/StatsCollector.java    |    1 +
 setup/db/create-schema.sql                         |   23 +
 ui/scripts/ui-custom/zoneWizard.js                 |   13 +-
 wscript_configure                                  |    2 +-
 61 files changed, 3155 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/agent/api/to/NicTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/NicTO.java b/api/src/com/cloud/agent/api/to/NicTO.java
index b65c61e..79a43d2 100644
--- a/api/src/com/cloud/agent/api/to/NicTO.java
+++ b/api/src/com/cloud/agent/api/to/NicTO.java
@@ -21,6 +21,7 @@ public class NicTO extends NetworkTO {
     Integer networkRateMbps;
     Integer networkRateMulticastMbps;
     boolean defaultNic;
+    String uuid;
 
     public NicTO() {
         super();
@@ -55,6 +56,16 @@ public class NicTO extends NetworkTO {
     }
     
     @Override
+    public String getUuid() {
+        return uuid;
+    }
+    
+    @Override
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+    
+    @Override
     public String toString() {
         return new StringBuilder("[Nic:").append(type).append("-").append(ip).append("-").append(broadcastUri).append("]").toString();
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
index 42d9162..a93c242 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -42,6 +42,7 @@ public class VirtualMachineTO {
     String vncPassword;
     String vncAddr;
     Map<String, String> params;
+    String uuid;
 
     VolumeTO[] disks;
     NicTO[] nics;
@@ -208,4 +209,14 @@ public class VirtualMachineTO {
     public void setDetails(Map<String, String> params) {
     	this.params = params;
     }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+    
+    
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/ApiConstants.java b/api/src/com/cloud/api/ApiConstants.java
index 00ec392..e410576 100755
--- a/api/src/com/cloud/api/ApiConstants.java
+++ b/api/src/com/cloud/api/ApiConstants.java
@@ -361,6 +361,10 @@ public class ApiConstants {
     public static final String RESOURCE_IDS = "resourceids";
     public static final String RESOURCE_ID = "resourceid";
     public static final String CUSTOMER = "customer";
+    public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
+    public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
+    public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
+
     
     public enum HostDetails {
         all, capacity, events, stats, min;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/host/Host.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/host/Host.java b/api/src/com/cloud/host/Host.java
index 0c9d06d..1bac0d2 100755
--- a/api/src/com/cloud/host/Host.java
+++ b/api/src/com/cloud/host/Host.java
@@ -41,7 +41,8 @@ public interface Host extends StateObject<Status> {
 
         ExternalDhcp(false),
         SecondaryStorageVM(true),
-        LocalSecondaryStorage(false);
+        LocalSecondaryStorage(false),
+        L2Networking(false);
         boolean _virtual;
         private Type(boolean virtual) {
             _virtual = virtual;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/network/Network.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 0443a0f..459b05b 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -52,6 +52,7 @@ public interface Network extends ControlledEntity {
         public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
         public static final Service PortForwarding = new Service("PortForwarding");
         public static final Service SecurityGroup = new Service("SecurityGroup");
+        public static final Service Connectivity = new Service("Connectivity");
 
         private String name;
         private Capability[] caps;
@@ -114,6 +115,7 @@ public interface Network extends ControlledEntity {
         public static final Provider ElasticLoadBalancerVm = new Provider("ElasticLoadBalancerVm", false);
         public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
         public static final Provider None = new Provider("None", false);
+        public static final Provider NiciraNvp = new Provider("NiciraNvp", true);
 
         private String name;
         private boolean isExternal;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/network/Networks.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java
index 84135b8..b96eaa2 100755
--- a/api/src/com/cloud/network/Networks.java
+++ b/api/src/com/cloud/network/Networks.java
@@ -61,6 +61,7 @@ public class Networks {
         LinkLocal(null, null),
         Vnet("vnet", Long.class),
         Storage("storage", Integer.class),
+        Lswitch("lswitch", String.class),
         UnDecided(null, null);
 
         private String scheme;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/api/src/com/cloud/network/PhysicalNetwork.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java
index e54fe00..be4b1d0 100644
--- a/api/src/com/cloud/network/PhysicalNetwork.java
+++ b/api/src/com/cloud/network/PhysicalNetwork.java
@@ -31,7 +31,8 @@ public interface PhysicalNetwork {
     public enum IsolationMethod {
         VLAN,
         L3,
-        GRE;
+        GRE,
+        STT;
     }
 
     public enum BroadcastDomainRange {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/build/build-cloud-plugins.xml
----------------------------------------------------------------------
diff --git a/build/build-cloud-plugins.xml b/build/build-cloud-plugins.xml
index 61b0e62..c16474d 100755
--- a/build/build-cloud-plugins.xml
+++ b/build/build-cloud-plugins.xml
@@ -279,8 +279,8 @@
 
   <!-- ===================== Network Elements ===================== -->
 
-  <target name="compile-network-elements" depends="compile-netscaler, compile-f5, compile-srx, compile-ovs, compile-elb" description="Compile all network elements"/>
-  <target name="build-network-elements" depends="build-netscaler, build-f5, build-srx, build-ovs, build-elb" description="build all network elements"/>
+  <target name="compile-network-elements" depends="compile-netscaler, compile-f5, compile-srx, compile-ovs, compile-elb, compile-nicira-nvp" description="Compile all network elements"/>
+  <target name="build-network-elements" depends="build-netscaler, build-f5, build-srx, build-ovs, build-elb, build-nicira-nvp" description="build all network elements"/>
  
   <target name="compile-netscaler" depends="-init, compile-server" description="Compile NetScaler plugin">
   	<ant antfile="${base.dir}/plugins/network-elements/netscaler/build.xml" target="build"/>
@@ -301,6 +301,12 @@
   	<ant antfile="${base.dir}/plugins/network-elements/ovs/build.xml" target="build"/>
   </target>
   <target name="build-ovs" depends="compile-ovs"/>
+    
+  <target name="compile-nicira-nvp" depends="-init, compile-server" description="Compile Nicira NVP plugin">
+      <ant antfile="${base.dir}/plugins/network-elements/nicira-nvp/build.xml" target="build"/>
+  </target>
+  <target name="build-nicira-nvp" depends="compile-nicira-nvp"/>
+    
 
   <target name="compile-elb" depends="-init, compile-server" description="Compile ELB plugin">
   	<ant antfile="${base.dir}/plugins/network-elements/elastic-loadbalancer/build.xml" target="build"/>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/build/package.xml
----------------------------------------------------------------------
diff --git a/build/package.xml b/build/package.xml
index 2b5a74b..d61c698 100755
--- a/build/package.xml
+++ b/build/package.xml
@@ -225,6 +225,7 @@
         <include name="${core.jar}" />
         <include name="${api.jar}" />
         <include name="${vmware-base.jar}" />
+          <include name="${vmware.jar}" />
       </zipfileset>
       <zipfileset dir="${console-proxy.dist.dir}" filemode="555"/>
       <zipfileset dir="${scripts.dir}/storage/secondary" prefix="scripts/storage/secondary" filemode="555">

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/client/tomcatconf/components.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index f36355d..16d7b19 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -70,7 +70,7 @@
                  However, above case barely happens.
             -->
 
-            <adapter name="StorageNetworkGuru" class="com.cloud.network.guru.StorageNetworkGuru"/>
+            <adapter name="StorageNetworkGuru" class="com.cloud.network.guru.StorageNetworkGuru"/>            
             <adapter name="ExternalGuestNetworkGuru" class="com.cloud.network.guru.ExternalGuestNetworkGuru"/>
             <adapter name="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru"/>
             <adapter name="PodBasedNetworkGuru" class="com.cloud.network.guru.PodBasedNetworkGuru"/>
@@ -78,6 +78,7 @@
             <adapter name="DirectNetworkGuru" class="com.cloud.network.guru.DirectNetworkGuru"/>
             <adapter name="DirectPodBasedNetworkGuru" class="com.cloud.network.guru.DirectPodBasedNetworkGuru"/>
             <adapter name="OvsGuestNetworkGuru" class="com.cloud.network.guru.OvsGuestNetworkGuru"/>
+            <adapter name="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru"/>
         </adapters>
         <adapters key="com.cloud.cluster.ClusterServiceAdapter">
             <adapter name="ClusterService" class="com.cloud.cluster.ClusterServiceServletAdapter"/>
@@ -142,6 +143,7 @@
             <adapter name="BareMetal" class="com.cloud.network.element.BareMetalElement"/>
             <adapter name="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement"/>
             <adapter name="CiscoNexus1000vVSM" class="com.cloud.network.element.CiscoNexusVSMElement"/>
+            <adapter name="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement"/>
         </adapters>
         <adapters key="com.cloud.cluster.agentlb.AgentLoadBalancerPlanner">
             <adapter name="ClusterBasedAgentLbPlanner" class="com.cloud.cluster.agentlb.ClusterBasedAgentLoadBalancerPlanner"/>
@@ -165,10 +167,13 @@
         <pluggableservice name="F5ExternalLoadBalancerElementService" key="com.cloud.network.element.F5ExternalLoadBalancerElementService" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
         <pluggableservice name="JuniperSRXFirewallElementService" key="com.cloud.network.element.JuniperSRXFirewallElementService" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
         <pluggableservice name="CiscoNexusVSMElementService" key="com.coud.network.element.CiscoNexusVSMElementService" class="com.cloud.network.element.CiscoNexusVSMElement"/>
+        <pluggableservice name="NiciraNvpElementService" key="com.coud.network.element.NiciraNvpElementService" class="com.cloud.network.element.NiciraNvpElement"/>
         <dao name="NetScalerPodDao" class="com.cloud.network.dao.NetScalerPodDaoImpl" singleton="false"/>
         <dao name="CiscoNexusVSMDeviceDao" class="com.cloud.network.dao.CiscoNexusVSMDeviceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelInterfaceDao" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelAccountDao" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" singleton="false"/>
+        <dao name="NiciraNvpDao" class="com.cloud.network.dao.NiciraNvpDaoImpl" singleton="false"/>
+        <dao name="NiciraNvpNicMappingDao" class="com.cloud.network.dao.NiciraNvpNicMappingDaoImpl" singleton="false"/>
         <dao name="NetappPool" class="com.cloud.netapp.dao.PoolDaoImpl" singleton="false"/>
         <dao name="NetappVolume" class="com.cloud.netapp.dao.VolumeDaoImpl" singleton="false"/>
         <dao name="NetappLun" class="com.cloud.netapp.dao.LunDaoImpl" singleton="false"/>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/client/tomcatconf/nicira-nvp_commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nicira-nvp_commands.properties.in b/client/tomcatconf/nicira-nvp_commands.properties.in
new file mode 100644
index 0000000..8e749d6
--- /dev/null
+++ b/client/tomcatconf/nicira-nvp_commands.properties.in
@@ -0,0 +1,12 @@
+### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
+### Please standardize naming conventions to camel-case (even for acronyms).
+
+#### nicira nvp commands
+
+addNiciraNvpDevice = com.cloud.api.commands.AddNiciraNvpDeviceCmd;1
+deleteNiciraNvpDevice = com.cloud.api.commands.DeleteNiciraNvpDeviceCmd;1
+listNiciraNvpDevices = com.cloud.api.commands.ListNiciraNvpDevicesCmd;1
+listNiciraNvpDeviceNetworks = com.cloud.api.commands.ListNiciraNvpDeviceNetworksCmd;1
+
+# Not implemented (yet)
+#configureNiciraNvpDevice = com.cloud.api.commands.ConfigureNiciraNvpDeviceCmd;1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/cloud.spec
----------------------------------------------------------------------
diff --git a/cloud.spec b/cloud.spec
index 773a729..7233f01 100644
--- a/cloud.spec
+++ b/cloud.spec
@@ -427,6 +427,7 @@ fi
 %{_javadir}/%{name}-user-authenticator-plaintext.jar
 %{_javadir}/%{name}-vmware.jar
 %{_javadir}/%{name}-xen.jar
+%{_javadir}/%{name}-plugin-nicira-nvp.jar
 %{_javadir}/%{name}-plugin-elb.jar
 %{_javadir}/%{name}-plugin-netapp.jar
 %config(noreplace) %{_sysconfdir}/%{name}/server/*

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 496aeb3..c81d461 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -751,12 +751,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         		long vlan = Long.parseLong(broadcastUri.getHost());
         		return enableVlanNetwork(conn, vlan, network);
         	}
+        } else if (nic.getBroadcastType() == BroadcastDomainType.Lswitch) {
+            // Nicira Logical Switch
+            return network.getNetwork();
         }
 
         throw new CloudRuntimeException("Unable to support this type of network broadcast domain: " + nic.getBroadcastUri());
     }
 
     protected VIF createVif(Connection conn, String vmName, VM vm, NicTO nic) throws XmlRpcException, XenAPIException {
+        assert(nic.getUuid() != null) : "Nic should have a uuid value";
+        
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Creating VIF for " + vmName + " on nic " + nic);
         }
@@ -765,7 +770,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         vifr.VM = vm;
         vifr.device = Integer.toString(nic.getDeviceId());
         vifr.MAC = nic.getMac();
-
+        
+        // Nicira needs these IDs to find the NIC 
+        vifr.otherConfig = new HashMap<String, String>();
+        vifr.otherConfig.put("nicira-iface-id", nic.getUuid());
+        vifr.otherConfig.put("nicira-vm-id", vm.getUuid(conn));
+        
         vifr.network = getNetwork(conn, nic);
 
         if (nic.getNetworkRateMbps() != null && nic.getNetworkRateMbps().intValue() != -1) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/.classpath
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/.classpath b/plugins/network-elements/nicira-nvp/.classpath
new file mode 100644
index 0000000..edbcfa2
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/.classpath
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+    <classpathentry kind="src" path="src"/>
+    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_31"/>
+    <classpathentry combineaccessrules="false" kind="src" path="/agent"/>
+    <classpathentry combineaccessrules="false" kind="src" path="/core"/>
+    <classpathentry combineaccessrules="false" kind="src" path="/deps"/>
+    <classpathentry combineaccessrules="false" kind="src" path="/server"/>
+    <classpathentry combineaccessrules="false" kind="src" path="/utils"/>
+    <classpathentry combineaccessrules="false" kind="src" path="/api"/>
+    <classpathentry kind="output" path="bin"/>
+</classpath>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/.project
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/.project b/plugins/network-elements/nicira-nvp/.project
new file mode 100644
index 0000000..15d5c67
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+    <name>nicira-nvp</name>
+    <comment></comment>
+    <projects>
+    </projects>
+    <buildSpec>
+        <buildCommand>
+            <name>org.eclipse.jdt.core.javabuilder</name>
+            <arguments>
+            </arguments>
+        </buildCommand>
+    </buildSpec>
+    <natures>
+        <nature>org.eclipse.jdt.core.javanature</nature>
+    </natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/README.NiciraIntegration
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/README.NiciraIntegration b/plugins/network-elements/nicira-nvp/README.NiciraIntegration
new file mode 100644
index 0000000..4ab74cd
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/README.NiciraIntegration
@@ -0,0 +1,68 @@
+Nicira Network Virtualization Platform (NVP) integration code is contributed 
+by Nicira and Schuberg Philis and copyright is donated to the Apache Software
+Foundation.
+
+Authors
+    Somik Behera <sbehera@nicira.com>
+    Hugo Trippaers <htrippaers@schubergphilis.com>
+    
+== New API Calls 
+
+The following API calls are added to CloudStack to support the integrations with
+the Nicira NVP platform. Please see the API documentation of CloudStack for 
+parameters and return values.
+
+ * addNiciraNvpDevice
+ * deleteNiciraNvpDevice        
+ * listNiciraNvpDevices
+ * listNiciraNvpDeviceNetworks
+
+== How to enable the Nicira NVP integration.
+
+When configuring a zone create a new physical network for "Guest" traffic and 
+select "STT" as the isolation type. Set the Xen traffic label for "Guest" 
+traffic to the label of the integration bridge (refer to the Nicira 
+Documentation for setting up the integration bridge). Note that this requires 
+all traffic types to have their traffic labels set.
+
+These steps are specified by the API calls as there is currently no GUI 
+available.
+
+1. addNetworkServiceProvider
+    name="NiciraNvp", physicalnetworkid=<see above>, 
+    servicelist="Connectivity"
+2. updateNetworkServiceProvider
+    id=<id from step1>, state="Enabled"
+3. addNiciraNvpDevice
+    physicalnetworkid=<see step 1>, 
+    hostname=<hostname or IP of the controller>
+    username=<admin username>
+    password=<admin password>
+    transportzoneuuid=<transport zone uuid>
+
+== How to use the Nicira integration
+
+When creating a guest network make sure it is created in the physical network 
+with the isolation type set to "STT". When the first virtual machine is 
+launched in this network the NiciraNvpNetworkGuru will configure a logical 
+switch on the NVP Controller. During the startup of a virtual machine the 
+NiciraNvpElement will create a logical port for any NICs in the guest networks
+and attach the port to the existing logical swith.
+
+== Debugging/Troubleshooting
+
+All elements created on the NVP controller have tags with the name of the 
+account, this can be used to search the items using the NVP manager. The NVP 
+uuid of the logical switch is also stored in the BroadcastUri of the 
+corresponding Guest network in an lswitch uri scheme. The CloudStack uuid of 
+the NIC is used to make the Vif attachement on the logical switchport.
+
+The following classes should be set to log level debug when troubleshooting.
+    com.cloud.network 
+        (Most NiciraNvp related objects live in this package and subpackages)
+    org.apache.commons.httpclient 
+        (used by NiciraNvpApi to make calls to the SDN Controller)
+    httpclient.wire
+        (wirelevel http tracing of httpclient)
+    
+Please report any findings to the developer mailing list.

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/build.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/build.xml b/plugins/network-elements/nicira-nvp/build.xml
new file mode 100644
index 0000000..2d84c5c
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/build.xml
@@ -0,0 +1,129 @@
+<?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 Nicira NVP network element" default="help" basedir=".">
+  <description>
+        Cloud Stack ant build file
+    </description>
+
+  <dirname property="nicira-nvp.base.dir" file="${ant.file.Cloud Stack Nicira NVP network element}/"/>
+  <!-- This directory must be set -->
+  <property name="top.dir" location="${nicira-nvp.base.dir}/../../.."/>
+  <property name="build.dir" location="${top.dir}/build"/>
+    
+    <echo message="build.dir=${build.dir}; top.dir=${top.dir}; nicira-nvp.base.dir=${nicira-nvp.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-nicira-nvp.jar" value="cloud-plugin-nicira-nvp.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="nicira-nvp.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-nicira-nvp" >
+  </target>
+
+  <target name="init" description="Initialize binaries directory">
+      <mkdir dir="${classes.dir}/${cloud-plugin-nicira-nvp.jar}"/>
+      <mkdir dir="${jar.dir}"/>
+  </target>
+
+  <target name="compile-nicira-nvp" depends="init" description="Compile Nicira Nvp">
+    <compile-java jar.name="${cloud-plugin-nicira-nvp.jar}" top.dir="${nicira-nvp.base.dir}" classpath="nicira-nvp.classpath" />
+  </target>
+
+  <target name="clean-nicira-nvp">
+    <delete dir="${classes.dir}/${cloud-plugin-nicira-nvp.jar}"/>
+  </target>
+    
+  <target name="build" depends="compile-nicira-nvp"/>
+  <target name="clean" depends="clean-nicira-nvp"/>
+
+  <target name="help" description="help">
+    <echo level="info" message="This is the build file for Nicira Nvp"/>
+    <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/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
new file mode 100644
index 0000000..c9a2f8c
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchAnswer.java
@@ -0,0 +1,20 @@
+package com.cloud.agent.api;
+
+public class CreateLogicalSwitchAnswer extends Answer {
+    private String _logicalSwitchUuid;
+
+    public CreateLogicalSwitchAnswer(Command command, boolean success,
+            String details, String logicalSwitchUuid) {
+        super(command, success, details);
+        this._logicalSwitchUuid = logicalSwitchUuid;
+    }
+    
+    public CreateLogicalSwitchAnswer(Command command, Exception e) {
+        super(command, e);
+    }
+
+    public String getLogicalSwitchUuid() {
+        return _logicalSwitchUuid;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
new file mode 100644
index 0000000..acc347d
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchCommand.java
@@ -0,0 +1,38 @@
+package com.cloud.agent.api;
+
+public class CreateLogicalSwitchCommand extends Command {
+    
+    private String _transportUuid;
+    private String _transportType;
+    private String _name;
+    private String _ownerName;
+
+    public CreateLogicalSwitchCommand(String transportUuid, String transportType, String name, String ownerName) {
+        this._transportUuid = transportUuid;
+        this._transportType = transportType;
+        this._name = name;
+        this._ownerName = ownerName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getTransportUuid() {
+        return _transportUuid;
+    }
+
+    public String getTransportType() {
+        return _transportType;
+    }
+
+    public String getName() {
+        return _name;
+    }
+
+    public String getOwnerName() {
+        return _ownerName;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
new file mode 100644
index 0000000..88522af
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortAnswer.java
@@ -0,0 +1,20 @@
+package com.cloud.agent.api;
+
+public class CreateLogicalSwitchPortAnswer extends Answer {
+    private String _logicalSwitchPortUuid;
+
+    public CreateLogicalSwitchPortAnswer(Command command, boolean success,
+            String details, String localSwitchPortUuid) {
+        super(command, success, details);
+        this._logicalSwitchPortUuid = localSwitchPortUuid;
+    }
+    
+    public String getLogicalSwitchPortUuid() {
+        return _logicalSwitchPortUuid;
+    }
+
+    public CreateLogicalSwitchPortAnswer(Command command, Exception e) {
+        super(command, e);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
new file mode 100644
index 0000000..af6f529
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/CreateLogicalSwitchPortCommand.java
@@ -0,0 +1,42 @@
+package com.cloud.agent.api;
+
+public class CreateLogicalSwitchPortCommand extends Command {
+    private String _logicalSwitchUuid;
+    private String _attachmentUuid;
+    private String _ownerName;
+    private String _nicName;
+    
+    public CreateLogicalSwitchPortCommand(String logicalSwitchUuid, String attachmentUuid, String ownerName, String nicName) {
+        this._logicalSwitchUuid = logicalSwitchUuid;
+        this._attachmentUuid = attachmentUuid;
+        this._ownerName = ownerName;
+        this._nicName = nicName;
+    }
+    
+    
+    public String getLogicalSwitchUuid() {
+        return _logicalSwitchUuid;
+    }
+
+
+    public String getAttachmentUuid() {
+        return _attachmentUuid;
+    }
+
+
+    public String getOwnerName() {
+        return _ownerName;
+    }
+
+
+    public String getNicName() {
+        return _nicName;
+    }
+
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
new file mode 100644
index 0000000..cec44bc
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchAnswer.java
@@ -0,0 +1,14 @@
+package com.cloud.agent.api;
+
+public class DeleteLogicalSwitchAnswer extends Answer {
+
+    public DeleteLogicalSwitchAnswer(Command command, boolean success,
+            String details) {
+        super(command, success, details);
+    }
+
+    public DeleteLogicalSwitchAnswer(Command command, Exception e) {
+        super(command, e);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
new file mode 100644
index 0000000..04c7630
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchCommand.java
@@ -0,0 +1,19 @@
+package com.cloud.agent.api;
+
+public class DeleteLogicalSwitchCommand extends Command {
+    
+    private String _logicalSwitchUuid;
+    
+    public DeleteLogicalSwitchCommand(String logicalSwitchUuid) {
+        this._logicalSwitchUuid = logicalSwitchUuid;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getLogicalSwitchUuid() {
+        return _logicalSwitchUuid;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
new file mode 100644
index 0000000..008d44c
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortAnswer.java
@@ -0,0 +1,14 @@
+package com.cloud.agent.api;
+
+public class DeleteLogicalSwitchPortAnswer extends Answer {
+
+    public DeleteLogicalSwitchPortAnswer(Command command, boolean success,
+            String details) {
+        super(command, success, details);
+    }
+
+    public DeleteLogicalSwitchPortAnswer(Command command, Exception e) {
+        super(command, e);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
new file mode 100644
index 0000000..b3a7d64
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/DeleteLogicalSwitchPortCommand.java
@@ -0,0 +1,25 @@
+package com.cloud.agent.api;
+
+public class DeleteLogicalSwitchPortCommand extends Command {
+    private String _logicalSwitchUuid;
+    private String _logicalSwithPortUuid;
+    
+    public DeleteLogicalSwitchPortCommand(String logicalSwitchUuid, String logicalSwitchPortUuid) {
+        this._logicalSwitchUuid = logicalSwitchUuid;
+        this._logicalSwithPortUuid = logicalSwitchPortUuid;
+    }
+    
+    public String getLogicalSwitchUuid() {
+        return _logicalSwitchUuid;
+    }
+    
+    public String getLogicalSwitchPortUuid() {
+        return _logicalSwithPortUuid;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/StartupNiciraNvpCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/StartupNiciraNvpCommand.java b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/StartupNiciraNvpCommand.java
new file mode 100644
index 0000000..a57c2fd
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/agent/api/StartupNiciraNvpCommand.java
@@ -0,0 +1,11 @@
+package com.cloud.agent.api;
+
+import com.cloud.host.Host;
+
+public class StartupNiciraNvpCommand extends StartupCommand {
+
+    public StartupNiciraNvpCommand() {
+        super(Host.Type.L2Networking);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
new file mode 100644
index 0000000..e32d7d2
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java
@@ -0,0 +1,110 @@
+package com.cloud.api.commands;
+
+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.BaseCmd.CommandType;
+import com.cloud.api.response.NiciraNvpDeviceResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.ExternalLoadBalancerDeviceVO;
+import com.cloud.network.NiciraNvpDeviceVO;
+import com.cloud.network.element.NiciraNvpElementService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NiciraNvpDeviceResponse.class, description="Adds a Nicira NVP device")
+public class AddNiciraNvpDeviceCmd extends BaseCmd {
+    private static final Logger s_logger = Logger.getLogger(AddNiciraNvpDeviceCmd.class.getName());
+    private static final String s_name = "addniciranvpdevice";
+    @PlugService NiciraNvpElementService _niciraNvpElementService;
+    
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="physical_network")
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, 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 Nicira NVP Controller.")
+    private String host;
+
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="Credentials to access the Nicira Controller API")
+    private String username;
+    
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Credentials to access the Nicira Controller API")
+    private String password;
+    
+    @Parameter(name=ApiConstants.NICIRA_NVP_TRANSPORT_ZONE_UUID, type=CommandType.STRING, required = true, description="The Transportzone UUID configured on the Nicira Controller")
+    private String transportzoneuuid;
+    
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    public String getHost() {
+        return host;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+    
+    public String getTransportzoneUuid() {
+        return transportzoneuuid;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+        try {
+            NiciraNvpDeviceVO niciraNvpDeviceVO = _niciraNvpElementService.addNiciraNvpDevice(this);
+            if (niciraNvpDeviceVO != null) {
+                NiciraNvpDeviceResponse response = _niciraNvpElementService.createNiciraNvpDeviceResponse(niciraNvpDeviceVO);
+                response.setObjectName("niciranvpdevice");
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add Nicira NVP device 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/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
new file mode 100644
index 0000000..181a747
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
@@ -0,0 +1,76 @@
+package com.cloud.api.commands;
+
+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.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.NiciraNvpElementService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=SuccessResponse.class, description=" delete a nicira nvp device")
+public class DeleteNiciraNvpDeviceCmd extends BaseCmd {
+    private static final Logger s_logger = Logger.getLogger(DeleteNiciraNvpDeviceCmd.class.getName());
+    private static final String s_name = "addniciranvpdevice";
+    @PlugService NiciraNvpElementService _niciraNvpElementService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="external_nicira_nvp_devices")
+    @Parameter(name=ApiConstants.NICIRA_NVP_DEVICE_ID, type=CommandType.LONG, required=true, description="Nicira device ID")
+    private Long niciraNvpDeviceId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getNiciraNvpDeviceId() {
+        return niciraNvpDeviceId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+        try {
+            boolean result = _niciraNvpElementService.deleteNiciraNvpDevice(this);
+            if (result) {
+                SuccessResponse response = new SuccessResponse(getCommandName());
+                response.setResponseName(getCommandName());
+                this.setResponseObject(response);
+            } else {
+                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete Nicira device.");
+            }
+        }  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/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
new file mode 100644
index 0000000..b4c1f88
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java
@@ -0,0 +1,85 @@
+package com.cloud.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.BaseCmd.CommandType;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.NetworkResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.network.element.NiciraNvpElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NetworkResponse.class, description="lists network that are using a nicira nvp device")
+public class ListNiciraNvpDeviceNetworksCmd extends BaseListCmd {
+
+    public static final Logger s_logger = Logger.getLogger(ListNiciraNvpDeviceNetworksCmd.class.getName());
+    private static final String s_name = "listniciranvpdevicenetworks";
+    @PlugService NiciraNvpElementService _niciraNvpElementService;
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="external_nicira_nvp_devices")
+    @Parameter(name=ApiConstants.NICIRA_NVP_DEVICE_ID, type=CommandType.LONG, required = true, description="nicira nvp device ID")
+    private Long niciraNvpDeviceId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getNiciraNvpDeviceId() {
+        return niciraNvpDeviceId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+        try {
+            List<? extends Network> networks  = _niciraNvpElementService.listNiciraNvpDeviceNetworks(this);
+            ListResponse<NetworkResponse> response = new ListResponse<NetworkResponse>();
+            List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
+
+            if (networks != null && !networks.isEmpty()) {
+                for (Network network : networks) {
+                    NetworkResponse networkResponse = _responseGenerator.createNetworkResponse(network);
+                    networkResponses.add(networkResponse);
+                }
+            }
+
+            response.setResponses(networkResponses);
+            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/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
new file mode 100644
index 0000000..a521f0e
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java
@@ -0,0 +1,90 @@
+package com.cloud.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.NiciraNvpDeviceResponse;
+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.NiciraNvpDeviceVO;
+import com.cloud.network.element.NiciraNvpElementService;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Implementation(responseObject=NiciraNvpDeviceResponse.class, description="Lists Nicira NVP devices")
+public class ListNiciraNvpDevicesCmd extends BaseListCmd {
+    private static final Logger s_logger = Logger.getLogger(ListNiciraNvpDevicesCmd.class.getName());
+    private static final String s_name = "listniciranvpdevices";
+    @PlugService NiciraNvpElementService _niciraNvpElementService;
+
+   /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName="physical_network")
+    @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.LONG, description="the Physical Network ID")
+    private Long physicalNetworkId;
+
+    @IdentityMapper(entityTableName="external_nicira_nvp_devices")
+    @Parameter(name=ApiConstants.NICIRA_NVP_DEVICE_ID, type=CommandType.LONG,  description="nicira nvp device ID")
+    private Long niciraNvpDeviceId;
+
+    /////////////////////////////////////////////////////
+    /////////////////// Accessors ///////////////////////
+    /////////////////////////////////////////////////////
+
+    public Long getNiciraNvpDeviceId() {
+        return niciraNvpDeviceId;
+    }
+
+    public Long getPhysicalNetworkId() {
+        return physicalNetworkId;
+    }
+
+    /////////////////////////////////////////////////////
+    /////////////// API Implementation///////////////////
+    /////////////////////////////////////////////////////
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+        try {
+            List<NiciraNvpDeviceVO> niciraDevices = _niciraNvpElementService.listNiciraNvpDevices(this);
+            ListResponse<NiciraNvpDeviceResponse> response = new ListResponse<NiciraNvpDeviceResponse>();
+            List<NiciraNvpDeviceResponse> niciraDevicesResponse = new ArrayList<NiciraNvpDeviceResponse>();
+
+            if (niciraDevices != null && !niciraDevices.isEmpty()) {
+                for (NiciraNvpDeviceVO niciraDeviceVO : niciraDevices) {
+                    NiciraNvpDeviceResponse niciraDeviceResponse = _niciraNvpElementService.createNiciraNvpDeviceResponse(niciraDeviceVO);
+                    niciraDevicesResponse.add(niciraDeviceResponse);
+                }
+            }
+
+            response.setResponses(niciraDevicesResponse);
+            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/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
new file mode 100644
index 0000000..e134bed
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/response/NiciraNvpDeviceResponse.java
@@ -0,0 +1,37 @@
+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;
+
+public class NiciraNvpDeviceResponse extends BaseResponse {
+    @SerializedName(ApiConstants.NICIRA_NVP_DEVICE_ID) @Param(description="device id of the Nicire Nvp")
+    private IdentityProxy id = new IdentityProxy("external_nicira_nvp_devices");
+    
+    @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network to which this Nirica Nvp belongs to")
+    private IdentityProxy physicalNetworkId = new IdentityProxy("physical_network");
+    
+    @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider")
+    private String providerName;
+    
+    @SerializedName(ApiConstants.NICIRA_NVP_DEVICE_NAME) @Param(description="device name")
+    private String deviceName;
+
+    public void setId(long nvpDeviceId) {
+        this.id.setValue(nvpDeviceId);
+    }
+
+    public void setPhysicalNetworkId(long physicalNetworkId) {
+        this.physicalNetworkId.setValue(physicalNetworkId);
+    }
+
+    public void setProviderName(String providerName) {
+        this.providerName = providerName;
+    }
+
+    public void setDeviceName(String deviceName) {
+        this.deviceName = deviceName;
+    }     
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
new file mode 100644
index 0000000..550479b
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpDeviceVO.java
@@ -0,0 +1,79 @@
+package com.cloud.network;
+
+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_nicira_nvp_devices")
+public class NiciraNvpDeviceVO {
+
+    @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 NiciraNvpDeviceVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public NiciraNvpDeviceVO(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/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
new file mode 100644
index 0000000..2b5f8ba
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/NiciraNvpNicMappingVO.java
@@ -0,0 +1,65 @@
+package com.cloud.network;
+
+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="nicira_nvp_nic_map")
+public class NiciraNvpNicMappingVO {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="logicalswitch")
+    private String logicalSwitchUuid;
+    
+    @Column(name="logicalswitchport")
+    private String logicalSwitchPortUuid;
+    
+    @Column(name="nic")
+    private String nicUuid;
+    
+    public NiciraNvpNicMappingVO () {    
+    }
+    
+    public NiciraNvpNicMappingVO (String logicalSwitchUuid, String logicalSwitchPortUuid, String nicUuid) {
+        this.logicalSwitchUuid = logicalSwitchUuid;
+        this.logicalSwitchPortUuid = logicalSwitchPortUuid;
+        this.nicUuid = nicUuid;
+    }
+
+    public String getLogicalSwitchUuid() {
+        return logicalSwitchUuid;
+    }
+
+    public void setLogicalSwitchUuid(String logicalSwitchUuid) {
+        this.logicalSwitchUuid = logicalSwitchUuid;
+    }
+
+    public String getLogicalSwitchPortUuid() {
+        return logicalSwitchPortUuid;
+    }
+
+    public void setLogicalSwitchPortUuid(String logicalSwitchPortUuid) {
+        this.logicalSwitchPortUuid = logicalSwitchPortUuid;
+    }
+
+    public String getNicUuid() {
+        return nicUuid;
+    }
+
+    public void setNicUuid(String nicUuid) {
+        this.nicUuid = nicUuid;
+    }
+
+    public long getId() {
+        return id;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDao.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDao.java
new file mode 100644
index 0000000..fddb75e
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDao.java
@@ -0,0 +1,16 @@
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import com.cloud.network.NiciraNvpDeviceVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface NiciraNvpDao extends GenericDao<NiciraNvpDeviceVO, Long>{
+    /**
+     * list all the nicira nvp devices added in to this physical network
+     * @param physicalNetworkId physical Network Id
+     * @return list of NiciraNvpDeviceVO for this physical network.
+     */
+    List<NiciraNvpDeviceVO> listByPhysicalNetwork(long physicalNetworkId);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
new file mode 100644
index 0000000..916d1ff
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java
@@ -0,0 +1,32 @@
+package com.cloud.network.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import com.cloud.network.NiciraNvpDeviceVO;
+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=NiciraNvpDao.class)
+public class NiciraNvpDaoImpl extends GenericDaoBase<NiciraNvpDeviceVO, Long>
+        implements NiciraNvpDao {
+    
+    protected final SearchBuilder<NiciraNvpDeviceVO> physicalNetworkIdSearch;
+    
+    public NiciraNvpDaoImpl() {
+        physicalNetworkIdSearch = createSearchBuilder();
+        physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ);
+        physicalNetworkIdSearch.done();
+    }
+
+    @Override
+    public List<NiciraNvpDeviceVO> listByPhysicalNetwork(long physicalNetworkId) {
+        SearchCriteria<NiciraNvpDeviceVO> sc = physicalNetworkIdSearch.create();
+        sc.setParameters("physicalNetworkId", physicalNetworkId);
+        return search(sc, null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
new file mode 100644
index 0000000..a51f521
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDao.java
@@ -0,0 +1,13 @@
+package com.cloud.network.dao;
+
+import com.cloud.network.NiciraNvpNicMappingVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface NiciraNvpNicMappingDao extends GenericDao<NiciraNvpNicMappingVO, Long> {
+
+    /** find the mapping for a nic 
+     * @param nicUuid the Uuid of a nic attached to a logical switch port
+     * @return NiciraNvpNicMapping for this nic uuid or null if it does not exist
+     */
+    public NiciraNvpNicMappingVO findByNicUuid(String nicUuid);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/79c7da07/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
new file mode 100644
index 0000000..b3223d3
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java
@@ -0,0 +1,30 @@
+package com.cloud.network.dao;
+
+import javax.ejb.Local;
+
+import com.cloud.network.NiciraNvpNicMappingVO;
+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=NiciraNvpNicMappingDao.class)
+public class NiciraNvpNicMappingDaoImpl extends
+        GenericDaoBase<NiciraNvpNicMappingVO, Long> implements NiciraNvpNicMappingDao {
+
+    protected final SearchBuilder<NiciraNvpNicMappingVO> nicSearch;
+    
+    public NiciraNvpNicMappingDaoImpl() {
+        nicSearch = createSearchBuilder();
+        nicSearch.and("nicUuid", nicSearch.entity().getNicUuid(), Op.EQ);
+        nicSearch.done();
+    }
+    
+    @Override
+    public NiciraNvpNicMappingVO findByNicUuid(String nicUuid) {
+        SearchCriteria<NiciraNvpNicMappingVO> sc = nicSearch.create();
+        sc.setParameters("nicUuid", nicUuid);
+        return findOneBy(sc);
+    }
+
+}


Mime
View raw message