You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by tu...@apache.org on 2014/03/01 10:32:18 UTC

[4/5] CLOUDSTACK-6162: add UI for OVS plugin

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
new file mode 100644
index 0000000..7f24155
--- /dev/null
+++ b/client/tomcatconf/componentContext.xml.in
@@ -0,0 +1,332 @@
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:context="http://www.springframework.org/schema/context"
+  xmlns:tx="http://www.springframework.org/schema/tx"
+  xmlns:aop="http://www.springframework.org/schema/aop"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/tx
+                      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+                      http://www.springframework.org/schema/aop
+                      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+  <context:annotation-config />
+
+
+<!--
+
+  OSS deployment configuration
+
+  OSS/non-OSS counter-exclusive components and related configurations should be put here
+  for example, configurationDaoImpl component, it has exclusive configuration settings in OSS and non-OSS deployment,
+  its component declaration should be put in both componentContext.xml.in and nonossComponentContext.xml.in, each with
+  independent configuration
+
+-->
+  
+  <bean id="databaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker" />
+  <bean id="configurationDaoImpl" class="com.cloud.configuration.dao.ConfigurationDaoImpl" />
+  <bean id="GlobalLoadBalancingRulesServiceImpl" class ="org.apache.cloudstack.region.gslb.GlobalLoadBalancingRulesServiceImpl" />
+
+  <!--
+    Nicira support components
+  -->
+  <bean id="niciraNvpDaoImpl" class="com.cloud.network.dao.NiciraNvpDaoImpl" />
+  <bean id="niciraNvpNicMappingDaoImpl" class="com.cloud.network.dao.NiciraNvpNicMappingDaoImpl" />
+  <bean id="niciraNvpRouterMappingDaoImpl" class="com.cloud.network.dao.NiciraNvpRouterMappingDaoImpl" />
+  <bean id="NiciraNvpGuestNetworkGuru" class="com.cloud.network.guru.NiciraNvpGuestNetworkGuru">
+    <property name="name" value="NiciraNvpGuestNetworkGuru"/>
+  </bean>
+  <bean id="NiciraNvp" class="com.cloud.network.element.NiciraNvpElement">
+    <property name="name" value="NiciraNvp"/>
+  </bean>
+
+  <!-- 
+    Midonet support components
+  -->
+  <bean id="MidoNetGuestNetworkGuru" class="com.cloud.network.guru.MidoNetGuestNetworkGuru">
+    <property name="name" value="MidoNetGuestNetworkGuru"/>
+  </bean>
+  <bean id="MidoNetElement" class="com.cloud.network.element.MidoNetElement">
+    <property name="name" value="MidoNetElement"/>
+  </bean>
+
+
+  <!--
+    Ovs support components
+  -->
+  <bean id="ovsTunnelInterfaceDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" />
+  <bean id="ovsTunnelNetworkDaoImpl" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" />
+  
+  <!--
+    Stratosphere SSP support components
+  -->
+  <bean id="sspCredentialDaoImpl" class="org.apache.cloudstack.network.dao.SspCredentialDaoImpl"/>
+  <bean id="sspTenantDaoImpl" class="org.apache.cloudstack.network.dao.SspTenantDaoImpl"/>
+  <bean id="sspUuidDaoImpl" class="org.apache.cloudstack.network.dao.SspUuidDaoImpl"/>
+  <bean id="SspGuestNetworkGuru" class="org.apache.cloudstack.network.guru.SspGuestNetworkGuru">
+    <property name="name" value="SspGuestNetworkGuru"/>
+  </bean>
+  <bean id="StratosphereSsp" class="org.apache.cloudstack.network.element.SspElement">
+    <property name="name" value="StratosphereSsp"/>
+  </bean>
+
+  <!--
+    UCS support components
+  -->
+  <bean id="ucsBladeDaoImpl" class="com.cloud.ucs.database.UcsBladeDaoImpl" />
+  <bean id="ucsManagerDaoImpl" class="com.cloud.ucs.database.UcsManagerDaoImpl" />
+
+<!--
+
+  Deployment configurations of various adapters
+
+  It determines whether or not a adapter is activated or how it is loaded in order in its managing provider,
+
+-->
+  <bean id="cloudStackImageStoreProviderImpl"
+        class="org.apache.cloudstack.storage.datastore.provider.CloudStackImageStoreProviderImpl"/>
+  <bean id="s3ImageStoreProviderImpl"
+        class="org.apache.cloudstack.storage.datastore.provider.S3ImageStoreProviderImpl"/>
+  <bean id="swiftImageStoreProviderImpl"
+        class="org.apache.cloudstack.storage.datastore.provider.SwiftImageStoreProviderImpl"/>
+  <bean id="solidFireDataStoreProvider"
+        class="org.apache.cloudstack.storage.datastore.provider.SolidfirePrimaryDataStoreProvider"/>
+
+  <!--Storage Providers-->
+  <bean id="dataStoreProviderManager"
+        class="org.apache.cloudstack.storage.datastore.provider.DataStoreProviderManagerImpl">
+    <property name="providers">
+      <list merge="true">
+        <ref bean="cloudStackPrimaryDataStoreProviderImpl"/>
+        <ref local="cloudStackImageStoreProviderImpl"/>
+        <ref local="s3ImageStoreProviderImpl"/>
+        <ref local="swiftImageStoreProviderImpl"/>
+        <ref local="solidFireDataStoreProvider"/>
+      </list>
+    </property>
+  </bean>
+
+  <!-- Security adapters -->
+  <bean id="userAuthenticators" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="SHA256SaltedUserAuthenticator"/>
+          <ref bean="MD5UserAuthenticator"/>
+          <ref bean="LDAPUserAuthenticator"/>
+          <ref bean="PlainTextUserAuthenticator"/>
+      </list>
+    </property>
+  </bean>
+  <bean id="userPasswordEncoders" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="SHA256SaltedUserAuthenticator"/>
+          <ref bean="MD5UserAuthenticator"/>
+          <ref bean="LDAPUserAuthenticator"/>
+          <ref bean="PlainTextUserAuthenticator"/>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="securityCheckers" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+		  <ref bean="affinityGroupAccessChecker"/>
+          <ref bean="domainChecker"/>
+      </list>
+    </property>
+  </bean>
+
+  <!-- Resource discoverers -->
+  <bean id="resourceDiscoverers" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="XcpServerDiscoverer"/>
+          <ref bean="SecondaryStorageDiscoverer"/>
+          <ref bean="KvmServerDiscoverer"/>
+          <ref bean="LxcServerDiscoverer"/>
+          <ref bean="BareMetalDiscoverer"/>
+          <ref bean="OvmDiscoverer"/>
+      </list>
+    </property>
+  </bean>
+
+  <!-- HA adapters -->
+  <bean id="haInvestigators" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="CheckOnAgentInvestigator"/>
+          <ref bean="XenServerInvestigator"/>
+          <ref bean="UserVmDomRInvestigator"/>
+          <ref bean="ManagementIPSystemVMInvestigator"/>
+          <ref bean="KVMInvestigator"/>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="haFenceBuilders" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="XenServerFencer"/>
+          <ref bean="KVMFencer"/>
+          <ref bean="OvmFencer"/>
+      </list>
+    </property>
+  </bean>
+
+  <!-- HA adapters -->
+  <bean id="haPlanners" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="SkipHeuresticsPlanner" />
+      </list>
+    </property>
+  </bean>
+
+  <!-- Deployment/allocation adapters -->
+  <bean id="deploymentPlanners" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="FirstFitPlanner" />
+          <ref bean="UserDispersingPlanner" />
+          <ref bean="UserConcentratedPodPlanner" />
+          <ref bean="ImplicitDedicationPlanner" />
+          <ref bean="BareMetalPlanner" />
+      </list>
+    </property>
+  </bean>
+
+  <bean id="podAllocators" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="UserConcentratedAllocator"/>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="hostAllocators" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="FirstFitRouting"/>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="storagePoolAllocators" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="LocalStoragePoolAllocator"/>
+          <ref bean="clusterScopeStoragePoolAllocator"/>
+          <ref bean="zoneWideStoragePoolAllocator"/>
+      </list>
+    </property>
+  </bean>
+
+  <!-- Networking adapters -->
+  <bean id="ipDeployers" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="elasticLoadBalancerElement"/>
+          <ref bean="VirtualRouter"/>
+          <ref bean="VpcVirtualRouter"/>
+          <ref bean="NiciraNvp"/>
+          <ref bean="InternalLbVm"/>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="dhcpProviders" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="VirtualRouter"/>
+          <ref bean="VpcVirtualRouter"/>
+          <ref bean="BareMetalDhcp"/>
+      </list>
+    </property>
+  </bean>
+
+  <bean id="networkGurus" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="StorageNetworkGuru"/>
+          <ref bean="ExternalGuestNetworkGuru"/>
+          <ref bean="PublicNetworkGuru"/>
+          <ref bean="PodBasedNetworkGuru"/>
+          <ref bean="DirectPodBasedNetworkGuru"/>
+          <ref bean="ControlNetworkGuru"/>
+          <ref bean="DirectNetworkGuru"/>
+          <ref bean="OvsGuestNetworkGuru"/>
+          <ref bean="PrivateNetworkGuru"/>
+          <ref bean="NiciraNvpGuestNetworkGuru"/>
+          <ref bean="MidoNetGuestNetworkGuru"/>
+          <ref bean="SspGuestNetworkGuru"/>
+      </list>
+    </property>
+  </bean>
+  
+  <bean id="networkElements" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="VirtualRouter"/>
+          <ref bean="Ovs"/>
+          <ref bean="SecurityGroupProvider"/>
+          <ref bean="VpcVirtualRouter"/>
+          <ref bean="NiciraNvp" />
+          <ref bean="MidoNetElement"/>
+          <ref bean="StratosphereSsp"/>
+          <ref bean="InternalLbVm"/>
+          <ref bean="BareMetalDhcp"/>
+          <ref bean="BareMetalPxe"/>
+          <ref bean="BareMetalUserdata"/>
+      </list>
+    </property>
+  </bean>
+
+  <!--
+   AffinityGroup Processors
+  -->
+  <bean id="HostAntiAffinityProcessor" class="org.apache.cloudstack.affinity.HostAntiAffinityProcessor">
+   	<property name="name" value="HostAntiAffinityProcessor"/>
+   	<property name="type" value="host anti-affinity"/>
+  </bean>
+
+  <bean id="affinityProcessors" class="com.cloud.utils.component.AdapterList">
+    <property name="Adapters">
+      <list>
+          <ref bean="HostAntiAffinityProcessor" />
+          <ref bean="ExplicitDedicationProcessor"/>
+      </list>
+    </property>
+  </bean>
+
+  <!--
+    Dedicated Resources components
+  -->
+  <bean id="DedicatedResourceManagerImpl" class="org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl"/>
+  <bean id="ExplicitDedicationProcessor" class="org.apache.cloudstack.affinity.ExplicitDedicationProcessor">
+    <property name="name" value="ExplicitDedicationProcessor"/>
+    <property name="type" value="ExplicitDedication"/>
+  </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/engine/schema/src/com/cloud/network/dao/OvsProviderDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/OvsProviderDao.java b/engine/schema/src/com/cloud/network/dao/OvsProviderDao.java
new file mode 100644
index 0000000..2cd21c6
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/OvsProviderDao.java
@@ -0,0 +1,30 @@
+// 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.element.OvsProviderVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface OvsProviderDao extends GenericDao<OvsProviderVO, Long> {
+	public OvsProviderVO findByNspId(long nspId);
+
+	public List<OvsProviderVO> listByEnabled(boolean enabled);
+
+	public OvsProviderVO findByIdAndEnabled(long id, boolean enabled);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/engine/schema/src/com/cloud/network/dao/OvsProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/OvsProviderDaoImpl.java b/engine/schema/src/com/cloud/network/dao/OvsProviderDaoImpl.java
new file mode 100644
index 0000000..ec20d4c
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/OvsProviderDaoImpl.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.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.element.OvsProviderVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = OvsProviderDao.class)
+@DB()
+public class OvsProviderDaoImpl extends GenericDaoBase<OvsProviderVO, Long>
+		implements OvsProviderDao {
+	final SearchBuilder<OvsProviderVO> AllFieldsSearch;
+
+	public OvsProviderDaoImpl() {
+		super();
+		AllFieldsSearch = createSearchBuilder();
+		AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(),
+				SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("nsp_id", AllFieldsSearch.entity().getNspId(),
+				SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("uuid", AllFieldsSearch.entity().getUuid(),
+				SearchCriteria.Op.EQ);
+		AllFieldsSearch.and("enabled", AllFieldsSearch.entity().isEnabled(),
+				SearchCriteria.Op.EQ);
+		AllFieldsSearch.done();
+	}
+
+	@Override
+	public OvsProviderVO findByNspId(long nspId) {
+		SearchCriteria<OvsProviderVO> sc = AllFieldsSearch.create();
+		sc.setParameters("nsp_id", nspId);
+		return findOneBy(sc);
+	}
+
+	@Override
+	public List<OvsProviderVO> listByEnabled(boolean enabled) {
+		SearchCriteria<OvsProviderVO> sc = AllFieldsSearch.create();
+		sc.setParameters("enabled", enabled);
+		return listBy(sc);
+	}
+
+	@Override
+	public OvsProviderVO findByIdAndEnabled(long id, boolean enabled) {
+		SearchCriteria<OvsProviderVO> sc = AllFieldsSearch.create();
+		sc.setParameters("id", id);
+		sc.setParameters("enabled", enabled);
+		return findOneBy(sc);
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/engine/schema/src/com/cloud/network/element/OvsProviderVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/element/OvsProviderVO.java b/engine/schema/src/com/cloud/network/element/OvsProviderVO.java
new file mode 100644
index 0000000..ddcc9c3
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/element/OvsProviderVO.java
@@ -0,0 +1,99 @@
+// 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.Date;
+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;
+
+import com.cloud.network.OvsProvider;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = ("ovs_providers"))
+public class OvsProviderVO implements OvsProvider {
+	@Id
+	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@Column(name = "id")
+	long id;
+
+	@Column(name = "nsp_id")
+	private long nspId;
+
+	@Column(name = "uuid")
+	private String uuid;
+
+	@Column(name = "enabled")
+	private boolean enabled;
+
+	@Column(name = GenericDao.REMOVED_COLUMN)
+	Date removed;
+
+	public OvsProviderVO() {
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	public OvsProviderVO(long nspId) {
+		this.nspId = nspId;
+		this.uuid = UUID.randomUUID().toString();
+	}
+
+	@Override
+	public long getNspId() {
+		return nspId;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	@Override
+	public long getId() {
+		return id;
+	}
+
+	public Date getRemoved() {
+		return removed;
+	}
+
+	public void setEnabled(boolean enabled) {
+		this.enabled = enabled;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return this.enabled;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public void setNspId(long nspId) {
+		this.nspId = nspId;
+	}
+
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/hypervisors/kvm/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml
index 1aff8f0..1d5e86f 100644
--- a/plugins/hypervisors/kvm/pom.xml
+++ b/plugins/hypervisors/kvm/pom.xml
@@ -44,6 +44,11 @@
       <version>${cs.libvirt-java.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-network-ovs</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
       <groupId>com.ceph</groupId>
       <artifactId>rados</artifactId>
       <version>${cs.rados-java.version}</version>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index ab7b9b5..762a0e6 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -132,6 +132,13 @@ import com.cloud.agent.api.NetworkRulesSystemVmCommand;
 import com.cloud.agent.api.NetworkRulesVmSecondaryIpCommand;
 import com.cloud.agent.api.NetworkUsageAnswer;
 import com.cloud.agent.api.NetworkUsageCommand;
+import com.cloud.agent.api.OvsCreateTunnelAnswer;
+import com.cloud.agent.api.OvsCreateTunnelCommand;
+import com.cloud.agent.api.OvsDestroyBridgeCommand;
+import com.cloud.agent.api.OvsDestroyTunnelCommand;
+import com.cloud.agent.api.OvsFetchInterfaceAnswer;
+import com.cloud.agent.api.OvsFetchInterfaceCommand;
+import com.cloud.agent.api.OvsSetupBridgeCommand;
 import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.PingRoutingCommand;
 import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
@@ -295,6 +302,7 @@ ServerResource {
     private String _ovsPvlanDhcpHostPath;
     private String _ovsPvlanVmPath;
     private String _routerProxyPath;
+	private String _ovsTunnelPath;
     private String _host;
     private String _dcId;
     private String _pod;
@@ -630,10 +638,14 @@ ServerResource {
         _securityGroupPath = Script.findScript(networkScriptsDir,
                 "security_group.py");
         if (_securityGroupPath == null) {
-            throw new ConfigurationException(
-                    "Unable to find the security_group.py");
+            throw new ConfigurationException("Unable to find the security_group.py");
         }
 
+		_ovsTunnelPath = Script.findScript(networkScriptsDir, "ovstunnel.py");
+		if (_ovsTunnelPath == null) {
+			throw new ConfigurationException("Unable to find the ovstunnel.py");
+		}
+
         _routerProxyPath = Script.findScript("scripts/network/domr/",
                 "router_proxy.sh");
         if (_routerProxyPath == null) {
@@ -1343,7 +1355,17 @@ ServerResource {
                 return execute((PvlanSetupCommand) cmd);
             } else if (cmd instanceof CheckOnHostCommand) {
                 return execute((CheckOnHostCommand)cmd);
-            } else {
+		    } else if (cmd instanceof OvsFetchInterfaceCommand) {
+			return execute((OvsFetchInterfaceCommand) cmd);
+			} else if (cmd instanceof OvsSetupBridgeCommand) {
+				return execute((OvsSetupBridgeCommand) cmd);
+			} else if (cmd instanceof OvsDestroyBridgeCommand) {
+				return execute((OvsDestroyBridgeCommand) cmd);
+			} else if (cmd instanceof OvsCreateTunnelCommand) {
+				return execute((OvsCreateTunnelCommand) cmd);
+			} else if (cmd instanceof OvsDestroyTunnelCommand) {
+				return execute((OvsDestroyTunnelCommand) cmd);
+			} else {
                 s_logger.warn("Unsupported command ");
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
@@ -1352,6 +1374,175 @@ ServerResource {
         }
     }
 
+    private OvsFetchInterfaceAnswer execute(OvsFetchInterfaceCommand cmd) {
+    	String label = cmd.getLabel();
+    	s_logger.debug("Will look for network with name-label:" + label);
+    	try {
+    		String ipadd = Script.runSimpleBashScript("ifconfig " + label + " | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'");
+    		String mask = Script.runSimpleBashScript("ifconfig " + label + " | grep 'inet addr:' | cut -d: -f4");
+    		String mac = Script.runSimpleBashScript("ifconfig " + label + " | grep HWaddr | awk -F \" \" '{print $5}'");
+			return new OvsFetchInterfaceAnswer(cmd, true, "Interface " + label
+					+ " retrieved successfully", ipadd, mask, mac);
+
+		} catch (Exception e) {
+			s_logger.warn("Caught execption when fetching interface", e);
+			return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:"
+					+ e.getMessage());
+    	}
+
+    }
+
+	private Answer execute(OvsSetupBridgeCommand cmd) {
+		findOrCreateTunnelNetwork(cmd.getKey());
+		configureTunnelNetwork(cmd.getNetworkId(), cmd.getHostId(),
+				cmd.getKey());
+		s_logger.debug("OVS Bridge configured");
+		return new Answer(cmd, true, null);
+	}
+
+	private Answer execute(OvsDestroyBridgeCommand cmd) {
+		destroyTunnelNetwork(cmd.getKey());
+		s_logger.debug("OVS Bridge destroyed");
+		return new Answer(cmd, true, null);
+	}
+
+	private synchronized void destroyTunnelNetwork(int key) {
+		try {
+			findOrCreateTunnelNetwork(key);
+			String bridge = "OVSTunnel" + key;
+			Script cmd = new Script(_ovsTunnelPath, _timeout, s_logger);
+			cmd.add("destroy_ovs_bridge");
+			cmd.add("--bridge", bridge);
+			String result = cmd.execute();
+			if (result != null) {
+				// TODO: Should make this error not fatal?
+				// Can Concurrent VM shutdown/migration/reboot events can cause
+				// this method
+				// to be executed on a bridge which has already been removed?
+				throw new CloudRuntimeException("Unable to remove OVS bridge " + bridge);
+			}
+			return;
+		} catch (Exception e) {
+			s_logger.warn("destroyTunnelNetwork failed:", e);
+			return;
+		}
+	}
+
+	private synchronized boolean findOrCreateTunnelNetwork(long key) {
+		try {
+			String nwName = "OVSTunnel" + key;
+			if (checkNetwork(nwName)) {
+				return true;
+			}
+			// if not found, create a new one
+			Map<String, String> otherConfig = new HashMap<String, String>();
+			otherConfig.put("ovs-host-setup", "");
+			Script.runSimpleBashScript("ovs-vsctl -- --may-exist add-br "
+					+ nwName + " -- set bridge " + nwName
+					+ " other_config:ovs_host_setup='-1'");
+			s_logger.debug("### KVM network for tunnels created:" + nwName);
+		} catch (Exception e) {
+			s_logger.warn("createTunnelNetwork failed", e);
+		}
+		return true;
+	}
+
+	private synchronized boolean configureTunnelNetwork(long networkId,
+			long hostId, int key) {
+		try {
+			findOrCreateTunnelNetwork(key);
+			String nwName = "OVSTunnel" + key;
+			String configuredHosts = Script
+					.runSimpleBashScript("ovs-vsctl get bridge " + nwName
+							+ " other_config:ovs_host_setup");
+			boolean configured = false;
+			if (configuredHosts != null) {
+				String hostIdsStr[] = configuredHosts.split(",");
+				for (String hostIdStr : hostIdsStr) {
+					if (hostIdStr.equals(((Long) hostId).toString())) {
+						configured = true;
+						break;
+					}
+				}
+			}
+			if (!configured) {
+				Script cmd = new Script(_ovsTunnelPath, _timeout, s_logger);
+				cmd.add("setup_ovs_bridge");
+				cmd.add("--key", String.valueOf(key));
+				cmd.add("--cs_host_id", ((Long) hostId).toString());
+				cmd.add("--bridge", nwName);
+				String result = cmd.execute();
+				if (result != null) {
+					throw new CloudRuntimeException(
+							"Unable to pre-configure OVS bridge " + nwName
+									+ " for network ID:" + networkId);
+				}
+			}
+		} catch (Exception e) {
+			s_logger.warn("createandConfigureTunnelNetwork failed", e);
+			return false;
+		}
+		return true;
+	}
+
+	private OvsCreateTunnelAnswer execute(OvsCreateTunnelCommand cmd) {
+		String bridge = "OVSTunnel" + cmd.getKey();
+		try {
+			if (!findOrCreateTunnelNetwork(cmd.getKey())) {
+				s_logger.debug("Error during bridge setup");
+				return new OvsCreateTunnelAnswer(cmd, false,
+						"Cannot create network", bridge);
+			}
+
+			configureTunnelNetwork(cmd.getNetworkId(), cmd.getFrom(),
+					cmd.getKey());
+			Script command = new Script(_ovsTunnelPath, _timeout, s_logger);
+			command.add("create_tunnel");
+			command.add("--bridge", bridge);
+			command.add("--remote_ip", cmd.getRemoteIp());
+			command.add("--key", cmd.getKey().toString());
+			command.add("--src_host", cmd.getFrom().toString());
+			command.add("--dst_host", cmd.getTo().toString());
+
+			String result = command.execute();
+			if (result != null) {
+				return new OvsCreateTunnelAnswer(cmd, true, result, null,
+						bridge);
+			} else {
+				return new OvsCreateTunnelAnswer(cmd, false, result, bridge);
+			}
+		} catch (Exception e) {
+			s_logger.debug("Error during tunnel setup");
+			s_logger.warn("Caught execption when creating ovs tunnel", e);
+			return new OvsCreateTunnelAnswer(cmd, false, e.getMessage(), bridge);
+		}
+	}
+
+	private Answer execute(OvsDestroyTunnelCommand cmd) {
+		try {
+			if (!findOrCreateTunnelNetwork(cmd.getKey())) {
+				s_logger.warn("Unable to find tunnel network for GRE key:"
+						+ cmd.getKey());
+				return new Answer(cmd, false, "No network found");
+			}
+
+			String bridge = "OVSTunnel" + cmd.getKey();
+			Script command = new Script(_ovsTunnelPath, _timeout, s_logger);
+			command.add("destroy_tunnel");
+			command.add("--bridge", bridge);
+			command.add("--iface_name", cmd.getInPortName());
+			String result = command.execute();
+			if (result == null) {
+				return new Answer(cmd, true, result);
+			} else {
+				return new Answer(cmd, false, result);
+			}
+		} catch (Exception e) {
+			s_logger.warn("caught execption when destroy ovs tunnel", e);
+			return new Answer(cmd, false, e.getMessage());
+		}
+	}
+
     private CheckNetworkAnswer execute(CheckNetworkCommand cmd) {
         List<PhysicalNetworkSetupInfo> phyNics = cmd
                 .getPhysicalNetworkInfoList();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/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 7199d28..01d878c 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
@@ -107,6 +107,7 @@ import com.cloud.agent.api.ModifyStoragePoolAnswer;
 import com.cloud.agent.api.ModifyStoragePoolCommand;
 import com.cloud.agent.api.NetworkRulesSystemVmCommand;
 import com.cloud.agent.api.NetworkRulesVmSecondaryIpCommand;
+import com.cloud.agent.api.OvsCreateGreTunnelCommand;
 import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.PingRoutingCommand;
 import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
@@ -210,18 +211,17 @@ import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.IsolationType;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetworkSetupInfo;
-import com.cloud.network.ovs.OvsCreateGreTunnelAnswer;
-import com.cloud.network.ovs.OvsCreateGreTunnelCommand;
-import com.cloud.network.ovs.OvsCreateTunnelAnswer;
-import com.cloud.network.ovs.OvsCreateTunnelCommand;
-import com.cloud.network.ovs.OvsDeleteFlowCommand;
-import com.cloud.network.ovs.OvsDestroyBridgeCommand;
-import com.cloud.network.ovs.OvsDestroyTunnelCommand;
-import com.cloud.network.ovs.OvsFetchInterfaceAnswer;
-import com.cloud.network.ovs.OvsFetchInterfaceCommand;
-import com.cloud.network.ovs.OvsSetTagAndFlowAnswer;
-import com.cloud.network.ovs.OvsSetTagAndFlowCommand;
-import com.cloud.network.ovs.OvsSetupBridgeCommand;
+import com.cloud.agent.api.OvsCreateGreTunnelAnswer;
+import com.cloud.agent.api.OvsCreateTunnelCommand;
+import com.cloud.agent.api.OvsDestroyTunnelCommand;
+import com.cloud.agent.api.OvsSetupBridgeCommand;
+import com.cloud.agent.api.OvsDestroyBridgeCommand;
+import com.cloud.agent.api.OvsCreateTunnelAnswer;
+import com.cloud.agent.api.OvsDeleteFlowCommand;
+import com.cloud.agent.api.OvsSetTagAndFlowAnswer;
+import com.cloud.agent.api.OvsFetchInterfaceAnswer;
+import com.cloud.agent.api.OvsSetTagAndFlowCommand;
+import com.cloud.agent.api.OvsFetchInterfaceCommand;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.resource.ServerResource;
 import com.cloud.resource.hypervisor.HypervisorResource;
@@ -871,12 +871,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         }
         // At this stage we surely have a VIF
         try {
-            dom0vif.plug(conn);
+        	dom0vif.plug(conn);
         } catch (Exception e) {
-            // though wierd exception is thrown, VIF actually gets plugged-in to dom0, so just ignore exception
-            s_logger.info("Ignoring the benign error thrown while plugging VIF to dom0");
+        // 	though wierd exception is thrown, VIF actually gets plugged-in to dom0, so just ignore exception
+        	s_logger.info("Ignoring the benign error thrown while plugging VIF to dom0");
+        }
+        try {
+        	dom0vif.unplug(conn);
+        } catch (Exception e) {
+        // 	though wierd exception is thrown, VIF actually gets plugged-in to dom0, so just ignore exception
+        	s_logger.info("Ignoring the benign error thrown while unplugging VIF to dom0");
         }
-        dom0vif.unplug(conn);
         synchronized(_tmpDom0Vif) {
             _tmpDom0Vif.add(dom0vif);
         }
@@ -933,6 +938,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 rec.otherConfig = otherConfig;
                 nw = Network.create(conn, rec);
                 // Plug dom0 vif only when creating network
+//                if (!is_xcp())
                 enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
                 s_logger.debug("### Xen Server network for tunnels created:" + nwName);
             } else {
@@ -969,7 +975,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             }
             if (!configured) {
                 // Plug dom0 vif only if not done before for network and host
-                enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
+//            	if (!is_xcp())
+            	enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key);
                 String result = callHostPlugin(conn, "ovstunnel", "setup_ovs_bridge", "bridge", bridge,
                         "key", String.valueOf(key),
                         "xs_nw_uuid", nw.getUuid(conn),
@@ -5662,8 +5669,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
             configureTunnelNetwork(conn, cmd.getNetworkId(), cmd.getFrom(), cmd.getKey());
             bridge = nw.getBridge(conn);
-            String result = callHostPlugin(conn, "ovstunnel", "create_tunnel", "bridge", bridge, "remote_ip", cmd.getRemoteIp(),
-                    "key", cmd.getKey().toString(), "from", cmd.getFrom().toString(), "to", cmd.getTo().toString());
+            String result =
+                callHostPlugin(conn, "ovstunnel", "create_tunnel", "bridge", bridge, "remote_ip", cmd.getRemoteIp(), "key", cmd.getKey().toString(), "from",
+                    cmd.getFrom().toString(), "to", cmd.getTo().toString());
             String[] res = result.split(":");
             if (res.length == 2 && res[0].equalsIgnoreCase("SUCCESS")) {
                 return new OvsCreateTunnelAnswer(cmd, true, result, res[1], bridge);
@@ -5684,8 +5692,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         try {
             Network nw = setupvSwitchNetwork(conn);
             String bridge = nw.getBridge(conn);
-            String result = callHostPlugin(conn, "ovsgre", "ovs_delete_flow", "bridge", bridge,
-                    "vmName", cmd.getVmName());
+            String result = callHostPlugin(conn, "ovsgre", "ovs_delete_flow", "bridge", bridge, "vmName", cmd.getVmName());
 
             if (result.equalsIgnoreCase("SUCCESS")) {
                 return new Answer(cmd, true, "success to delete flows for " + cmd.getVmName());
@@ -5736,9 +5743,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
              * none guest network nic. don't worry, it will fail silently at host
              * plugin side
              */
-            String result = callHostPlugin(conn, "ovsgre", "ovs_set_tag_and_flow", "bridge", bridge,
-                    "vmName", cmd.getVmName(), "tag", cmd.getTag(),
-                    "vlans", cmd.getVlans(), "seqno", cmd.getSeqNo());
+            String result =
+                callHostPlugin(conn, "ovsgre", "ovs_set_tag_and_flow", "bridge", bridge, "vmName", cmd.getVmName(), "tag", cmd.getTag(), "vlans", cmd.getVlans(),
+                    "seqno", cmd.getSeqNo());
             s_logger.debug("set flow for " + cmd.getVmName() + " " + result);
 
             if (result.equalsIgnoreCase("SUCCESS")) {
@@ -5761,6 +5768,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     private OvsFetchInterfaceAnswer execute(OvsFetchInterfaceCommand cmd) {
 
         String label = cmd.getLabel();
+        //FIXME: this is a tricky to pass the network checking in XCP. I temporary get default label from Host.
+        if (is_xcp()) {
+        	label = getLabel();
+        }
         s_logger.debug("Will look for network with name-label:" + label + " on host " + _host.ip);
         Connection conn = getConnection();
         try {
@@ -5769,19 +5780,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             PIF pif = nw.getPif(conn);
             Record pifRec = pif.getRecord(conn);
             s_logger.debug("PIF object:" + pifRec.uuid + "(" + pifRec.device + ")");
-            return new OvsFetchInterfaceAnswer(cmd, true, "Interface " + pifRec.device + " retrieved successfully",
-                    pifRec.IP, pifRec.netmask, pifRec.MAC);
+            return new OvsFetchInterfaceAnswer(cmd, true, "Interface " + pifRec.device + " retrieved successfully", pifRec.IP, pifRec.netmask, pifRec.MAC);
         } catch (BadServerResponse e) {
-            s_logger.error("An error occurred while fetching the interface for " +
-                    label + " on host " + _host.ip , e);
+            s_logger.error("An error occurred while fetching the interface for " + label + " on host " + _host.ip, e);
             return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage());
         } catch (XenAPIException e) {
-            s_logger.error("An error occurred while fetching the interface for " +
-                    label + " on host " + _host.ip , e);
+            s_logger.error("An error occurred while fetching the interface for " + label + " on host " + _host.ip, e);
             return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage());
         } catch (XmlRpcException e) {
-            s_logger.error("An error occurred while fetching the interface for " +
-                    label + " on host " + _host.ip, e);
+            s_logger.error("An error occurred while fetching the interface for " + label + " on host " + _host.ip, e);
             return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage());
         }
     }
@@ -5796,25 +5803,21 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             Network nw = setupvSwitchNetwork(conn);
             bridge = nw.getBridge(conn);
 
-            String result = callHostPlugin(conn, "ovsgre", "ovs_create_gre", "bridge", bridge,
-                    "remoteIP", cmd.getRemoteIp(), "greKey", cmd.getKey(), "from",
+            String result =
+                callHostPlugin(conn, "ovsgre", "ovs_create_gre", "bridge", bridge, "remoteIP", cmd.getRemoteIp(), "greKey", cmd.getKey(), "from",
                     Long.toString(cmd.getFrom()), "to", Long.toString(cmd.getTo()));
             String[] res = result.split(":");
             if (res.length != 2 || (res.length == 2 && res[1].equalsIgnoreCase("[]"))) {
-                return new OvsCreateGreTunnelAnswer(cmd, false, result,
-                        _host.ip, bridge);
+                return new OvsCreateGreTunnelAnswer(cmd, false, result, _host.ip, bridge);
             } else {
                 return new OvsCreateGreTunnelAnswer(cmd, true, result, _host.ip, bridge, Integer.parseInt(res[1]));
             }
         } catch (BadServerResponse e) {
-            s_logger.error("An error occurred while creating a GRE tunnel to " +
-                    cmd.getRemoteIp() + " on host " + _host.ip , e);
+            s_logger.error("An error occurred while creating a GRE tunnel to " + cmd.getRemoteIp() + " on host " + _host.ip, e);
         } catch (XenAPIException e) {
-            s_logger.error("An error occurred while creating a GRE tunnel to " +
-                    cmd.getRemoteIp() + " on host " + _host.ip , e);
+            s_logger.error("An error occurred while creating a GRE tunnel to " + cmd.getRemoteIp() + " on host " + _host.ip, e);
         } catch (XmlRpcException e) {
-            s_logger.error("An error occurred while creating a GRE tunnel to " +
-                    cmd.getRemoteIp() + " on host " + _host.ip , e);
+            s_logger.error("An error occurred while creating a GRE tunnel to " + cmd.getRemoteIp() + " on host " + _host.ip, e);
         }
 
         return new OvsCreateGreTunnelAnswer(cmd, false, "EXCEPTION", _host.ip, bridge);
@@ -8194,4 +8197,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
     @Override
     public void setRunLevel(int level) {
     }
+
+	private boolean is_xcp() {
+		Connection conn = getConnection();
+		String result = callHostPlugin(conn, "ovstunnel", "is_xcp");
+		if (result.equals("XCP"))
+			return true;
+		return false;
+	}
+
+	private String getLabel() {
+		Connection conn = getConnection();
+		String result = callHostPlugin(conn, "ovstunnel", "getLabel");
+		return result;
+	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelAnswer.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelAnswer.java
new file mode 100644
index 0000000..7913cc8
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelAnswer.java
@@ -0,0 +1,81 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class OvsCreateGreTunnelAnswer extends Answer {
+	String hostIp;
+	String remoteIp;
+	String bridge;
+	String key;
+	long from;
+	long to;
+	int port;
+
+	public OvsCreateGreTunnelAnswer(Command cmd, boolean success, String details) {
+		super(cmd, success, details);
+	}
+
+	public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
+			String details, String hostIp, String bridge) {
+		super(cmd, success, details);
+		OvsCreateGreTunnelCommand c = (OvsCreateGreTunnelCommand) cmd;
+		this.hostIp = hostIp;
+		this.bridge = bridge;
+		this.remoteIp = c.getRemoteIp();
+		this.key = c.getKey();
+		this.port = -1;
+		this.from = c.getFrom();
+		this.to = c.getTo();
+	}
+
+	public OvsCreateGreTunnelAnswer(Command cmd, boolean success,
+			String details, String hostIp, String bridge, int port) {
+		this(cmd, success, details, hostIp, bridge);
+		this.port = port;
+	}
+
+	public String getHostIp() {
+		return hostIp;
+	}
+
+	public String getRemoteIp() {
+		return remoteIp;
+	}
+
+	public String getBridge() {
+		return bridge;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public long getFrom() {
+		return from;
+	}
+
+	public long getTo() {
+		return to;
+	}
+
+	public int getPort() {
+		return port;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelCommand.java
new file mode 100644
index 0000000..588ff51
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateGreTunnelCommand.java
@@ -0,0 +1,55 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsCreateGreTunnelCommand extends Command {
+	String remoteIp;
+	String key;
+	long from;
+	long to;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public OvsCreateGreTunnelCommand(String remoteIp, String key, long from,
+			long to) {
+		this.remoteIp = remoteIp;
+		this.key = key;
+		this.from = from;
+		this.to = to;
+	}
+
+	public String getRemoteIp() {
+		return remoteIp;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public long getFrom() {
+		return from;
+	}
+
+	public long getTo() {
+		return to;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelAnswer.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelAnswer.java
new file mode 100644
index 0000000..f921042
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelAnswer.java
@@ -0,0 +1,85 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class OvsCreateTunnelAnswer extends Answer {
+	Long from;
+	Long to;
+	long networkId;
+	String inPortName;
+
+	// for debug info
+	String fromIp;
+	String toIp;
+	int key;
+	String bridge;
+
+	public OvsCreateTunnelAnswer(Command cmd, boolean success, String details,
+			String bridge) {
+		super(cmd, success, details);
+		OvsCreateTunnelCommand c = (OvsCreateTunnelCommand) cmd;
+		from = c.getFrom();
+		to = c.getTo();
+		networkId = c.getNetworkId();
+		inPortName = "[]";
+		fromIp = c.getFromIp();
+		toIp = c.getRemoteIp();
+		key = c.getKey();
+		this.bridge = bridge;
+	}
+
+	public OvsCreateTunnelAnswer(Command cmd, boolean success, String details,
+			String inPortName, String bridge) {
+		this(cmd, success, details, bridge);
+		this.inPortName = inPortName;
+	}
+
+	public Long getFrom() {
+		return from;
+	}
+
+	public Long getTo() {
+		return to;
+	}
+
+	public long getNetworkId() {
+		return networkId;
+	}
+
+	public String getInPortName() {
+		return inPortName;
+	}
+
+	public String getFromIp() {
+		return fromIp;
+	}
+
+	public String getToIp() {
+		return toIp;
+	}
+
+	public int getKey() {
+		return key;
+	}
+
+	public String getBridge() {
+		return bridge;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelCommand.java
new file mode 100644
index 0000000..1dc4d82
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsCreateTunnelCommand.java
@@ -0,0 +1,70 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsCreateTunnelCommand extends Command {
+	Integer key;
+	String remoteIp;
+	Long from;
+	Long to;
+	long networkId;
+
+	// for debug info
+	String fromIp;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public OvsCreateTunnelCommand(String remoteIp, Integer key, Long from,
+			Long to, long networkId, String fromIp) {
+		this.remoteIp = remoteIp;
+		this.key = key;
+		this.from = from;
+		this.to = to;
+		this.networkId = networkId;
+		this.fromIp = fromIp;
+	}
+
+	public Integer getKey() {
+		return key;
+	}
+
+	public String getRemoteIp() {
+		return remoteIp;
+	}
+
+	public Long getFrom() {
+		return from;
+	}
+
+	public Long getTo() {
+		return to;
+	}
+
+	public long getNetworkId() {
+		return networkId;
+	}
+
+	public String getFromIp() {
+		return fromIp;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDeleteFlowCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDeleteFlowCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDeleteFlowCommand.java
new file mode 100644
index 0000000..3b5e1c2
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDeleteFlowCommand.java
@@ -0,0 +1,36 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsDeleteFlowCommand extends Command {
+	String vmName;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public OvsDeleteFlowCommand(String vmName) {
+		this.vmName = vmName;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyBridgeCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyBridgeCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyBridgeCommand.java
new file mode 100644
index 0000000..21b89af
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyBridgeCommand.java
@@ -0,0 +1,44 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsDestroyBridgeCommand extends Command {
+
+	Long networkId;
+	Integer key;
+
+	public OvsDestroyBridgeCommand(Long networkId, Integer key) {
+		this.networkId = networkId;
+		this.key = key;
+	}
+
+	public Long getNetworkId() {
+		return networkId;
+	}
+
+	public Integer getKey() {
+		return key;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyTunnelCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyTunnelCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyTunnelCommand.java
new file mode 100644
index 0000000..d06acf5
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsDestroyTunnelCommand.java
@@ -0,0 +1,50 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsDestroyTunnelCommand extends Command {
+
+	Long networkId;
+	Integer key;
+	String inPortName;
+
+	public OvsDestroyTunnelCommand(Long networkId, Integer key,
+			String inPortName) {
+		this.networkId = networkId;
+		this.inPortName = inPortName;
+		this.key = key;
+	}
+
+	public Long getNetworkId() {
+		return networkId;
+	}
+
+	public String getInPortName() {
+		return inPortName;
+	}
+
+	public Integer getKey() {
+		return key;
+	}
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceAnswer.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceAnswer.java
new file mode 100644
index 0000000..6c7deaa
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceAnswer.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.agent.api;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class OvsFetchInterfaceAnswer extends Answer {
+	String ip;
+	String netmask;
+	String mac;
+	String label;
+
+	public OvsFetchInterfaceAnswer(Command cmd, boolean success, String details) {
+		super(cmd, success, details);
+		this.label = ((OvsFetchInterfaceCommand) cmd).getLabel();
+	}
+
+	public OvsFetchInterfaceAnswer(Command cmd, boolean success,
+			String details, String ip, String netmask, String mac) {
+		super(cmd, success, details);
+		this.ip = ip;
+		this.netmask = netmask;
+		this.mac = mac;
+		this.label = ((OvsFetchInterfaceCommand) cmd).getLabel();
+	}
+
+	public String getIp() {
+		return ip;
+	}
+
+	public String getNetmask() {
+		return netmask;
+	}
+
+	public String getMac() {
+		return mac;
+	}
+
+	public String getLabel() {
+		return label;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceCommand.java
new file mode 100644
index 0000000..a305d5b
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsFetchInterfaceCommand.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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsFetchInterfaceCommand extends Command {
+	String label;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public OvsFetchInterfaceCommand(String label) {
+		this.label = label;
+	}
+
+	public String getLabel() {
+		return label;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowAnswer.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowAnswer.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowAnswer.java
new file mode 100644
index 0000000..ee1fe42
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowAnswer.java
@@ -0,0 +1,40 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class OvsSetTagAndFlowAnswer extends Answer {
+	Long vmId;
+	Long seqno;
+
+	public OvsSetTagAndFlowAnswer(Command cmd, boolean success, String details) {
+		super(cmd, success, details);
+		OvsSetTagAndFlowCommand c = (OvsSetTagAndFlowCommand) cmd;
+		this.vmId = c.getVmId();
+		this.seqno = Long.parseLong(c.getSeqNo());
+	}
+
+	public Long getVmId() {
+		return vmId;
+	}
+
+	public Long getSeqNo() {
+		return seqno;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowCommand.java
new file mode 100644
index 0000000..28a936a
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetTagAndFlowCommand.java
@@ -0,0 +1,61 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsSetTagAndFlowCommand extends Command {
+	String vlans;
+	String vmName;
+	String seqno;
+	String tag;
+	Long vmId;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public String getSeqNo() {
+		return seqno;
+	}
+
+	public String getVlans() {
+		return vlans;
+	}
+
+	public String getVmName() {
+		return vmName;
+	}
+
+	public Long getVmId() {
+		return vmId;
+	}
+
+	public String getTag() {
+		return tag;
+	}
+
+	public OvsSetTagAndFlowCommand(String vmName, String tag, String vlans,
+			String seqno, Long vmId) {
+		this.vmName = vmName;
+		this.tag = tag;
+		this.vlans = vlans;
+		this.seqno = seqno;
+		this.vmId = vmId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetupBridgeCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetupBridgeCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetupBridgeCommand.java
new file mode 100644
index 0000000..6968a4c
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/OvsSetupBridgeCommand.java
@@ -0,0 +1,49 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.Command;
+
+public class OvsSetupBridgeCommand extends Command {
+	Integer key;
+	Long hostId;
+	Long networkId;
+
+	@Override
+	public boolean executeInSequence() {
+		return true;
+	}
+
+	public OvsSetupBridgeCommand(Integer key, Long hostId, Long networkId) {
+		this.key = key;
+		this.hostId = hostId;
+		this.networkId = networkId;
+	}
+
+	public Integer getKey() {
+		return key;
+	}
+
+	public Long getHostId() {
+		return hostId;
+	}
+
+	public Long getNetworkId() {
+		return networkId;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/065ac54b/plugins/network-elements/ovs/src/com/cloud/agent/api/StartupOvsCommand.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/agent/api/StartupOvsCommand.java b/plugins/network-elements/ovs/src/com/cloud/agent/api/StartupOvsCommand.java
new file mode 100644
index 0000000..766aec2
--- /dev/null
+++ b/plugins/network-elements/ovs/src/com/cloud/agent/api/StartupOvsCommand.java
@@ -0,0 +1,27 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.host.Host;
+
+public class StartupOvsCommand extends StartupCommand {
+
+	public StartupOvsCommand() {
+		super(Host.Type.L2Networking);
+	}
+}